返回提交历史
Modified
static/webui/script.js
+11
-3
XFEstudio/XFESpaceNinjaServer
fix(webui): handle config get request failing due to expired authz (#1716)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1716 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
6394adb0
代码差异
1 个文件
+11
-3
@@ -1315,7 +1315,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
1315
1315
interval = setInterval(() => {
1316
1316
if (window.authz) {
1317
1317
clearInterval(interval);
1318
fetch("/custom/config?" + window.authz).then(res => {
1318
fetch("/custom/config?" + window.authz).then(async res => {
1319
1319
if (res.status == 200) {
1320
1320
$("#server-settings-no-perms").addClass("d-none");
1321
1321
$("#server-settings").removeClass("d-none");
@@ -1335,8 +1335,16 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
1335
1335
})
1336
1336
);
1337
1337
} else {
1338
$("#server-settings-no-perms").removeClass("d-none");
1339
$("#server-settings").addClass("d-none");
1338
if ((await res.text()) == "Log-in expired") {
1339
revalidateAuthz(() => {
1340
if (single.getCurrentPath() == "/webui/cheats") {
1341
single.loadRoute("/webui/cheats");
1342
}
1343
});
1344
} else {
1345
$("#server-settings-no-perms").removeClass("d-none");
1346
$("#server-settings").addClass("d-none");
1347
}
1340
1348
}
1341
1349
});
1342
1350
}