diff --git a/CHANGELOG b/CHANGELOG index 64202de..2014614 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ Revision history for Lufi ?.??.? ????-??-?? + - Notifications when uploading and downloading files (#181) + +0.04.6 2019-11-07 - Now can send large files (>2Gio) while using a DB other than SQLite (#165) - Use customized instance name in diff --git a/themes/default/lib/Lufi/I18N/lufi.pot b/themes/default/lib/Lufi/I18N/lufi.pot index 0a3ec3b..47a989c 100644 --- a/themes/default/lib/Lufi/I18N/lufi.pot +++ b/themes/default/lib/Lufi/I18N/lufi.pot @@ -45,7 +45,7 @@ msgstr "" msgid "%A %d %B %Y at %T" msgstr "" -#: themes/default/templates/partial/index.js.ep:27 +#: themes/default/templates/partial/index.js.ep:28 msgid "(max size: XXX)" msgstr "" @@ -90,7 +90,7 @@ msgid "As Lufi is a free software licensed under of the terms of the <a href=\"h msgstr "" #. (stash('nbslices') -#: themes/default/templates/partial/render.js.ep:9 +#: themes/default/templates/partial/render.js.ep:10 msgid "Asking for file part XX1 of %1" msgstr "" @@ -254,10 +254,18 @@ msgstr "" msgid "File deleted" msgstr "" +#: themes/default/templates/partial/render.js.ep:9 +msgid "File downloaded" +msgstr "" + #: themes/default/templates/files.html.ep:27 msgid "File name" msgstr "" +#: themes/default/templates/partial/index.js.ep:24 +msgid "File uploaded" +msgstr "" + #: themes/default/templates/invitations/my_invitations.html.ep:61 msgid "Files" msgstr "" @@ -307,11 +315,11 @@ msgstr "" msgid "Hide hidden invitations" msgstr "" -#: themes/default/templates/partial/index.js.ep:25 +#: themes/default/templates/partial/index.js.ep:26 msgid "Hit Enter, then Ctrl+C to copy all the download links" msgstr "" -#: themes/default/templates/partial/index.js.ep:24 +#: themes/default/templates/partial/index.js.ep:25 msgid "Hit Enter, then Ctrl+C to copy the download link" msgstr "" @@ -422,7 +430,7 @@ msgstr "" msgid "No enough space available on the server for this file (size: %1)." msgstr "" -#: themes/default/templates/partial/files.js.ep:10 themes/default/templates/partial/index.js.ep:28 +#: themes/default/templates/partial/files.js.ep:10 themes/default/templates/partial/index.js.ep:29 msgid "No expiration delay" msgstr "" @@ -479,7 +487,7 @@ msgstr "" msgid "Rows in red mean that the files have expired and are no longer available." msgstr "" -#: themes/default/templates/partial/index.js.ep:26 +#: themes/default/templates/partial/index.js.ep:27 msgid "Send all links by email" msgstr "" @@ -495,7 +503,7 @@ msgstr "" msgid "Send with your own mail software" msgstr "" -#: themes/default/templates/partial/index.js.ep:29 +#: themes/default/templates/partial/index.js.ep:30 msgid "Sending part XX1 of XX2. Please, be patient, the progress bar can take a while to move." msgstr "" @@ -508,7 +516,7 @@ msgstr "" msgid "Show hidden invitations" msgstr "" -#: themes/default/templates/partial/render.js.ep:11 +#: themes/default/templates/partial/render.js.ep:12 msgid "Show zip content" msgstr "" @@ -686,7 +694,7 @@ msgstr "" msgid "Uploaded files" msgstr "" -#: themes/default/templates/partial/index.js.ep:30 +#: themes/default/templates/partial/index.js.ep:31 msgid "Websocket communication error" msgstr "" @@ -718,7 +726,7 @@ msgstr "" msgid "You don't need to register yourself to upload files but be aware that, for legal reasons, your IP address will be stored when you send a file. Don't panic, this is normally the case for all sites on which you send files." msgstr "" -#: themes/default/templates/partial/render.js.ep:10 +#: themes/default/templates/partial/render.js.ep:11 msgid "You don't seem to have a key in your URL. You won't be able to decrypt the file. Download canceled." msgstr "" @@ -751,7 +759,7 @@ msgstr "" msgid "Your password is not valid. Please refresh the page to retry." msgstr "" -#: themes/default/templates/partial/render.js.ep:12 +#: themes/default/templates/partial/render.js.ep:13 msgid "Zip content:" msgstr "" diff --git a/themes/default/public/js/lufi-down.js b/themes/default/public/js/lufi-down.js index 4108df9..54d0c87 100644 --- a/themes/default/public/js/lufi-down.js +++ b/themes/default/public/js/lufi-down.js @@ -95,6 +95,7 @@ function spawnWebsocket(pa) { if (data.part + 1 === data.total) { var blob = new Blob(a, {type: data.type}); + notify(i18n.fileDownloaded, data.name); $('#please-wait').remove(); $('#loading').remove(); diff --git a/themes/default/public/js/lufi-notifications.js b/themes/default/public/js/lufi-notifications.js new file mode 100644 index 0000000..d198df6 --- /dev/null +++ b/themes/default/public/js/lufi-notifications.js @@ -0,0 +1,26 @@ +function notify(title, body) { + if (!Notification) { + console.log("This browser does not support desktop notification, cannot send following message: "+title+" "+body); + return; + } + + if (Notification.permission !== "granted") { + Notification.requestPermission(); + } else { + let options = { + body: body, + icon: '/img/lufi196.png' + }; + let n = new Notification(title, options); + } +} + +document.addEventListener('DOMContentLoaded', function () { + if (!Notification) { + return; + } + + if (Notification.permission !== "granted") { + Notification.requestPermission(); + } +}); diff --git a/themes/default/public/js/lufi-up.js b/themes/default/public/js/lufi-up.js index e7ae260..8776fde 100644 --- a/themes/default/public/js/lufi-up.js +++ b/themes/default/public/js/lufi-up.js @@ -477,6 +477,8 @@ function updateProgressBar(data) { console.log('Error on WebSocket connection but file has been fully send, so we don\'t care.'); } + notify(i18n.fileUploaded, data.name); + $('#parts-'+window.fc).remove(); var n = $('#name-'+window.fc); var s = $('#size-'+window.fc); diff --git a/themes/default/templates/index.html.ep b/themes/default/templates/index.html.ep index 9f498c2..6409f78 100644 --- a/themes/default/templates/index.html.ep +++ b/themes/default/templates/index.html.ep @@ -165,5 +165,6 @@ %= javascript '/js/moment-with-locales.min.js' %= javascript '/js/filesize.min.js' %= javascript '/js/jszip.min.js' +%= javascript '/js/lufi-notifications.js' %= javascript '/js/lufi-up.js' % } diff --git a/themes/default/templates/partial/index.js.ep b/themes/default/templates/partial/index.js.ep index 6fc6d76..241d371 100644 --- a/themes/default/templates/partial/index.js.ep +++ b/themes/default/templates/partial/index.js.ep @@ -10,24 +10,25 @@ var baseURL = '<%= url_for('/')->to_abs() %>'; % } var actionURL = '<%= url_for('/')->to_abs() %>'; var i18n = { - enqueued: '<%= l('XXX file has been added to upload queue.') %>', - confirmExit: '<%= l('You have attempted to leave this page. The upload will be canceled. Are you sure?') %>', - copyAll: '<%= l('Copy all links to clipboard') %>', - copySuccess: '<%= l('The link(s) has been copied to your clipboard') %>', - copyFail: '<%= l('Unable to copy the link(s) to your clipboard') %>', - cpText: '<%= l('Copy to clipboard') %>', - delText: '<%= l('Deletion link') %>', - dlText: '<%= l('Download link') %>', - download: '<%= l('Download') %>', - encrypting: '<%= l('Encrypting part XX1 of XX2') %>', - expiration: '<%= l('Expiration:') %>', - hit: '<%= l('Hit Enter, then Ctrl+C to copy the download link') %>', - hits: '<%= l('Hit Enter, then Ctrl+C to copy all the download links') %>', - mailTo: '<%= l('Send all links by email') %>', - maxSize: '<%= l('(max size: XXX)') %>', - noLimit: '<%= l('No expiration delay') %>', - sending: '<%= l('Sending part XX1 of XX2. Please, be patient, the progress bar can take a while to move.') %>', - wsProblem: '<%= l('Websocket communication error') %>', + enqueued: '<%= l('XXX file has been added to upload queue.') %>', + confirmExit: '<%= l('You have attempted to leave this page. The upload will be canceled. Are you sure?') %>', + copyAll: '<%= l('Copy all links to clipboard') %>', + copySuccess: '<%= l('The link(s) has been copied to your clipboard') %>', + copyFail: '<%= l('Unable to copy the link(s) to your clipboard') %>', + cpText: '<%= l('Copy to clipboard') %>', + delText: '<%= l('Deletion link') %>', + dlText: '<%= l('Download link') %>', + download: '<%= l('Download') %>', + encrypting: '<%= l('Encrypting part XX1 of XX2') %>', + expiration: '<%= l('Expiration:') %>', + fileUploaded: '<%= l('File uploaded') %>', + hit: '<%= l('Hit Enter, then Ctrl+C to copy the download link') %>', + hits: '<%= l('Hit Enter, then Ctrl+C to copy all the download links') %>', + mailTo: '<%= l('Send all links by email') %>', + maxSize: '<%= l('(max size: XXX)') %>', + noLimit: '<%= l('No expiration delay') %>', + sending: '<%= l('Sending part XX1 of XX2. Please, be patient, the progress bar can take a while to move.') %>', + wsProblem: '<%= l('Websocket communication error') %>', }; var maxSize = <%= config('max_file_size') || 0 %>; diff --git a/themes/default/templates/partial/render.js.ep b/themes/default/templates/partial/render.js.ep index 174438a..4ca1131 100644 --- a/themes/default/templates/partial/render.js.ep +++ b/themes/default/templates/partial/render.js.ep @@ -6,6 +6,7 @@ var i18n = { 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') %>', + fileDownloaded: '<%= l('File downloaded') %>', 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 4c06596..9deb809 100644 --- a/themes/default/templates/render.html.ep +++ b/themes/default/templates/render.html.ep @@ -45,6 +45,7 @@ %= javascript '/js/filesize.min.js' %= javascript '/js/sjcl.js' %= javascript '/js/jszip.min.js' +%= javascript '/js/lufi-notifications.js' %= javascript '/js/lufi-down.js' % } % }