mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-13 05:53:06 +01:00
Merge branch 'master' of github.com:wellenvogel/esp32-nmea2000
This commit is contained in:
14
web/index.js
14
web/index.js
@@ -236,16 +236,24 @@ function changeConfig() {
|
||||
ensurePass()
|
||||
.then(function (pass) {
|
||||
let newAdminPass;
|
||||
let url = "/api/setConfig?_hash="+encodeURIComponent(pass)+"&";
|
||||
let url = "/api/setConfig"
|
||||
let body="_hash="+encodeURIComponent(pass)+"&";
|
||||
let allValues=getAllConfigs();
|
||||
if (!allValues) return;
|
||||
for (let name in allValues){
|
||||
if (name == 'adminPassword'){
|
||||
newAdminPass=allValues[name];
|
||||
}
|
||||
url += name + "=" + encodeURIComponent(allValues[name]) + "&";
|
||||
body += encodeURIComponent(name) + "=" + encodeURIComponent(allValues[name]) + "&";
|
||||
}
|
||||
getJson(url)
|
||||
fetch(url,{
|
||||
method:'POST',
|
||||
headers:{
|
||||
'Content-Type': 'application/octet-stream' //we must lie here
|
||||
},
|
||||
body: body
|
||||
})
|
||||
.then((rs)=>rs.json())
|
||||
.then(function (status) {
|
||||
if (status.status == 'OK') {
|
||||
if (newAdminPass !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user