Allow to see what files are in zip files
This commit is contained in:
parent
096be71b1a
commit
659e430578
|
@ -361,6 +361,10 @@ msgstr ""
|
||||||
msgid "Share your files in total privacy on %1"
|
msgid "Share your files in total privacy on %1"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/render.js.ep:11
|
||||||
|
msgid "Show zip content"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/layouts/default.html.ep:36 themes/default/templates/layouts/default.html.ep:65 themes/default/templates/login.html.ep:27 themes/default/templates/logout.html.ep:17
|
#: themes/default/templates/layouts/default.html.ep:36 themes/default/templates/layouts/default.html.ep:65 themes/default/templates/login.html.ep:27 themes/default/templates/logout.html.ep:17
|
||||||
msgid "Signin"
|
msgid "Signin"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -106,6 +106,7 @@ function spawnWebsocket(pa) {
|
||||||
}
|
}
|
||||||
var innerHTML = ['<p><a href="', blobURL, '" class="btn btn-primary" download="', escapeHtml(data.name), '">', i18n.download, '</a></p>'];
|
var innerHTML = ['<p><a href="', blobURL, '" class="btn btn-primary" download="', escapeHtml(data.name), '">', i18n.download, '</a></p>'];
|
||||||
|
|
||||||
|
var isZip = false;
|
||||||
if (data.type.match(/^image\//) !== null) {
|
if (data.type.match(/^image\//) !== null) {
|
||||||
innerHTML.push('<img id="render-image" class="responsive-img" alt="', escapeHtml(data.name), '" src="', blobURL, '">');
|
innerHTML.push('<img id="render-image" class="responsive-img" alt="', escapeHtml(data.name), '" src="', blobURL, '">');
|
||||||
} else if (data.type.match(/^video\//) !== null) {
|
} else if (data.type.match(/^video\//) !== null) {
|
||||||
|
@ -116,9 +117,28 @@ function spawnWebsocket(pa) {
|
||||||
innerHTML.push('<audio class="responsive-video" controls>',
|
innerHTML.push('<audio class="responsive-video" controls>',
|
||||||
'<source src="', blobURL, '" type="', data.type, '">',
|
'<source src="', blobURL, '" type="', data.type, '">',
|
||||||
'</audio>');
|
'</audio>');
|
||||||
|
} else if (data.type.match(/^application\/zip/) !== null) {
|
||||||
|
innerHTML.push('<p><a class="btn btn-primary" id="showZipContent">', i18n.showZipContent, '</a></p>');
|
||||||
|
isZip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pbd.html(innerHTML.join(''));
|
pbd.html(innerHTML.join(''));
|
||||||
|
|
||||||
|
if (isZip) {
|
||||||
|
$('#showZipContent').click(function() {
|
||||||
|
JSZip.loadAsync(blob)
|
||||||
|
.then(function (zip) {
|
||||||
|
var innerHTML = ['<h3>Zip content:</h3><ul>'];
|
||||||
|
zip.forEach(function (relativePath, zipEntry) {
|
||||||
|
innerHTML.push('<li>', zipEntry.name, '</li>');
|
||||||
|
});
|
||||||
|
innerHTML.push('</ul>');
|
||||||
|
pbd.append(innerHTML.join(''));
|
||||||
|
$('#showZipContent').hide();
|
||||||
|
$('#showZipContent').unbind('click');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
if ($('#file_pwd').length === 1) {
|
if ($('#file_pwd').length === 1) {
|
||||||
window.ws.send('{"ended":true, "file_pwd": "'+$('#file_pwd').val()+'"}');
|
window.ws.send('{"ended":true, "file_pwd": "'+$('#file_pwd').val()+'"}');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
% # vim:set sts=4 sw=4 ts=4 ft=javascript expandtab:
|
% # vim:set sts=4 sw=4 ts=4 ft=javascript expandtab:
|
||||||
var ws_url = '<%= url_for('download')->to_abs().stash('file') %>';
|
var ws_url = '<%= url_for('download')->to_abs().stash('file') %>';
|
||||||
var i18n = {
|
var i18n = {
|
||||||
aborted1: '<%= l('Download aborted.') %>',
|
aborted1: '<%= l('Download aborted.') %>',
|
||||||
aborted2: '<%= l('Click here to refresh the page and restart the download.') %>',
|
aborted2: '<%= l('Click here to refresh the page and restart the download.') %>',
|
||||||
badkey: '<%= l('It seems that the key in your URL is incorrect. Please, verify your URL.') %>',
|
badkey: '<%= l('It seems that the key in your URL is incorrect. Please, verify your URL.') %>',
|
||||||
confirmExit: '<%= l('You have attempted to leave this page. The download will be canceled. Are you sure?') %>',
|
confirmExit: '<%= l('You have attempted to leave this page. The download will be canceled. Are you sure?') %>',
|
||||||
download: '<%= l('Get the file') %>',
|
download: '<%= l('Get the file') %>',
|
||||||
loading: '<%= l('Asking for file part XX1 of %1', stash('nbslices')) %>',
|
loading: '<%= l('Asking for file part XX1 of %1', stash('nbslices')) %>',
|
||||||
nokey: '<%= l('You don\'t seem to have a key in your URL. You won\'t be able to decrypt the file. Download canceled.') %>',
|
nokey: '<%= l('You don\'t seem to have a key in your URL. You won\'t be able to decrypt the file. Download canceled.') %>',
|
||||||
|
showZipContent: '<%= l('Show zip content') %>'
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
%= javascript '/partial/render.js?nbslices='.stash('f')->nbslices.'&file='.stash('f')->short
|
%= javascript '/partial/render.js?nbslices='.stash('f')->nbslices.'&file='.stash('f')->short
|
||||||
%= javascript '/js/filesize.min.js'
|
%= javascript '/js/filesize.min.js'
|
||||||
%= javascript '/js/sjcl.js'
|
%= javascript '/js/sjcl.js'
|
||||||
|
%= javascript '/js/jszip.min.js'
|
||||||
%= javascript '/js/lufi-down.js'
|
%= javascript '/js/lufi-down.js'
|
||||||
% }
|
% }
|
||||||
% }
|
% }
|
||||||
|
|
Loading…
Reference in New Issue