Skip to content

Commit e63cb44

Browse files
committed
webui/js: improve save config code
Signed-off-by: KOWX712 <[email protected]>
1 parent 005b94a commit e63cb44

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

webui/file.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,11 @@ export async function writeConfig() {
7676
let command;
7777
if (typeof value === 'string') {
7878
value = value.replace(/"/g, '\"').replace(/\\/g, '');
79-
command = `sed 's|^${key}=.*|${key}="${value}"|'`;
79+
command = `sed -i 's|^${key}=.*|${key}="${value}"|'`;
8080
} else {
81-
command = `sed 's|^${key}=.*|${key}=${value}|'`;
81+
command = `sed -i 's|^${key}=.*|${key}=${value}|'`;
8282
}
83-
commands.push(command
84-
+ ` ${moddir}/webroot/config.sh > ${moddir}/webroot/config.sh.tmp`
85-
+ ` && cat ${moddir}/webroot/config.sh.tmp > ${moddir}/webroot/config.sh`
86-
+ ` && rm -f ${moddir}/webroot/config.sh.tmp`
87-
);
83+
commands.push(command + `"$(realpath ${moddir}/webroot/config.sh)"`);
8884
}
8985
}
9086
}

0 commit comments

Comments
 (0)