clean up file structure
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var request_is_async = true;
|
||||
|
||||
var bf0app_update = false;
|
||||
var request_path = request_headers.request_url.replace(service_name + ":/", "");
|
||||
var romtype = session_data.get("wtv-client-rom-type");
|
||||
var bootver = session_data.get("wtv-client-bootrom-version")
|
||||
|
||||
if ((romtype == "bf0app" || !romtype) && (bootver == "105" || !bootver)) {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
bf0app_update = true;
|
||||
session_data.set("bf0app_update", bf0app_update);
|
||||
}
|
||||
|
||||
if (!session_data.data_store.WTVFlashrom) {
|
||||
session_data.data_store.WTVFlashrom = new WTVFlashrom(minisrv_config, service_vaults, service_name, minisrv_config.services[service_name].use_zefie_server, bf0app_update);
|
||||
}
|
||||
|
||||
session_data.data_store.WTVFlashrom.getFlashRom(request_path, function (data, headers) {
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
request_is_async = true;
|
||||
|
||||
// this build can be local or on zefie's server
|
||||
// to get the path from zefie's server, browse
|
||||
// https://archive.midnightchannel.net/zefie/files/wtv-flashrom/content/artemis-webtv-000/
|
||||
// and put everything from 'content/' onwards, including the part000.rom filename
|
||||
// example is below
|
||||
var default_build_to_send = minisrv_config.services[service_name].bf0app_default_rom || "content/artemis-webtv-000/build7181/daily-nondebug/bf0app-part000.rom";
|
||||
|
||||
|
||||
var request_path = "";
|
||||
var bf0app_update = true;
|
||||
if (request_headers.query.path) request_path = request_headers.query.path;
|
||||
else request_path = default_build_to_send;
|
||||
|
||||
if (session_data.get("wtv-client-rom-type") == "bf0app" && session_data.get("wtv-client-bootrom-version") == "105") {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
bf0app_update = true;
|
||||
session_data.set("bf0app_update", bf0app_update);
|
||||
}
|
||||
|
||||
if (!session_data.data_store.WTVFlashrom) {
|
||||
session_data.data_store.WTVFlashrom = new WTVFlashrom(minisrv_config, service_vaults, service_name, minisrv_config.services[service_name].use_zefie_server, bf0app_update);
|
||||
}
|
||||
|
||||
session_data.data_store.WTVFlashrom.getFlashRom(request_path, function (data, headers) {
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
request_is_async = true;
|
||||
|
||||
var bf0app_update = false;
|
||||
var request_path = request_headers.query.path;
|
||||
var romtype = session_data.get("wtv-client-rom-type");
|
||||
var bootver = session_data.get("wtv-client-bootrom-version")
|
||||
|
||||
if ((romtype == "bf0app" || !romtype) && (bootver == "105" || !bootver)) {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
bf0app_update = true;
|
||||
session_data.set("bf0app_update", bf0app_update);
|
||||
}
|
||||
|
||||
if (request_headers.query.raw || bf0app_update) {
|
||||
if (!session_data.data_store.WTVFlashrom) {
|
||||
session_data.data_store.WTVFlashrom = new WTVFlashrom(minisrv_config, service_vaults, service_name, minisrv_config.services[service_name].use_zefie_server, bf0app_update);
|
||||
}
|
||||
|
||||
session_data.data_store.WTVFlashrom.getFlashRom(request_path, function (data, headers) {
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
} else {
|
||||
if (request_headers.query.path) {
|
||||
headers = "200 OK\n"
|
||||
headers += "wtv-visit: " + service_name + ":/initiate-lc2-download?path=" + request_headers.query.path + "\n";
|
||||
headers += "Content-type: text/html"
|
||||
data = '';
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(404)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
sendToClient(socket, headers, data);
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
request_is_async = true;
|
||||
|
||||
if (!request_headers.query.path) {
|
||||
var errpage = wtvshared.doErrorPage(400);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
} else {
|
||||
var wtvflashrom = new WTVFlashrom(minisrv_config, service_vaults, service_name, minisrv_config.services[service_name].use_zefie_server, false, (minisrv_config.services[service_name].debug ? false : true));
|
||||
var request_path = request_headers.query.path;
|
||||
|
||||
// read flashrom header info into array using WTVFlashrom class
|
||||
wtvflashrom.getFlashromMeta(request_path, function (data, headers) {
|
||||
processLC2DownloadPage(data, headers, (request_headers.query.numparts ? request_headers.query.numparts : null));
|
||||
});
|
||||
}
|
||||
|
||||
async function processLC2DownloadPage(flashrom_info, headers, numparts = null) {
|
||||
if (typeof flashrom_info === 'string') {
|
||||
// zefie_flashrom_server error
|
||||
data = flashrom_info;
|
||||
headers += "\nminisrv-no-mail-count: true\nwtv-expire-all: wtv-flashrom:/get-lc2-page?";
|
||||
sendToClient(socket, headers, data);
|
||||
return false;
|
||||
}
|
||||
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, ''));
|
||||
console.log(flashrom_info);
|
||||
if (parseInt(flashrom_info.part_number) >= 0 && flashrom_info.rompath && flashrom_info.next_rompath) {
|
||||
if (!flashrom_info.message && flashrom_info.is_bootrom) {
|
||||
flashrom_info.message = "BootRom Part " + (flashrom_info.part_number + 1) + " of " + flashrom_info.part_count;
|
||||
}
|
||||
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+":/","")));
|
||||
}
|
||||
|
||||
headers = `200 OK
|
||||
Content-type: text/html
|
||||
minisrv-no-mail-count: true`
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<title>
|
||||
Updating
|
||||
</title>
|
||||
<display switchtowebmode transition=none nostatus nooptions skipback clearback>
|
||||
</head>
|
||||
<body noscroll bgcolor="#191919" text="#42CC55" link="36d5ff"
|
||||
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="${minisrv_config.config.service_logo}" width=87 height=67>
|
||||
<td width=20 valign=top align=left bgcolor="3B3A4D">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td colspan=10 width=436 valign=middle align=left bgcolor="3B3A4D">
|
||||
<font color="D6DFD0" size="+2">
|
||||
<blackface>
|
||||
<shadow>
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=1 height=4>
|
||||
<br>
|
||||
Updating now
|
||||
</shadow>
|
||||
</blackface>
|
||||
</font>
|
||||
<tr>
|
||||
<td colspan=12 width=560 height=10 valign=top align=left>
|
||||
<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>
|
||||
<td width=67 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>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=68 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<form action="client:poweroff">
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=100 height=258 valign=top align=left>
|
||||
<font size=+1>
|
||||
Your ${session_data.getBoxName()} is being<br>updated automatically.
|
||||
<p> <font size=+1>
|
||||
This will take a while, and<br>then you can use your ${session_data.getBoxName()} again.
|
||||
`;
|
||||
if (flashrom_info.is_bootrom && flashrom_info.part_number == (flashrom_info.part_count - 1)) {
|
||||
data += `<p>
|
||||
The system will pause for about 30 seconds at the end of this
|
||||
update. Please <strong>do not</strong> interrupt the system
|
||||
during this time.
|
||||
`
|
||||
}
|
||||
data += `
|
||||
</font>
|
||||
<br><br><br><br><br>
|
||||
<upgradeblock width=250 height=15
|
||||
nexturl="${flashrom_info.next_rompath}"
|
||||
errorurl="${service_name}:/lc2-download-failed?"
|
||||
blockurl="${flashrom_info.rompath}"
|
||||
lastblock="${flashrom_info.is_last_part}"
|
||||
curblock="${(flashrom_info.part_number + 1)}"${(flashrom_info.part_count) ? `
|
||||
totalblocks="${flashrom_info.part_count}">` : `>`}
|
||||
<font size="-1" color="#D6DFD0">
|
||||
<br>
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=2 height=10><br>
|
||||
${flashrom_info.message}
|
||||
<br><br>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=middle align=center bgcolor="#191919">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=1 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=top align=left bgcolor="#191919">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=4 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=416 valign=top align=right>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=306 valign=top align=left>
|
||||
<font size="-1"><i>
|
||||
</i></font><td width=112 valign=top align=right>
|
||||
<font size="-1" color="#191919">
|
||||
</font>
|
||||
</form>
|
||||
</table>
|
||||
<td width=20 valign=middle align=center>
|
||||
</table>
|
||||
</body>
|
||||
</html>`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
headers += "\nminisrv-no-mail-count: true\nwtv-expire-all: wtv-flashrom:/get-lc2-page?";
|
||||
data = errpage[1];
|
||||
}
|
||||
sendToClient(socket, headers, data);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (request_headers.query.path) {
|
||||
var url = service_name + ":/get-lc2-page?path=" + request_headers.query.path;
|
||||
var romtype = session_data.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);
|
||||
} else {
|
||||
if (request_headers.query.numparts) url += "&numparts=" + request_headers.query.numparts;
|
||||
}
|
||||
headers = "300 OK\n";
|
||||
headers += "minisrv-no-mail-count: true\n";
|
||||
headers += "wtv-visit: " + url + "\n";
|
||||
headers += "Location: " + url + "\n";
|
||||
headers += "Content-type: text/html";
|
||||
data = '';
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
headers = `200 OK
|
||||
Content-type: text/html
|
||||
minisrv-no-mail-count: true`
|
||||
|
||||
data = `<html>
|
||||
|
||||
<head>
|
||||
<title>
|
||||
Updating
|
||||
</title>
|
||||
<display switchtowebmode nostatus nooptions skipback clearback>
|
||||
|
||||
<meta http-equiv=Refresh content="270; url=client:poweroff?invalRAMImage">
|
||||
|
||||
</head>
|
||||
|
||||
<body onLoad="document.forms.invalram.submit()";
|
||||
noscroll bgcolor="#191919" text="#42CC55" link="36d5ff"
|
||||
hspace=0 vspace=0 fontsize="large">
|
||||
|
||||
<form name ="invalram" action="client:invalramimage">
|
||||
</form>
|
||||
|
||||
<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=87 height=67>
|
||||
<td width=20 valign=top align=left bgcolor="3B3A4D">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td colspan=10 width=436 valign=middle align=left bgcolor="3B3A4D">
|
||||
<font color="D6DFD0" size="+2">
|
||||
<blackface>
|
||||
<shadow>
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=1 height=4>
|
||||
<br>
|
||||
Updating complete
|
||||
</shadow>
|
||||
</blackface>
|
||||
</font>
|
||||
<tr>
|
||||
<td colspan=12 width=560 height=10 valign=top align=left>
|
||||
<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>
|
||||
<td width=67 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>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=68 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=100 height=258 valign=top align=left>
|
||||
<font size=+1>
|
||||
The update is complete.<br>
|
||||
<p><font size=+1>Choose <b>Connect Now</b> if you<br>want to connect to ${minisrv_config.config.service_name}.
|
||||
<p><font size=+1>Press the <b>power</b> button to switch<br>off your ${session_data.getBoxName()}.
|
||||
</font>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=middle align=center bgcolor="2B2B2B">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=1 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=top align=left bgcolor="0D0D0D">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=4 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=416 valign=top align=left>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=306 valign=top align=left>
|
||||
<font size="-1"><i>
|
||||
</i></font><td width=112 valign=top align=right>
|
||||
<font size="-1" color="#E7CE4A">
|
||||
<shadow>
|
||||
|
||||
<form action="client:poweroff">
|
||||
<input selected type=submit value="Connect Now" name="UseUpgradeNow"
|
||||
borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=170>
|
||||
<input type="hidden" name="invalRAMImage">
|
||||
<input type="hidden" name="autoPowerOn">
|
||||
</shadow>
|
||||
</font>
|
||||
</form>
|
||||
|
||||
</table>
|
||||
<td width=20 valign=middle align=center>
|
||||
</table>
|
||||
</body>
|
||||
</html>`
|
||||
@@ -0,0 +1,142 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var error = '';
|
||||
if (request_headers.query.error) {
|
||||
switch (request_headers.query.error) {
|
||||
case "1":
|
||||
error = "uncompression failed";
|
||||
break;
|
||||
case "2":
|
||||
error = "upgrade write failed";
|
||||
break;
|
||||
case "3":
|
||||
error = "signature verification failed";
|
||||
break;
|
||||
case "4":
|
||||
error = "cannot upgrade bootstrap";
|
||||
break;
|
||||
case "5":
|
||||
error = "out of memory";
|
||||
break;
|
||||
case "-7":
|
||||
error = "response error";
|
||||
break;
|
||||
case "-20":
|
||||
error = "timed out";
|
||||
break;
|
||||
case "99":
|
||||
error = "test code";
|
||||
break;
|
||||
default:
|
||||
error = "unknown error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var try_again_url = service_name + ":/willie";
|
||||
var try_again_url_path = ''
|
||||
var try_again_url_start_time = parseInt(new Date().toUTCString()) / 1000;
|
||||
|
||||
headers = `200 OK
|
||||
Content-type: text/html`
|
||||
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<display switchtowebmode nooptions nostatus>
|
||||
<title>Update failed</title>
|
||||
</head>
|
||||
|
||||
<body noscroll bgcolor="#191919" text="#42CC55" link="36d5ff"
|
||||
hspace=0 vspace=0 transition=none fontsize="large">
|
||||
<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=87 height=67>
|
||||
<td width=20 valign=top align=left bgcolor="3B3A4D">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td colspan=10 width=436 valign=middle align=left bgcolor="3B3A4D">
|
||||
<font color="D6DFD0" size="+2">
|
||||
<blackface>
|
||||
<shadow>
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=1 height=4>
|
||||
<br>
|
||||
Updating failed
|
||||
</shadow>
|
||||
</blackface>
|
||||
</font>
|
||||
<tr>
|
||||
<td colspan=12 width=560 height=10 valign=top align=left>
|
||||
<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>
|
||||
<td width=67 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>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=68 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
|
||||
<form action="${try_again_url}">
|
||||
<input type="hidden" name="clear_cache" value="true">
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=100 height=258 valign=top align=left>
|
||||
<font size=+1>
|
||||
We ran into a technical problem while updating
|
||||
your unit. (Error: ${error})
|
||||
Choose <b>Try Again</b> to try again now.
|
||||
<p><font size=+1>Press the <b>power</b> button to switch off your ${session_data.getBoxName()}.
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=middle align=center bgcolor="2B2B2B">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=1 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=top align=left bgcolor="0D0D0D">
|
||||
<img src="${service_name}:/ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=4 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=416 valign=top align=left>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=306 valign=top align=left>
|
||||
<font size="-1">
|
||||
<i>
|
||||
</i>
|
||||
</font>
|
||||
<td width=112 valign=top align=right>
|
||||
<font size="-1" color="#E7CE4A">
|
||||
<shadow>
|
||||
<input selected
|
||||
name="Try Again"
|
||||
value="Try Again"
|
||||
type=submit Value=TryAgain name="Try Again"
|
||||
borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=110>
|
||||
</shadow>
|
||||
</font>
|
||||
</form>
|
||||
|
||||
</table>
|
||||
<td width=20 valign=middle align=center>
|
||||
</table>
|
||||
</body>
|
||||
</html>`;
|
||||
@@ -0,0 +1,31 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
request_is_async = true;
|
||||
|
||||
// this build can be local or on zefie's server
|
||||
// to get the path from zefie's server, browse
|
||||
// https://archive.midnightchannel.net/zefie/files/wtv-flashrom/content/artemis-webtv-000/
|
||||
// and put everything from 'content/' onwards, including the part000.rom filename
|
||||
// example is below
|
||||
var default_build_to_send = minisrv_config.services[service_name].bf0app_default_rom || "content/artemis-webtv-000/build7181/daily-nondebug/bf0app-part000.rom";
|
||||
|
||||
|
||||
var request_path = "";
|
||||
var bf0app_update = true;
|
||||
if (request_headers.query.path) request_path = request_headers.query.path;
|
||||
else request_path = default_build_to_send;
|
||||
|
||||
if (session_data.get("wtv-client-rom-type") == "bf0app" && session_data.get("wtv-client-bootrom-version") == "105") {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
bf0app_update = true;
|
||||
session_data.set("bf0app_update", bf0app_update);
|
||||
}
|
||||
|
||||
if (!session_data.data_store.WTVFlashrom) {
|
||||
session_data.data_store.WTVFlashrom = new WTVFlashrom(minisrv_config, service_vaults, service_name, 0, minisrv_config.services[service_name].use_zefie_server, bf0app_update, minisrv_config.services[service_name].debug);
|
||||
}
|
||||
|
||||
session_data.data_store.WTVFlashrom.getFlashRom(request_path, function (data, headers) {
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
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.
|
||||
|
||||
request_is_async = true;
|
||||
|
||||
var proxy_query = '';
|
||||
if (request_headers.query.flash) delete request_headers.query.flash;
|
||||
if (request_headers.query.vflash) delete request_headers.query.vflash;
|
||||
if (request_headers.query.pflash) delete request_headers.query.pflash;
|
||||
|
||||
for (const [key, value] of Object.entries(request_headers.query)) {
|
||||
proxy_query += "&" + key + "=" + escape(value);
|
||||
}
|
||||
|
||||
if (!minisrv_config.services[service_name].use_zefie_server) {
|
||||
proxy_query += "&minisrv_local_mode=true";
|
||||
}
|
||||
|
||||
var options = {
|
||||
host: "wtv.zefie.com",
|
||||
path: "/willie.php?minisrv=true&service_name="+escape(service_name)+"&pflash=" + session_data.get("wtv-client-rom-type") + proxy_query,
|
||||
timeout: 5000,
|
||||
method: 'GET'
|
||||
}
|
||||
|
||||
|
||||
headers = "200 OK\nContent-type: text/html";
|
||||
const req = https.request(options, function (res) {
|
||||
data = '';
|
||||
res.on('data', d => {
|
||||
data += d;
|
||||
});
|
||||
|
||||
res.on('error', function (e) {
|
||||
if (!minisrv_config.config.debug_flags.quiet) console.log(" * Upstream Ultra Willies HTTP Error:", e);
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
|
||||
res.on('end', function () {
|
||||
if (!minisrv_config.config.debug_flags.quiet) console.log(" * Upstream Ultra Willies HTTP Response:", res.statusCode, res.statusMessage);
|
||||
if (request_headers.query.clear_cache) {
|
||||
headers += "\nwtv-expire-all: "+service_name;
|
||||
}
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
});
|
||||
req.end();
|
||||
Reference in New Issue
Block a user