v0.9.4
- feature: add SSID whitelist/blacklist as well as IP based SSID auth - Add user_config_README.md - Update user_config.example.json - Update README.md - update: wtv-1800:/finish-prereg: send tellyscript on relogin if tellyscripts are enabled, and wtv-script-id == 0 (no tellyscript) - Allow definition of custom ServiceVault paths - feature: app.js: add `bind_ip` option to specify an IP to bind to, instead of `0.0.0.0` - feature: custom service logos and better wtv-home:/splash
This commit is contained in:
@@ -14,21 +14,29 @@ if (socket.ssid != null) {
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
var prereg_contype = "text/html";
|
||||
|
||||
// if relogin, skip tellyscript
|
||||
if (request_headers.query.relogin) { // skip tellyscript
|
||||
if (request_headers.query.relogin) { // relogin
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 = null; // clear old ticket
|
||||
}
|
||||
|
||||
// if relogin, skip tellyscript
|
||||
// if relogin and wtv-script-id != 0, skip tellyscript
|
||||
var romtype, file_path = null;
|
||||
if (!request_headers.query.relogin && minisrv_config.config.send_tellyscripts) {
|
||||
var romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
var send_tellyscript = true;
|
||||
var wtv_script_id = parseInt(ssid_sessions[socket.ssid].get("wtv-script-id"));
|
||||
if (request_headers.query.relogin && wtv_script_id != 0) send_tellyscript = false;
|
||||
if (send_tellyscript && minisrv_config.services[service_name].send_tellyscripts) {
|
||||
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");
|
||||
} else {
|
||||
romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
}
|
||||
}
|
||||
|
||||
switch (romtype) {
|
||||
case "US-LC2-disk-0MB-8MB":
|
||||
prereg_contype = "text/tellyscript";
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access")) var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_OISP_5555732_56k.tok";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access") == "true") var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_OISP_5555732_56k.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_WTV_18006138199_56k.tok";
|
||||
break;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ if (request_headers.query.raw) {
|
||||
var flashrom_file_path = null;
|
||||
Object.keys(service_vaults).forEach(function (g) {
|
||||
if (flashrom_file_path != null) return;
|
||||
flashrom_file_path = service_vaults[g].path + "/" + service_name + "/" + request_path;
|
||||
flashrom_file_path = service_vaults[g] + "/" + 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) {
|
||||
|
||||
@@ -29,7 +29,7 @@ if (!request_headers.query.path) {
|
||||
var flashrom_file_path = null;
|
||||
Object.keys(service_vaults).forEach(function (g) {
|
||||
if (flashrom_file_path != null) return;
|
||||
flashrom_file_path = service_vaults[g].path + "/" + service_name + "/" + request_path;
|
||||
flashrom_file_path = service_vaults[g] + "/" + service_name + "/" + request_path;
|
||||
if (!fs.existsSync(flashrom_file_path)) flashrom_file_path = null;
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ hspace=0 vspace=0 fontsize="large">
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=104 height=74 valign=middle align=center bgcolor="3B3A4D">
|
||||
<img src="wtv-flashrom:/ROMCache/HackTVLogoJewel.gif" width=87 height=67>
|
||||
<img src="`+ minisrv_config.config.service_logo +`" width=87 height=67>
|
||||
<td width=20 valign=top align=left bgcolor="3B3A4D">
|
||||
<img src="wtv-flashrom:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td colspan=10 width=436 valign=middle align=left bgcolor="3B3A4D">
|
||||
|
||||
@@ -23,7 +23,7 @@ hspace=0 vspace=0 fontsize="large">
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=104 height=74 valign=middle align=center bgcolor="3B3A4D">
|
||||
<img src="wtv-flashrom:/ROMCache/HackTVLogoJewel.gif" width=87 height=67>
|
||||
<img src="`+ minisrv_config.config.service_logo +`" width=87 height=67>
|
||||
<td width=20 valign=top align=left bgcolor="3B3A4D">
|
||||
<img src="wtv-flashrom:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td colspan=10 width=436 valign=middle align=left bgcolor="3B3A4D">
|
||||
|
||||
@@ -51,7 +51,7 @@ data = `<html>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=104 height=74 valign=middle align=center bgcolor="3B3A4D">
|
||||
<img src="wtv-flashrom:/ROMCache/HackTVLogoJewel.gif" width=87 height=67>
|
||||
<img src="`+ minisrv_config.config.service_logo +`" width=87 height=67>
|
||||
<td width=20 valign=top align=left bgcolor="3B3A4D">
|
||||
<img src="wtv-flashrom:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td colspan=10 width=436 valign=middle align=left bgcolor="3B3A4D">
|
||||
|
||||
@@ -50,9 +50,9 @@ Content-type: text/html`;
|
||||
}
|
||||
else {
|
||||
var namerand = Math.floor(Math.random() * 100000);
|
||||
var nickname = 'HackTVUsr_' + namerand;
|
||||
var nickname = minisrv_config.config.service_name+'_Usr_' + namerand;
|
||||
var userid = '1'+ Math.floor(Math.random() * 1000000000000000000);
|
||||
var offline_user_list = CryptoJS.enc.Latin1.parse("<user-list>\n\t<user userid=\"" + userid + " user-name=\"" + nickname + "\" first-name=\"HackTV\" last-name=\"User \"" + namerand + "\" password=\"\" mail-enabled=\"true\" />\n</user-list>").toString(CryptoJS.enc.Base64);
|
||||
var offline_user_list = CryptoJS.enc.Latin1.parse("<user-list>\n\t<user userid=\"" + userid + " user-name=\"" + nickname + "\" first-name=\"" + minisrv_config.config.service_name + "User \" last-name=\\" + namerand + "\" password=\"\" mail-enabled=\"true\" />\n</user-list>").toString(CryptoJS.enc.Base64);
|
||||
data = '';
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
|
||||
@@ -44,6 +44,6 @@ data += `width=250 height=10 bgcolor=#444444 text=#ffdd33 cursor=#cc9933 select
|
||||
</form></li>
|
||||
</ul>`
|
||||
|
||||
if (fs.existsSync(service_vaults[0].path + "/" + service_name + "/home.zefie.html")) {
|
||||
data += fs.readFileSync(service_vaults[0].path + "/" + service_name + "/home.zefie.html", { 'encoding': 'utf8' });
|
||||
if (fs.existsSync(service_vaults[0] + "/" + service_name + "/home.zefie.html")) {
|
||||
data += fs.readFileSync(service_vaults[0] + "/" + service_name + "/home.zefie.html", { 'encoding': 'utf8' });
|
||||
}
|
||||
36
zefie_wtvp_minisrv/ServiceVault/wtv-home/splash.js
Normal file
36
zefie_wtvp_minisrv/ServiceVault/wtv-home/splash.js
Normal file
@@ -0,0 +1,36 @@
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
wtv-expire-all: wtv-
|
||||
wtv-expire-all: http
|
||||
Content-type: text/html`
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<display hideoptions nostatus showwhencomplete skipback clearback fontsize=medium>
|
||||
<title>Engaging zefie...</title>
|
||||
<meta http-equiv=Refresh content="5; url=wtv-home:/home?">
|
||||
</head>
|
||||
<body bgcolor="#000000" text="#449944">
|
||||
<bgsound src="file://ROM/Sounds/Splash.mid">
|
||||
<center>
|
||||
<spacer type=block height=88 width=21>
|
||||
<img src="file://ROM/Images/spacer.gif" height=4><br>
|
||||
<img src="`+ minisrv_config.config.service_splash_logo + `">
|
||||
<br><br><br>
|
||||
<p><br>
|
||||
<p><br>
|
||||
<table border>
|
||||
<tr><td width=150>
|
||||
Mini service
|
||||
<tr><td>
|
||||
zefie minisrv v`+ minisrv_config.version;
|
||||
if (getGitRevision()) {
|
||||
data += ` (git ` + getGitRevision().substring(0,8) + `)`;
|
||||
}
|
||||
data += `
|
||||
<tr><td>&rate;
|
||||
</table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
@@ -1,26 +0,0 @@
|
||||
200 OK
|
||||
Connection: Keep-Alive
|
||||
wtv-expire-all: wtv-
|
||||
wtv-expire-all: http
|
||||
Content-type: text/html
|
||||
|
||||
<html>
|
||||
<title>Engaging zefie...</title>
|
||||
<head>
|
||||
<display nooptions showwhencomplete nostatus skipback clearback fontsize=medium>
|
||||
<meta
|
||||
http-equiv=refresh
|
||||
content="5; url=wtv-home:/home?"
|
||||
>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#000000" text="#449944">
|
||||
<bgsound src="file://ROM/Sounds/Splash.mid">
|
||||
<center>
|
||||
<img src="wtv-star:/images/HackTVLogo.gif">
|
||||
<br>
|
||||
<spacer type=block height=98 width=21>
|
||||
<br>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
BIN
zefie_wtvp_minisrv/ServiceVault/wtv-star/images/MSNLogo.gif
Normal file
BIN
zefie_wtvp_minisrv/ServiceVault/wtv-star/images/MSNLogo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
@@ -1,4 +1,7 @@
|
||||
<html>
|
||||
headers = `200 OK
|
||||
Content-Type: text/html`
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<meta
|
||||
http-equiv=refresh
|
||||
@@ -11,7 +14,7 @@
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=104 height=74 valign=middle align=center bgcolor=3B3A4D>
|
||||
<img src="wtv-star:/images/WebTVLogoJewel.gif" width=86 height=64>
|
||||
<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>
|
||||
@@ -45,4 +48,4 @@
|
||||
</font>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</html>`
|
||||
@@ -103,7 +103,7 @@ function processGroup(diskmap_primary_group, diskmap_group_data, diskmap_subgrou
|
||||
var post_match_file = null;
|
||||
Object.keys(service_vaults).forEach(function (g) {
|
||||
if (post_match_file != null) return;
|
||||
post_match_file = service_vaults[g].path + "/" + service_name + "/" + diskmap_group_data.files[k].location;
|
||||
post_match_file = service_vaults[g] + "/" + service_name + "/" + diskmap_group_data.files[k].location;
|
||||
if (!fs.existsSync(post_match_file)) post_match_file = null;
|
||||
});
|
||||
|
||||
@@ -136,7 +136,7 @@ if (request_headers.query.diskmap && request_headers.query.group && request_head
|
||||
var diskmap_json_file = null;
|
||||
Object.keys(service_vaults).forEach(function (g) {
|
||||
if (diskmap_json_file != null) return;
|
||||
diskmap_json_file = service_vaults[g].path + "/" + service_name + "/" + diskmap_dir + request_headers.query.diskmap + ".json";
|
||||
diskmap_json_file = service_vaults[g] + "/" + service_name + "/" + diskmap_dir + request_headers.query.diskmap + ".json";
|
||||
if (!fs.existsSync(diskmap_json_file)) diskmap_json_file = null;
|
||||
});
|
||||
|
||||
|
||||
@@ -89,14 +89,14 @@ async function processPath(socket, service_vault_file_path, request_headers = ne
|
||||
try {
|
||||
service_vaults.forEach(function (service_vault_dir) {
|
||||
if (service_vault_found) return;
|
||||
service_vault_file_path = service_vault_dir.path + "/" + service_path.replace(/\\/g, "/");
|
||||
service_vault_file_path = service_vault_dir + "/" + service_path.replace(/\\/g, "/");
|
||||
|
||||
|
||||
if (fs.existsSync(service_vault_file_path)) {
|
||||
// file exists, read it and return it
|
||||
service_vault_found = true;
|
||||
request_is_async = true;
|
||||
if (!zquiet) console.log(" * Found " + service_vault_file_path + " in " + service_vault_dir.name +" to handle request (Direct File Mode) [Socket " + socket.id + "]");
|
||||
if (!zquiet) console.log(" * Found " + service_vault_file_path + " to handle request (Direct File Mode) [Socket " + socket.id + "]");
|
||||
var contype = getConType(service_vault_file_path);
|
||||
headers = "200 OK\n"
|
||||
headers += "Content-Type: " + contype;
|
||||
@@ -106,7 +106,7 @@ async function processPath(socket, service_vault_file_path, request_headers = ne
|
||||
} else if (fs.existsSync(service_vault_file_path + ".txt")) {
|
||||
// raw text format, entire payload expected (headers and content)
|
||||
service_vault_found = true;
|
||||
if (!zquiet) console.log(" * Found " + service_vault_file_path + ".txt in " + service_vault_dir.name +" to handle request (Raw TXT Mode) [Socket " + socket.id + "]");
|
||||
if (!zquiet) console.log(" * Found " + service_vault_file_path + ".txt to handle request (Raw TXT Mode) [Socket " + socket.id + "]");
|
||||
request_is_async = true;
|
||||
fs.readFile(service_vault_file_path + ".txt", 'Utf-8', function (err, file_raw) {
|
||||
if (file_raw.indexOf("\n\n") > 0) {
|
||||
@@ -137,9 +137,9 @@ async function processPath(socket, service_vault_file_path, request_headers = ne
|
||||
// In Asynchronous mode, you are expected to call sendToClient(socket,headers,data) by the end of your script
|
||||
// `socket` is already defined and should be passed-through.
|
||||
service_vault_found = true;
|
||||
if (!zquiet) console.log(" * Found " + service_vault_file_path + ".js in " + service_vault_dir.name + " to handle request (JS Interpreter mode) [Socket " + socket.id + "]");
|
||||
if (!zquiet) console.log(" * Found " + service_vault_file_path + ".js to handle request (JS Interpreter mode) [Socket " + socket.id + "]");
|
||||
// expose var service_dir for script path to the root of the wtv-service
|
||||
var service_dir = service_vault_dir.path.replace(/\\/g, "/") + "/" + service_name;
|
||||
var service_dir = service_vault_dir.replace(/\\/g, "/") + "/" + service_name;
|
||||
socket_sessions[socket.id].starttime = Math.floor(new Date().getTime() / 1000);
|
||||
var jscript_eval = fs.readFileSync(service_vault_file_path + ".js").toString();
|
||||
eval(jscript_eval);
|
||||
@@ -148,7 +148,7 @@ async function processPath(socket, service_vault_file_path, request_headers = ne
|
||||
else if (fs.existsSync(service_vault_file_path + ".html")) {
|
||||
// Standard HTML with no headers, WTV Style
|
||||
service_vault_found = true;
|
||||
if (!zquiet) console.log(" * Found " + service_vault_file_path + ".html in " + service_vault_dir.name +" to handle request (HTML Mode) [Socket " + socket.id + "]");
|
||||
if (!zquiet) console.log(" * Found " + service_vault_file_path + ".html to handle request (HTML Mode) [Socket " + socket.id + "]");
|
||||
request_is_async = true;
|
||||
headers = "200 OK\n"
|
||||
headers += "Content-Type: text/html"
|
||||
@@ -186,7 +186,7 @@ async function processPath(socket, service_vault_file_path, request_headers = ne
|
||||
}
|
||||
|
||||
function filterSSID(obj) {
|
||||
if (minisrv_config.config.hide_ssid_in_logs) {
|
||||
if (minisrv_config.config.hide_ssid_in_logs === true) {
|
||||
if (typeof (obj) == "string") {
|
||||
if (obj.substr(0, 8) == "MSTVSIMU") {
|
||||
return obj.substr(0, 10) + ('*').repeat(10) + obj.substr(20);
|
||||
@@ -598,7 +598,86 @@ async function processRequest(socket, data_hex, returnHeadersBeforeSecure = fals
|
||||
ssid_sessions[socket.ssid] = new ClientSessionData();
|
||||
}
|
||||
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);
|
||||
ssid_sessions[socket.ssid].data_store.sockets.push(socket.id);
|
||||
}
|
||||
|
||||
var ip2long = function (ip) {
|
||||
var components;
|
||||
|
||||
if (components = ip.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)) {
|
||||
var iplong = 0;
|
||||
var power = 1;
|
||||
for (var i = 4; i >= 1; i -= 1) {
|
||||
iplong += power * parseInt(components[i]);
|
||||
power *= 256;
|
||||
}
|
||||
return iplong;
|
||||
}
|
||||
else return -1;
|
||||
};
|
||||
|
||||
var isInSubnet = function (ip, subnet) {
|
||||
var mask, base_ip, long_ip = ip2long(ip);
|
||||
if ((mask = subnet.match(/^(.*?)\/(\d{1,2})$/)) && ((base_ip = ip2long(mask[1])) >= 0)) {
|
||||
var freedom = Math.pow(2, 32 - parseInt(mask[2]));
|
||||
return (long_ip > base_ip) && (long_ip < base_ip + freedom - 1);
|
||||
}
|
||||
else return false;
|
||||
};
|
||||
|
||||
var rejectSSIDConnection = function (ssid, blacklist) {
|
||||
if (blacklist) console.log(" * Request from SSID", filterSSID(ssid), "(" + socket.remoteAddr + "), but that SSID is in the blacklist, rejecting.");
|
||||
else console.log(" * Request from SSID", filterSSID(socket.ssid), "(" + socket.remoteAddress + "), but that SSID is not in the whitelist, rejecting.");
|
||||
|
||||
var errpage = doErrorPage(401, "Access to this service is denied.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
socket_sessions[socket.id].close_me = true;
|
||||
}
|
||||
|
||||
var checkSSIDIPWhitelist = function (ssid, blacklist) {
|
||||
var ssid_access_list_ip_override = false;
|
||||
if (minisrv_config.config.ssid_ip_allow_list) {
|
||||
if (minisrv_config.config.ssid_ip_allow_list[socket.ssid]) {
|
||||
Object.keys(minisrv_config.config.ssid_ip_allow_list[socket.ssid]).forEach(function (k) {
|
||||
if (minisrv_config.config.ssid_ip_allow_list[socket.ssid][k].indexOf('/') > 0) {
|
||||
if (isInSubnet(socket.remoteAddress, minisrv_config.config.ssid_ip_allow_list[socket.ssid][k])) {
|
||||
// remoteAddr is in allowed subnet
|
||||
ssid_access_list_ip_override = true;
|
||||
}
|
||||
} else {
|
||||
if (socket.remoteAddress == minisrv_config.config.ssid_ip_allow_list[socket.ssid][k]) {
|
||||
// remoteAddr directly matches IP
|
||||
ssid_access_list_ip_override = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!ssid_access_list_ip_override) rejectSSIDConnection(socket.ssid, blacklist);
|
||||
} else {
|
||||
rejectSSIDConnection(socket.ssid, blacklist);
|
||||
}
|
||||
} else {
|
||||
rejectSSIDConnection(socket.ssid, blacklist);
|
||||
}
|
||||
if (ssid_access_list_ip_override && zdebug) console.log(" * Request from disallowed SSID", filterSSID(ssid), "was allowed due to IP address whitelist");
|
||||
}
|
||||
|
||||
// process whitelist first
|
||||
if (socket.ssid && minisrv_config.config.ssid_allow_list) {
|
||||
var ssid_is_in_whitelist = minisrv_config.config.ssid_allow_list.findIndex(element => element == socket.ssid);
|
||||
if (ssid_is_in_whitelist == -1) {
|
||||
// no whitelist match, but lets see if the remoteAddress is allowed
|
||||
checkSSIDIPWhitelist(socket.ssid, false);
|
||||
}
|
||||
}
|
||||
|
||||
// now check blacklist
|
||||
if (socket.ssid && minisrv_config.config.ssid_block_list) {
|
||||
var ssid_is_in_blacklist = minisrv_config.config.ssid_block_list.findIndex(element => element == socket.ssid);
|
||||
if (ssid_is_in_blacklist != -1) {
|
||||
// blacklist match, but lets see if the remoteAddress is allowed
|
||||
checkSSIDIPWhitelist(socket.ssid, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -756,7 +835,7 @@ async function cleanupSocket(socket) {
|
||||
delete socket_sessions[socket.id];
|
||||
}
|
||||
if (socket.ssid) {
|
||||
var socket_array_index = ssid_sessions[socket.ssid].data_store.sockets.findIndex(element => element = socket.id);
|
||||
var socket_array_index = ssid_sessions[socket.ssid].data_store.sockets.findIndex(element => element == socket.id);
|
||||
if (socket_array_index != -1) {
|
||||
ssid_sessions[socket.ssid].data_store.sockets.splice(socket_array_index,1);
|
||||
}
|
||||
@@ -849,6 +928,19 @@ function returnAbsolsutePath(path) {
|
||||
}
|
||||
|
||||
|
||||
function getGitRevision() {
|
||||
try {
|
||||
const rev = fs.readFileSync(__dirname.replace(/\\/g, "/") + '/../.git/HEAD').toString().trim();
|
||||
if (rev.indexOf(':') === -1) {
|
||||
return rev;
|
||||
} else {
|
||||
return fs.readFileSync(__dirname.replace(/\\/g, "/") + '/../.git/' + rev.substring(5)).toString().trim();
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// SERVER START
|
||||
|
||||
var z_title = "zefie's wtv minisrv v" + require('./package.json').version;
|
||||
@@ -886,11 +978,15 @@ if (throw_me) {
|
||||
throw ("An error has occured while reading the configuration files.");
|
||||
}
|
||||
|
||||
if (minisrv_config.config.UserServiceVault) service_vaults.push({ "path": returnAbsolsutePath(minisrv_config.config.UserServiceVault), "name": "User Service Vault" });
|
||||
service_vaults.push({ "path": returnAbsolsutePath(minisrv_config.config.ServiceVault), "name": "Service Vault" });
|
||||
Object.keys(service_vaults).forEach(function (k) {
|
||||
console.log(" * Using", service_vaults[k].name, "at", service_vaults[k].path);
|
||||
});
|
||||
if (minisrv_config.config.ServiceVaults) {
|
||||
Object.keys(minisrv_config.config.ServiceVaults).forEach(function (k) {
|
||||
var service_vault = returnAbsolsutePath(minisrv_config.config.ServiceVaults[k]);
|
||||
service_vaults.push(service_vault);
|
||||
console.log(" * Configured Service Vault at", service_vault, "with priority",(parseInt(k)+1));
|
||||
})
|
||||
} else {
|
||||
throw ("ERROR: No Service Vaults defined!");
|
||||
}
|
||||
|
||||
var service_ip = minisrv_config.config.service_ip;
|
||||
Object.keys(minisrv_config.services).forEach(function (k) {
|
||||
@@ -917,7 +1013,13 @@ Object.keys(minisrv_config.services).forEach(function (k) {
|
||||
}
|
||||
console.log(" * Configured Service", k, "on Port", minisrv_config.services[k].port, "- Host", minisrv_config.services[k].host, "- Bind Port:", !minisrv_config.services[k].nobind);
|
||||
})
|
||||
if (minisrv_config.config.hide_ssid_in_logs) console.log(" * Masking SSIDs in the console for security");
|
||||
if (minisrv_config.config.hide_ssid_in_logs) console.log(" * Masking SSIDs in console logs for security");
|
||||
else console.log(" * Full SSIDs will be shown in console logs");
|
||||
|
||||
if (minisrv_config.config.service_logo.indexOf(':') == -1) minisrv_config.config.service_logo = "wtv-star:/images/" + minisrv_config.config.service_logo;
|
||||
if (minisrv_config.config.service_splash_logo.indexOf(':') == -1) minisrv_config.config.service_splash_logo = "wtv-star:/images/" + minisrv_config.config.service_splash_logo;
|
||||
|
||||
minisrv_config.version = require('./package.json').version;
|
||||
|
||||
// defaults
|
||||
var zdebug = false;
|
||||
@@ -964,17 +1066,19 @@ ports.sort();
|
||||
|
||||
// de-duplicate ports in case user configured multiple services on same port
|
||||
const bind_ports = [...new Set(ports)]
|
||||
|
||||
if (!minisrv_config.config.bind_ip) minisrv_config.config.bind_ip = "0.0.0.0";
|
||||
bind_ports.forEach(function (v) {
|
||||
try {
|
||||
var server = net.createServer(handleSocket);
|
||||
server.listen(v, '0.0.0.0');
|
||||
server.listen(v, minisrv_config.config.bind_ip);
|
||||
initstring += v + ", ";
|
||||
} catch (e) {
|
||||
throw ("Could not bind to port", v, e.toString());
|
||||
throw ("Could not bind to port", v, "on", minisrv_config.config.bind_ip, e.toString());
|
||||
}
|
||||
});
|
||||
initstring = initstring.substring(0, initstring.length - 2);
|
||||
|
||||
console.log(" * Started server on ports " + initstring + "... Service IP is " + service_ip);
|
||||
console.log(" * Started server on ports " + initstring + "...")
|
||||
var listening_ip_string = (minisrv_config.config.bind_ip != "0.0.0.0") ? "IP: " + minisrv_config.config.bind_ip : "all interfaces";
|
||||
console.log(" * Listening on", listening_ip_string,"~","Service IP:", service_ip);
|
||||
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
{
|
||||
"config": {
|
||||
"service_ip": "0.0.0.0",
|
||||
"ServiceVault": "ServiceVault",
|
||||
"UserServiceVault": "UserServiceVault",
|
||||
"service_name": "HackTV",
|
||||
"send_tellyscripts": false,
|
||||
"ServiceVaults": [
|
||||
"UserServiceVault",
|
||||
"ServiceVault"
|
||||
],
|
||||
"service_name": "MSNTV",
|
||||
"service_logo": "MSNLogo.gif",
|
||||
"service_splash_logo": "splash_logo_msn.gif",
|
||||
"hide_ssid_in_logs": true,
|
||||
"socket_timeout": 350,
|
||||
"socket_timeout": 350,
|
||||
"verbosity": 2
|
||||
},
|
||||
"services": {
|
||||
"wtv-1800": {
|
||||
"host": null,
|
||||
"port": 1615,
|
||||
"connections": 1
|
||||
"connections": 1,
|
||||
"send_tellyscripts": false
|
||||
},
|
||||
"wtv-star": {
|
||||
"port": 1603,
|
||||
|
||||
2
zefie_wtvp_minisrv/package-lock.json
generated
2
zefie_wtvp_minisrv/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zefie_wtvp_minisrv",
|
||||
"version": "0.9.1",
|
||||
"version": "0.9.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zefie_wtvp_minisrv",
|
||||
"version": "0.9.3",
|
||||
"version": "0.9.4",
|
||||
"description": "WebTV Service (WTVP) Emulation Server",
|
||||
"main": "app.js",
|
||||
"homepage": "https://github.com/zefie/zefie_wtvp_minisrv",
|
||||
|
||||
@@ -1,12 +1,36 @@
|
||||
{
|
||||
"config": {
|
||||
"service_ip": "192.168.11.8",
|
||||
"service_name": "MyWebTV",
|
||||
"send_tellyscripts": true,
|
||||
"service_ip": "192.168.1.8",
|
||||
"service_name": "WebTV",
|
||||
"service_logo": "WebTVLogoJewel.gif",
|
||||
"service_splash_logo": "file://ROM/images/SplashLogo1.gif",
|
||||
"ServiceVaults": [
|
||||
"UserServiceVault",
|
||||
"ServiceVault",
|
||||
"C:\\users\\zefie\\webtv\\ServiceVault",
|
||||
"C:/Users/zefie/webtv/ServiceVault2",
|
||||
"/home/zefie/webtv/ServiceVault"
|
||||
],
|
||||
"ssid_block_list": [
|
||||
"8100000000000000",
|
||||
"8100000000000010"
|
||||
],
|
||||
"ssid_ip_allow_list": {
|
||||
"8100000000000000": [
|
||||
"192.168.1.0/24",
|
||||
"127.0.0.1"
|
||||
]
|
||||
},
|
||||
"hide_ssid_in_logs": true,
|
||||
"verbosity": 0
|
||||
"verbosity": 2
|
||||
},
|
||||
"services": {
|
||||
"wtv-1800": {
|
||||
"send_tellyscripts": true,
|
||||
"send_tellyscript_ssid_whitelist": [
|
||||
"8100000000000000"
|
||||
]
|
||||
},
|
||||
"wtv-log": {
|
||||
"write_logs_to_disk": true
|
||||
},
|
||||
@@ -15,7 +39,7 @@
|
||||
"connections": 1
|
||||
},
|
||||
"wtv-tricks": {
|
||||
"service_ip": "192.168.11.8",
|
||||
"service_ip": "192.168.1.8",
|
||||
"port": 1702,
|
||||
"nobind": true
|
||||
},
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
<Content Include="ServiceVault\wtv-update\sync.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="ServiceVault\wtv-update\DealerDemo.html" />
|
||||
<Content Include="ServiceVault\wtv-update\DealerDemo.js" />
|
||||
<Content Include="ServiceVault\wtv-home\home.js" />
|
||||
<Content Include="ServiceVault\wtv-update\updatesuccess.txt" />
|
||||
<Content Include="ServiceVault\wtv-1800\finish-prereg.js" />
|
||||
@@ -197,11 +197,12 @@
|
||||
<Content Include="ServiceVault\wtv-head-waiter\finalize-security.js" />
|
||||
<Content Include="ServiceVault\wtv-head-waiter\login-stage-two.js" />
|
||||
<Content Include="ServiceVault\wtv-head-waiter\login.js" />
|
||||
<Content Include="ServiceVault\wtv-home\splash.txt" />
|
||||
<Content Include="ServiceVault\wtv-home\splash.js" />
|
||||
<Content Include="ServiceVault\wtv-log\log.js" />
|
||||
<Content Include="session_data.js">
|
||||
<SubType>Code</SubType>
|
||||
</Content>
|
||||
<Content Include="user_config.example.json" />
|
||||
<Content Include="user_config.json" />
|
||||
<Content Include="wtvsec.js">
|
||||
<SubType>Code</SubType>
|
||||
|
||||
Reference in New Issue
Block a user