v0.8.0
- FlashROM Support for LC2 and newer. - FlashROM system can handle local files, or proxy from server (default). No need to have a local FlashROM collection! - Added 'verbosity' configuration option - Update HTML Mode to async fileRead - Config option for sending tellyscripts or not - Config option to mask SSIDs in console log - Update wtv-home:/home and wtv-home:/zefie - Update .gitignore - Add wtv-music:/demo/index courtesy of MattMan69 - Update HTML Mode to async fileRead - Update Raw TXT Mode to async fileRead - Replaced .async.js feature with defining `request_is_async` in standard .js script - Cleaned up code a bit - Moved global var 'query' to 'request_headers.query' - Tidied ServiceDeps - Upgraded wtv-log:/log to async, now also logs query arguments, saves to .txt for easier reading.
This commit is contained in:
@@ -1,26 +1,40 @@
|
||||
if (socket_session_data[socket.id].ssid != null && !getSessionData(socket_session_data[socket.id].ssid, 'wtvsec_login')) {
|
||||
var wtvsec_login = new WTVSec();
|
||||
wtvsec_login.IssueChallenge();
|
||||
wtvsec_login.set_incarnation(request_headers['wtv-incarnation']);
|
||||
wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
||||
setSessionData(socket_session_data[socket.id].ssid, 'wtvsec_login', wtvsec_login)
|
||||
} else {
|
||||
var wtvsec_login = getSessionData(socket_session_data[socket.id].ssid, 'wtvsec_login')
|
||||
}
|
||||
|
||||
var contype = "text/tellyscript";
|
||||
|
||||
var skip_tellyscript = false;
|
||||
var prereg_contype = "text/html";
|
||||
|
||||
// if relogin, skip tellyscript
|
||||
if (query['relogin']) {
|
||||
contype = "text/html"; // skip tellyscript
|
||||
if (request_headers.query.relogin) { // skip tellyscript
|
||||
wtvsec_login.ticket_b64 = null; // clear old ticket
|
||||
}
|
||||
|
||||
// if relogin, skip tellyscript
|
||||
var romtype, file_path = null;
|
||||
if (!request_headers.query.relogin && services_configured.config.send_tellyscripts) {
|
||||
var romtype = getSessionData(socket_session_data[socket.id].ssid, 'wtv-client-rom-type');
|
||||
}
|
||||
|
||||
switch (romtype) {
|
||||
case "US-LC2-disk-0MB-8MB":
|
||||
prereg_contype = "text/tellyscript";
|
||||
var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_OISP_5555732_56k.tok";
|
||||
break;
|
||||
|
||||
default:
|
||||
data = '';
|
||||
break;
|
||||
}
|
||||
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
wtv-initial-key: ` + wtvsec_login.challenge_key.toString(CryptoJS.enc.Base64) + `
|
||||
Content-Type: `+ contype + `
|
||||
Content-Type: `+ prereg_contype + `
|
||||
wtv-service: reset
|
||||
` + getServiceString('wtv-1800') + `
|
||||
` + getServiceString('wtv-star') + `
|
||||
@@ -30,20 +44,16 @@ wtv-boot-url: wtv-1800:/preregister?relogin=true
|
||||
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`;
|
||||
wtv-client-date: `+ strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCString())) + ` GMT`;
|
||||
|
||||
// if relogin, skip tellyscript
|
||||
var romtype = null;
|
||||
if (!query['relogin'] && skip_tellyscript == false) {
|
||||
var romtype = getSessionData(socket_session_data[socket.id].ssid, 'wtv-client-rom-type');
|
||||
}
|
||||
|
||||
switch (romtype) {
|
||||
case "US-LC2-disk-0MB-8MB":
|
||||
data = getFile("LC2/LC2_OISP_5555732_56k.tok", true);
|
||||
break;
|
||||
|
||||
default:
|
||||
data = '';
|
||||
break;
|
||||
if (file_path) {
|
||||
request_is_async = true;
|
||||
fs.readFile(file_path, null, function (err, file_read_data) {
|
||||
if (err) {
|
||||
var errmsg = doErrorCode(400);
|
||||
headers = errmsg[0];
|
||||
file_read_data = errmsg[1] + "\n" + err.toString();
|
||||
}
|
||||
sendToClient(socket, headers, file_read_data);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user