Add download for single file recordings to web interface
This commit is contained in:
parent
71be9b3665
commit
627200d18d
|
@ -158,7 +158,7 @@
|
||||||
<button class="btn btn-secondary fa fa-play" title="Play recording" data-bind="enable: ko_status() == 'FINISHED', click: play"></button>
|
<button class="btn btn-secondary fa fa-play" title="Play recording" data-bind="enable: ko_status() == 'FINISHED', click: play"></button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-secondary fa fa-download" title="Download recording" data-bind="enable: ko_status() == 'FINISHED' && singleFile, click: function() { $.notify('Not implemented, yet', 'info'); }"></button>
|
<button class="btn btn-secondary fa fa-download" title="Download recording" data-bind="enable: ko_status() == 'FINISHED' && singleFile, click: download"></button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-secondary fa fa-trash" title="Delete recording" data-bind="enable: ko_status() == 'FINISHED', click: ctbrec.deleteRecording"></button>
|
<button class="btn btn-secondary fa fa-trash" title="Delete recording" data-bind="enable: ko_status() == 'FINISHED', click: ctbrec.deleteRecording"></button>
|
||||||
|
@ -390,7 +390,6 @@
|
||||||
|
|
||||||
function play(recording) {
|
function play(recording) {
|
||||||
let src = recording.singleFile ? '/hls' + recording.path : recording.playlist;
|
let src = recording.singleFile ? '/hls' + recording.path : recording.playlist;
|
||||||
console.log("####################", src);
|
|
||||||
let hmacOfPath = CryptoJS.HmacSHA256(src, hmac);
|
let hmacOfPath = CryptoJS.HmacSHA256(src, hmac);
|
||||||
src = '..' + src;
|
src = '..' + src;
|
||||||
if(console) console.log("Path", src, "HMAC", hmacOfPath);
|
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) {
|
function calculateSize(sizeInByte) {
|
||||||
let size = sizeInByte;
|
let size = sizeInByte;
|
||||||
let unit = "Bytes";
|
let unit = "Bytes";
|
||||||
|
|
Loading…
Reference in New Issue