diff --git a/zefie_wtvp_minisrv/ServiceVault/wtv-admin/admin.js b/zefie_wtvp_minisrv/ServiceVault/wtv-admin/admin.js index fad5cf02..a9a9ac56 100644 --- a/zefie_wtvp_minisrv/ServiceVault/wtv-admin/admin.js +++ b/zefie_wtvp_minisrv/ServiceVault/wtv-admin/admin.js @@ -51,17 +51,17 @@ if (auth === true) {
+
+Polyzoot a User`; + + if (!request_headers.query.username) { + data += `"Polyzooting" a user will replace their Background Music with only Polyzoot, +and turn on BGM if they have it disabled. This will not work on Old Classic clients. +Also, the only way to undo a "Polyzooting" is to reset the user's music selection to default.` + } + +data += ` + ` + if (request_headers.query.username) { + if (user_info && !request_headers.query.confirm && !request_headers.query.reset) { + if (user_info.username == ssid_sessions[socket.ssid].getSessionData("subscriber_username")) { + data += `Are you sure you want to Polyzoot yourself? Are you a masochist?`; + } else { + data += `Are you sure you want to Polyzoot ${user_info.username}? Are you a sadist?`; + } + data += ` + + | ||
| + | ++ + | +|
+Go Back +
+ + +`; + } else { + var 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); + headers = errpage[0]; + data = errpage[1]; +} \ No newline at end of file diff --git a/zefie_wtvp_minisrv/ServiceVault/wtv-admin/removeuserpasswd.js b/zefie_wtvp_minisrv/ServiceVault/wtv-admin/removeuserpasswd.js new file mode 100644 index 00000000..e66a6d52 --- /dev/null +++ b/zefie_wtvp_minisrv/ServiceVault/wtv-admin/removeuserpasswd.js @@ -0,0 +1,109 @@ +var minisrv_service_file = true; + +var WTVAdmin = require("./WTVAdmin.js"); +var wtva = new WTVAdmin(minisrv_config, ssid_sessions[socket.ssid], service_name); +var auth = wtva.isAuthorized(); +if (auth === true) { + var password = null; + if (request_headers.Authorization) { + var authheader = request_headers.Authorization.split(' '); + if (authheader[0] == "Basic") { + password = Buffer.from(authheader[1], 'base64').toString(); + if (password) password = password.split(':')[1]; + } + } + if (wtva.checkPassword(password)) { + if (request_headers.query.username) { + var show_cannot_modify_self = false; + var show_user_has_no_password = false; + var user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search + if (user_info) { + if (user_info.ssid == socket.ssid) { + show_cannot_modify_self = true; + } + var userAccount = wtva.getAccountBySSID(user_info.ssid); + userAccount.switchUserID(user_info.user_id, false, false); + if (!userAccount.getUserPasswordEnabled()) { + show_user_has_no_password = true; + } + if (request_headers.query.confirm_remove) { + if (!show_cannot_modify_self && !show_user_has_no_password) { + userAccount.disableUserPassword(); + } + } + } + } + headers = `200 OK +Content-Type: text/html +wtv-expire-all: wtv-admin:/removeuserpasswd +wtv-noback-all: wtv-admin:/removeuserpasswd`; + data = ` + +
+
+Remove Password from a User Account+` + if (request_headers.query.username) { + if (user_info && !request_headers.query.confirm_remove && !show_user_has_no_password && !show_cannot_modify_self) { + data += ` +User Information: +
Try wtv-setup. `; + } else if (show_user_has_no_password) { + data += `${user_info.username} has no password, so there nothing to do. `; + } else { + data += `Password removed from account "${user_info.username}" `; + } + } + data += ` + + + | ||||||||||
+Go Back +
+ + +`; + } else { + var 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); + headers = errpage[0]; + data = errpage[1]; +} \ No newline at end of file diff --git a/zefie_wtvp_minisrv/WTVAdmin.js b/zefie_wtvp_minisrv/WTVAdmin.js index 78aff4ca..0c428d9e 100644 --- a/zefie_wtvp_minisrv/WTVAdmin.js +++ b/zefie_wtvp_minisrv/WTVAdmin.js @@ -148,6 +148,17 @@ class WTVAdmin { userSession.user_id = 0; return userSession; } + + isBanned(ssid) { + var self = this; + var isBanned = false; + Object.keys(this.minisrv_config.config.ssid_block_list).forEach(function (k) { + if (self.minisrv_config.config.ssid_block_list[k] == ssid) { + isBanned = true; + } + }); + return isBanned; + } } module.exports = WTVAdmin; diff --git a/zefie_wtvp_minisrv/WTVBGMusic.js b/zefie_wtvp_minisrv/WTVBGMusic.js index 2cfa8bdd..0fe4c2a6 100644 --- a/zefie_wtvp_minisrv/WTVBGMusic.js +++ b/zefie_wtvp_minisrv/WTVBGMusic.js @@ -1252,12 +1252,12 @@ class WTVBGMusic { this.wtvshared = new WTVShared(minisrv_config); } - getMusicObj() { + getMusicObj(force_default = false) { var music_obj = this.session_data.getSessionData("wtv-bgmusic"); if (music_obj === null) music_obj = {}; // check if we need to set defaults - var setDefaults = false; + var setDefaults = force_default; if (!music_obj.enableCategories) setDefaults = true; else if (music_obj.enableCategories.length == 0) setDefaults = true; if (!music_obj.enableSongs) setDefaults = true; diff --git a/zefie_wtvp_minisrv/WTVClientSessionData.js b/zefie_wtvp_minisrv/WTVClientSessionData.js index 68ab198b..0a1be9b1 100644 --- a/zefie_wtvp_minisrv/WTVClientSessionData.js +++ b/zefie_wtvp_minisrv/WTVClientSessionData.js @@ -451,7 +451,7 @@ class WTVClientSessionData { getUserPasswordEnabled() { if (!this.minisrv_config.config.passwords.enabled) return false; // master config override var enabled = this.getSessionData("subscriber_password"); - return (enabled); // true if set, false if null/disabled + return (enabled != null && typeof enabled != undefined); // true if set, false if null/disabled } validateUserPassword(passwd) { diff --git a/zefie_wtvp_minisrv/config.json b/zefie_wtvp_minisrv/config.json index 40308694..07f8dd7f 100644 --- a/zefie_wtvp_minisrv/config.json +++ b/zefie_wtvp_minisrv/config.json @@ -113,6 +113,7 @@ }, "wtv-admin": { "port": 1698, + "enable_multi_query": true, "password": "viRak-7" }, "http": {