add compress: false option to diskmaps

This commit is contained in:
zefie
2021-08-12 17:57:10 -04:00
parent d9fdad4b04
commit 7bcead69c1
2 changed files with 8 additions and 1 deletions

View File

@@ -78,7 +78,9 @@ if (request_headers['wtv-request-type'] == 'download') {
break;
case "GET":
wtvdl.get(update_list[k].file.replace(diskmap_group_data.base, ""), update_list[k].file, service_name + ":/" + update_list[k].location, diskmap_group_name, update_list[k].checksum, update_list[k].uncompressed_size || null, update_list[k].original_filename)
var get_url = service_name + ":/" + update_list[k].location;
if (update_list[k].compress === false) get_url += "?dont_compress=true";
wtvdl.get(update_list[k].file.replace(diskmap_group_data.base, ""), update_list[k].file, get_url, diskmap_group_name, update_list[k].checksum, update_list[k].uncompressed_size || null, update_list[k].original_filename)
break;
}
});

View File

@@ -609,6 +609,11 @@ async function sendToClient(socket, headers_obj, data) {
// small files actually get larger, so don't compress them
var compression_type = 0;
if (content_length >= 256) compression_type = wtvmime.shouldWeCompress(ssid_sessions[socket.ssid], headers_obj);
if (socket_sessions[socket.id].request_headers.query) {
if (socket_sessions[socket.id].request_headers.query.dont_compress) {
compression_type = 0;
}
}
// compress if needed
if (compression_type > 0 && content_length > 0 && headers_obj['http_response'].substring(0, 3) == "200") {