fix/optimize wtv-admin

This commit is contained in:
zefie
2025-08-12 18:28:56 -04:00
parent b9d64de79e
commit d5c04688e9
14 changed files with 159 additions and 148 deletions

View File

@@ -1,12 +1,12 @@
var minisrv_service_file = true;
const minisrv_service_file = true;
var WTVAdmin = require(classPath + "/WTVAdmin.js");
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
var auth = wtva.isAuthorized();
const WTVAdmin = require(classPath + "/WTVAdmin.js");
const wtva = new WTVAdmin(minisrv_config, session_data, service_name);
const auth = wtva.isAuthorized();
if (auth === true) {
var password = null;
let password = null;
if (request_headers.Authorization) {
var authheader = request_headers.Authorization.split(' ');
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
@@ -45,12 +45,12 @@ If you added a new service, it will not bind without a restart.
</html>
`;
} else {
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
const errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
headers = errpage[0];
data = errpage[1];
}
} else {
var errpage = wtvshared.doErrorPage(403, auth);
const errpage = wtvshared.doErrorPage(403, auth);
headers = errpage[0];
data = errpage[1];
}