- numerous bug fixes
 - add UTV tellyscripts
 - BREAKING CHANGE: doErrorPage moved to wtvshared.doErrorPage
	- but I fixed flashrom error handling..
	- added a passthrough for old scripts
 - added eMac's lzpf compression
 - Bump vm2 from 3.9.3 to 3.9.5 in /zefie_wtvp_minisrv
This commit is contained in:
zefie
2021-08-13 17:39:14 -04:00
parent 72c15305fa
commit 245e126298
57 changed files with 740 additions and 509 deletions

View File

@@ -1,3 +1,5 @@
var minisrv_service_file = true;
const WTVFlashrom = require("./WTVFlashrom.js");
request_is_async = true;

View File

@@ -1,3 +1,5 @@
var minisrv_service_file = true;
const WTVFlashrom = require("./WTVFlashrom.js");
request_is_async = true;

View File

@@ -1,3 +1,5 @@
var minisrv_service_file = true;
const WTVFlashrom = require("./WTVFlashrom.js");
request_is_async = true;
@@ -28,7 +30,7 @@ if (request_headers.query.raw || bf0app_update) {
headers += "Content-type: text/html"
data = '';
} else {
var errpage = doErrorPage(404)
var errpage = wtvshared.doErrorPage(404)
headers = errpage[0];
data = errpage[1];
}

View File

@@ -1,10 +1,11 @@
var minisrv_service_file = true;
const WTVFlashrom = require("./WTVFlashrom.js");
var wtvflashrom;
request_is_async = true;
if (!request_headers.query.path) {
var errpage = doErrorPage(400);
var errpage = wtvshared.doErrorPage(400);
headers = errpage[0];
data = errpage[1];
} else {
@@ -21,7 +22,7 @@ async function processLC2DownloadPage(path, flashrom_info, numparts = null) {
if (numparts != null) flashrom_info.part_count = parseInt(numparts);
if (!flashrom_info.part_count) flashrom_info.part_count = parseInt(flashrom_info.message.substring(flashrom_info.message.length - 4).replace(/\D/g, ''));
if (!flashrom_info.part_number || !flashrom_info.is_last_part || !flashrom_info.rompath || !flashrom_info.next_rompath || !flashrom_info.is_bootrom) {
if (!flashrom_info.is_last_part || request_headers.query.last_part) {
if (!flashrom_info.is_last_part) {
flashrom_info.next_rompath = request_headers.request_url.replace(escape(request_headers.query.path), escape(flashrom_info.next_rompath.replace(service_name+":/","")));
}
@@ -92,8 +93,7 @@ data += `
<upgradeblock width=280 height=15
nexturl="${flashrom_info.next_rompath}"
errorurl="${service_name}:/lc2-download-failed?"
`
if (!flashrom_info.is_last_part) data += `blockurl = "${flashrom_info.rompath}"`;
blockurl="${flashrom_info.rompath}"`;
data += `
lastblock="${flashrom_info.is_last_part}"
@@ -144,7 +144,7 @@ ${flashrom_info.message}
</body>
</html>`;
} else {
var errpage = doErrorPage(400)
var errpage = wtvshared.doErrorPage(400)
headers = errpage[0];
data = errpage[1];
}

View File

@@ -1,9 +1,11 @@
var minisrv_service_file = true;
if (request_headers.query.path) {
var url = service_name + ":/get-lc2-page?path=" + request_headers.query.path;
var romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
if (romtype == "bf0app") {
url = "client:updateflash?ipaddr=" + minisrv_config.services[service_name].host + "&port=" + minisrv_config.services[service_name].port + "&path=" + escape(service_name + ":/" +request_headers.query.path);
if (request_headers.query.numparts) url += escape("&numparts=" + request_headers.query.numparts);
if (request_headers.query.numparts) url += escape("?numparts=" + request_headers.query.numparts);
}
headers = "300 OK\n";
headers += "wtv-visit: " + url + "\n";
@@ -11,7 +13,7 @@ var romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
headers += "Content-type: text/html";
data = '';
} else {
var errpage = doErrorPage(400)
var errpage = wtvshared.doErrorPage(400)
headers = errpage[0];
data = errpage[1];
}

View File

@@ -1,3 +1,5 @@
var minisrv_service_file = true;
headers = `200 OK
Connection: Close
wtv-connection-close: true
@@ -43,6 +45,7 @@ Updating complete
<img src="${service_name}:/ROMCache/S40H1.gif" width=560 height=6>
<tr>
<td width=104 height=10 valign=top align=left>
<td width=20 valign=top align=left>
<td width=67 valign=top align=left>
<td width=20 valign=top align=left>

View File

@@ -1,3 +1,5 @@
var minisrv_service_file = true;
var error = '';
if (request_headers.query.error) {
switch (request_headers.query.error) {

View File

@@ -1,3 +1,5 @@
var minisrv_service_file = true;
const WTVFlashrom = require("./WTVFlashrom.js");
request_is_async = true;

View File

@@ -1,3 +1,5 @@
var minisrv_service_file = true;
// willie is just a graphical frontend to a list of ROMs
// the rest of the scripts should work if you manually link to a ROM, and actually have it.
@@ -33,7 +35,7 @@ const req = https.request(options, function (res) {
res.on('error', function (e) {
if (!minisrv_config.config.debug_flags.quiet) console.log(" * Upstream Ultra Willies HTTP Error:", e);
var errpage = doErrorPage(400)
var errpage = wtvshared.doErrorPage(400)
headers = errpage[0];
data = errpage[1];
sendToClient(socket, headers, data);