more optimizations, remove WTVIRC for now, upgrade test.js
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const minisrv_service_file = true;
|
||||
session_data.loadSessionData();
|
||||
|
||||
if (session_data.user_id != 0) {
|
||||
if (session_data.user_id !== 0) {
|
||||
const errpage = wtvshared.doErrorPage(400, "You are not authorized to edit the primary account.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
|
||||
@@ -2,7 +2,7 @@ const minisrv_service_file = true;
|
||||
let errpage;
|
||||
|
||||
|
||||
if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
if (session_data.user_id !== 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
else if (session_data.getNumberOfUserAccounts() > minisrv_config.config.user_accounts.max_users_per_account) errpage = wtvshared.doErrorPage(400, "You are not authorized to add more than " + minisrv_config.config.user_accounts.max_users_per_account + ` account${minisrv_config.config.user_accounts.max_users_per_account > 1 ? 's' : ''}.`);
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ let errpage = null;
|
||||
|
||||
const wtvr = new WTVRegister(minisrv_config, SessionStore);
|
||||
|
||||
if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
if (session_data.user_id !== 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
else if (!request_headers.query.user_name) errpage = wtvshared.doErrorPage(400, "Please enter a username.");
|
||||
else if (request_headers.query.user_name.length < minisrv_config.config.user_accounts.min_username_length) errpage = wtvshared.doErrorPage(400, "Please choose a username with <b>" + minisrv_config.config.user_accounts.min_username_length + "</b> or more characters.");
|
||||
else if (request_headers.query.user_name.length > minisrv_config.config.user_accounts.max_username_length) errpage = wtvshared.doErrorPage(400, "Please choose a username with <b>" + minisrv_config.config.user_accounts.max_username_length + "</b> or less characters.");
|
||||
|
||||
@@ -4,7 +4,7 @@ let errpage;
|
||||
if (Object.keys(session_data.listPrimaryAccountUsers()).length >= minisrv_config.config.user_accounts.max_users_per_account) {
|
||||
errpage = wtvshared.doErrorPage(400, "You are not authorized to add more than " + minisrv_config.config.user_accounts.max_users_per_account + ` account${minisrv_config.config.user_accounts.max_users_per_account > 1 ? 's' : ''}.`);
|
||||
}
|
||||
else if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
else if (session_data.user_id !== 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
|
||||
|
||||
if (errpage) {
|
||||
|
||||
@@ -88,7 +88,7 @@ Object.keys(categories).forEach(function (k) {
|
||||
const catID = categories[k].id;
|
||||
const songsInCat = wtvbgm.getCategorySongList(catID);
|
||||
if (songsInCat.length > 0) {
|
||||
if (catsListed == divide) {
|
||||
if (catsListed === divide) {
|
||||
data += `</td ><td width="20">
|
||||
</td><td width="198" valign="top" align="left">`;
|
||||
}
|
||||
|
||||
@@ -3,18 +3,18 @@ let userSession = null;
|
||||
|
||||
session_data.loadSessionData();
|
||||
|
||||
let user_id = (request_headers.query.user_id) ? request_headers.query.user_id : session_data.user_id;
|
||||
let user_id = (request_headers.query.user_id) ? parseInt(request_headers.query.user_id) : session_data.user_id;
|
||||
|
||||
// security
|
||||
if (session_data.user_id != 0 && session_data.user_id != user_id) {
|
||||
if (session_data.user_id !== 0 && session_data.user_id !== parseInt(request_headers.query.user_id)) {
|
||||
user_id = null; // force unset
|
||||
const errpage = wtvshared.doErrorPage(400, "You are not authorized to change the selected user's password.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
if (user_id != null) {
|
||||
if (session_data.user_id == request_headers.query.user_id) userSession = session_data;
|
||||
if (user_id !== null) {
|
||||
if (session_data.user_id === user_id) userSession = session_data;
|
||||
else {
|
||||
userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
userSession.user_id = user_id;
|
||||
@@ -34,7 +34,7 @@ Content-Type: text/html`;
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
Change ${(user_id == session_data.user_id) ? 'your' : 'user'} password
|
||||
Change ${(user_id === session_data.user_id) ? 'your' : 'user'} password
|
||||
</TITLE>
|
||||
<DISPLAY nosave skipback noscroll>
|
||||
</HEAD>
|
||||
@@ -73,7 +73,7 @@ Change ${(user_id == session_data.user_id) ? 'your' : 'user'} password
|
||||
<td abswidth=14>
|
||||
<td abswidth=416 absheight=80 valign=center>
|
||||
<font size="+2" color="E7CE4A"><blackface><shadow>
|
||||
Change ${(user_id == session_data.user_id) ? 'your' : 'user'} password
|
||||
Change ${(user_id === session_data.user_id) ? 'your' : 'user'} password
|
||||
<td abswidth=20>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -161,5 +161,4 @@ value=Done name="Done" usestyle width=103>
|
||||
</html>
|
||||
`;
|
||||
}
|
||||
}
|
||||
if (userSession) userSession = null;
|
||||
}
|
||||
@@ -3,27 +3,27 @@ session_data.loadSessionData();
|
||||
let userSession, user_id;
|
||||
|
||||
if (request_headers.query.user_id) {
|
||||
user_id = request_headers.query.user_id;
|
||||
user_id = parseInt(request_headers.query.user_id);
|
||||
} else {
|
||||
user_id = session_data.user_id;
|
||||
}
|
||||
|
||||
// security
|
||||
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
||||
if (session_data.user_id !== 0 && session_data.user_id !== parseInt(request_headers.query.user_id)) {
|
||||
user_id = null; // force unset
|
||||
const errpage = wtvshared.doErrorPage(400, "You are not authorized to edit the selected user.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
if (user_id != null) {
|
||||
if (user_id !== null) {
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-setup:/edit-user
|
||||
wtv-noback-all: wtv-setup:/edit-user`
|
||||
|
||||
if (session_data.user_id == request_headers.query.user_id) userSession = session_data;
|
||||
if (session_data.user_id === user_id) userSession = session_data;
|
||||
else {
|
||||
userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
userSession.user_id = user_id;
|
||||
@@ -39,7 +39,7 @@ wtv-noback-all: wtv-setup:/edit-user`
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
Changing ${(user_id == 0) ? 'subscriber' : 'user'} information
|
||||
Changing ${(user_id === 0) ? 'subscriber' : 'user'} information
|
||||
</TITLE>
|
||||
<DISPLAY nosave
|
||||
noscroll>
|
||||
@@ -79,7 +79,7 @@ noscroll>
|
||||
<td abswidth=14>
|
||||
<td abswidth=416 absheight=80 valign=center>
|
||||
<font size="+2" color="E7CE4A"><blackface><shadow>
|
||||
${(user_id == 0) ? 'Subscriber' : 'User'} information
|
||||
${(user_id === 0) ? 'Subscriber' : 'User'} information
|
||||
<td abswidth=20>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -161,5 +161,4 @@ value=Done name="Done" usestyle width=103>
|
||||
</html>
|
||||
`;
|
||||
}
|
||||
}
|
||||
if (userSession) userSession = null;
|
||||
}
|
||||
@@ -2,18 +2,18 @@ const minisrv_service_file = true;
|
||||
let userSession = null;
|
||||
session_data.loadSessionData();
|
||||
|
||||
let user_id = (request_headers.query.user_id) ? request_headers.query.user_id : session_data.user_id;
|
||||
let user_id = (request_headers.query.user_id) ? parseInt(request_headers.query.user_id) : session_data.user_id;
|
||||
|
||||
// security
|
||||
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
||||
if (session_data.user_id !== 0 && session_data.user_id !== parseInt(request_headers.query.user_id)) {
|
||||
user_id = null; // force unset
|
||||
const errpage = wtvshared.doErrorPage(400, "You are not authorized to change the selected user's password.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
if (user_id != null) {
|
||||
if (session_data.user_id == request_headers.query.user_id) userSession = session_data;
|
||||
if (user_id !== null) {
|
||||
if (session_data.user_id === request_headers.query.user_id) userSession = session_data;
|
||||
else {
|
||||
userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
userSession.user_id = user_id;
|
||||
@@ -146,5 +146,4 @@ value=Done name="Done" usestyle width=103>
|
||||
</html>
|
||||
`;
|
||||
}
|
||||
}
|
||||
if (userSession) userSession = null;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ appear on your screen.
|
||||
<BR>
|
||||
<BR>
|
||||
`;
|
||||
if (settings_obj['setup-keyboard'] == "standard") {
|
||||
if (settings_obj['setup-keyboard'] === "standard") {
|
||||
data += '<INPUT TYPE="radio" id="standard" NAME="setup-keyboard" VALUE="standard" selected>';
|
||||
} else {
|
||||
data += '<INPUT TYPE="radio" id="standard" NAME="setup-keyboard" VALUE="standard">';
|
||||
|
||||
@@ -12,7 +12,7 @@ Content-Type: text/html`
|
||||
let signature = session_data.getSessionData("subscriber_signature");
|
||||
|
||||
if (request_headers.query.mail_signature) {
|
||||
if (signature != request_headers.query.mail_signature) {
|
||||
if (signature !== request_headers.query.mail_signature) {
|
||||
session_data.setSessionData("subscriber_signature", (request_headers.query.mail_signature) ? request_headers.query.mail_signature : "");
|
||||
session_data.saveSessionData();
|
||||
signature = request_headers.query.mail_signature;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const minisrv_service_file = true;
|
||||
let justenabled, enablestatus;
|
||||
|
||||
if (!session_data.getSessionData("messenger_enabled") == 1) {
|
||||
if (!session_data.getSessionData("messenger_enabled") === 1) {
|
||||
session_data.setSessionData("messenger_enabled", 1);
|
||||
session_data.saveSessionData;
|
||||
justenabled = "true";
|
||||
|
||||
@@ -47,7 +47,7 @@ function ShowMessengerPanel()
|
||||
</table>
|
||||
</sidebar>
|
||||
<BODY BGCOLOR="#191919" TEXT="#42CC55" LINK="189CD6" VLINK="189CD6" HSPACE=0 VSPACE=0 FONTSIZE="large"`;
|
||||
if (request_headers.query.just_enabled == "true") {
|
||||
if (request_headers.query.just_enabled === "true") {
|
||||
data += "onload=ShowMessengerPanel()"
|
||||
} data += `
|
||||
>
|
||||
@@ -69,7 +69,7 @@ Messenger
|
||||
<tr>
|
||||
<td absheight=195 valign=top>
|
||||
Messenger is currently <b>`;
|
||||
if (session_data.getSessionData("messenger_enabled") == 1) {
|
||||
if (session_data.getSessionData("messenger_enabled") === 1) {
|
||||
data += "on"
|
||||
} else {
|
||||
data += "off"
|
||||
@@ -81,7 +81,7 @@ if (session_data.getSessionData("messenger_enabled") == 1) {
|
||||
<tr>
|
||||
<td align=left>
|
||||
<a href="messenger-enable">Turn messenger `;
|
||||
if (!session_data.getSessionData("messenger_enabled") == 1) {
|
||||
if (!session_data.getSessionData("messenger_enabled") === 1) {
|
||||
data += "on"
|
||||
} else {
|
||||
data += "off"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const minisrv_service_file = true;
|
||||
let errpage;
|
||||
|
||||
if (Object.keys(session_data.listPrimaryAccountUsers()).length == 1) {
|
||||
if (Object.keys(session_data.listPrimaryAccountUsers()).length === 1) {
|
||||
errpage = wtvshared.doErrorPage(400, "There are no more users to remove.");
|
||||
}
|
||||
else if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
else if (session_data.user_id !== 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
if (errpage) {
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
|
||||
@@ -71,22 +71,23 @@ Television
|
||||
<spacer type=block height=24 width=1>
|
||||
<td WIDTH=200 HEIGHT=244 VALIGN=top ALIGN=left>
|
||||
<br><font size="-1">
|
||||
<A HREF="wtv-setup:/center-display" selected><BLACKFACE>Center</BLACKFACE></A><BR>
|
||||
<FONT SIZE="-1">Center WebTV on your screen</FONT><BR>`;
|
||||
<A HREF="wtv-setup:/adjust-display-intro"><BLACKFACE>Picture</BLACKFACE></A><BR>
|
||||
<FONT SIZE="-1">Adjust brightness, contrast, and sharpness</FONT><BR>
|
||||
`;
|
||||
|
||||
// old classic apparently can do Screen Border
|
||||
if (session_data.get("wtv-client-rom-type") == "bf0app") {
|
||||
if (session_data.get("wtv-client-rom-type") === "bf0app") {
|
||||
data += `<spacer type=block width=1 height=5><BR>
|
||||
<A HREF="wtv-setup:/screen-border" selected><BLACKFACE>Border</BLACKFACE></A><BR>
|
||||
<FONT SIZE="-1">Change the color of the screen border</FONT><BR>`;
|
||||
}
|
||||
<FONT SIZE="-1">Change the color of the screen border</FONT><BR>
|
||||
|
||||
data += `
|
||||
<TD WIDTH=20>
|
||||
<TD WIDTH=500 VALIGN=top ALIGN=left>
|
||||
<spacer type=block width=15 height=14> <font size="2"><br>
|
||||
<A HREF="wtv-setup:/adjust-display-intro"><BLACKFACE>Picture</BLACKFACE></A><BR>
|
||||
<FONT SIZE="-1">Adjust brightness, contrast, and sharpness</FONT><BR>
|
||||
<A HREF="wtv-setup:/center-display" selected><BLACKFACE>Center</BLACKFACE></A><BR>
|
||||
<FONT SIZE="-1">Center WebTV on your screen</FONT><BR>`;
|
||||
}
|
||||
data += `
|
||||
<TD>
|
||||
<TR>
|
||||
<TD>
|
||||
|
||||
@@ -96,7 +96,7 @@ Choose the songs that you'd like to include.
|
||||
let songsListed = 0;
|
||||
const divide = Math.round(musicList.length / 2, 0);
|
||||
Object.keys(musicList).forEach(function (k) {
|
||||
if (songsListed == divide) {
|
||||
if (songsListed === divide) {
|
||||
data += `</td ><td width="20">
|
||||
</td><td width="198" valign="top" align="left">`;
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ for (let i = 0; i < settings.length; i += 2) {
|
||||
data += `<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td>${(settings[i][0] != "") ? `€ <a href="${settings[i][0]}">${settings[i][1]}</a>` : `<!-- TODO --> `}
|
||||
<td>${(settings[i][0] !== "") ? `€ <a href="${settings[i][0]}">${settings[i][1]}</a>` : `<!-- TODO --> `}
|
||||
<td width=25>
|
||||
<td>`
|
||||
if (i + 1 < settings.length) {
|
||||
data += (settings[i + 1][0] != "") ? `€ <a href="${settings[i + 1][0]}">${settings[i + 1][1]}</a>` : `<!-- TODO --> `
|
||||
data += (settings[i + 1][0] !== "") ? `€ <a href="${settings[i + 1][0]}">${settings[i + 1][1]}</a>` : `<!-- TODO --> `
|
||||
} else {
|
||||
// require even number of settings
|
||||
data += "<!-- TODO --> "
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const minisrv_service_file = true;
|
||||
|
||||
// security
|
||||
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
||||
if (session_data.user_id !== 0 && session_data.user_id !== parseInt(request_headers.query.user_id)) {
|
||||
const errpage = wtvshared.doErrorPage(400, "You are not authorized to transfer this account. Please log in as the primary user.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
|
||||
@@ -2,7 +2,7 @@ const minisrv_service_file = true;
|
||||
let userSession = null;
|
||||
let errpage = null;
|
||||
|
||||
if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
if (session_data.user_id !== 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
|
||||
// seperate if statements as to not overwrite the first error if multiple occur
|
||||
|
||||
@@ -71,6 +71,4 @@ wtv-expire: wtv-setup:/accounts
|
||||
Location: wtv-setup:/accounts`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (userSession) userSession = null;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
const minisrv_service_file = true;
|
||||
let errpage = null;
|
||||
|
||||
if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
if (session_data.user_id !== 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to add users to this account.");
|
||||
|
||||
// seperate if statements as to not overwrite the first error if multiple occur
|
||||
|
||||
@@ -129,7 +129,7 @@ display_name=${request_headers.query.display_name}&
|
||||
user_name=${request_headers.query.user_name}&
|
||||
user_password=${request_headers.query.user_password}&
|
||||
user_password2=${request_headers.query.user_password2}">`;
|
||||
if ((request_headers.query.user_password) == "") {
|
||||
if ((request_headers.query.user_password) === "") {
|
||||
data += `No password`;
|
||||
} else {
|
||||
data += `Has password`;
|
||||
|
||||
@@ -8,13 +8,13 @@ if (request_headers.query && session_data) {
|
||||
if (request_headers.request_url.indexOf('?') >= 0) {
|
||||
const category = (request_headers.query.category) ? request_headers.query.category : null;
|
||||
|
||||
if (category == null) music_obj.enableCategories = [];
|
||||
if (category === null) music_obj.enableCategories = [];
|
||||
else {
|
||||
const cat = wtvbgm.categories[parseInt(category) - 1];
|
||||
if (cat) {
|
||||
const toRemove = [];
|
||||
Object.keys(music_obj.enableSongs).forEach(function (k) {
|
||||
if (wtvbgm.getSongCategory(parseInt(music_obj.enableSongs[k])) == parseInt(category)) toRemove.push(k);
|
||||
if (wtvbgm.getSongCategory(parseInt(music_obj.enableSongs[k])) === parseInt(category)) toRemove.push(k);
|
||||
});
|
||||
toRemove.forEach(function (v) {
|
||||
music_obj.enableSongs.splice(v, 1, "");
|
||||
@@ -28,10 +28,10 @@ if (request_headers.query && session_data) {
|
||||
const qraw = _qraw.split("&");
|
||||
for (let i = 0; i < qraw.length; i++) {
|
||||
const qraw_split = qraw[i].split("=");
|
||||
if (qraw_split.length == 2) {
|
||||
if (qraw_split.length === 2) {
|
||||
const k = qraw_split[0];
|
||||
if (k == "enableCategory") music_obj['enableCategories'].push(decodeURIComponent(qraw[i].split("=")[1].replace(/\+/g, "%20")));
|
||||
if (k == "enableSong") music_obj['enableSongs'].push(decodeURIComponent(qraw[i].split("=")[1].replace(/\+/g, "%20")));
|
||||
if (k === "enableCategory") music_obj['enableCategories'].push(decodeURIComponent(qraw[i].split("=")[1].replace(/\+/g, "%20")));
|
||||
if (k === "enableSong") music_obj['enableSongs'].push(decodeURIComponent(qraw[i].split("=")[1].replace(/\+/g, "%20")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ if (request_headers.query && session_data) {
|
||||
music_obj.enableCategories = [...new Set(music_obj.enableCategories.filter(value => Object.keys(value).length !== 0))];
|
||||
music_obj.enableSongs = [...new Set(music_obj.enableSongs.filter(value => Object.keys(value).length !== 0))];
|
||||
music_obj = Object.assign({}, music_obj)
|
||||
if ((Object.keys(music_obj.enableCategories).length != Object.keys(old_music_obj.enableCategories).length) || (Object.keys(music_obj.enableSongs).length != Object.keys(old_music_obj.enableSongs).length)) {
|
||||
if ((Object.keys(music_obj.enableCategories).length !== Object.keys(old_music_obj.enableCategories).length) || (Object.keys(music_obj.enableSongs).length !== Object.keys(old_music_obj.enableSongs).length)) {
|
||||
// something changed
|
||||
session_data.setSessionData("wtv-bgmusic", music_obj);
|
||||
session_data.saveSessionData();
|
||||
|
||||
@@ -2,19 +2,19 @@ const minisrv_service_file = true;
|
||||
let userSession;
|
||||
session_data.loadSessionData();
|
||||
|
||||
let user_id = (request_headers.query.user_id) ? request_headers.query.user_id : session_data.user_id;
|
||||
let user_id = (request_headers.query.user_id) ? parseInt(request_headers.query.user_id) : session_data.user_id;
|
||||
|
||||
// security
|
||||
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
||||
if (session_data.user_id !== 0 && session_data.user_id !== parseInt(request_headers.query.user_id)) {
|
||||
user_id = null; // force unset
|
||||
const errpage = wtvshared.doErrorPage(400, "You are not authorized to change the selected user's password.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
if (user_id != null) {
|
||||
if (user_id !== null) {
|
||||
|
||||
if (session_data.user_id == request_headers.query.user_id) userSession = session_data;
|
||||
if (session_data.user_id === parseInt(request_headers.query.user_id)) userSession = session_data;
|
||||
else {
|
||||
userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
userSession.user_id = user_id;
|
||||
@@ -35,5 +35,4 @@ wtv-expire: wtv-setup:/edit-user-begin?user_id=${user_id}
|
||||
wtv-expire: wtv-setup:/edit-user-name?user_id=${user_id}
|
||||
Location: wtv-setup:/edit-user-begin?user_id=${user_id}`;
|
||||
}
|
||||
}
|
||||
if (userSession) userSession = null;
|
||||
}
|
||||
@@ -5,14 +5,14 @@ session_data.loadSessionData();
|
||||
|
||||
let user_id = null;
|
||||
if (request_headers.query.user_id) {
|
||||
user_id = request_headers.query.user_id;
|
||||
user_id = parseInt(request_headers.query.user_id);
|
||||
} else {
|
||||
errpage = wtvshared.doErrorPage(400, "User was not specified.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
||||
if (session_data.user_id !== 0 && session_data.user_id !== parseInt(request_headers.query.user_id)) {
|
||||
user_id = null; // force unset
|
||||
errpage = wtvshared.doErrorPage(400, "You are not authorized to edit the selected user.");
|
||||
headers = errpage[0];
|
||||
@@ -24,10 +24,10 @@ if (user_id && !errpage) {
|
||||
Connection: Keep-Alive
|
||||
Content-Type: text/html`
|
||||
userSession = null;
|
||||
if (session_data.user_id == request_headers.query.user_id) userSession = session_data;
|
||||
if (session_data.user_id === parseInt(request_headers.query.user_id)) userSession = session_data;
|
||||
else {
|
||||
userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
userSession.user_id = user_id;``
|
||||
userSession.user_id = user_id;
|
||||
}
|
||||
|
||||
if (!userSession.loadSessionData()) {
|
||||
@@ -36,7 +36,7 @@ Content-Type: text/html`
|
||||
data = errpage[1];
|
||||
}
|
||||
else {
|
||||
if (request_headers.query.password.length == 0 && request_headers.query.password_verify.length == 0) {
|
||||
if (request_headers.query.password.length === 0 && request_headers.query.password_verify.length === 0) {
|
||||
userSession.disableUserPassword();
|
||||
headers = `300 OK
|
||||
Content-type: text/html
|
||||
@@ -76,5 +76,3 @@ if (errpage) {
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
if (userSession) userSession = null;
|
||||
@@ -2,7 +2,7 @@ const minisrv_service_file = true;
|
||||
|
||||
if (request_headers.query && session_data) {
|
||||
const signature = session_data.getSessionData("subscriber_signature");
|
||||
if (request_headers.query.mail_signature != signature) {
|
||||
if (request_headers.query.mail_signature !== signature) {
|
||||
session_data.setSessionData("subscriber_signature", (request_headers.query.mail_signature) ? request_headers.query.mail_signature : "");
|
||||
session_data.saveSessionData();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const minisrv_service_file = true;
|
||||
let errpage;
|
||||
|
||||
if (Object.keys(session_data.listPrimaryAccountUsers()).length == 1) {
|
||||
if (Object.keys(session_data.listPrimaryAccountUsers()).length === 1) {
|
||||
errpage = wtvshared.doErrorPage(400, "There are no more users to remove.");
|
||||
}
|
||||
else if (session_data.user_id != 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to remove users from this account.");
|
||||
else if (session_data.user_id !== 0) errpage = wtvshared.doErrorPage(400, "You are not authorized to remove users from this account.");
|
||||
|
||||
const usersToRemove = [];
|
||||
Object.keys(request_headers.query).forEach(function (k) {
|
||||
@@ -21,7 +21,7 @@ if (errpage) {
|
||||
} else {
|
||||
if (!request_headers.query.confirm_remove) {
|
||||
let message = '';
|
||||
if (usersToRemove.length == 1) {
|
||||
if (usersToRemove.length === 1) {
|
||||
const userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
userSession.switchUserID(usersToRemove[0]);
|
||||
const userName = userSession.getSessionData("subscriber_username");
|
||||
@@ -61,7 +61,7 @@ Location: ${confirmAlert}`
|
||||
})
|
||||
const num_accounts = session_data.getNumberOfUserAccounts();
|
||||
let gourl = "wtv-setup:/remove-users?";
|
||||
if (num_accounts == 1) gourl = "wtv-setup:/accounts?";
|
||||
if (num_accounts === 1) gourl = "wtv-setup:/accounts?";
|
||||
|
||||
headers = `300 OK
|
||||
Connection: Keep-Alive
|
||||
|
||||
@@ -3,7 +3,7 @@ const minisrv_service_file = true;
|
||||
const wtvr = new WTVRegister(minisrv_config);
|
||||
|
||||
// security
|
||||
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
||||
if (session_data.user_id !== 0 && session_data.user_id !== parseInt(request_headers.query.user_id)) {
|
||||
const errpage = wtvshared.doErrorPage(400, "You are not authorized to transfer this account. Please log in as the primary user.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
|
||||
Reference in New Issue
Block a user