fix super preferences save

audio-only-output
Moe 2022-12-26 16:51:55 -08:00
parent 7b81878f67
commit 7b55da06d5
1 changed files with 4 additions and 5 deletions

View File

@ -212,7 +212,8 @@ module.exports = function(s,config,lang,app){
}
var form = s.getPostData(req)
if(form){
var currentSuperUserList = JSON.parse(fs.readFileSync(s.location.super))
const configPath = config.thisIsDocker ? "/config/super.json" : s.location.super;
var currentSuperUserList = JSON.parse(fs.readFileSync(configPath))
var currentSuperUser = {}
var currentSuperUserPosition = -1
//find this user in current list
@ -250,13 +251,11 @@ module.exports = function(s,config,lang,app){
currentSuperUserList.push(currentSuperUser)
}
//update master list in system
const configPath = config.thisIsDocker ? "/config/super.json" : s.location.super;
const configData = JSON.stringify(postBody,null,3);
const configData = JSON.stringify(currentSuperUserList,null,3);
fs.writeFile(configPath, configData, () => {
s.tx({f: 'save_preferences'},'$')
});
}else{
endData.ok = false
endData.msg = lang.postDataBroken