v0.9.37
- remove extra debugging - fix: could not unregister if multiple users existed - fix: http(s) proxy - add example in user_config.example.json to use public proxy - maybe fix: double reg - add support for "modpacks" to viewergen - first mod is "BackgroundSound" by @Sgeo (and https://github.com/elishacloud/dxwrapper)
This commit is contained in:
BIN
zefie_wtvp_minisrv/ServiceDeps/viewergen/BackgroundSound.zip
Normal file
BIN
zefie_wtvp_minisrv/ServiceDeps/viewergen/BackgroundSound.zip
Normal file
Binary file not shown.
@@ -30,6 +30,15 @@ var viewer_stock_md5s = {
|
||||
"WebTVIntel--2.5-HE.exe": "64edab977ec19a663c5842176bec306a"
|
||||
}
|
||||
|
||||
var modpacks = {
|
||||
0: {
|
||||
"name": "Background Sound",
|
||||
"description": "Enables the Viewer to continue playing sound when it is not the currently active window.",
|
||||
"file": "BackgroundSound.zip",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var patch_defaults = {
|
||||
"start_url": "client:GoToConn",
|
||||
@@ -336,7 +345,6 @@ if (request_headers.query.viewer &&
|
||||
|
||||
var viewer_file = viewers[request_headers.query.viewer];
|
||||
var needs_hacktv_mini = (viewer_file === "WebTVIntel--2.5-HE.exe") ? true : false
|
||||
console.log('needs_hacktv_mini', needs_hacktv_mini)
|
||||
if (!viewer_file) {
|
||||
errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||
headers = errpage[0];
|
||||
@@ -346,7 +354,7 @@ if (request_headers.query.viewer &&
|
||||
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]) {
|
||||
console.log(viewer_file, "md5sum error. expected:", viewer_stock_md5s[viewer_file], ", got:", viewer_md5)
|
||||
console.error(viewer_file, "md5sum error. expected:", viewer_stock_md5s[viewer_file], ", got:", viewer_md5)
|
||||
errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
@@ -411,6 +419,26 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var embed_modpacks = [];
|
||||
Object.keys(request_headers.query).forEach((k) => {
|
||||
if (k.substring(0, 8) === "modpack_") {
|
||||
embed_modpacks.push(parseInt(k.substring(8)));
|
||||
}
|
||||
});
|
||||
|
||||
if (embed_modpacks.length > 0) {
|
||||
Object.keys(embed_modpacks).forEach((k) => {
|
||||
var modpack_file = viewergen_resource_dir + modpacks[k].file;
|
||||
if (fs.existsSync(modpack_file)) {
|
||||
var modpack_zip = new AdmZip(modpack_file);
|
||||
var zipEntries = modpack_zip.getEntries();
|
||||
zipEntries.forEach(function (zipEntry) {
|
||||
zip.addFile(zipEntry.entryName, zipEntry.getData());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
data = zip.toBuffer();
|
||||
}
|
||||
@@ -505,8 +533,8 @@ Welcome to the zefie minisrv v${minisrv_config.version} PC Services<Br>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>SSID:</strong></td>
|
||||
<td><input name="client_ssid" id="client_ssid" maxlength=16" value="91">
|
||||
<input type="button" onclick="generateSSID()" id="generate_ssid" value="Randomize SSID" /><br>
|
||||
<td><input name="client_ssid" id="client_ssid" maxlength=16" value="91" disabled=disabled>
|
||||
<input type="button" onclick="generateSSID()" id="generate_ssid" value="Randomize SSID" disabled=disabled/><br>
|
||||
<em>Viewer clients should use SSIDs starting with <strong>91</strong>,<br>
|
||||
unless you are intentionally trying to spoof a box.</em>
|
||||
</td>
|
||||
@@ -542,11 +570,20 @@ although certain advanced server operators may use these flags<br>
|
||||
to determine what your "box" can do, and as such, may offer<br>
|
||||
features that do not work in the Viewer, especially older ones</em>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Mod Packs</strong></td>
|
||||
<td>`;
|
||||
|
||||
Object.keys(modpacks).forEach((k) => {
|
||||
data += `<input type="checkbox" name="modpack_${k}"${(modpacks[k].default) ? " checked=checked" : ""}>${modpacks[k].name}<br> <em>${modpacks[k].description}</em><br>`
|
||||
})
|
||||
|
||||
data += `</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Other Flags</strong>:</td>
|
||||
<td>
|
||||
<input type="checkbox" name="random_ssid" id="random_ssid" onchange="toggleRandomizer(this)"> Let the server choose the SSID (Ignores SSID above)<br>
|
||||
<input type="checkbox" name="random_ssid" id="random_ssid" onchange="toggleRandomizer(this)" checked=checked> Let the server choose the SSID (Ignores SSID above)<br>
|
||||
<input type="checkbox" name="viewer_only" onchange="toggleLogoOption(this)"> Only include Viewer EXE, not ROM files or Logos (Advanced Users Only)
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -67,11 +67,11 @@ hspace="0" vspace="0" fontsize="large" noscroll>
|
||||
|
||||
|
||||
function doConnect() {
|
||||
// if (document.connect.machine.value == "${minisrv_config.services['wtv-1800'].host}" && document.connect.port.value == "${minisrv_config.services['wtv-1800'].port}") {
|
||||
// alert("You are already here!");
|
||||
// } else {
|
||||
if (document.connect.machine.value == "${minisrv_config.services['wtv-1800'].host}" && document.connect.port.value == "${minisrv_config.services['wtv-1800'].port}") {
|
||||
alert("You are already here!");
|
||||
} else {
|
||||
document.connect.submit();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
function setOther() {
|
||||
@@ -103,7 +103,7 @@ hspace="0" vspace="0" fontsize="large" noscroll>
|
||||
document.message.msg.value='Default WebTV Production IP/Port. Can be used to check your routing setup.'
|
||||
break;
|
||||
case "wni-int":
|
||||
document.connect.machine.value="192.168.11.8"
|
||||
document.connect.machine.value="10.0.128.1"
|
||||
document.connect.port.value="1615"
|
||||
document.message.msg.value='Default WebTV Internal IP/Port. Can be used to check your routing setup.'
|
||||
break;
|
||||
|
||||
@@ -11,7 +11,7 @@ if (!session_data.getSessionData("registered")) {
|
||||
} else if (session_data.user_id !== 0) {
|
||||
headers += "\nwtv-noback-all: wtv-";
|
||||
headers += "\nwtv-expire-all: wtv-";
|
||||
var redirect = [5, "wtv-tricks:/tricks"];
|
||||
var redirect = [5, "client:relogin?"];
|
||||
var message = "Error: You must be the primary user to unregister this box.";
|
||||
} else if (request_headers.query.confirm_unregister) {
|
||||
if (session_data.unregisterBox()) {
|
||||
|
||||
@@ -879,7 +879,8 @@ async function doHTTPProxy(socket, request_headers) {
|
||||
method: request_data.method,
|
||||
followAllRedirects: true,
|
||||
headers: {
|
||||
"User-Agent": request_headers["User-Agent"] || "WebTV"
|
||||
"User-Agent": request_headers["User-Agent"] || "WebTV",
|
||||
"Connection": "Keep-Alive"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1005,7 +1006,7 @@ function stripHeaders(headers_obj, whitelist) {
|
||||
var whitelisted_headers = new Array();
|
||||
var out_headers = new Array();
|
||||
out_headers.Response = headers_obj.Response;
|
||||
out_headers['wtv-connection-close'] = headers_obj['wtv-connection-close'];
|
||||
if (headers_obj['wtv-connection-close']) out_headers['wtv-connection-close'] = headers_obj['wtv-connection-close'];
|
||||
|
||||
// compare regardless of case
|
||||
Object.keys(whitelist).forEach(function (k) {
|
||||
|
||||
@@ -91,7 +91,7 @@ class WTVClientSessionData {
|
||||
}
|
||||
|
||||
switchUserID(user_id, update_mail = true, update_ticket = true, update_favorite = true) {
|
||||
this.user_id = user_id;
|
||||
this.user_id = parseInt(user_id);
|
||||
if (user_id != null) {
|
||||
this.loadSessionData();
|
||||
if (this.isRegistered() && update_mail) this.assignMailStore();
|
||||
@@ -505,12 +505,13 @@ class WTVClientSessionData {
|
||||
|
||||
try {
|
||||
// only save if file has changed
|
||||
var json_save_data = JSON.stringify(this.session_store);
|
||||
var json_load_data = (!skip_merge) ? this.loadSessionData(true) : {};
|
||||
var sessionToStore = this.session_store;
|
||||
var json_save_data = JSON.stringify(sessionToStore);
|
||||
var json_load_data = (skip_merge) ? {} : this.loadSessionData(true);
|
||||
|
||||
var storeDir = this.getUserStoreDirectory();
|
||||
if (!this.fs.existsSync(storeDir)) this.mkdirRecursive(storeDir);
|
||||
var sessionToStore = this.session_store;
|
||||
|
||||
if (sessionToStore.password_valid) delete sessionToStore.password_valid; // do not save validity state of password login, resets when session expires
|
||||
if (json_save_data != json_load_data) this.fs.writeFileSync(storeDir + "user" + this.user_id + ".json", JSON.stringify(sessionToStore), "Utf8");
|
||||
return true;
|
||||
|
||||
@@ -44,8 +44,7 @@ class WTVRegister {
|
||||
|
||||
// check against user accounts
|
||||
directory = (directory) ? directory : this.session_store_dir + this.path.sep + "accounts";
|
||||
|
||||
console.log(directory)
|
||||
|
||||
if (this.fs.existsSync(directory)) {
|
||||
this.fs.readdirSync(directory).forEach(file => {
|
||||
if (self.fs.lstatSync(directory + self.path.sep + file).isDirectory() && !return_val) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zefie_wtvp_minisrv",
|
||||
"version": "0.9.36",
|
||||
"version": "0.9.37",
|
||||
"description": "WebTV Service (WTVP) Emulation Server",
|
||||
"main": "app.js",
|
||||
"homepage": "https://github.com/zefie/zefie_wtvp_minisrv",
|
||||
|
||||
@@ -118,7 +118,19 @@
|
||||
"username": "mylocaluser",
|
||||
"password": "mylocalpass"
|
||||
}
|
||||
},
|
||||
// the following uses zefie's public proxy with webone for web surfing and image scaling
|
||||
"services": {
|
||||
"http": {
|
||||
"host": "51.222.164.146",
|
||||
"nobind": true
|
||||
},
|
||||
"https": {
|
||||
"host": "51.222.164.146",
|
||||
"nobind": true
|
||||
}
|
||||
}
|
||||
// end zefie's public proxy
|
||||
},
|
||||
"favorites": {
|
||||
"folder_templates": {
|
||||
|
||||
Reference in New Issue
Block a user