more optimizations, remove WTVIRC for now, upgrade test.js

This commit is contained in:
zefie
2025-08-13 21:42:22 -04:00
parent 54bb975f1a
commit 22c7229e38
162 changed files with 1002 additions and 5539 deletions

View File

@@ -7,7 +7,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}

View File

@@ -7,7 +7,7 @@ if (auth === true) {
let result, ssid, password;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}
@@ -44,10 +44,10 @@ wtv-expire-all: wtv-admin:/ban`;
<input type="submit" value="Ban SSID">
</form><br><br>`
if (request_headers.query.ssid) {
if (result == wtva.REASON_SELF) {
if (result === wtva.REASON_SELF) {
data += "<strong>Cannot ban yourself.</strong>"
} else {
if (result == wtva.REASON_EXISTS) {
if (result === wtva.REASON_EXISTS) {
data += "<strong>SSID " + request_headers.query.ssid + " is already in the ban list.</strong><br><br>";
} else if (result === wtva.SUCCESS) {
reloadConfig();

View File

@@ -8,7 +8,7 @@ if (auth === true) {
let ssid_match = false;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}
@@ -19,7 +19,7 @@ if (auth === true) {
user_info = wtva.getAccountInfoBySSID(ssid);
if (request_headers.query.confirm_delete) {
user_info = null;
if (ssid == socket.ssid) {
if (ssid === socket.ssid) {
ssid_match = true;
} else {
// delete
@@ -63,7 +63,7 @@ wtv-noback-all: wtv-admin:/deleteaccount`;
if (Object.keys(user_info.account_users).length > 1) {
data += `<tr><td>Additional Users:</td><td>`;
Object.keys(user_info.account_users).forEach(function (k) {
if (k == "subscriber") return;
if (k === "subscriber") return;
data += user_info.account_users[k].subscriber_username + "<br>";
})
data += `</td></tr>`

View File

@@ -12,7 +12,7 @@ if (auth === true) {
const show_box_was_unregistered = false;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}
@@ -22,7 +22,7 @@ if (auth === true) {
user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
if (user_info) {
if (user_info.ssid == socket.ssid) {
if (user_info.ssid === socket.ssid) {
show_cannot_modify_self = true;
}
if (request_headers.query.confirm_delete) {

View File

@@ -8,7 +8,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}
@@ -53,7 +53,7 @@ wtv-noback-all: wtv-admin:/findaccount`;
if (Object.keys(user_info.account_users).length > 1) {
data += `<tr><td>Additional Users:</td><td>`;
Object.keys(user_info.account_users).forEach(function (k) {
if (k == "subscriber") return;
if (k === "subscriber") return;
data += user_info.account_users[k].subscriber_username + "<br>";
})
data += `</td></tr>`

View File

@@ -20,15 +20,15 @@ function generateFormField(type, confvar, options = null) {
confvar_value = user_config.config[confvar] || minisrv_config.config[confvar];
}
if (type == "input")
if (type === "input")
return `<input bgcolor="101010" text="ee44bb" type="text" name="${confvar}" value="${confvar_value}"${(options) ? ' '+options : ''}>`
if (type == "checkbox")
if (type === "checkbox")
return `<input type="hidden" name="${confvar}" value="false">\n<input type=checkbox name="${confvar}" ${wtvshared.parseBool(confvar_value) ? "checked=checked" : ''}${(options) ? ' ' + options : ''}>`
if (type == "select") {
if (type === "select") {
let out = `<select name="${confvar}">\n`
if (options) {
Object.keys(options).forEach((k) => {
out += `<option value="${options[k].value}"${(confvar_value == options[k].value) ? ' selected' : ''}>${options[k].name}</option>\n`
out += `<option value="${options[k].value}"${(confvar_value === options[k].value) ? ' selected' : ''}>${options[k].name}</option>\n`
});
}
return out + "</select>";
@@ -39,7 +39,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}

View File

@@ -8,7 +8,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}
@@ -79,7 +79,7 @@ data += `
</form><br><br>`
if (request_headers.query.username) {
if (user_info && !request_headers.query.confirm && !request_headers.query.reset) {
if (user_info.username == session_data.getSessionData("subscriber_username")) {
if (user_info.username === session_data.getSessionData("subscriber_username")) {
data += `Are you sure you want to Polyzoot <b>yourself</b>?<br>Are you a masochist?`;
} else {
data += `Are you sure you want to Polyzoot <b>${user_info.username}</b>?<br>Are you a sadist?`;

View File

@@ -8,7 +8,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}

View File

@@ -7,7 +7,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}

View File

@@ -10,7 +10,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}
@@ -19,7 +19,7 @@ if (auth === true) {
if (request_headers.query.username) {
user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
if (user_info) {
if (user_info.ssid == socket.ssid) {
if (user_info.ssid === socket.ssid) {
show_cannot_modify_self = true;
}
const userAccount = wtva.getAccountBySSID(user_info.ssid);

View File

@@ -10,7 +10,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}
@@ -22,7 +22,7 @@ if (auth === true) {
if (!fake_config.config.ssid_block_list) fake_config.config.ssid_block_list = [];
if (typeof request_headers.query.unban_ssid === 'string') {
Object.keys(fake_config.config.ssid_block_list).forEach(function (k) {
if (fake_config.config.ssid_block_list[k] == request_headers.query.unban_ssid) {
if (fake_config.config.ssid_block_list[k] === request_headers.query.unban_ssid) {
fake_config.config.ssid_block_list.splice(k, 1);
ssids_removed.push(request_headers.query.unban_ssid)
config_changed = true;
@@ -30,9 +30,9 @@ if (auth === true) {
});
} else {
Object.keys(fake_config.config.ssid_block_list).forEach(function (k) {
Object.keys(request_headers.query.unban_ssid).forEach(function (j) {
if (fake_config.config.ssid_block_list[k] == request_headers.query.unban_ssid[j]) {
fake_config.config.ssid_block_list.splice(k,1);
Object.keys(request_headers.query.unban_ssid).forEach(function (j) {
if (fake_config.config.ssid_block_list[k] === request_headers.query.unban_ssid[j]) {
fake_config.config.ssid_block_list.splice(k, 1);
ssids_removed.push(request_headers.query.unban_ssid[j])
config_changed = true;
}

View File

@@ -8,7 +8,7 @@ if (auth === true) {
let password = null;
if (request_headers.Authorization) {
const authheader = request_headers.Authorization.split(' ');
if (authheader[0] == "Basic") {
if (authheader[0] === "Basic") {
password = Buffer.from(authheader[1], 'base64').toString();
if (password) password = password.split(':')[1];
}