fix flashrom yet again

This commit is contained in:
zefie
2021-08-10 01:17:39 -04:00
parent 28adff5a59
commit 5083b51c6b
5 changed files with 7 additions and 6 deletions

View File

@@ -1,6 +1,5 @@
const WTVFlashrom = require("./WTVFlashrom.js");
request_is_async = true;
console.log(request_headers);
var bf0app_update = false;
var request_path = request_headers.request_url.replace(service_name + ":/", "");

View File

@@ -8,7 +8,7 @@ if (!request_headers.query.path) {
headers = errpage[0];
data = errpage[1];
} else {
var wtvflashrom = new WTVFlashrom(service_vaults, service_name, minisrv_config.services[service_name].use_zefie_server, minisrv_config.services[service_name].debug);
var wtvflashrom = new WTVFlashrom(service_vaults, service_name, minisrv_config.services[service_name].use_zefie_server);
var request_path = request_headers.query.path;
// read flashrom header info into array using WTVFlashrom class

View File

@@ -5,8 +5,9 @@ var romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
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);
}
headers = "200 OK\n";
headers = "300 OK\n";
headers += "wtv-visit: " + url + "\n";
headers += "Location: " + url + "\n";
headers += "Content-type: text/html";
data = '';
} else {

View File

@@ -14,7 +14,7 @@ class WTVFlashrom {
this.service_name = service_name;
this.use_zefie_server = use_zefie_server;
this.bf0app_update = bf0app_update;
this.zdebug = true;
this.zdebug = debug;
}
@@ -138,7 +138,7 @@ class WTVFlashrom {
var flashrom_info = this.getFlashromInfo(data, request_path)
if (flashrom_info.is_bootrom) headers += "Content-Type: binary/x-wtv-bootrom"; // maybe?
else headers += "Content-Type: binary/x-wtv-flashblock";
if (flashrom_info.next_rompath != null) headers += "\nwtv-visit: " + flashrom_info.next_rompath;
if (flashrom_info.next_rompath != null && this.bf0app_update) headers += "\nwtv-visit: " + flashrom_info.next_rompath;
callback(data, headers);
}

View File

@@ -238,7 +238,8 @@ class WTVSec {
* #returns {Buffer} JS Buffer object
*/
wordArrayToBuffer(wordArray) {
return new Buffer.from(wordArray.toString(CryptoJS.enc.Hex), 'hex');
if (wordArray) return new Buffer.from(wordArray.toString(CryptoJS.enc.Hex), 'hex');
else return null;
}
/**