add calculating message

This commit is contained in:
zefie
2021-08-11 11:44:34 -04:00
parent 8e234e4841
commit fe7e076ff0

View File

@@ -591,6 +591,7 @@ async function sendToClient(socket, headers_obj, data) {
// disk service hack before further processing :) // disk service hack before further processing :)
if (socket_sessions[socket.id].wtv_request_type == "download" && content_length > 0) { if (socket_sessions[socket.id].wtv_request_type == "download" && content_length > 0) {
if (minisrv_config.config.debug_flags.debug) console.log(" * Calculating uncompressed size and checksum...");
if (headers_obj['Content-Type'] == "application/gzip") { if (headers_obj['Content-Type'] == "application/gzip") {
var gunzipped = zlib.gunzipSync(data); var gunzipped = zlib.gunzipSync(data);
headers_obj['wtv-checksum'] = CryptoJS.MD5(CryptoJS.lib.WordArray.create(gunzipped)).toString(CryptoJS.enc.Hex).toLowerCase(); headers_obj['wtv-checksum'] = CryptoJS.MD5(CryptoJS.lib.WordArray.create(gunzipped)).toString(CryptoJS.enc.Hex).toLowerCase();