Merge branch 'dev'
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
if (socket.ssid) {
|
||||
if (ssid_sessions[socket.ssid].loadSessionData() == true) {
|
||||
console.log(" * Loaded session data from disk for", filterSSID(socket.ssid))
|
||||
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);
|
||||
} else {
|
||||
ssid_sessions[socket.ssid].session_data = {};
|
||||
@@ -20,11 +20,11 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
if (i > 0 && zdebug) console.log(" # Closed", i, "previous sockets for", filterSSID(socket.ssid));
|
||||
if (i > 0 && zdebug) console.log(" # Closed", i, "previous sockets for", wtvshared.filterSSID(socket.ssid));
|
||||
}
|
||||
}
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
if (zdebug) console.log(" # Recreating primary WTVSec login instance for", filterSSID(socket.ssid));
|
||||
if (zdebug) console.log(" # Recreating primary WTVSec login instance for", wtvshared.filterSSID(socket.ssid));
|
||||
delete ssid_sessions[socket.ssid].data_store.wtvsec_login;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
// todo: async
|
||||
const WTVDownloadList = require("./WTVDownloadList.js");
|
||||
var wtvdl = new WTVDownloadList(minisrv_config, service_name);
|
||||
|
||||
var force_update = (request_headers.query.force == "true") ? true : false;
|
||||
if (request_headers['wtv-request-type'] == 'download') {
|
||||
const WTVDownloadList = require("./WTVDownloadList.js");
|
||||
var wtvdl = new WTVDownloadList();
|
||||
|
||||
var content_dir = "content/"
|
||||
var diskmap_dir = content_dir + "diskmaps/";
|
||||
|
||||
@@ -272,58 +270,6 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
} else if (request_headers.query.group && request_headers.query.diskmap) {
|
||||
var message = request_headers.query.message || "Retrieving files...";
|
||||
var main_message = request_headers.query.main_message || "Your receiver is downloading files.";
|
||||
headers = `200 OK
|
||||
Content-Type: text/html`;
|
||||
|
||||
data = `
|
||||
<html>
|
||||
<head>
|
||||
<meta
|
||||
http-equiv=refresh
|
||||
content="0;url=client:Fetch?group=${escape(request_headers.query.group)}&source=${service_name}:/sync%3Fdiskmap%3D${escape(escape(request_headers.query.diskmap))}%26force%3D${force_update}&message=${escape(message)}"
|
||||
>
|
||||
<display downloadsuccess="client:ShowAlert?message=Download%20successful%21&buttonlabel1=Okay&buttonaction1=client:goback&image=${minisrv_config.config.service_logo}&noback=true" downloadfail="client:ShowAlert?message=Download%20failed...&buttonlabel1=Okay...&buttonaction1=client:goback&image=${minisrv_config.config.service_logo}&noback=true">
|
||||
<title>Retrieving files...</title>
|
||||
</head>
|
||||
<body bgcolor=#0 text=#42CC55 fontsize=large hspace=0 vspace=0>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<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>
|
||||
<spacer>
|
||||
<td colspan=2 width=436 valign=middle align=left bgcolor=3B3A4D>
|
||||
<font color=D6DFD0 size=+2><blackface><shadow>
|
||||
<spacer type=block width=1 height=4>
|
||||
<br>
|
||||
${message}
|
||||
</shadow>
|
||||
</blackface>
|
||||
</font>
|
||||
<tr>
|
||||
<td width=104 height=20>
|
||||
<td width=20>
|
||||
<td width=416>
|
||||
<td width=20>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<td>
|
||||
<font size=+1>
|
||||
${main_message}
|
||||
<p>This may take a while.
|
||||
</font>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<td>
|
||||
<br><br>
|
||||
<font color=white>
|
||||
<progressindicator name="downloadprogress"
|
||||
message="Preparing..."
|
||||
height=40 width=250>
|
||||
</font>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
headers = "200 OK\nContent-Type: text/html";
|
||||
data = wtvdl.getSyncPage(message, request_headers.query.group, request_headers.query.diskmap, main_message, message, force_update)
|
||||
}
|
||||
57
zefie_wtvp_minisrv/ServiceVault/wtv-disk/uptest.js
Normal file
57
zefie_wtvp_minisrv/ServiceVault/wtv-disk/uptest.js
Normal file
@@ -0,0 +1,57 @@
|
||||
const WTVDownloadList = require("./WTVDownloadList.js");
|
||||
var wtvdl = new WTVDownloadList(minisrv_config);
|
||||
if (request_headers['wtv-request-type'] == 'download') {
|
||||
console.log(request_headers.post_data.toString(CryptoJS.enc.Latin1));
|
||||
wtvdl.reset();
|
||||
var froot = "file://disk/Demo/";
|
||||
var fget = [
|
||||
"attract.mpg",
|
||||
"can-you-hear.mpg",
|
||||
"explore.mpg",
|
||||
"hear.html",
|
||||
"index.html",
|
||||
"menu1.html",
|
||||
"menu2.html",
|
||||
"menu3.html",
|
||||
"menu4.html",
|
||||
"service.html",
|
||||
"splash-mits.mpg",
|
||||
"splash-phil.mpg",
|
||||
"splash-sony.mpg",
|
||||
"splash1.html",
|
||||
"splash2.html",
|
||||
"splash3.html",
|
||||
"what-is-it.html",
|
||||
"what-is-it.mpg",
|
||||
"what-others.html",
|
||||
"what-others.mpg",
|
||||
"whats-in-it.html",
|
||||
"whats-in-it.mpg",
|
||||
"whats-in-it.mpg.old"
|
||||
];
|
||||
|
||||
Object.keys(fget).forEach(function (k) {
|
||||
wtvdl.putUserStore(froot + fget[k]);
|
||||
});
|
||||
headers = "200 OK\nContent-type: " + wtvdl.content_type;
|
||||
data = wtvdl.getDownloadList();
|
||||
console.log(data);
|
||||
} else {
|
||||
headers = "200 OK\nContent-type: text/html";
|
||||
var success_url = new clientShowAlert({
|
||||
'image': minisrv_config.config.service_logo,
|
||||
'message': "Upload successful!",
|
||||
'buttonlabel1': "Okay",
|
||||
'buttonaction1': "client:goback",
|
||||
'noback': true,
|
||||
}).getURL();
|
||||
|
||||
var fail_url = new clientShowAlert({
|
||||
'image': minisrv_config.config.service_logo,
|
||||
'message': "Upload failed...",
|
||||
'buttonlabel1': "Okay...",
|
||||
'buttonaction1': "client:goback",
|
||||
'noback': true,
|
||||
}).getURL();
|
||||
data = wtvdl.getSyncPage("Testing", "UploadTest", null, "Your receiver is uploading files.", "Sending files", null, success_url, fail_url, "wtv-disk:/uptest");
|
||||
}
|
||||
23
zefie_wtvp_minisrv/ServiceVault/wtv-disk/userbrowser.js
Normal file
23
zefie_wtvp_minisrv/ServiceVault/wtv-disk/userbrowser.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// todo some fancy ass file manager or something
|
||||
|
||||
|
||||
if (socket.ssid) {
|
||||
if (ssid_sessions[socket.ssid]) {
|
||||
if (ssid_sessions[socket.ssid].isRegistered()) {
|
||||
data = ssid_sessions[socket.ssid].getUserStoreFileByURL("file://Disk/Demo/allyouneed.html");
|
||||
//data = ssid_sessions[socket.ssid].getUserStoreFile("Disk/Demo/allyouneed.html");
|
||||
var contype = ssid_sessions[socket.ssid].getUserStoreContentType("file://Disk/Demo/allyouneed.html");
|
||||
|
||||
if (data) {
|
||||
headers = "200 OK\n";
|
||||
headers += "Content-Type: " + contype;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!headers) {
|
||||
var errpage = doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
21
zefie_wtvp_minisrv/ServiceVault/wtv-disk/userstore.js
Normal file
21
zefie_wtvp_minisrv/ServiceVault/wtv-disk/userstore.js
Normal file
@@ -0,0 +1,21 @@
|
||||
if (request_headers.post_data) {
|
||||
if (request_headers.query.partialPath) {
|
||||
if (socket.ssid) {
|
||||
if (ssid_sessions[socket.ssid]) {
|
||||
if (ssid_sessions[socket.ssid].isRegistered()) {
|
||||
var result = ssid_sessions[socket.ssid].storeUserStoreFile(request_headers.query.partialPath, new Buffer.from(request_headers.post_data.toString(CryptoJS.enc.Hex), 'hex'), request_headers.query['last-modified-seconds'] || null, (request_headers.query.no_overwrite) ? false : true);
|
||||
if (result) {
|
||||
headers = "200 OK\n";
|
||||
headers += "Content-Type: text/plain";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!headers) {
|
||||
var errpage = doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -16,11 +16,11 @@ if (socket.ssid !== null) {
|
||||
var client_challenge_response = request_headers["wtv-challenge-response"] || null;
|
||||
if (challenge_response && client_challenge_response) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64) == client_challenge_response) {
|
||||
console.log(" * wtv-challenge-response success for " + filterSSID(socket.ssid));
|
||||
console.log(" * wtv-challenge-response success for " + wtvshared.filterSSID(socket.ssid));
|
||||
wtvsec_login.PrepareTicket();
|
||||
|
||||
} else {
|
||||
console.log(" * wtv-challenge-response FAILED for " + filterSSID(socket.ssid));
|
||||
console.log(" * wtv-challenge-response FAILED for " + wtvshared.filterSSID(socket.ssid));
|
||||
if (zdebug) console.log("Response Expected:", challenge_response.toString(CryptoJS.enc.Base64));
|
||||
if (zdebug) console.log("Response Received:", client_challenge_response)
|
||||
gourl = "wtv-head-waiter:/login?reissue_challenge=true";
|
||||
|
||||
@@ -5,14 +5,9 @@ wtv-expire-all: wtv-flashrom:
|
||||
Content-type: text/html`
|
||||
|
||||
if (request_headers.query.url) headers += "\nwtv-visit: " + request_headers.query.url;
|
||||
var cryptstatus = ((socket_sessions[socket.id].secure === true) ? "Encrypted" : "Not Encrypted")
|
||||
|
||||
if (ssid_sessions[socket.ssid].get('box-does-psuedo-encryption')) {
|
||||
var cryptstatus = "<a href='client:showalert?message=Your%20WebTV%20Unit%20sent%20us%20a%20request%20for%20SECURE%20ON%2C%20but%20did%20not%20encrypt%20any%20data%2C%20nor%20will%20accept%20it.%20However%2C%20we%20send%20the%20wtv-encryption%20flag%20to%20roll%20with%20it%2C%20enabling%20%27psuedo-encryption%27.%20Nothing%20is%20encrypted%2C%20but%20the%20box%20trusts%20us.%20This%20will%20probably%20go%20away%20if%20you%20reload%20or%20change%20pages.&buttonaction1=client:donothing&buttonlabel1=Oh%2C%20okay...'>Psuedo-encrypted</a>";
|
||||
} else {
|
||||
var cryptstatus = ((socket_sessions[socket.id].secure === true) ? "Encrypted" : "Not Encrypted")
|
||||
}
|
||||
|
||||
var comp_type = shouldWeCompress(socket.ssid,'text/html');
|
||||
var comp_type = wtvmime.shouldWeCompress(ssid_sessions[socket.ssid],'text/html');
|
||||
var compstatus = "uncompressed";
|
||||
switch (comp_type) {
|
||||
case 1:
|
||||
|
||||
@@ -22,7 +22,7 @@ Content-length: 0`;
|
||||
logdata_outstring_hex += request_headers.post_data.toString(CryptoJS.enc.Hex);
|
||||
if (minisrv_config.services[service_name].write_logs_to_disk) {
|
||||
fs.writeFile(fullpath, logdata_outstring_hex, "Hex", function () {
|
||||
if (!zquiet) console.log(" * Wrote POST log data from", filterSSID(socket.ssid), "for", socket.id);
|
||||
if (!zquiet) console.log(" * Wrote POST log data from", wtvshared.filterSSID(socket.ssid), "for", socket.id);
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
} else {
|
||||
@@ -41,7 +41,7 @@ Content-length: 0`;
|
||||
var logdata_outstring_hex = Buffer.from(logdata_outstring, 'utf8').toString('hex');
|
||||
if (minisrv_config.services[service_name].write_logs_to_disk) {
|
||||
fs.writeFile(fullpath, logdata_outstring_hex, "Hex", function () {
|
||||
if (!zquiet) console.log(" * Wrote GET log data from", filterSSID(socket.ssid), "for", socket.id);
|
||||
if (!zquiet) console.log(" * Wrote GET log data from", wtvshared.filterSSID(socket.ssid), "for", socket.id);
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -18,7 +18,7 @@ Content-Type: text/html`
|
||||
|
||||
var wtv_system_version = ssid_sessions[socket.ssid].get("wtv-system-version");
|
||||
var wtv_client_bootrom_version = ssid_sessions[socket.ssid].get("wtv-client-bootrom-version");
|
||||
var wtv_client_serial_number = filterSSID(ssid_sessions[socket.ssid].get("wtv-client-serial-number"));
|
||||
var wtv_client_serial_number = wtvshared.filterSSID(ssid_sessions[socket.ssid].get("wtv-client-serial-number"));
|
||||
var wtv_client_rom_type = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
var wtv_system_chipversion_str = ssid_sessions[socket.ssid].get("wtv-system-chipversion");
|
||||
var wtv_system_sysconfig_hex = parseInt(ssid_sessions[socket.ssid].get("wtv-system-sysconfig")).toString(16);
|
||||
|
||||
Reference in New Issue
Block a user