Initial web-files for system settings and configuration management

This commit is contained in:
logicog
2025-11-29 12:44:23 +01:00
parent 76344e172c
commit ba9bc2e845
6 changed files with 149 additions and 1 deletions
+41
View File
@@ -0,0 +1,41 @@
var configInterval = Number();
var configuration = {};
function parseConf(c){
var a = s.split(/\r\n|\n/);
for (var l = 0; l < a.length; l++) {
console.log(l + ' --> ' + a[l]);
}
}
function fetchConfig() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
s = xhttp.responseText;
console.log("CONFIG: ", s);
parseConf(s);
clearInterval(configInterval);
}
}
xhttp.open("GET", `/config`, true);
xhttp.send();
}
function fetchCmdLog() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
s = xhttp.responseText;
console.log("CMD-Log: ", s);
parseConf(s);
clearInterval(configInterval);
}
}
xhttp.open("GET", `/cmd_log`, true);
xhttp.send();
}
window.addEventListener("load", function() {
configInterval = setInterval(fetchConfig, 1000);
});