fix issue with locally stored flashroms
This commit is contained in:
@@ -36,7 +36,7 @@ class WTVFlashrom {
|
||||
if (info_only) {
|
||||
callback(self.getFlashromInfo(data, request_path));
|
||||
} else {
|
||||
self.sendToClient(data, flashrom_file_path, callback);
|
||||
self.sendToClient(data, request_path, callback);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -123,6 +123,7 @@ class WTVFlashrom {
|
||||
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 && this.bf0app_update) headers += "\nwtv-visit: " + flashrom_info.next_rompath;
|
||||
headers += "\nminisrv-no-mail-count: true";
|
||||
callback(data, headers);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ const WTVClientCapabilities = require('./WTVClientCapabilities.js');
|
||||
const WTVClientSessionData = require('./WTVClientSessionData.js');
|
||||
const WTVMime = require("./WTVMime.js");
|
||||
const { WTVShared, clientShowAlert } = require("./WTVShared.js");
|
||||
const WTVFlashrom = require("./WTVFlashrom.js");
|
||||
|
||||
process
|
||||
.on('SIGTERM', shutdown('SIGTERM'))
|
||||
@@ -161,8 +162,30 @@ async function processPath(socket, service_vault_file_path, request_headers = ne
|
||||
request_headers.service_file_path = service_vault_file_path;
|
||||
request_headers.raw_file = true;
|
||||
|
||||
// service parsed files, we might not want to expose our service source files so we can protect them with a flag on the first line
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "js" || wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "txt") {
|
||||
// process flashroms
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "rom" || wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "brom") {
|
||||
var bf0app_update = false;
|
||||
var request_path = request_headers.request_url.replace(service_name + ":/", "");
|
||||
var romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
var bootver = ssid_sessions[socket.ssid].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;
|
||||
ssid_sessions[socket.ssid].set("bf0app_update", bf0app_update);
|
||||
}
|
||||
|
||||
if (!ssid_sessions[socket.ssid].data_store.WTVFlashrom) {
|
||||
ssid_sessions[socket.ssid].data_store.WTVFlashrom = new WTVFlashrom(minisrv_config, service_vaults, service_name, minisrv_config.services[service_name].use_zefie_server, bf0app_update);
|
||||
}
|
||||
|
||||
ssid_sessions[socket.ssid].data_store.WTVFlashrom.getFlashRom(request_path, function (data, headers) {
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
|
||||
// service parsed files, we might not want to expose our service source files so we can protect them with a flag on the first line
|
||||
} else if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "js" || wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "txt") {
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "js") {
|
||||
wtvshared.getLineFromFile(service_vault_file_path, 0, function (status, line) {
|
||||
if (!status) {
|
||||
|
||||
Reference in New Issue
Block a user