Save configuration to preferences in NVS
This commit is contained in:
@@ -115,6 +115,14 @@
|
||||
"description": "Stop the access point after that many minutes if not used.\n1 to 60 minutes.\n\n'0' means that the access point is permanently enabled.",
|
||||
"category": "Wifi"
|
||||
},
|
||||
{
|
||||
"name": "apHidden",
|
||||
"label": "Hide SSID",
|
||||
"type": "boolean",
|
||||
"default": "false",
|
||||
"description": "Hide Wifi SSID",
|
||||
"category": "Wifi"
|
||||
},
|
||||
{
|
||||
"name": "cpuSpeed",
|
||||
"label": "CPU Speed [MHz]",
|
||||
@@ -139,7 +147,7 @@
|
||||
"category": "Hardware"
|
||||
},
|
||||
{
|
||||
"name": "ledRgbBrightness",
|
||||
"name": "rgbBrightness",
|
||||
"label": "RGB-LED brightness",
|
||||
"type": "number",
|
||||
"default": 64,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
margin: 0;
|
||||
@@ -14,14 +13,12 @@ body {
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: 0.2em;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -31,53 +28,51 @@ body {
|
||||
#tabs .tab {
|
||||
background-color: lightgray;
|
||||
padding: 0.5em;
|
||||
/*border: 1px;
|
||||
border-color: grey;
|
||||
border-style: solid; */
|
||||
border: 1px solid grey;
|
||||
opacity: 0.6;
|
||||
}
|
||||
#tabs .tab.active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#tabPages {
|
||||
overflow: auto;
|
||||
padding-bottom: 1ex;
|
||||
border-bottom: 1px solid grey;
|
||||
}
|
||||
|
||||
hr {
|
||||
border-top: 1px solid grey;
|
||||
}
|
||||
.configForm {
|
||||
padding-bottom: 0.5em;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
.configForm .buttons {
|
||||
margin-bottom: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
.configForm .content>div:nth-child(even) {
|
||||
background-color: rgb(211 211 211 / 43%);
|
||||
background-color: rgb(211 211 211 / 43%);
|
||||
}
|
||||
#statusPage .even {
|
||||
background-color: rgb(211 211 211 / 43%);
|
||||
background-color: rgb(211 211 211 / 43%);
|
||||
}
|
||||
#statusPageContent {
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
.counter-row .value{
|
||||
text-align: right;
|
||||
width: 6em;
|
||||
text-align: right;
|
||||
width: 6em;
|
||||
}
|
||||
.icon-row .label{
|
||||
width: 8.7em;
|
||||
width: 8.7em;
|
||||
}
|
||||
.category .title .label {
|
||||
opacity: 1;
|
||||
margin-left: 1em;
|
||||
opacity: 1;
|
||||
margin-left: 1em;
|
||||
}
|
||||
.changed input{
|
||||
color: green;
|
||||
color: green;
|
||||
}
|
||||
.changed select{
|
||||
color: green;
|
||||
color: green;
|
||||
}
|
||||
.category.changed{
|
||||
color: green;
|
||||
@@ -160,7 +155,6 @@ button.addunassigned {
|
||||
display: flex;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
margin: auto;
|
||||
background-color: white;
|
||||
@@ -214,7 +208,6 @@ h1 {
|
||||
.icon-eye.active{
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.dash {
|
||||
width: 6.5em;
|
||||
height: 4em;
|
||||
@@ -242,10 +235,10 @@ div#dashboardPage {
|
||||
}
|
||||
.dashValue.formatLatitude {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
}
|
||||
.dashValue.formatLongitude {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
font-size: 1.1em;
|
||||
}
|
||||
.dashValue.formatDate {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
@@ -255,12 +248,12 @@ div#dashboardPage {
|
||||
padding: 0.1em;
|
||||
background-color: lightgray;
|
||||
font-size: 0.7em;
|
||||
}
|
||||
.footer .unit{
|
||||
}
|
||||
.footer .source{
|
||||
.footer .unit {
|
||||
}
|
||||
.footer .source {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
#adminPassInput {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
@@ -273,7 +266,6 @@ div#uploadProgress {
|
||||
max-width: 20em;
|
||||
height: 1em;
|
||||
margin-left: 1em;
|
||||
/* margin-right: auto; */
|
||||
border: 1px solid grey;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
checkers.checkPort=function(v,allValues,def){
|
||||
let parsed=parseInt(v);
|
||||
if (isNaN(parsed)) return "must be a number";
|
||||
if (parsed <1 || parsed >= 65536) return "port must be in the range 1..65536";
|
||||
if (parsed <1 || parsed >= 65535) return "port must be in the range 1..65535";
|
||||
}
|
||||
checkers.checkSystemName=function(v) {
|
||||
//2...32 characters for ssid
|
||||
@@ -293,6 +293,7 @@
|
||||
let url = apiPrefix + "/api/setconfig"
|
||||
let body = "_hash=" + encodeURIComponent(pass) + "&";
|
||||
let allValues = getAllConfigs();
|
||||
console.log(allValues);
|
||||
if (!allValues) return;
|
||||
for (let name in allValues) {
|
||||
if (name == 'adminPassword') {
|
||||
@@ -303,7 +304,6 @@
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
//'Content-Type': 'application/octet-stream' //we must lie here
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: body
|
||||
@@ -323,6 +323,7 @@
|
||||
alert("unable to set config: " + status.status);
|
||||
}
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
})
|
||||
.catch(function (e) { alert(e); })
|
||||
}
|
||||
@@ -633,6 +634,9 @@
|
||||
el = addEl('input', clazz, frame);
|
||||
if (configItem.readOnly) el.setAttribute('disabled', true);
|
||||
el.setAttribute('name', configItem.name)
|
||||
if (configItem.type === 'string') {
|
||||
// TODO limit length
|
||||
}
|
||||
if (configItem.type === 'password') {
|
||||
el.setAttribute('type', 'password');
|
||||
let vis = addEl('span', 'icon-eye icon', frame);
|
||||
|
||||
Reference in New Issue
Block a user