v0.9.3
- fix: wtv-home:/home: remove `nostatus` to enable loading progress bar for outgoing links - fix: wtv-1800:/finish-prereg: swap error message location for better debugging - fix: app.js: Properly clean up old sockets - fix: wtv-flashrom: fix search for local flashrom files - update: wtv-home:/home: add link to access downloaded DealerDemo
This commit is contained in:
@@ -5,7 +5,8 @@ if (socket.ssid != null) {
|
|||||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
ssid_sessions[socket.ssid].data_store.wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var errpage = doErrorCode(400);
|
console.log(" * Something bad happened (we don't know the client ssid???)");
|
||||||
|
var errpage = doErrorCode(400)
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
@@ -63,8 +64,7 @@ wtv-client-date: `+ strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCS
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(" * Something bad happened (we don't know the client ssid???)");
|
var errpage = doErrorCode(400);
|
||||||
var errpage = doErrorCode(400)
|
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,13 @@ function doLocalFlashROM(flashrom_file_path) {
|
|||||||
if (request_headers.query.raw) {
|
if (request_headers.query.raw) {
|
||||||
if ((/\.brom$/).test(request_path)) headers += "Content-Type: binary/x-wtv-bootrom"; // maybe?
|
if ((/\.brom$/).test(request_path)) headers += "Content-Type: binary/x-wtv-bootrom"; // maybe?
|
||||||
else headers += "Content-Type: binary/x-wtv-flashblock";
|
else headers += "Content-Type: binary/x-wtv-flashblock";
|
||||||
var flashrom_file_path = service_dir + '/' + request_path;
|
var flashrom_file_path = null;
|
||||||
if (minisrv_config.services[service_name].use_zefie_server && !fs.existsSync(flashrom_file_path)) {
|
Object.keys(service_vaults).forEach(function (g) {
|
||||||
|
if (flashrom_file_path != null) return;
|
||||||
|
flashrom_file_path = service_vaults[g].path + "/" + service_name + "/" + request_path;
|
||||||
|
if (!fs.existsSync(flashrom_file_path)) flashrom_file_path = null;
|
||||||
|
});
|
||||||
|
if (minisrv_config.services[service_name].use_zefie_server && !flashrom_file_path) {
|
||||||
// get flashrom files from archive.midnightchannel.net
|
// get flashrom files from archive.midnightchannel.net
|
||||||
var options = {
|
var options = {
|
||||||
host: "archive.midnightchannel.net",
|
host: "archive.midnightchannel.net",
|
||||||
|
|||||||
@@ -26,8 +26,14 @@ if (!request_headers.query.path) {
|
|||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
} else {
|
} else {
|
||||||
var request_path = unescape(request_headers.query.path);
|
var request_path = unescape(request_headers.query.path);
|
||||||
var flashrom_file_path = service_dir + '/' + request_path;
|
var flashrom_file_path = null;
|
||||||
if (minisrv_config.services[service_name].use_zefie_server && !fs.existsSync(flashrom_file_path)) {
|
Object.keys(service_vaults).forEach(function (g) {
|
||||||
|
if (flashrom_file_path != null) return;
|
||||||
|
flashrom_file_path = service_vaults[g].path + "/" + service_name + "/" + request_path;
|
||||||
|
if (!fs.existsSync(flashrom_file_path)) flashrom_file_path = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (minisrv_config.services[service_name].use_zefie_server && !flashrom_file_path) {
|
||||||
// read first 256 bytes of flashrom file from archive.midnightchannel.net
|
// read first 256 bytes of flashrom file from archive.midnightchannel.net
|
||||||
// to get `flashrom_message` and `numparts` if missing
|
// to get `flashrom_message` and `numparts` if missing
|
||||||
var options = {
|
var options = {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ if (ssid_sessions[socket.ssid].get('box-does-psuedo-encryption')) {
|
|||||||
data =`<html>
|
data =`<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Home for minisrv</title>
|
<title>Home for minisrv</title>
|
||||||
<DISPLAY NoLogo NoStatus hideoptions noscroll>
|
<DISPLAY NoLogo hideoptions noscroll>
|
||||||
</head>
|
</head>
|
||||||
<body bgcolor="black" link="gold" vlink="gold" alink="gold" text="gold">
|
<body bgcolor="black" link="gold" vlink="gold" alink="gold" text="gold">
|
||||||
<script>
|
<script>
|
||||||
@@ -31,7 +31,7 @@ Connection Speed: &rate;
|
|||||||
<li><a href="wtv-tricks:/blastcache?return_to=wtv-home:/home">Clear Cache</a></li>
|
<li><a href="wtv-tricks:/blastcache?return_to=wtv-home:/home">Clear Cache</a></li>
|
||||||
<li><a href="wtv-flashrom:/willie">Ultra Willies</a></li>
|
<li><a href="wtv-flashrom:/willie">Ultra Willies</a></li>
|
||||||
<li><a href="wtv-music:/demo/index">MIDI Music Demo</a></li>
|
<li><a href="wtv-music:/demo/index">MIDI Music Demo</a></li>
|
||||||
<li><a href="wtv-update:/DealerDemo">Download old MSNTV DealerDemo</a></li>
|
<li>Old MSNTV DealerDemo: <a href="wtv-update:/DealerDemo">Download</a> ~ <a href="file://Disk/Demo/index.html">Access (after Download)</a></li>
|
||||||
<li><a href="http://duckduckgo.com/lite/">DuckDuckGo Lite</a></li>
|
<li><a href="http://duckduckgo.com/lite/">DuckDuckGo Lite</a></li>
|
||||||
<li><input name=url `;
|
<li><input name=url `;
|
||||||
|
|
||||||
|
|||||||
@@ -596,9 +596,9 @@ async function processRequest(socket, data_hex, returnHeadersBeforeSecure = fals
|
|||||||
socket.ssid = headers["wtv-client-serial-number"];
|
socket.ssid = headers["wtv-client-serial-number"];
|
||||||
if (!ssid_sessions[socket.ssid]) {
|
if (!ssid_sessions[socket.ssid]) {
|
||||||
ssid_sessions[socket.ssid] = new ClientSessionData();
|
ssid_sessions[socket.ssid] = new ClientSessionData();
|
||||||
ssid_sessions[socket.ssid].sockets = new Array();
|
|
||||||
ssid_sessions[socket.ssid].sockets.push(socket.id);
|
|
||||||
}
|
}
|
||||||
|
if (!ssid_sessions[socket.ssid].data_store.sockets) ssid_sessions[socket.ssid].data_store.sockets = new Array();
|
||||||
|
ssid_sessions[socket.ssid].data_store.sockets.push(socket.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -750,19 +750,20 @@ async function checkForPostData(socket, headers, data, data_hex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function cleanupSocket(socket) {
|
async function cleanupSocket(socket) {
|
||||||
try {
|
try {
|
||||||
if (!zquiet) console.log(" * Destroying old WTVSec instance on disconnected socket", socket.id);
|
if (socket_sessions[socket.id]) {
|
||||||
delete socket_sessions[socket.id].buffer;
|
if (!zquiet) console.log(" * Cleaning up disconnected socket", socket.id);
|
||||||
delete socket_sessions[socket.id].wtvsec;
|
delete socket_sessions[socket.id];
|
||||||
delete socket_sessions[socket.id];
|
}
|
||||||
if (socket.ssid) {
|
if (socket.ssid) {
|
||||||
if (ssid_sessions[socket.ssid].sockets.findIndex(element => element = socket.id) != -1) {
|
var socket_array_index = ssid_sessions[socket.ssid].data_store.sockets.findIndex(element => element = socket.id);
|
||||||
ssid_sessions[socket.ssid].sockets.splice(ssid_sessions[socket.ssid].sockets.findIndex(element => element = socket.id));
|
if (socket_array_index != -1) {
|
||||||
|
ssid_sessions[socket.ssid].data_store.sockets.splice(socket_array_index,1);
|
||||||
}
|
}
|
||||||
var fuckyou = ssid_sessions[socket.ssid].sockets;
|
|
||||||
if (ssid_sessions[socket.ssid].sockets.length === 0 && ssid_sessions[socket.ssid].get("wtvsec_login")) {
|
if (ssid_sessions[socket.ssid].data_store.sockets.length === 0 && ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||||
// if last socket for SSID disconnected, destroy login session
|
// if last socket for SSID disconnected, destroy login session
|
||||||
if (!zquiet) console.log(" * Last socket from WebTV SSID", filterSSID(socket.ssid),"disconnected, destroying initial WTVSec instance");
|
if (!zquiet) console.log(" * Last socket from WebTV SSID", filterSSID(socket.ssid),"disconnected, cleaning up primary WTVSec instance for this SSID");
|
||||||
ssid_sessions[socket.ssid].delete("wtvsec_login");
|
ssid_sessions[socket.ssid].delete("wtvsec_login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -776,7 +777,7 @@ async function cleanupSocket(socket) {
|
|||||||
async function handleSocket(socket) {
|
async function handleSocket(socket) {
|
||||||
// create unique socket id with client address and port
|
// create unique socket id with client address and port
|
||||||
socket.id = parseInt(crc16('CCITT-FALSE', Buffer.from(String(socket.remoteAddress) + String(socket.remotePort), "utf8")).toString(16), 16);
|
socket.id = parseInt(crc16('CCITT-FALSE', Buffer.from(String(socket.remoteAddress) + String(socket.remotePort), "utf8")).toString(16), 16);
|
||||||
socket_sessions[socket.id] = [];
|
socket_sessions[socket.id] = [];
|
||||||
socket.setEncoding('hex'); //set data encoding (Text: 'ascii', 'utf8' ~ Binary: 'hex', 'base64' (do not trust 'binary' encoding))
|
socket.setEncoding('hex'); //set data encoding (Text: 'ascii', 'utf8' ~ Binary: 'hex', 'base64' (do not trust 'binary' encoding))
|
||||||
|
|
||||||
// NOTE: As it stands we use a 'timeout' to start processing data when we have not recieved any data
|
// NOTE: As it stands we use a 'timeout' to start processing data when we have not recieved any data
|
||||||
@@ -814,6 +815,11 @@ async function handleSocket(socket) {
|
|||||||
// Attempt to clean up all of our WTVSec instances
|
// Attempt to clean up all of our WTVSec instances
|
||||||
cleanupSocket(socket);
|
cleanupSocket(socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('close', function () {
|
||||||
|
// Attempt to clean up all of our WTVSec instances
|
||||||
|
cleanupSocket(socket);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function integrateConfig(main, user) {
|
function integrateConfig(main, user) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "zefie_wtvp_minisrv",
|
"name": "zefie_wtvp_minisrv",
|
||||||
"version": "0.9.2",
|
"version": "0.9.3",
|
||||||
"description": "WebTV Service (WTVP) Emulation Server",
|
"description": "WebTV Service (WTVP) Emulation Server",
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"homepage": "https://github.com/zefie/zefie_wtvp_minisrv",
|
"homepage": "https://github.com/zefie/zefie_wtvp_minisrv",
|
||||||
|
|||||||
Reference in New Issue
Block a user