- numerous bug fixes - wtv-mail system - user account updates - viewergen alpha (experimental webtv viewer patcher on pc_service) - implement wtv-favorites with huge help from @JarHead4 - add wtv-ticket store api - Bump vm2 from 3.9.5 to 3.9.7 in /zefie_wtvp_minisrv - fix bf0app default rom - Add wtv-1800 service to wtv-1800:/noflash - handle webtvism: - allow get/post variables to be the same name multiple times - rather than overwrite, the server will now change the variable from a string to an array. - Rewrite script processing a bit - Instead of using eval() we now use a proper VM Context - As a result, any scripting errors will now give a more useful filename and line number. - However, some things may break, if they are dependant on variables we are not allowing in the context. - BREAKING CHANGES: - `ssid_sessions[socket.ssid]` is now `session_data` - `require` is no longer allowed in user scripts - add star service - change how we handle modules for services in the VM - fixed wtv-disk:/sync always failed the first time - implement production-like wtv-star handling (when a service port becomes unavailable, it requests the url over the wtv-star port to show an error page) - renamed WTVDownloadList.js to WTVDisk.js - a bit more work on WTVNews (created class) - probably more stuff I can't remember
75 lines
2.6 KiB
JavaScript
75 lines
2.6 KiB
JavaScript
var minisrv_service_file = true;
|
|
var errpage;
|
|
|
|
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.");
|
|
|
|
var usersToRemove = [];
|
|
Object.keys(request_headers.query).forEach(function (k) {
|
|
if (k.substr(0, 4) === "user" && request_headers.query[k] === "on") {
|
|
usersToRemove.push(parseInt(k.replace("user", "")));
|
|
}
|
|
});
|
|
|
|
if (usersToRemove.length === 0) errpage = wtvshared.doErrorPage(400, "No users were specified for removal.");
|
|
|
|
if (errpage) {
|
|
headers = errpage[0];
|
|
data = errpage[1];
|
|
} else {
|
|
if (!request_headers.query.confirm_remove) {
|
|
var message = '';
|
|
if (usersToRemove.length == 1) {
|
|
var userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
|
|
userSession.switchUserID(usersToRemove[0]);
|
|
var userName = userSession.getSessionData("subscriber_username");
|
|
message = `Removing <b>${userName}</b> will permanently remove all of <b>${userName}</b>'s e-mail and favorites as well. You will not be able to restore <b>${userName}</b>.`;
|
|
} else {
|
|
message = "Removing the selected users will permanently remove their e-mail and favorites as well. You will not be able to restore the users.";
|
|
}
|
|
var removeurl = request_headers.request_url;
|
|
if (removeurl.indexOf('?') >= 0) {
|
|
removeurl = removeurl.substring(0, removeurl.indexOf('?'));
|
|
}
|
|
removeurl += "?";
|
|
|
|
Object.keys(usersToRemove).forEach(function (k) {
|
|
removeurl += "user" + usersToRemove[k] + "=on&";
|
|
});
|
|
removeurl += "confirm_remove=true";
|
|
|
|
var confirmAlert = new clientShowAlert({
|
|
'image': minisrv_config.config.service_logo,
|
|
'message': message,
|
|
'buttonlabel1': "Don't Remove",
|
|
'buttonaction1': "client:donothing",
|
|
'buttonlabel2': "Remove",
|
|
'buttonaction2': removeurl,
|
|
'noback': true,
|
|
}).getURL();
|
|
headers = `300 OK
|
|
Connection: Keep-Alive
|
|
Content-Type: text/html
|
|
wtv-expire-all: wtv-setup:/remove-users
|
|
wtv-expire-all: wtv-setup:/accounts
|
|
wtv-visit: ${confirmAlert}
|
|
Location: ${confirmAlert}`
|
|
} else {
|
|
Object.keys(usersToRemove).forEach(function (k) {
|
|
session_data.removeUser(usersToRemove[k]);
|
|
})
|
|
var num_accounts = session_data.getNumberOfUserAccounts();
|
|
var gourl = "wtv-setup:/remove-users?";
|
|
if (num_accounts == 1) gourl = "wtv-setup:/accounts?";
|
|
|
|
headers = `300 OK
|
|
Connection: Keep-Alive
|
|
Content-Type: text/html
|
|
wtv-expire-all: wtv-setup:/remove-users
|
|
wtv-expire-all: wtv-setup:/accounts
|
|
wtv-visit: ${gourl}
|
|
Location: ${gourl}`
|
|
}
|
|
} |