remove guest mode

This commit is contained in:
zefie
2025-08-12 01:05:10 -04:00
parent b29dd70f52
commit ad95d5f088
16 changed files with 467 additions and 568 deletions

View File

@@ -51,10 +51,6 @@ if (request_headers.query.reconnect && session_data.getSessionData("registered")
if (session_data.data_store.wtvsec_login) { if (session_data.data_store.wtvsec_login) {
var prereg_contype = "text/html"; var prereg_contype = "text/html";
if (request_headers.query.relogin || request_headers.query.guest_login) { // relogin
session_data.data_store.wtvsec_login.ticket_b64 = null; // clear old ticket
}
// if relogin and wtv-script-id != 0, skip tellyscript // if relogin and wtv-script-id != 0, skip tellyscript
session_data.set("wtv-open-access", (request_headers['wtv-open-access'] === "true") ? true : false); session_data.set("wtv-open-access", (request_headers['wtv-open-access'] === "true") ? true : false);
var file_path = null; var file_path = null;
@@ -63,7 +59,7 @@ if (session_data.data_store.wtvsec_login) {
var bf0app_update = false; var bf0app_update = false;
var romtype = session_data.get("wtv-client-rom-type"); var romtype = session_data.get("wtv-client-rom-type");
var bootrom = parseInt(session_data.get("wtv-client-bootrom-version")); var bootrom = parseInt(session_data.get("wtv-client-bootrom-version"));
var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin && !request_headers.query.guest_login && !bootrom !== 0); var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin && !bootrom !== 0);
var wtv_script_id = parseInt(session_data.get("wtv-script-id")); var wtv_script_id = parseInt(session_data.get("wtv-script-id"));
var wtv_script_mod = parseInt(session_data.get("wtv-script-mod")); var wtv_script_mod = parseInt(session_data.get("wtv-script-mod"));
if ((request_headers.query.reconnect || request_headers.query.relogin) && wtv_script_id != 0) send_tellyscript = false; if ((request_headers.query.reconnect || request_headers.query.relogin) && wtv_script_id != 0) send_tellyscript = false;
@@ -165,12 +161,6 @@ if (session_data.data_store.wtvsec_login) {
if (request_headers.query.reconnect) gourl = null; if (request_headers.query.reconnect) gourl = null;
if (request_headers.query.guest_login) {
send_tellyscript = false;
if (gourl != null) gourl += "&guest_login=true"
if (request_headers.query.skip_splash) gourl += "&skip_splash=true";
}
if (file_path != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Sending TellyScript", file_path, "on socket", socket.id); if (file_path != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Sending TellyScript", file_path, "on socket", socket.id);
if (template != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Generating TellyScript on socket", socket.id); if (template != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Generating TellyScript on socket", socket.id);
@@ -193,7 +183,6 @@ if (session_data.data_store.wtvsec_login) {
if (bf0app_update) headers += "wtv-boot-url: " + gourl + "\n"; if (bf0app_update) headers += "wtv-boot-url: " + gourl + "\n";
else { else {
headers += "wtv-boot-url: wtv-head-waiter:/login?relogin=true"; headers += "wtv-boot-url: wtv-head-waiter:/login?relogin=true";
if (request_headers.query.guest_login) headers += "&guest_login=true";
headers += "\n"; headers += "\n";
} }
if (gourl != null) headers += "wtv-visit: " + gourl + "\n"; if (gourl != null) headers += "wtv-visit: " + gourl + "\n";

View File

@@ -137,9 +137,6 @@ contact the server operator (eg. email, Discord, Twitter, etc...)
<font size=-1><b>verbosity</b><br>Console log debug level. <font size=-1><b>verbosity</b><br>Console log debug level.
<tr><td absheight=60 valign=top> <tr><td absheight=60 valign=top>
<font size=-1><b>show_diskmap</b><br>Useful for debugging wtv-disk downloads. <font size=-1><b>show_diskmap</b><br>Useful for debugging wtv-disk downloads.
<tr><td absheight=140 valign=top>
<font size=-1><b>allow_guests</b><br>Allows users to use the service without having to register.
Guest session data is destroyed upon logout, and some features are not available to guests.
<tr><td absheight=90 valign=top> <tr><td absheight=90 valign=top>
<font size=-1><b>enable_<br>lzpf_compression</b><br>Toggles whether LZPF compression will be considered or not <font size=-1><b>enable_<br>lzpf_compression</b><br>Toggles whether LZPF compression will be considered or not
<tr><td absheight=90 valign=top> <tr><td absheight=90 valign=top>
@@ -211,9 +208,6 @@ ${generateFormField('select', 'verbosity', [
<td absheight=60 valign=top> <td absheight=60 valign=top>
${generateFormField('checkbox', 'show_diskmap')} ${generateFormField('checkbox', 'show_diskmap')}
<tr> <tr>
<td absheight=140 valign=top>
${generateFormField('checkbox', 'allow_guests')}
<tr>
<td absheight=85 valign=top> <td absheight=85 valign=top>
${generateFormField('checkbox', 'enable_lzpf_compression')} ${generateFormField('checkbox', 'enable_lzpf_compression')}
<tr> <tr>

View File

@@ -82,12 +82,6 @@ wtv-visit: client:hangupphone`
} }
} }
if (request_headers.query.guest_login) {
if (request_headers.query.relogin || request_headers.query.reconnect) gourl += "&";
gourl += "guest_login=true";
if (request_headers.query.skip_splash) gourl += "&skip_splash=true";
}
if (user_id != null && !request_headers.query.initial_login && !request_headers.query.user_login && !request_headers.query.relogin && !request_headers.query.reconnect) { if (user_id != null && !request_headers.query.initial_login && !request_headers.query.user_login && !request_headers.query.relogin && !request_headers.query.reconnect) {
if (request_headers.query.password == "") { if (request_headers.query.password == "") {
headers = `403 Please enter your password and try again headers = `403 Please enter your password and try again

View File

@@ -3,14 +3,14 @@ var gourl = null;
var bootrom = parseInt(session_data.get("wtv-client-bootrom-version")); var bootrom = parseInt(session_data.get("wtv-client-bootrom-version"));
if (!session_data.isRegistered() && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) gourl = "wtv-register:/splash?"; if (!session_data.isRegistered()) gourl = "wtv-register:/splash?";
var home_url = "wtv-home:/home?"; var home_url = "wtv-home:/home?";
if (gourl) { if (gourl) {
headers = "200 OK\n"; headers = "200 OK\n";
if (bootrom !== 0) headers += "wtv-open-isp-disabled: false\n"; if (bootrom !== 0) headers += "wtv-open-isp-disabled: false\n";
if (!session_data.isRegistered() && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) { if (!session_data.isRegistered()) {
// fake logged in for reg // fake logged in for reg
session_data.setUserLoggedIn(true); session_data.setUserLoggedIn(true);
headers += `wtv-encrypted: ${(request_headers['wtv-encrypted']) ? wtvshared.parseBool(request_headers['wtv-encrypted']) : true} headers += `wtv-encrypted: ${(request_headers['wtv-encrypted']) ? wtvshared.parseBool(request_headers['wtv-encrypted']) : true}
@@ -27,17 +27,6 @@ Content-type: text/html`;
else { else {
if (session_data.lockdown) { if (session_data.lockdown) {
home_url = minisrv_config.config.unauthorized_url; home_url = minisrv_config.config.unauthorized_url;
}
else if (request_headers.query.guest_login && minisrv_config.config.allow_guests) {
var namerand = Math.floor(Math.random() * 100000);
var nickname = (minisrv_config.config.service_name + '_' + namerand)
var human_name = nickname;
var userid = '1' + Math.floor(Math.random() * 1000000000000000000);
var messenger_enabled = 0;
var messenger_authorized = 0;
var timezone = "-0000";
if (request_headers.query.skip_splash) gourl = "wtv-home:/home?";
else gourl = "wtv-home:/splash?";
} else if (!session_data.getSessionData("registered")) { } else if (!session_data.getSessionData("registered")) {
var errpage = wtvshared.doErrorPage(400); var errpage = wtvshared.doErrorPage(400);
headers = errpage[0]; headers = errpage[0];
@@ -174,13 +163,8 @@ wtv-inactive-timeout: 1440
if (!limitedLogin && !limitedLoginRegistered) { if (!limitedLogin && !limitedLoginRegistered) {
headers += "wtv-relogin-url: wtv-head-waiter:/relogin?relogin=true\n"; headers += "wtv-relogin-url: wtv-head-waiter:/relogin?relogin=true\n";
if (request_headers.query.guest_login) headers += "&guest_login=true\n";
headers += "wtv-reconnect-url: wtv-head-waiter:/login-stage-two?reconnect=true\n"; headers += "wtv-reconnect-url: wtv-head-waiter:/login-stage-two?reconnect=true\n";
if (request_headers.query.guest_login) headers += "&guest_login=true\n";
headers += "wtv-boot-url: wtv-head-waiter:/relogin?relogin=true\n"; headers += "wtv-boot-url: wtv-head-waiter:/relogin?relogin=true\n";
if (request_headers.query.guest_login) headers += "&guest_login=true\n ";
headers += "wtv-home-url: " + home_url + "\n"; headers += "wtv-home-url: " + home_url + "\n";
} }

View File

@@ -9,11 +9,6 @@ else if (request_headers.query.reconnect) gourl += "reconnect=true";
else gourl += "initial_login=true" else gourl += "initial_login=true"
var bootrom = parseInt(session_data.get("wtv-client-bootrom-version")); var bootrom = parseInt(session_data.get("wtv-client-bootrom-version"));
if (request_headers.query.guest_login || bootrom === 0) {
if (gourl.substr(-1) != "?") gourl += "&";
gourl += "guest_login=true";
if (request_headers.query.skip_splash) gourl += "&skip_splash=true";
}
var send_to_relogin = true; var send_to_relogin = true;

View File

@@ -6,12 +6,6 @@ var gourl = "wtv-1800:/preregister?";
if (request_headers.query.relogin) gourl += "relogin=true"; if (request_headers.query.relogin) gourl += "relogin=true";
else if (request_headers.query.reconnect) gourl += "reconnect=true"; else if (request_headers.query.reconnect) gourl += "reconnect=true";
if (request_headers.query.guest_login) {
if (request_headers.query.relogin || request_headers.query.reconnect) gourl += "&";
gourl += "guest_login=true";
if (request_headers.query.skip_splash) gourl += "&skip_splash=true";
}
headers = `200 OK headers = `200 OK
Connection: Keep-Alive Connection: Keep-Alive
Expires: Wed, 09 Oct 1991 22:00:00 GMT Expires: Wed, 09 Oct 1991 22:00:00 GMT

View File

@@ -1,34 +1,30 @@
var minisrv_service_file = true; var minisrv_service_file = true;
var mailstore_exists = false; var mailstore_exists = false;
if (!session_data.isRegistered()) {
var errpage = wtvshared.doErrorPage("400", "Mail service is not available for guest users."); function mail_end_error(msg) {
headers = errpage[0];
data = errpage[1];
} else {
function mail_end_error(msg) {
var errpage = wtvshared.doErrorPage("400", msg); var errpage = wtvshared.doErrorPage("400", msg);
headers = errpage[0]; headers = errpage[0];
data = errpage[1]; data = errpage[1];
} }
var intro_seen = session_data.mailstore.checkMailIntroSeen(); var intro_seen = session_data.mailstore.checkMailIntroSeen();
if (!intro_seen && !request_headers.query.intro_seen) { if (!intro_seen && !request_headers.query.intro_seen) {
// user is trying to bypass the intro screen // user is trying to bypass the intro screen
headers = "300 OK\nLocation: wtv-mail:/DiplomaMail"; headers = "300 OK\nLocation: wtv-mail:/DiplomaMail";
} else { } else {
if (!intro_seen && request_headers.query.intro_seen) { if (!intro_seen && request_headers.query.intro_seen) {
// User has come from intro // User has come from intro
session_data.mailstore.setMailIntroSeen(true); session_data.mailstore.setMailIntroSeen(true);
} }
// check if mailstore exists (returns null if guest) // check if mailstore exista
mailstore_exists = session_data.mailstore.mailstoreExists(); mailstore_exists = session_data.mailstore.mailstoreExists();
// create mailstore if it doesnt exist (also returns null if guest) // create mailstore if it doesnt exist
if (!mailstore_exists) mailstore_exists = session_data.mailstore.createMailstore(); if (!mailstore_exists) mailstore_exists = session_data.mailstore.createMailstore();
if (mailstore_exists) { if (mailstore_exists) {
// mailstore exists and user is not guest // mailstore exists
var default_limit = (minisrv_config.services[service_name].messages_per_page) ? minisrv_config.services[service_name].messages_per_page : 25; // user config or 25 var default_limit = (minisrv_config.services[service_name].messages_per_page) ? minisrv_config.services[service_name].messages_per_page : 25; // user config or 25
var mailbox = (request_headers.query.mailbox) ? parseInt(request_headers.query.mailbox) : 0; var mailbox = (request_headers.query.mailbox) ? parseInt(request_headers.query.mailbox) : 0;
@@ -336,12 +332,11 @@ ${username}@${minisrv_config.config.service_name}
</table> </table>
</body> </body>
</HTML> </HTML>
`; `;
} }
} else { } else {
mail_end_error("Access Denied"); mail_end_error("Access Denied");
} }
}
} }

View File

@@ -3,16 +3,11 @@ var minisrv_service_file = true;
var message_snapshot_data = null; var message_snapshot_data = null;
var message_voicemail_data = null; var message_voicemail_data = null;
if (!session_data.isRegistered()) { var intro_seen = session_data.mailstore.checkMailIntroSeen();
var errpage = wtvshared.doErrorPage("400", "Sending mail and posting to usenet is not available for guest users."); if (!intro_seen && !request_headers.query.intro_seen) {
headers = errpage[0];
data = errpage[1];
} else {
var intro_seen = session_data.mailstore.checkMailIntroSeen();
if (!intro_seen && !request_headers.query.intro_seen) {
// user is trying to bypass the intro screen // user is trying to bypass the intro screen
headers = "300 OK\nLocation: wtv-mail:/DiplomaMail?came-from=" + encodeURIComponent(request_headers.request_url); headers = "300 OK\nLocation: wtv-mail:/DiplomaMail?came-from=" + encodeURIComponent(request_headers.request_url);
} else if (request_headers.query.clear == "true") { } else if (request_headers.query.clear == "true") {
if (request_headers.Referer) if (request_headers.Referer)
gourl = request_headers.Referer.replace(/[\?\&]clear\=true/, ''); gourl = request_headers.Referer.replace(/[\?\&]clear\=true/, '');
else else
@@ -34,7 +29,7 @@ if (!session_data.isRegistered()) {
wtv-expire-all: wtv-mail:/listmail wtv-expire-all: wtv-mail:/listmail
wtv-expire-all: wtv-mail:/sendmail wtv-expire-all: wtv-mail:/sendmail
Location: ${gourl}`; Location: ${gourl}`;
} else { } else {
var doClientError = function (msg) { var doClientError = function (msg) {
var clientErrorMsg = new clientShowAlert({ var clientErrorMsg = new clientShowAlert({
'image': minisrv_config.config.service_logo, 'image': minisrv_config.config.service_logo,
@@ -364,8 +359,8 @@ myURL = "client:submitform?name=sendform&submitname=gabbing&submitvalue=cache%3A
location = "client:submitform?name=sendform&submitname=gabbing&submitvalue=true"; location = "client:submitform?name=sendform&submitname=gabbing&submitvalue=true";
location.reload(); } location.reload(); }
function clearDraft() { function clearDraft() {
location = "client:submitform?name=sendform&submitname=clear&submitvalue=true"; location = "client:submitform?name=sendform&submitname=clear&submitvalue=true";
location.reload(); location.reload();
} }
</script> </script>
<title> <title>
@@ -802,5 +797,4 @@ ${(!mail_draft_attachments.message_voicemail_data) ? '' : '<input type=hidden na
`; `;
} }
} }
}
} }

View File

@@ -1,28 +0,0 @@
var minisrv_service_file = true;
if (minisrv_config.config.allow_guests) {
headers = `300 Moved
Connection: Close
wtv-noback-all: wtv-register:
wtv-expire-all: wtv-`;
if (socket.ssid) {
if (session_data) {
if (session_data.data_store) {
if (session_data.data_store.wtvsec_login) {
headers += "\nwtv-ticket: " + session_data.data_store.wtvsec_login.ticket_b64;
}
}
}
}
headers += `
wtv-service: reset
${getServiceString('wtv-1800')}
wtv-relogin-url: wtv-1800:/preregister?guest_login=true&skip_splash=true
wtv-reconnect-url: wtv-1800:/preregister?guest_login=true&reconnect=true
wtv-boot-url: wtv-1800:/preregister?guest_login=true
Location: client:relogin`;
} else {
var errpage = wtvshared.doErrorPage(400, "Guest mode is not enabled on this service.");
headers = errpage[0];
data = errpage[1];
}

View File

@@ -10,7 +10,6 @@ var nickname = (minisrv_config.config.service_name + '_' + namerand)
var human_name = nickname; var human_name = nickname;
var isOldBuild = wtvshared.isOldBuild(session_data); var isOldBuild = wtvshared.isOldBuild(session_data);
var form_data = `<input type=button action="ValidateAgreement?registering=true&subscriber_name=${human_name}&subscriber_username=${nickname}" text="#dddddd" Value="Quick Reg" name="speedyreg" borderimage="file://ROM/Borders/ButtonBorder2.bif" width=130>`; var form_data = `<input type=button action="ValidateAgreement?registering=true&subscriber_name=${human_name}&subscriber_username=${nickname}" text="#dddddd" Value="Quick Reg" name="speedyreg" borderimage="file://ROM/Borders/ButtonBorder2.bif" width=130>`;
if (minisrv_config.config.allow_guests) form_data += `<input type=button text="#dddddd" action="BeMyGuest" Value="Sign in as Guest" name="noreg" borderimage="file://ROM/Borders/ButtonBorder2.bif" width=170 >`;
var main_data = `<form action="ValidateAgreement" var main_data = `<form action="ValidateAgreement"
ENCTYPE="x-www-form-encoded" METHOD="POST"> ENCTYPE="x-www-form-encoded" METHOD="POST">
<input type=hidden name=registering value="true"> <input type=hidden name=registering value="true">

View File

@@ -55,7 +55,6 @@ class WTVAuthor {
} }
pagestoreExists() { pagestoreExists() {
if (!this.isguest) {
if (this.pagestore_dir === null) { if (this.pagestore_dir === null) {
// set pagestore directory local var so we don't call the function every time // set pagestore directory local var so we don't call the function every time
var userstore_dir = this.wtvclient.getUserStoreDirectory(); var userstore_dir = this.wtvclient.getUserStoreDirectory();
@@ -65,8 +64,6 @@ class WTVAuthor {
} }
return this.fs.existsSync(this.pagestore_dir); return this.fs.existsSync(this.pagestore_dir);
} }
return true;
}
createPagestore() { createPagestore() {
if (this.pagestoreExists() === false) { if (this.pagestoreExists() === false) {

View File

@@ -346,13 +346,11 @@ class WTVClientSessionData {
} }
scrapbookExists() { scrapbookExists() {
if (!this.isguest) {
if (this.scrapbook_dir === null) { if (this.scrapbook_dir === null) {
var userstore_dir = this.getUserStoreDirectory(); var userstore_dir = this.getUserStoreDirectory();
var store_dir = "Scrapbook" + this.path.sep; var store_dir = "Scrapbook" + this.path.sep;
this.scrapbook_dir = userstore_dir + store_dir; this.scrapbook_dir = userstore_dir + store_dir;
} }
}
return this.fs.existsSync(this.scrapbook_dir); return this.fs.existsSync(this.scrapbook_dir);
} }

View File

@@ -39,7 +39,6 @@ class WTVFavorites {
} }
favstoreExists() { favstoreExists() {
if (!this.isguest) {
if (this.favstore_dir === null) { if (this.favstore_dir === null) {
// set favstore directory local var so we don't call the function every time // set favstore directory local var so we don't call the function every time
const userstore_dir = this.wtvclient.getUserStoreDirectory(); const userstore_dir = this.wtvclient.getUserStoreDirectory();
@@ -50,8 +49,6 @@ class WTVFavorites {
} }
return this.fs.existsSync(this.favstore_dir); return this.fs.existsSync(this.favstore_dir);
} }
return null;
}
folderExists(foldername) { folderExists(foldername) {
let folder_dir, store_dir = null; let folder_dir, store_dir = null;

View File

@@ -56,7 +56,6 @@ class WTVMail {
mailstoreExists() { mailstoreExists() {
if (!this.isguest) {
if (this.mailstore_dir === null) { if (this.mailstore_dir === null) {
// set mailstore directory local var so we don't call the function every time // set mailstore directory local var so we don't call the function every time
const userstore_dir = this.wtvclient.getUserStoreDirectory(); const userstore_dir = this.wtvclient.getUserStoreDirectory();
@@ -66,8 +65,6 @@ class WTVMail {
} }
return this.fs.existsSync(this.mailstore_dir); return this.fs.existsSync(this.mailstore_dir);
} }
return null;
}
getSignatureColors(signature = null, sendmail = true) { getSignatureColors(signature = null, sendmail = true) {
const colors = Object.assign({}, this.defaultColors); // start with default colors const colors = Object.assign({}, this.defaultColors); // start with default colors

View File

@@ -47,7 +47,6 @@
"show_diskmap": false, // Useful for debugging custom Diskmaps "show_diskmap": false, // Useful for debugging custom Diskmaps
"unauthorized_url": "wtv-1800:/unauthorized?", // Where to send unauthorized users "unauthorized_url": "wtv-1800:/unauthorized?", // Where to send unauthorized users
"enable_port_isolation": true, // Only respond to services on their correct ports "enable_port_isolation": true, // Only respond to services on their correct ports
"allow_guests": true, // Allow users to experience the server without registering
"domain_name": "wtv.zefie.com", // For usenet and future stuff, no need to change just yet, "domain_name": "wtv.zefie.com", // For usenet and future stuff, no need to change just yet,
"max_post_length": 20, // in megabytes "max_post_length": 20, // in megabytes
"require_valid_ssid": false, // require a valid SSID (with valid CRC) "require_valid_ssid": false, // require a valid SSID (with valid CRC)

View File

@@ -9,7 +9,8 @@
"start": "node app.js", "start": "node app.js",
"irc": "node irconly.js", "irc": "node irconly.js",
"test": "node test.js", "test": "node test.js",
"debug": "cross-env DEBUG=* node app.js" "debug": "cross-env DEBUG=* node app.js",
"modem-proxy": "node modem_proxy.js"
}, },
"author": { "author": {
"name": "zefie", "name": "zefie",