This commit is contained in:
parent
a83a3efc79
commit
1cf5795aee
@ -1898,34 +1898,36 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
|
||||
url: "/custom/getConfig?" + window.authz,
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(uiConfigs)
|
||||
}).done(json => {
|
||||
//window.is_admin = true;
|
||||
$(".config-admin-hide").addClass("d-none");
|
||||
$(".config-admin-show").removeClass("d-none");
|
||||
Object.entries(json).forEach(entry => {
|
||||
const [key, value] = entry;
|
||||
var x = document.getElementById(`${key}`);
|
||||
if (x != null) {
|
||||
if (x.type == "checkbox") {
|
||||
x.checked = value;
|
||||
} else if (x.type == "number") {
|
||||
x.setAttribute("value", `${value}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
}).fail(res => {
|
||||
if (res.responseText == "Log-in expired") {
|
||||
revalidateAuthz().then(() => {
|
||||
if (single.getCurrentPath() == "/webui/cheats") {
|
||||
single.loadRoute("/webui/cheats");
|
||||
})
|
||||
.done(json => {
|
||||
//window.is_admin = true;
|
||||
$(".config-admin-hide").addClass("d-none");
|
||||
$(".config-admin-show").removeClass("d-none");
|
||||
Object.entries(json).forEach(entry => {
|
||||
const [key, value] = entry;
|
||||
var x = document.getElementById(`${key}`);
|
||||
if (x != null) {
|
||||
if (x.type == "checkbox") {
|
||||
x.checked = value;
|
||||
} else if (x.type == "number") {
|
||||
x.setAttribute("value", `${value}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//window.is_admin = false;
|
||||
$(".config-admin-hide").removeClass("d-none");
|
||||
$(".config-admin-show").addClass("d-none");
|
||||
}
|
||||
});
|
||||
})
|
||||
.fail(res => {
|
||||
if (res.responseText == "Log-in expired") {
|
||||
revalidateAuthz().then(() => {
|
||||
if (single.getCurrentPath() == "/webui/cheats") {
|
||||
single.loadRoute("/webui/cheats");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//window.is_admin = false;
|
||||
$(".config-admin-hide").removeClass("d-none");
|
||||
$(".config-admin-show").addClass("d-none");
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 10);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user