wtvsec: use initial key for ticket signing
update: initial work for future ability to update wtv-ticket to client
update: wtv-flashrom: use zefie server only if file does not exist locally (allows both zefie server roms and local roms)
update: wtv-flashrom:/get-lc2-path: experimental 'Cancel Update' button
fix: wtv-tricks:/blastcache: return_to was not unescaped
This commit is contained in:
zefie
2021-07-20 23:44:55 -04:00
parent b07d74d2db
commit 897bf10abb
9 changed files with 92 additions and 47 deletions

View File

@@ -4,13 +4,30 @@
// - handle failures
request_is_async = true;
function doLocalFlashROM() {
fs.readFile(flashrom_file_path, null, function (err, data) {
try {
var data_128 = new Buffer.alloc(128);
data.copy(data_128, 0, 0, 128);
var flashrom_message = new Buffer.from(data_128.toString('hex').substring(36 * 2, 68 * 2), 'hex').toString('ascii').replace(/[^0-9a-z\ \.\-]/gi, "");
processLC2DownloadPage(request_headers.query.path, flashrom_message, (request_headers.query.numparts || null));
} catch (e) {
var errpage = doErrorPage(404, "The service could not find the requested ROM.")
headers = errpage[0];
data = errpage[1];
sendToClient(socket, headers, data);
}
});
}
if (!request_headers.query.path) {
var errpage = doErrorPage(400);
headers = errpage[0];
data = errpage[1];
} else {
var request_path = unescape(request_headers.query.path);
if (minisrv_config.services[service_name].use_zefie_server) {
var flashrom_file_path = service_dir + '/' + request_path;
if (minisrv_config.services[service_name].use_zefie_server && !fs.existsSync(flashrom_file_path)) {
// read first 256 bytes of flashrom file from archive.midnightchannel.net
// to get `flashrom_message` and `numparts` if missing
var options = {
@@ -60,21 +77,8 @@ if (!request_headers.query.path) {
});
req.end();
} else {
// use local flashrom files
var flashrom_file_path = service_dir + '/' + request_path;
fs.readFile(flashrom_file_path, null, function (err, data) {
try {
var data_128 = new Buffer.alloc(128);
data.copy(data_128, 0, 0, 128);
var flashrom_message = new Buffer.from(data_128.toString('hex').substring(36 * 2, 68 * 2), 'hex').toString('ascii').replace(/[^0-9a-z\ \.\-]/gi, "");
processLC2DownloadPage(request_headers.query.path, flashrom_message, (request_headers.query.numparts || null));
} catch (e) {
var errpage = doErrorPage(404, "The service could not find the requested ROM.")
headers = errpage[0];
data = errpage[1];
sendToClient(socket, headers, data);
}
});
// use local flashrom files
doLocalFlashROM(flashrom_file_path);
}
}
@@ -195,7 +199,10 @@ ${flashrom_message}
<tr>
<td width=104 valign=middle align=center>
<td width=20 valign=middle align=center>
<td colspan=9 width=416 valign=top align=left>
<td colspan=9 width=416 valign=top align=right>
<form action="client:gohome">
<input type="submit" value="Cancel Update" text="#CCCCCC" borderimage="file://ROM/Borders/ButtonBorder2.bif">
</form>
<table cellspacing=0 cellpadding=0>
<tr>
<td width=306 valign=top align=left>