fix: wtv-flashrom: fix search for local flashrom files
This commit is contained in:
@@ -26,8 +26,13 @@ function doLocalFlashROM(flashrom_file_path) {
|
|||||||
if (request_headers.query.raw) {
|
if (request_headers.query.raw) {
|
||||||
if ((/\.brom$/).test(request_path)) headers += "Content-Type: binary/x-wtv-bootrom"; // maybe?
|
if ((/\.brom$/).test(request_path)) headers += "Content-Type: binary/x-wtv-bootrom"; // maybe?
|
||||||
else headers += "Content-Type: binary/x-wtv-flashblock";
|
else headers += "Content-Type: binary/x-wtv-flashblock";
|
||||||
var flashrom_file_path = service_dir + '/' + request_path;
|
var flashrom_file_path = null;
|
||||||
if (minisrv_config.services[service_name].use_zefie_server && !fs.existsSync(flashrom_file_path)) {
|
Object.keys(service_vaults).forEach(function (g) {
|
||||||
|
if (flashrom_file_path != null) return;
|
||||||
|
flashrom_file_path = service_vaults[g].path + "/" + service_name + "/" + request_path;
|
||||||
|
if (!fs.existsSync(flashrom_file_path)) flashrom_file_path = null;
|
||||||
|
});
|
||||||
|
if (minisrv_config.services[service_name].use_zefie_server && !flashrom_file_path) {
|
||||||
// get flashrom files from archive.midnightchannel.net
|
// get flashrom files from archive.midnightchannel.net
|
||||||
var options = {
|
var options = {
|
||||||
host: "archive.midnightchannel.net",
|
host: "archive.midnightchannel.net",
|
||||||
|
|||||||
@@ -26,8 +26,14 @@ if (!request_headers.query.path) {
|
|||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
} else {
|
} else {
|
||||||
var request_path = unescape(request_headers.query.path);
|
var request_path = unescape(request_headers.query.path);
|
||||||
var flashrom_file_path = service_dir + '/' + request_path;
|
var flashrom_file_path = null;
|
||||||
if (minisrv_config.services[service_name].use_zefie_server && !fs.existsSync(flashrom_file_path)) {
|
Object.keys(service_vaults).forEach(function (g) {
|
||||||
|
if (flashrom_file_path != null) return;
|
||||||
|
flashrom_file_path = service_vaults[g].path + "/" + service_name + "/" + request_path;
|
||||||
|
if (!fs.existsSync(flashrom_file_path)) flashrom_file_path = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (minisrv_config.services[service_name].use_zefie_server && !flashrom_file_path) {
|
||||||
// read first 256 bytes of flashrom file from archive.midnightchannel.net
|
// read first 256 bytes of flashrom file from archive.midnightchannel.net
|
||||||
// to get `flashrom_message` and `numparts` if missing
|
// to get `flashrom_message` and `numparts` if missing
|
||||||
var options = {
|
var options = {
|
||||||
|
|||||||
Reference in New Issue
Block a user