v0.9.33
- 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
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (socket.ssid != null && !ssid_sessions[socket.ssid].get("wtvsec_login")) {
|
||||
var wtvsec_login = new WTVSec(minisrv_config);
|
||||
if (socket.ssid != null && !session_data.get("wtvsec_login")) {
|
||||
var wtvsec_login = session_data.createWTVSecSession();
|
||||
wtvsec_login.IssueChallenge();
|
||||
if (request_headers["wtv-incarnation"]) wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
||||
ssid_sessions[socket.ssid].set("wtvsec_login", wtvsec_login);
|
||||
session_data.set("wtvsec_login", wtvsec_login);
|
||||
} else if (socket.ssid != null) {
|
||||
var wtvsec_login = ssid_sessions[socket.ssid].get("wtvsec_login");
|
||||
var wtvsec_login = session_data.get("wtvsec_login");
|
||||
}
|
||||
|
||||
if (wtvsec_login) {
|
||||
@@ -15,19 +15,21 @@ if (wtvsec_login) {
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
minisrv-use-carriage-return: false
|
||||
minisrv-no-mail-count: true
|
||||
wtv-initial-key: ` + wtvsec_login.challenge_key.toString(CryptoJS.enc.Base64) + `
|
||||
Content-Type: text/tellyscript
|
||||
wtv-service: reset
|
||||
` + getServiceString('wtv-head-waiter') + `
|
||||
` + getServiceString('wtv-star', { "no_star_word": true }) + `
|
||||
` + getServiceString('wtv-flashrom') + `
|
||||
${getServiceString('wtv-1800')}
|
||||
${getServiceString('wtv-head-waiter')}
|
||||
${getServiceString('wtv-star', { "no_star_word": true })}
|
||||
${getServiceString('wtv-flashrom')}
|
||||
wtv-boot-url: wtv-head-waiter:/login?
|
||||
wtv-visit: wtv-head-waiter:/login?
|
||||
wtv-client-time-zone: GMT -0000
|
||||
wtv-client-time-dst-rule: GMT
|
||||
wtv-client-date: `+ strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCString())) + ` GMT`;
|
||||
|
||||
var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
|
||||
var file_path = ServiceDeps + "/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
|
||||
|
||||
if (file_path) {
|
||||
request_is_async = true;
|
||||
|
||||
@@ -10,6 +10,7 @@ if (request_headers["wtv-ticket"]) {
|
||||
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
minisrv-no-mail-count: true
|
||||
wtv-expire-all: wtv-
|
||||
wtv-open-isp-disabled: false
|
||||
wtv-visit: `+ gourl + `
|
||||
|
||||
@@ -3,21 +3,21 @@ var minisrv_service_file = true;
|
||||
var gourl = "wtv-head-waiter:/login?";
|
||||
|
||||
if (socket.ssid) {
|
||||
if (ssid_sessions[socket.ssid].loadSessionData() == true) {
|
||||
if (session_data.loadSessionData() == true) {
|
||||
console.log(" * Loaded session data from disk for", wtvshared.filterSSID(socket.ssid))
|
||||
ssid_sessions[socket.ssid].setSessionData("registered", (ssid_sessions[socket.ssid].getSessionData("registered") == true) ? true : false);
|
||||
session_data.setSessionData("registered", (session_data.getSessionData("registered") == true) ? true : false);
|
||||
} else {
|
||||
ssid_sessions[socket.ssid].session_data = {};
|
||||
ssid_sessions[socket.ssid].setSessionData("registered", false);
|
||||
session_data.session_data = {};
|
||||
session_data.setSessionData("registered", false);
|
||||
}
|
||||
if (ssid_sessions[socket.ssid].data_store) {
|
||||
if (ssid_sessions[socket.ssid].data_store.sockets) {
|
||||
if (session_data.data_store) {
|
||||
if (session_data.data_store.sockets) {
|
||||
var i = 0;
|
||||
ssid_sessions[socket.ssid].data_store.sockets.forEach(function (k) {
|
||||
session_data.data_store.sockets.forEach(function (k) {
|
||||
if (typeof k != "undefined") {
|
||||
if (k != socket) {
|
||||
k.destroy();
|
||||
ssid_sessions[socket.ssid].data_store.sockets.delete(k);
|
||||
session_data.data_store.sockets.delete(k);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -25,14 +25,14 @@ if (socket.ssid) {
|
||||
if (i > 0 && minisrv_config.config.debug_flags.debug) console.log(" # Closed", i, "previous sockets for", wtvshared.filterSSID(socket.ssid));
|
||||
}
|
||||
}
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
if (session_data.data_store.wtvsec_login) {
|
||||
if (minisrv_config.config.debug_flags.debug) console.log(" # Recreating primary WTVSec login instance for", wtvshared.filterSSID(socket.ssid));
|
||||
delete ssid_sessions[socket.ssid].data_store.wtvsec_login;
|
||||
delete session_data.data_store.wtvsec_login;
|
||||
}
|
||||
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login = new WTVSec(minisrv_config);
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.IssueChallenge();
|
||||
if (request_headers["wtv-incarnation"]) ssid_sessions[socket.ssid].data_store.wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
||||
session_data.data_store.wtvsec_login = session_data.createWTVSecSession();
|
||||
session_data.data_store.wtvsec_login.IssueChallenge();
|
||||
if (request_headers["wtv-incarnation"]) session_data.data_store.wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
||||
} else {
|
||||
console.log(" * Something bad happened (we don't know the client ssid???)");
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
@@ -40,33 +40,33 @@ if (socket.ssid) {
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
if (request_headers.query.relogin && ssid_sessions[socket.ssid].getSessionData("registered")) gourl += "relogin=true";
|
||||
if (request_headers.query.reconnect && ssid_sessions[socket.ssid].getSessionData("registered")) gourl += "reconnect=true";
|
||||
if (request_headers.query.relogin && session_data.getSessionData("registered")) gourl += "relogin=true";
|
||||
if (request_headers.query.reconnect && session_data.getSessionData("registered")) gourl += "reconnect=true";
|
||||
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
if (session_data.data_store.wtvsec_login) {
|
||||
var prereg_contype = "text/html";
|
||||
|
||||
if (request_headers.query.relogin) { // relogin
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 = null; // clear old ticket
|
||||
session_data.data_store.wtvsec_login.ticket_b64 = null; // clear old ticket
|
||||
}
|
||||
|
||||
// if relogin and wtv-script-id != 0, skip tellyscript
|
||||
ssid_sessions[socket.ssid].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 bf0app_update = false;
|
||||
var romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
var romtype = session_data.get("wtv-client-rom-type");
|
||||
var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin);
|
||||
var wtv_script_id = parseInt(ssid_sessions[socket.ssid].get("wtv-script-id"));
|
||||
var bootrom = ssid_sessions[socket.ssid].get("wtv-client-bootrom-version");
|
||||
var wtv_script_id = parseInt(session_data.get("wtv-script-id"));
|
||||
var bootrom = session_data.get("wtv-client-bootrom-version");
|
||||
if ((request_headers.query.reconnect || request_headers.query.relogin) && wtv_script_id != 0) send_tellyscript = false;
|
||||
if (send_tellyscript) {
|
||||
if (minisrv_config.services[service_name].send_tellyscript_ssid_whitelist) {
|
||||
var send_telly_to_ssid = (minisrv_config.services[service_name].send_tellyscript_ssid_whitelist.findIndex(element => element == socket.ssid) != -1)
|
||||
if (send_telly_to_ssid) {
|
||||
romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
romtype = session_data.get("wtv-client-rom-type");
|
||||
}
|
||||
} else {
|
||||
romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
romtype = session_data.get("wtv-client-rom-type");
|
||||
}
|
||||
var file_path = null;
|
||||
switch (romtype) {
|
||||
@@ -77,22 +77,23 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
case "US-WEBSTAR-disk-0MB-16MB-softmodem-CPU5230":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access")) file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_OpenISP_56k.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_WTV_18006138199.tok";
|
||||
if (session_data.get("wtv-open-access")) file_path = __dirname + "/" +
|
||||
+ "/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok";
|
||||
else var file_path = ServiceDeps + "/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok";
|
||||
break;
|
||||
|
||||
case "US-DTV-disk-0MB-32MB-softmodem-CPU5230":
|
||||
if (wtvshared.isMiniBrowser(ssid_sessions[socket.ssid])) {
|
||||
if (wtvshared.isMiniBrowser(session_data)) {
|
||||
prereg_contype = "text/tellyscript";
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access")) file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_OpenISP_56k.tok";
|
||||
else file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_WTV_18006138199.tok";
|
||||
if (session_data.get("wtv-open-access")) file_path = ServiceDeps + "/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok";
|
||||
else file_path = ServiceDeps + "/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok";
|
||||
} else {
|
||||
prereg_contype = "text/dialscript";
|
||||
if (ssid_sessions[socket.ssid].get("wtv-lan") == "true") {
|
||||
file_path = __dirname + "/ServiceDeps/premade_tellyscripts/UTV/utv_hsd.tok";
|
||||
if (session_data.get("wtv-lan") == "true") {
|
||||
file_path = ServiceDeps + "/wtv-1800/tellyscripts/UTV/utv_hsd.tok";
|
||||
} else {
|
||||
// todo OpenISP telly
|
||||
file_path = __dirname + "/ServiceDeps/premade_tellyscripts/UTV/utv_normal.tok";
|
||||
file_path = ServiceDeps + "/wtv-1800/tellyscripts/UTV/utv_normal.tok";
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -100,8 +101,8 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
case "bf0app":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access")) file_path = __dirname + "/ServiceDeps/premade_tellyscripts/bf0app/bf0app_OISP.tok";
|
||||
else file_path = __dirname + "/ServiceDeps/premade_tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
|
||||
if (session_data.get("wtv-open-access")) file_path = ServiceDeps + "/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok";
|
||||
else file_path = ServiceDeps + "/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
|
||||
break;
|
||||
|
||||
// the following are not yet zefie generated and may have an unknown username/password attached
|
||||
@@ -109,8 +110,8 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
case "JP-Fiji":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access")) var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/FIJI/dc_production_normal.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/FIJI/dc_production_normal.tok";
|
||||
if (session_data.get("wtv-open-access")) var file_path = ServiceDeps + "/wtv-1800/tellyscripts/FIJI/dc_production_normal.tok";
|
||||
else var file_path = ServiceDeps + "/wtv-1800/tellyscripts/FIJI/dc_production_normal.tok";
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -120,7 +121,7 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
|
||||
if (socket.ssid.substr(0, 8) == "MSTVSIMU") {
|
||||
prereg_contype = "text/dialscript";
|
||||
var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/UTV/utv_hsd.tok";
|
||||
var file_path = ServiceDeps + "/wtv-1800/tellyscripts/UTV/utv_hsd.tok";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,9 +130,9 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
prereg_contype = "text/tellyscript";
|
||||
var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
|
||||
var file_path = ServiceDeps + "/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
|
||||
var bf0app_update = true;
|
||||
ssid_sessions[socket.ssid].set("bf0app_update", bf0app_update);
|
||||
session_data.set("bf0app_update", bf0app_update);
|
||||
}
|
||||
|
||||
if (request_headers["wtv-ticket"] && !request_headers.query.reconnect) {
|
||||
@@ -150,9 +151,10 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
|
||||
|
||||
headers = "200 OK\n"
|
||||
headers += "minisrv-no-mail-count: true\n";
|
||||
if (bf0app_update) headers += "minisrv-use-carriage-return: false\n";
|
||||
headers += "Connection: Keep-Alive\n";
|
||||
headers += "wtv-initial-key: " + ssid_sessions[socket.ssid].data_store.wtvsec_login.challenge_key.toString(CryptoJS.enc.Base64) + "\n";
|
||||
headers += "wtv-initial-key: " + session_data.data_store.wtvsec_login.challenge_key.toString(CryptoJS.enc.Base64) + "\n";
|
||||
headers += "Content-Type: " + prereg_contype + "\n";
|
||||
if (!request_headers.query.reconnect) headers += "wtv-service: reset\n";
|
||||
if (!bf0app_update) headers += getServiceString('wtv-1800') + "\n";
|
||||
@@ -162,8 +164,8 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
|
||||
if (bf0app_update) headers += getServiceString('wtv-star', { "no_star_word": true }) + "\n";
|
||||
else headers += getServiceString('wtv-star') + "\n";
|
||||
if (request_headers.query.reconnect && !ssid_sessions[socket.ssid].getSessionData("registered")) headers += getServiceString('wtv-register') + "\n";
|
||||
headers += getServiceString('wtv-flashrom') + "\n";
|
||||
if (request_headers.query.reconnect && !session_data.getSessionData("registered") && !session_data.lockdown) headers += getServiceString('wtv-register') + "\n";
|
||||
if (!session_data.lockdown) headers += getServiceString('wtv-flashrom') + "\n";
|
||||
if (bf0app_update) headers += "wtv-boot-url: " + gourl + "\n";
|
||||
else {
|
||||
headers += "wtv-boot-url: wtv-head-waiter:/relogin?relogin=true";
|
||||
@@ -171,7 +173,7 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
headers += "\n";
|
||||
}
|
||||
if (gourl != null) headers += "wtv-visit: " + gourl + "\n";
|
||||
if (!bf0app_update && ssid_sessions[socket.ssid].get("wtv-open-access")) headers += "wtv-open-isp-disabled: false\n";
|
||||
if (!bf0app_update && session_data.get("wtv-open-access")) headers += "wtv-open-isp-disabled: false\n";
|
||||
headers += "wtv-client-time-zone: GMT -0000\n";
|
||||
headers += "wtv-client-time-dst-rule: GMT\n"
|
||||
headers += "wtv-client-date: " + strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCString())) + " GMT";
|
||||
|
||||
98
zefie_wtvp_minisrv/ServiceVault/wtv-1800/unauthorized.js
Normal file
98
zefie_wtvp_minisrv/ServiceVault/wtv-1800/unauthorized.js
Normal file
@@ -0,0 +1,98 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
headers = `200 OK
|
||||
Content-type: text/html
|
||||
minisrv-no-mail-count: true`;
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<title>
|
||||
Access Denied
|
||||
</title>
|
||||
<display nostatus nooptions switchtowebmode nohome>
|
||||
</head>
|
||||
<body noscroll bgcolor="#191919" text="#42CC55" link="36d5ff"
|
||||
hspace=0 vspace=0 fontsize="large"
|
||||
>
|
||||
<table cellspacing=0 cellpadding=0^C>
|
||||
<tr>
|
||||
<td width=104 height=74 valign=middle align=center bgcolor="3B3A4D">
|
||||
<img src="${minisrv_config.config.service_logo}" width=86 height=64>
|
||||
<td width=20 valign=top align=left bgcolor="3B3A4D">
|
||||
<img src="ROMCache/Spacer.gif"
|
||||
width=1 height=1>
|
||||
<td colspan=10 width=436 valign=middle align=left bgcolor="3B3A4D">
|
||||
<font color="D6DFD0" size="+2">
|
||||
<blackface>
|
||||
<shadow>
|
||||
<img src="ROMCache/Spacer.gif"
|
||||
width=1 height=4>
|
||||
<br>
|
||||
Access Denied
|
||||
</shadow>
|
||||
</blackface>
|
||||
</font>
|
||||
<tr>
|
||||
<td colspan=12 width=560 height=10 valign=top align=left>
|
||||
<img src="ROMCache/Shadow.gif" width=560 height=6>
|
||||
<tr>
|
||||
<td width=104 height=10 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=68 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<form action="client:poweroff"
|
||||
>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=100 height=258 valign=top align=left>
|
||||
<font size=-1>You are not authorized to use this service. <p>Reason: ${session_data.lockdownReason}</font>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=middle align=center bgcolor="2B2B2B">
|
||||
<img src="ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=1 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=top align=left bgcolor="0D0D0D">
|
||||
<img src="ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=4 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=416 valign=top align=left>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=306 valign=top align=left>
|
||||
<font size="-1"><i>
|
||||
</i></font><td width=112 valign=top align=right>
|
||||
<font size="-1" color="#E7CE4A">
|
||||
<shadow>
|
||||
<input selected
|
||||
name="Power Off"
|
||||
value="Power Off"
|
||||
type=submit Value=Continue name="Continue" borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=110>
|
||||
</shadow>
|
||||
</font>
|
||||
</form>
|
||||
</table>
|
||||
<td width=20 valign=middle align=center>
|
||||
</table>
|
||||
</body>
|
||||
</html>`;
|
||||
Reference in New Issue
Block a user