Update AppData--2.5-HE.zip from MattMan

- moved all viewergen data to ServiceDeps, outside of the requestable file path
- Added "ServiceDeps" config option to specific the name of the ServiceDeps folder
- Updated wtv-1800 tellyscript code accordingly
This commit is contained in:
zefie
2022-10-10 12:45:59 -04:00
parent d1dbbcf82f
commit e608a96787
21 changed files with 23 additions and 20 deletions

View File

@@ -1,6 +1,8 @@
var minisrv_service_file = true;
var viewer = 2 // debug override
var viewergen_resource_dir = __dirname + "/" + minisrv_config.config.ServiceDeps + "/viewergen/";
var viewers = {
0: "WebTVIntel--1.0.exe",
1: "WebTVIntel--1.1.exe",
@@ -72,10 +74,10 @@ function getPatchDataType(type, invert = false) {
function getResData(file) {
var res_data = null;
if (file.substr(-2, 2).toLowerCase() == "gz") {
var res_gz_data = fs.readFileSync(cwd + "/viewers/" + file);
var res_gz_data = fs.readFileSync(viewergen_resource_dir + file);
res_data = zlib.gunzipSync(res_gz_data);
} else {
res_data = fs.readFileSync(cwd + "/viewers/" + file);
res_data = fs.readFileSync(viewergen_resource_dir + file);
}
return res_data;
}
@@ -318,7 +320,7 @@ function buildProfile(build) {
}
var enable_full_hacktv = false;
if (fs.existsSync(cwd + path.sep + "viewers" + path.sep + "HackTV.zip")) {
if (fs.existsSync(viewergen_resource_dir + "HackTV.zip")) {
enable_full_hacktv = true;
disksets['99'] = "HackTV.zip";
}
@@ -338,7 +340,7 @@ if (request_headers.query.viewer &&
headers = errpage[0];
data = errpage[1];
} else {
var viewer_gz_data = fs.readFileSync(cwd + "/viewers/" + viewer_file + ".gz");
var viewer_gz_data = fs.readFileSync(viewergen_resource_dir + viewer_file + ".gz");
var viewer_data = zlib.gunzipSync(viewer_gz_data);
var viewer_md5 = crypto.createHash('md5').update(viewer_data).digest("hex");
if (viewer_md5 != viewer_stock_md5s[viewer_file]) {
@@ -378,13 +380,13 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")
zip.addZipComment("Viewer SSID: " + client_ssid);
zip.addFile(viewer_file, patched_file);
if (!request_headers.query.viewer_only) {
var romset_zip = new AdmZip(cwd + "/viewers/" + viewer_file.replace(".exe", "").replace("WebTVIntel", "AppData") + ".zip");
var romset_zip = new AdmZip(viewergen_resource_dir + viewer_file.replace(".exe", "").replace("WebTVIntel", "AppData") + ".zip");
var zipEntries = romset_zip.getEntries();
zipEntries.forEach(function (zipEntry) {
if (zipEntry.entryName == "Setup.bmp" && request_headers.query.logo) {
var logo_file = logos[parseInt(request_headers.query.logo) || 0];
if (logo_file) {
var logo_gz_data = fs.readFileSync(cwd + "/viewers/" + logo_file + ".gz");
var logo_gz_data = fs.readFileSync(viewergen_resource_dir + logo_file + ".gz");
var logo_data = zlib.gunzipSync(logo_gz_data);
zip.addFile(zipEntry.entryName, logo_data);
} else {
@@ -397,7 +399,7 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")
if (request_headers.query.diskset) {
var diskset_file = disksets[parseInt(request_headers.query.diskset) || 0];
if (diskset_file) {
var diskset_zip = new AdmZip(cwd + "/viewers/" + diskset_file);
var diskset_zip = new AdmZip(viewergen_resource_dir + diskset_file);
var zipEntries = diskset_zip.getEntries();
zipEntries.forEach(function (zipEntry) {
zip.addFile("Disk/" + zipEntry.entryName, zipEntry.getData());

View File

@@ -1,3 +0,0 @@
Disksets should contain the files under the "Disk" folder in the WebTV Viewer.
The zip should NOT contain the "Disk" folder itself, but only the files you intend
to install UNDER the "Disk" folder.

View File

@@ -29,7 +29,7 @@ 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/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
var file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
if (file_path) {
request_is_async = true;

View File

@@ -77,22 +77,22 @@ if (session_data.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 (session_data.get("wtv-open-access")) file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok";
else var file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok";
if (session_data.get("wtv-open-access")) file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok";
else var file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok";
break;
case "US-DTV-disk-0MB-32MB-softmodem-CPU5230":
if (wtvshared.isMiniBrowser(session_data)) {
prereg_contype = "text/tellyscript";
if (session_data.get("wtv-open-access")) file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok";
else file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok";
if (session_data.get("wtv-open-access")) file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok";
else file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok";
} else {
prereg_contype = "text/dialscript";
if (session_data.get("wtv-lan") == "true") {
file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/UTV/utv_hsd.tok";
file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/UTV/utv_hsd.tok";
} else {
// todo OpenISP telly
file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/UTV/utv_normal.tok";
file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/UTV/utv_normal.tok";
}
}
break;
@@ -100,8 +100,8 @@ if (session_data.data_store.wtvsec_login) {
case "bf0app":
prereg_contype = "text/tellyscript";
// if wtv-open-access: true then client expects OpenISP
if (session_data.get("wtv-open-access")) file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok";
else file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
if (session_data.get("wtv-open-access")) file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok";
else file_path = __dirname + "/" + minisrv_config.config.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 +109,8 @@ if (session_data.data_store.wtvsec_login) {
case "JP-Fiji":
prereg_contype = "text/tellyscript";
// if wtv-open-access: true then client expects OpenISP
if (session_data.get("wtv-open-access")) var file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/FIJI/dc_production_normal.tok";
else var file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/FIJI/dc_production_normal.tok";
if (session_data.get("wtv-open-access")) var file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/FIJI/dc_production_normal.tok";
else var file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/FIJI/dc_production_normal.tok";
break;
default:
@@ -120,7 +120,7 @@ if (session_data.data_store.wtvsec_login) {
if (socket.ssid.substr(0, 8) == "MSTVSIMU") {
prereg_contype = "text/dialscript";
var file_path = __dirname + "/ServiceDeps/wtv-1800/tellyscripts/UTV/utv_hsd.tok";
var file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/UTV/utv_hsd.tok";
}
}
@@ -129,7 +129,7 @@ if (session_data.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/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
var file_path = __dirname + "/" + minisrv_config.config.ServiceDeps + "/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
var bf0app_update = true;
session_data.set("bf0app_update", bf0app_update);
}