Merge branch 'NicolasConstant/lufi-development' into development

This commit is contained in:
Luc Didry 2020-03-22 11:23:17 +01:00
commit 4b36910aee
No known key found for this signature in database
GPG Key ID: EA868E12D0257E3C
9 changed files with 73 additions and 29 deletions

View File

@ -1,6 +1,9 @@
Revision history for Lufi 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) - Now can send large files (>2Gio) while using a DB other than SQLite (#165)
- Use customized instance name in <title> - Use customized instance name in <title>

View File

@ -45,7 +45,7 @@ msgstr ""
msgid "%A %d %B %Y at %T" msgid "%A %d %B %Y at %T"
msgstr "" msgstr ""
#: themes/default/templates/partial/index.js.ep:27 #: themes/default/templates/partial/index.js.ep:28
msgid "(max size: XXX)" msgid "(max size: XXX)"
msgstr "" msgstr ""
@ -90,7 +90,7 @@ msgid "As Lufi is a free software licensed under of the terms of the <a href=\"h
msgstr "" msgstr ""
#. (stash('nbslices') #. (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" msgid "Asking for file part XX1 of %1"
msgstr "" msgstr ""
@ -254,10 +254,18 @@ msgstr ""
msgid "File deleted" msgid "File deleted"
msgstr "" msgstr ""
#: themes/default/templates/partial/render.js.ep:9
msgid "File downloaded"
msgstr ""
#: themes/default/templates/files.html.ep:27 #: themes/default/templates/files.html.ep:27
msgid "File name" msgid "File name"
msgstr "" msgstr ""
#: themes/default/templates/partial/index.js.ep:24
msgid "File uploaded"
msgstr ""
#: themes/default/templates/invitations/my_invitations.html.ep:61 #: themes/default/templates/invitations/my_invitations.html.ep:61
msgid "Files" msgid "Files"
msgstr "" msgstr ""
@ -307,11 +315,11 @@ msgstr ""
msgid "Hide hidden invitations" msgid "Hide hidden invitations"
msgstr "" 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" msgid "Hit Enter, then Ctrl+C to copy all the download links"
msgstr "" 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" msgid "Hit Enter, then Ctrl+C to copy the download link"
msgstr "" msgstr ""
@ -422,7 +430,7 @@ msgstr ""
msgid "No enough space available on the server for this file (size: %1)." msgid "No enough space available on the server for this file (size: %1)."
msgstr "" 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" msgid "No expiration delay"
msgstr "" msgstr ""
@ -479,7 +487,7 @@ msgstr ""
msgid "Rows in red mean that the files have expired and are no longer available." msgid "Rows in red mean that the files have expired and are no longer available."
msgstr "" msgstr ""
#: themes/default/templates/partial/index.js.ep:26 #: themes/default/templates/partial/index.js.ep:27
msgid "Send all links by email" msgid "Send all links by email"
msgstr "" msgstr ""
@ -495,7 +503,7 @@ msgstr ""
msgid "Send with your own mail software" msgid "Send with your own mail software"
msgstr "" 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." msgid "Sending part XX1 of XX2. Please, be patient, the progress bar can take a while to move."
msgstr "" msgstr ""
@ -508,7 +516,7 @@ msgstr ""
msgid "Show hidden invitations" msgid "Show hidden invitations"
msgstr "" msgstr ""
#: themes/default/templates/partial/render.js.ep:11 #: themes/default/templates/partial/render.js.ep:12
msgid "Show zip content" msgid "Show zip content"
msgstr "" msgstr ""
@ -686,7 +694,7 @@ msgstr ""
msgid "Uploaded files" msgid "Uploaded files"
msgstr "" msgstr ""
#: themes/default/templates/partial/index.js.ep:30 #: themes/default/templates/partial/index.js.ep:31
msgid "Websocket communication error" msgid "Websocket communication error"
msgstr "" 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." 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 "" 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." msgid "You don't seem to have a key in your URL. You won't be able to decrypt the file. Download canceled."
msgstr "" msgstr ""
@ -751,7 +759,7 @@ msgstr ""
msgid "Your password is not valid. Please refresh the page to retry." msgid "Your password is not valid. Please refresh the page to retry."
msgstr "" msgstr ""
#: themes/default/templates/partial/render.js.ep:12 #: themes/default/templates/partial/render.js.ep:13
msgid "Zip content:" msgid "Zip content:"
msgstr "" msgstr ""

View File

@ -95,6 +95,7 @@ function spawnWebsocket(pa) {
if (data.part + 1 === data.total) { if (data.part + 1 === data.total) {
var blob = new Blob(a, {type: data.type}); var blob = new Blob(a, {type: data.type});
notify(i18n.fileDownloaded, data.name);
$('#please-wait').remove(); $('#please-wait').remove();
$('#loading').remove(); $('#loading').remove();

View File

@ -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();
}
});

View File

@ -477,6 +477,8 @@ function updateProgressBar(data) {
console.log('Error on WebSocket connection but file has been fully send, so we don\'t care.'); 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(); $('#parts-'+window.fc).remove();
var n = $('#name-'+window.fc); var n = $('#name-'+window.fc);
var s = $('#size-'+window.fc); var s = $('#size-'+window.fc);

View File

@ -165,5 +165,6 @@
%= javascript '/js/moment-with-locales.min.js' %= javascript '/js/moment-with-locales.min.js'
%= javascript '/js/filesize.min.js' %= javascript '/js/filesize.min.js'
%= javascript '/js/jszip.min.js' %= javascript '/js/jszip.min.js'
%= javascript '/js/lufi-notifications.js'
%= javascript '/js/lufi-up.js' %= javascript '/js/lufi-up.js'
% } % }

View File

@ -10,24 +10,25 @@ var baseURL = '<%= url_for('/')->to_abs() %>';
% } % }
var actionURL = '<%= url_for('/')->to_abs() %>'; var actionURL = '<%= url_for('/')->to_abs() %>';
var i18n = { var i18n = {
enqueued: '<%= l('XXX file has been added to upload queue.') %>', 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?') %>', confirmExit: '<%= l('You have attempted to leave this page. The upload will be canceled. Are you sure?') %>',
copyAll: '<%= l('Copy all links to clipboard') %>', copyAll: '<%= l('Copy all links to clipboard') %>',
copySuccess: '<%= l('The link(s) has been copied to your clipboard') %>', copySuccess: '<%= l('The link(s) has been copied to your clipboard') %>',
copyFail: '<%= l('Unable to copy the link(s) to your clipboard') %>', copyFail: '<%= l('Unable to copy the link(s) to your clipboard') %>',
cpText: '<%= l('Copy to clipboard') %>', cpText: '<%= l('Copy to clipboard') %>',
delText: '<%= l('Deletion link') %>', delText: '<%= l('Deletion link') %>',
dlText: '<%= l('Download link') %>', dlText: '<%= l('Download link') %>',
download: '<%= l('Download') %>', download: '<%= l('Download') %>',
encrypting: '<%= l('Encrypting part XX1 of XX2') %>', encrypting: '<%= l('Encrypting part XX1 of XX2') %>',
expiration: '<%= l('Expiration:') %>', expiration: '<%= l('Expiration:') %>',
hit: '<%= l('Hit Enter, then Ctrl+C to copy the download link') %>', fileUploaded: '<%= l('File uploaded') %>',
hits: '<%= l('Hit Enter, then Ctrl+C to copy all the download links') %>', hit: '<%= l('Hit Enter, then Ctrl+C to copy the download link') %>',
mailTo: '<%= l('Send all links by email') %>', hits: '<%= l('Hit Enter, then Ctrl+C to copy all the download links') %>',
maxSize: '<%= l('(max size: XXX)') %>', mailTo: '<%= l('Send all links by email') %>',
noLimit: '<%= l('No expiration delay') %>', maxSize: '<%= l('(max size: XXX)') %>',
sending: '<%= l('Sending part XX1 of XX2. Please, be patient, the progress bar can take a while to move.') %>', noLimit: '<%= l('No expiration delay') %>',
wsProblem: '<%= l('Websocket communication error') %>', 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 %>; var maxSize = <%= config('max_file_size') || 0 %>;

View File

@ -6,6 +6,7 @@ var i18n = {
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') %>',
fileDownloaded: '<%= l('File downloaded') %>',
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') %>', showZipContent: '<%= l('Show zip content') %>',

View File

@ -45,6 +45,7 @@
%= 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/jszip.min.js'
%= javascript '/js/lufi-notifications.js'
%= javascript '/js/lufi-down.js' %= javascript '/js/lufi-down.js'
% } % }
% } % }