misc fixes

This commit is contained in:
zefie
2021-08-15 17:54:53 -04:00
parent 78f6adee6e
commit 7b0200eac8
2 changed files with 8 additions and 4 deletions

View File

@@ -41,7 +41,8 @@ class WTVMime {
if (this.minisrv_config.config.enable_gzip_compression || this.minisrv_config.config.force_compression_type) {
var is_bf0app = ssid_session.get("wtv-client-rom-type") == "bf0app";
var isOldBuild = this.wtvshared.isOldBuild(ssid_session);
var is_softmodem = ssid_session.get("wtv-client-rom-type").match(/softmodem/);
var is_softmodem = false;
if (ssid_session.get("wtv-client-rom-type")) is_softmodem = ssid_session.get("wtv-client-rom-type").match(/softmodem/);
if (!is_bf0app && ((!is_softmodem && !isOldBuild) || (is_softmodem && !isOldBuild))) {
// softmodem boxes do not appear to support gzip in the minibrowser
// LC2 appears to support gzip even in the MiniBrowser
@@ -75,6 +76,7 @@ class WTVMime {
// gzip only
if (content_type.match(/^audio\/(x-)?(s3m|mod|xm)$/)) compress_data = true; // s3m, mod, xm
if (content_type.match(/^audio\/(x-)?(midi|wav|wave|aif(f)?)$/)) compress_data = true; // midi & wav
if (content_type.match(/^application\/karaoke$/)) compress_data = true; // midi karaoke
if (content_type.match(/^binary\/x-wtv-approm$/)) compress_data = true; // approms
if (content_type.match(/^binary\/doom-data$/)) compress_data = true; // DOOM WADs
if (content_type.match(/^wtv\/download-list$/)) compress_data = true; // WebTV Download List
@@ -179,6 +181,9 @@ class WTVMime {
case "wad":
wtv_mime_type = "binary/doom-data";
break;
case "kar":
wtv_mime_type = "application/karaoke";
break;
case "mp2":
case "hsb":
case "rmf":

View File

@@ -106,12 +106,11 @@ async function processPath(socket, service_vault_file_path, request_headers = ne
var headers, data = null;
var request_is_async = false;
var service_vault_found = false;
var service_path = service_vault_file_path;
var service_path = unescape(service_vault_file_path);
try {
service_vaults.forEach(function (service_vault_dir) {
if (service_vault_found) return;
service_vault_file_path = wtvshared.makeSafePath(service_vault_dir, service_path);
console.log(service_vault_file_path);
// deny access to catchall file name directly
var service_path_split = service_path.split("/");
var service_path_request_file = service_path_split[service_path_split.length - 1];