diff --git a/themes/default/lib/Lufi/I18N/lufi.pot b/themes/default/lib/Lufi/I18N/lufi.pot index e51f40e..4b33f80 100644 --- a/themes/default/lib/Lufi/I18N/lufi.pot +++ b/themes/default/lib/Lufi/I18N/lufi.pot @@ -361,6 +361,10 @@ msgstr "" msgid "Share your files in total privacy on %1" 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 msgid "Signin" msgstr "" diff --git a/themes/default/public/js/lufi-down.js b/themes/default/public/js/lufi-down.js index dfe0b44..b650021 100644 --- a/themes/default/public/js/lufi-down.js +++ b/themes/default/public/js/lufi-down.js @@ -106,6 +106,7 @@ function spawnWebsocket(pa) { } var innerHTML = ['

', i18n.download, '

']; + var isZip = false; if (data.type.match(/^image\//) !== null) { innerHTML.push('', escapeHtml(data.name), ''); } else if (data.type.match(/^video\//) !== null) { @@ -116,9 +117,28 @@ function spawnWebsocket(pa) { innerHTML.push(''); + } else if (data.type.match(/^application\/zip/) !== null) { + innerHTML.push('

', i18n.showZipContent, '

'); + isZip = true; } + pbd.html(innerHTML.join('')); + if (isZip) { + $('#showZipContent').click(function() { + JSZip.loadAsync(blob) + .then(function (zip) { + var innerHTML = ['

Zip content:

'); + pbd.append(innerHTML.join('')); + $('#showZipContent').hide(); + $('#showZipContent').unbind('click'); + }); + }); + } if ($('#file_pwd').length === 1) { window.ws.send('{"ended":true, "file_pwd": "'+$('#file_pwd').val()+'"}'); } else { diff --git a/themes/default/templates/partial/render.js.ep b/themes/default/templates/partial/render.js.ep index 0cafdad..2d2ccd4 100644 --- a/themes/default/templates/partial/render.js.ep +++ b/themes/default/templates/partial/render.js.ep @@ -1,11 +1,12 @@ % # vim:set sts=4 sw=4 ts=4 ft=javascript expandtab: var ws_url = '<%= url_for('download')->to_abs().stash('file') %>'; var i18n = { - aborted1: '<%= l('Download aborted.') %>', - 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.') %>', - confirmExit: '<%= l('You have attempted to leave this page. The download will be canceled. Are you sure?') %>', - download: '<%= l('Get the file') %>', - 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.') %>', + aborted1: '<%= l('Download aborted.') %>', + 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.') %>', + confirmExit: '<%= l('You have attempted to leave this page. The download will be canceled. Are you sure?') %>', + download: '<%= l('Get the file') %>', + 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.') %>', + showZipContent: '<%= l('Show zip content') %>' } diff --git a/themes/default/templates/render.html.ep b/themes/default/templates/render.html.ep index 6018c25..e68781f 100644 --- a/themes/default/templates/render.html.ep +++ b/themes/default/templates/render.html.ep @@ -44,6 +44,7 @@ %= javascript '/partial/render.js?nbslices='.stash('f')->nbslices.'&file='.stash('f')->short %= javascript '/js/filesize.min.js' %= javascript '/js/sjcl.js' +%= javascript '/js/jszip.min.js' %= javascript '/js/lufi-down.js' % } % }