implement config option to disable guest mode
This commit is contained in:
@@ -17,7 +17,11 @@ If an absolute path (`wtv-url:/`, `file://` url, or `http(s)://` url) is not pas
|
||||
```
|
||||
"post_debug": true
|
||||
```
|
||||
If you would like to see debug information about realtime bytes received from a client POST request, set `post_debug` to true.
|
||||
If you would like to see debug information about realtime bytes received from a client POST request, set `post_debug` to `true`.
|
||||
```
|
||||
"allow_guests": false
|
||||
```
|
||||
If you would like to require registration, disabling guest mode, you can set `allow_guests` to `false`. Default is `true`;
|
||||
```
|
||||
"post_percentages": [ 0, 25, 50, 100]
|
||||
```
|
||||
|
||||
@@ -18,7 +18,6 @@ if (socket.ssid !== null) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64) == client_challenge_response) {
|
||||
console.log(" * wtv-challenge-response success for " + filterSSID(socket.ssid));
|
||||
wtvsec_login.PrepareTicket();
|
||||
if (!ssid_sessions[socket.ssid].getSessionData("registered") && !request_headers.query.guest_login) gourl = "wtv-register:/splash";
|
||||
|
||||
} else {
|
||||
console.log(" * wtv-challenge-response FAILED for " + filterSSID(socket.ssid));
|
||||
@@ -32,12 +31,14 @@ if (socket.ssid !== null) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!ssid_sessions[socket.ssid].getSessionData("registered") && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) gourl = "wtv-register:/splash";
|
||||
|
||||
if (gourl) {
|
||||
headers = `200 OK
|
||||
Connection: Close
|
||||
wtv-open-isp-disabled: false
|
||||
`;
|
||||
if (!ssid_sessions[socket.ssid].getSessionData("registered") && !request_headers.query.guest_login) {
|
||||
if (!ssid_sessions[socket.ssid].getSessionData("registered") && (!request_headers.query.guest_login || !minisrv_config.config.allow_guests)) {
|
||||
headers += `wtv-encrypted: true
|
||||
wtv-ticket: ${wtvsec_login.ticket_b64}
|
||||
${getServiceString('wtv-register')}
|
||||
@@ -51,7 +52,7 @@ Content-type: text/html`;
|
||||
data = '';
|
||||
}
|
||||
else {
|
||||
if (request_headers.query.guest_login) {
|
||||
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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
if (request_headers.query.noreg) {
|
||||
if (request_headers.query.noreg && minisrv_config.config.allow_guests) {
|
||||
headers = `300 Moved
|
||||
Connection: Close
|
||||
wtv-noback-all: wtv-register:
|
||||
|
||||
@@ -59,11 +59,13 @@ The next screens will lead you through a quick setup process for using this serv
|
||||
var namerand = Math.floor(Math.random() * 100000);
|
||||
var nickname = (minisrv_config.config.service_name + '_' + namerand)
|
||||
var human_name = nickname;
|
||||
data += `
|
||||
data += `
|
||||
<shadow>
|
||||
<input type=button action="ValidateAgreement?registering=true&subscriber_name=${human_name}&subscriber_username=${nickname}" Value="Quick Reg" name="speedyreg" borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=130>
|
||||
<input type=button action="ValidateWelcome" Value="Sign in as Guest" name="noreg" borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=170>
|
||||
<input type=submit Value=Continue name="Continue" borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=110 selected>
|
||||
`;
|
||||
if (minisrv_config.config.allow_guests) data += `<input type=button action="ValidateWelcome" Value="Sign in as Guest" name="noreg" borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=170 >`;
|
||||
|
||||
data += `<input type=submit Value=Continue name="Continue" borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=110 selected>
|
||||
</shadow>
|
||||
</font>
|
||||
</form> <td abswidth=13 absheight=50 bgcolor=#171726>
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
"post_percentages": [ 0, 25, 50, 100 ],
|
||||
"verbosity": 2,
|
||||
"error_log_file": "errors.log",
|
||||
"enable_lzpf_compression": false
|
||||
"enable_lzpf_compression": false,
|
||||
"allow_guests": true
|
||||
},
|
||||
"services": {
|
||||
"wtv-head-waiter": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zefie_wtvp_minisrv",
|
||||
"version": "0.9.12",
|
||||
"version": "0.9.13-dev",
|
||||
"description": "WebTV Service (WTVP) Emulation Server",
|
||||
"main": "app.js",
|
||||
"homepage": "https://github.com/zefie/zefie_wtvp_minisrv",
|
||||
|
||||
Reference in New Issue
Block a user