From 627200d18d6ec0172e5391bc4453a76bd91a1dab Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Sat, 22 Feb 2020 17:44:40 +0100 Subject: [PATCH] Add download for single file recordings to web interface --- server/src/main/resources/html/static/index.html | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/src/main/resources/html/static/index.html b/server/src/main/resources/html/static/index.html index d8139478..faecf4a3 100644 --- a/server/src/main/resources/html/static/index.html +++ b/server/src/main/resources/html/static/index.html @@ -158,7 +158,7 @@ - + @@ -390,7 +390,6 @@ function play(recording) { let src = recording.singleFile ? '/hls' + recording.path : recording.playlist; - console.log("####################", src); let hmacOfPath = CryptoJS.HmacSHA256(src, hmac); src = '..' + src; if(console) console.log("Path", src, "HMAC", hmacOfPath); @@ -438,6 +437,17 @@ } } + function download(recording) { + let src = recording.singleFile ? '/hls' + recording.path : recording.playlist; + let hmacOfPath = CryptoJS.HmacSHA256(src, hmac); + src = '..' + src; + if(console) console.log("Path", src, "HMAC", hmacOfPath); + if (hmac.length > 0) { + src += "?hmac=" + hmacOfPath; + } + location.href = src; + } + function calculateSize(sizeInByte) { let size = sizeInByte; let unit = "Bytes";