Fix #8
This commit is contained in:
parent
507ddd0ec4
commit
69151630b3
4
Makefile
4
Makefile
|
@ -7,8 +7,8 @@ REAL_LUFI=script/application
|
|||
LUFI=script/lufi
|
||||
|
||||
locales:
|
||||
$(XGETTEXT) -f $(EXTRACTFILES) -o $(EN)
|
||||
$(XGETTEXT) -f $(EXTRACTFILES) -o $(FR)
|
||||
$(XGETTEXT) -f $(EXTRACTFILES) -o $(EN) 2>/dev/null
|
||||
$(XGETTEXT) -f $(EXTRACTFILES) -o $(FR) 2>/dev/null
|
||||
|
||||
test:
|
||||
$(CARTON) $(REAL_LUFI) test
|
||||
|
|
|
@ -65,23 +65,23 @@ msgstr ""
|
|||
msgid "Copy to clipboard"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:282
|
||||
#: lib/Lufi/Controller/Files.pm:284
|
||||
msgid "Could not find the file. Are you sure of the URL and the token?"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:210
|
||||
#: lib/Lufi/Controller/Files.pm:212
|
||||
msgid "Could not find the file. Are you sure of the URL?"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:17
|
||||
#: themes/default/templates/files.html.ep:25
|
||||
msgid "Counter"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:18 themes/default/templates/index.html.ep:58
|
||||
#: themes/default/templates/files.html.ep:26 themes/default/templates/index.html.ep:58
|
||||
msgid "Delete at first download?"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:21 themes/default/templates/index.html.ep:84
|
||||
#: themes/default/templates/files.html.ep:29 themes/default/templates/index.html.ep:84
|
||||
msgid "Deletion link"
|
||||
msgstr ""
|
||||
|
||||
|
@ -93,7 +93,7 @@ msgstr ""
|
|||
msgid "Download"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:16 themes/default/templates/index.html.ep:85
|
||||
#: themes/default/templates/files.html.ep:24 themes/default/templates/index.html.ep:85
|
||||
msgid "Download link"
|
||||
msgstr ""
|
||||
|
||||
|
@ -117,15 +117,15 @@ msgstr ""
|
|||
msgid "Emails"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:146
|
||||
#: lib/Lufi/Controller/Files.pm:148
|
||||
msgid "Error: the file existed but has been deleted."
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:187
|
||||
#: lib/Lufi/Controller/Files.pm:189
|
||||
msgid "Error: the file has not been send entirely."
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:192
|
||||
#: lib/Lufi/Controller/Files.pm:194
|
||||
msgid "Error: unable to find the file. Are you sure of your URL?"
|
||||
msgstr ""
|
||||
|
||||
|
@ -133,15 +133,19 @@ msgstr ""
|
|||
msgid "Expiration:"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:20
|
||||
#: themes/default/templates/files.html.ep:28
|
||||
msgid "Expires at"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:266
|
||||
#: themes/default/templates/files.html.ep:12
|
||||
msgid "Export localStorage data"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:268
|
||||
msgid "File deleted"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:15
|
||||
#: themes/default/templates/files.html.ep:23
|
||||
msgid "File name"
|
||||
msgstr ""
|
||||
|
||||
|
@ -185,6 +189,10 @@ msgstr ""
|
|||
msgid "If you send the mail from this server, the links will be send to the server, which may lower your privacy protection."
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:14
|
||||
msgid "Import localStorage data"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:30
|
||||
msgid "Important: more information on delays"
|
||||
msgstr ""
|
||||
|
@ -210,11 +218,11 @@ msgid "My files"
|
|||
msgstr ""
|
||||
|
||||
#. (format_bytes($json->{size})
|
||||
#: lib/Lufi/Controller/Files.pm:45
|
||||
#: lib/Lufi/Controller/Files.pm:47
|
||||
msgid "No enough space available on the server for this file (size: %1)."
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:33 themes/default/templates/index.html.ep:91
|
||||
#: themes/default/templates/files.html.ep:41 themes/default/templates/index.html.ep:91
|
||||
msgid "No expiration delay"
|
||||
msgstr ""
|
||||
|
||||
|
@ -235,7 +243,7 @@ msgstr ""
|
|||
msgid "Privacy"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:6
|
||||
#: themes/default/templates/files.html.ep:11
|
||||
msgid "Purge expired files from localStorage"
|
||||
msgstr ""
|
||||
|
||||
|
@ -264,7 +272,7 @@ msgstr ""
|
|||
msgid "Sorry, the uploading is currently disabled. Please try again later."
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:33
|
||||
#: lib/Lufi/Controller/Files.pm:35
|
||||
msgid "Sorry, uploading is disabled."
|
||||
msgstr ""
|
||||
|
||||
|
@ -272,6 +280,10 @@ msgstr ""
|
|||
msgid "The administrator can only see the file's name, its size and its mimetype (what kind of file it is: video, text, etc)."
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:42
|
||||
msgid "The data has been successfully imported."
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Mail.pm:32
|
||||
msgid "The email body can't be empty."
|
||||
msgstr ""
|
||||
|
@ -280,7 +292,7 @@ msgstr ""
|
|||
msgid "The email subject can't be empty."
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:263
|
||||
#: lib/Lufi/Controller/Files.pm:265
|
||||
msgid "The file has already been deleted"
|
||||
msgstr ""
|
||||
|
||||
|
@ -307,12 +319,12 @@ msgid "This server sets limitations according to the file size. The expiration d
|
|||
msgstr ""
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:247
|
||||
#: lib/Lufi/Controller/Files.pm:249
|
||||
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
|
||||
msgstr ""
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:237
|
||||
#: lib/Lufi/Controller/Files.pm:239
|
||||
msgid "Unable to get counter for %1. The token is unvalid."
|
||||
msgstr ""
|
||||
|
||||
|
@ -320,7 +332,7 @@ msgstr ""
|
|||
msgid "Upload files"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/files.html.ep:19
|
||||
#: themes/default/templates/files.html.ep:27
|
||||
msgid "Uploaded at"
|
||||
msgstr ""
|
||||
|
||||
|
@ -361,7 +373,7 @@ msgid "You must give email addresses."
|
|||
msgstr ""
|
||||
|
||||
#. (format_bytes($json->{size})
|
||||
#: lib/Lufi/Controller/Files.pm:39
|
||||
#: lib/Lufi/Controller/Files.pm:41
|
||||
msgid "Your file is too big: %1 (maximum size allowed: %2)"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -71,23 +71,23 @@ msgstr "Copier tous les liens dans le presse-papier"
|
|||
msgid "Copy to clipboard"
|
||||
msgstr "Copier dans le presse-papier"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:282
|
||||
#: lib/Lufi/Controller/Files.pm:284
|
||||
msgid "Could not find the file. Are you sure of the URL and the token?"
|
||||
msgstr "Impossible de retrouver le fichier. Êtes-vous sûr(e) que l’URL et le jeton sont les bons ?"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:210
|
||||
#: lib/Lufi/Controller/Files.pm:212
|
||||
msgid "Could not find the file. Are you sure of the URL?"
|
||||
msgstr "Impossible de retrouver le fichier. Êtes-vous sûr(e) que l’URL est la bonne ?"
|
||||
|
||||
#: themes/default/templates/files.html.ep:17
|
||||
#: themes/default/templates/files.html.ep:25
|
||||
msgid "Counter"
|
||||
msgstr "Compteur"
|
||||
|
||||
#: themes/default/templates/files.html.ep:18 themes/default/templates/index.html.ep:58
|
||||
#: themes/default/templates/files.html.ep:26 themes/default/templates/index.html.ep:58
|
||||
msgid "Delete at first download?"
|
||||
msgstr "Supprimer après le premier téléchargement ?"
|
||||
|
||||
#: themes/default/templates/files.html.ep:21 themes/default/templates/index.html.ep:84
|
||||
#: themes/default/templates/files.html.ep:29 themes/default/templates/index.html.ep:84
|
||||
msgid "Deletion link"
|
||||
msgstr "Lien de suppression"
|
||||
|
||||
|
@ -99,7 +99,7 @@ msgstr "Ne vous inquiétez pas : si un utilisateur commence à télécharger le
|
|||
msgid "Download"
|
||||
msgstr "Télécharger"
|
||||
|
||||
#: themes/default/templates/files.html.ep:16 themes/default/templates/index.html.ep:85
|
||||
#: themes/default/templates/files.html.ep:24 themes/default/templates/index.html.ep:85
|
||||
msgid "Download link"
|
||||
msgstr "Lien de téléchargement"
|
||||
|
||||
|
@ -123,15 +123,15 @@ msgstr "Sujet du mail"
|
|||
msgid "Emails"
|
||||
msgstr "Mails"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:146
|
||||
#: lib/Lufi/Controller/Files.pm:148
|
||||
msgid "Error: the file existed but has been deleted."
|
||||
msgstr "Erreur : le fichier existait mais a été supprimé"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:187
|
||||
#: lib/Lufi/Controller/Files.pm:189
|
||||
msgid "Error: the file has not been send entirely."
|
||||
msgstr "Erreur : le fichier n’a pas été envoyé dans son intégralité"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:192
|
||||
#: lib/Lufi/Controller/Files.pm:194
|
||||
msgid "Error: unable to find the file. Are you sure of your URL?"
|
||||
msgstr "Erreur : impossible de retrouver le fichier. Êtes-vous sûr(e) de l’URL ?"
|
||||
|
||||
|
@ -139,15 +139,19 @@ msgstr "Erreur : impossible de retrouver le fichier. Êtes-vous sûr(e) de l’
|
|||
msgid "Expiration:"
|
||||
msgstr "Expiration :"
|
||||
|
||||
#: themes/default/templates/files.html.ep:20
|
||||
#: themes/default/templates/files.html.ep:28
|
||||
msgid "Expires at"
|
||||
msgstr "Expire le"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:266
|
||||
#: themes/default/templates/files.html.ep:12
|
||||
msgid "Export localStorage data"
|
||||
msgstr "Exporter les données localStorage"
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:268
|
||||
msgid "File deleted"
|
||||
msgstr "Fichier supprimé"
|
||||
|
||||
#: themes/default/templates/files.html.ep:15
|
||||
#: themes/default/templates/files.html.ep:23
|
||||
msgid "File name"
|
||||
msgstr "Nom du fichier"
|
||||
|
||||
|
@ -191,6 +195,10 @@ msgstr "Si vous choisissez un délai, le fichier sera supprimé après ce délai
|
|||
msgid "If you send the mail from this server, the links will be send to the server, which may lower your privacy protection."
|
||||
msgstr "Si vous envoyer le mail depuis ce serveur, les liens seront envoyés au serveur, ce qui peut diminuer la protection de la confidentialité."
|
||||
|
||||
#: themes/default/templates/files.html.ep:14
|
||||
msgid "Import localStorage data"
|
||||
msgstr "Importer des données localStorage"
|
||||
|
||||
#: themes/default/templates/index.html.ep:30
|
||||
msgid "Important: more information on delays"
|
||||
msgstr "Important : plus d’informations sur les délais"
|
||||
|
@ -216,11 +224,11 @@ msgid "My files"
|
|||
msgstr "Mes fichiers"
|
||||
|
||||
#. (format_bytes($json->{size})
|
||||
#: lib/Lufi/Controller/Files.pm:45
|
||||
#: lib/Lufi/Controller/Files.pm:47
|
||||
msgid "No enough space available on the server for this file (size: %1)."
|
||||
msgstr "Espace disque insuffisant sur le serveur pour ce fichier (taille du fichier: %1)."
|
||||
|
||||
#: themes/default/templates/files.html.ep:33 themes/default/templates/index.html.ep:91
|
||||
#: themes/default/templates/files.html.ep:41 themes/default/templates/index.html.ep:91
|
||||
msgid "No expiration delay"
|
||||
msgstr "Pas de délai d’expiration"
|
||||
|
||||
|
@ -245,7 +253,7 @@ msgstr "Veuillez patienter pendant la récupération de votre fichier"
|
|||
msgid "Privacy"
|
||||
msgstr "Confidentialité"
|
||||
|
||||
#: themes/default/templates/files.html.ep:6
|
||||
#: themes/default/templates/files.html.ep:11
|
||||
msgid "Purge expired files from localStorage"
|
||||
msgstr "Supprimer du localStorage les fichiers expirés"
|
||||
|
||||
|
@ -274,7 +282,7 @@ msgstr "Partagez vos fichiers en toute confidentialité sur %1"
|
|||
msgid "Sorry, the uploading is currently disabled. Please try again later."
|
||||
msgstr "Désolé, l’envoi de fichier est actuellement désactivé. Veuillez réessayer plus tard."
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:33
|
||||
#: lib/Lufi/Controller/Files.pm:35
|
||||
msgid "Sorry, uploading is disabled."
|
||||
msgstr "Désolé, l’envoi de fichier est désactivé."
|
||||
|
||||
|
@ -282,6 +290,10 @@ msgstr "Désolé, l’envoi de fichier est désactivé."
|
|||
msgid "The administrator can only see the file's name, its size and its mimetype (what kind of file it is: video, text, etc)."
|
||||
msgstr "L’administrateur ne peut voir que le nom du fichier, sa taille et son type mime (son type de fichier : vidéo, text, etc)."
|
||||
|
||||
#: themes/default/templates/files.html.ep:42
|
||||
msgid "The data has been successfully imported."
|
||||
msgstr "Les données ont été importées avec succès."
|
||||
|
||||
#: lib/Lufi/Controller/Mail.pm:32
|
||||
msgid "The email body can't be empty."
|
||||
msgstr "Le corps du mail ne peut être vide."
|
||||
|
@ -290,7 +302,7 @@ msgstr "Le corps du mail ne peut être vide."
|
|||
msgid "The email subject can't be empty."
|
||||
msgstr "Le sujet du mail ne peut être vide."
|
||||
|
||||
#: lib/Lufi/Controller/Files.pm:263
|
||||
#: lib/Lufi/Controller/Files.pm:265
|
||||
msgid "The file has already been deleted"
|
||||
msgstr "Le fichier a déjà été supprimé"
|
||||
|
||||
|
@ -321,12 +333,12 @@ msgid "Unable to get counter for %1. The file does not exists."
|
|||
msgstr "Impossible de récupérer le compteur de %1. Le fichier n’existe pas."
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:247
|
||||
#: lib/Lufi/Controller/Files.pm:249
|
||||
msgid "Unable to get counter for %1. The file does not exists. It will be removed from your localStorage."
|
||||
msgstr "Impossible de récupérer le compteur pour %1. Le fichier n’existe pas. Il va être supprimé de votre localStorage."
|
||||
|
||||
#. ($short)
|
||||
#: lib/Lufi/Controller/Files.pm:237
|
||||
#: lib/Lufi/Controller/Files.pm:239
|
||||
msgid "Unable to get counter for %1. The token is unvalid."
|
||||
msgstr "Impossible de récupérer le compteur pour %1. Le jeton est invalide."
|
||||
|
||||
|
@ -334,7 +346,7 @@ msgstr "Impossible de récupérer le compteur pour %1. Le jeton est invalide."
|
|||
msgid "Upload files"
|
||||
msgstr "Envoyer des fichiers"
|
||||
|
||||
#: themes/default/templates/files.html.ep:19
|
||||
#: themes/default/templates/files.html.ep:27
|
||||
msgid "Uploaded at"
|
||||
msgstr "Envoyé le"
|
||||
|
||||
|
@ -375,7 +387,7 @@ msgid "You must give email addresses."
|
|||
msgstr "Vous devez envoyer des adresses mail."
|
||||
|
||||
#. (format_bytes($json->{size})
|
||||
#: lib/Lufi/Controller/Files.pm:39
|
||||
#: lib/Lufi/Controller/Files.pm:41
|
||||
msgid "Your file is too big: %1 (maximum size allowed: %2)"
|
||||
msgstr "Votre fichier est trop volumineux : %1 (la taille maximum autorisée est %2)"
|
||||
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
// Add item to localStorage
|
||||
function addItem(item) {
|
||||
var files = localStorage.getItem('files');
|
||||
if (files === null) {
|
||||
files = new Array();
|
||||
} else {
|
||||
files = JSON.parse(files);
|
||||
}
|
||||
files.push(item);
|
||||
localStorage.setItem('files', JSON.stringify(files));
|
||||
}
|
||||
|
||||
function delItem(name) {
|
||||
var files = localStorage.getItem('files');
|
||||
if (files === null) {
|
||||
|
@ -14,6 +26,22 @@ function delItem(name) {
|
|||
localStorage.setItem('files', JSON.stringify(files));
|
||||
}
|
||||
|
||||
function itemExists(name) {
|
||||
var files = localStorage.getItem('files');
|
||||
if (files === null) {
|
||||
return false;
|
||||
} else {
|
||||
files = JSON.parse(files);
|
||||
var i;
|
||||
for (i = 0; i < files.length; i++) {
|
||||
if (files[i].short === name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function purgeExpired() {
|
||||
var files = JSON.parse(localStorage.getItem('files'));
|
||||
|
||||
|
@ -36,9 +64,58 @@ function purgeExpired() {
|
|||
});
|
||||
}
|
||||
|
||||
function exportStorage() {
|
||||
var a = document.createElement("a");
|
||||
a.style = "display: none";
|
||||
document.body.appendChild(a);
|
||||
|
||||
var storageData = [localStorage.getItem('files')];
|
||||
var exportFile = new File(storageData, 'data.json', {type : 'application/json'});
|
||||
var url = window.URL.createObjectURL(exportFile);
|
||||
|
||||
a.href = url;
|
||||
a.setAttribute('download', 'data.json');
|
||||
a.click();
|
||||
a.remove();
|
||||
}
|
||||
|
||||
function importStorage(f) {
|
||||
var reader = new FileReader();
|
||||
reader.addEventListener("loadend", function() {
|
||||
try {
|
||||
var newFiles = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(reader.result)));
|
||||
var i;
|
||||
var hasImported = 0;
|
||||
for (i = 0; i < newFiles.length; i++) {
|
||||
var item = newFiles[i];
|
||||
if (!itemExists(item.short)) {
|
||||
addItem(item);
|
||||
hasImported++;
|
||||
}
|
||||
}
|
||||
populateFilesTable();
|
||||
|
||||
alert(i18n.importProcessed);
|
||||
} catch(err) {
|
||||
alert(err);
|
||||
}
|
||||
});
|
||||
reader.readAsArrayBuffer(f[0]);
|
||||
}
|
||||
|
||||
function populateFilesTable() {
|
||||
document.getElementById('myfiles').innerHTML = '';
|
||||
|
||||
var files = JSON.parse(localStorage.getItem('files'));
|
||||
files.reverse();
|
||||
files.sort(function(a, b) {
|
||||
if (a.created_at < b.created_at) {
|
||||
return -1;
|
||||
} else if (a.created_at > b.created_at) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
});
|
||||
files.forEach(function(element, index, array) {
|
||||
var del_view = (element.del_at_first_view) ? '<span class="icon icon-ok"></span>' : '<span class="icon icon-cancel"></span>';
|
||||
var dlink = baseURL+'d/'+element.short+'/'+element.token;
|
||||
|
|
|
@ -2,11 +2,19 @@
|
|||
<h2><%= l('My files') %></h2>
|
||||
<hr>
|
||||
|
||||
|
||||
<p>
|
||||
<a href="#" onclick="purgeExpired();" class="pull-right btn btn-info btn-xs left-mg"><%= l('Purge expired files from localStorage') %></a>
|
||||
<%= l('Only the files sent with this browser will be listed here. The informations are stored in localStorage: if you delete your localStorage data, you\'ll loose this informations.') %><br>
|
||||
<%= l('Rows in red means that the file has expired and is no longer available.') %>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="purgeExpired();" class="btn btn-info btn-xs left-mg"><%= l('Purge expired files from localStorage') %></a>
|
||||
<a href="#" onclick="exportStorage();" class="btn btn-info btn-xs left-mg"><%= l('Export localStorage data') %></a>
|
||||
<label>
|
||||
<span class="btn btn-info btn-xs left-mg"><%= l('Import localStorage data') %></span>
|
||||
<input type="file" onchange="importStorage(this.files)" class="hidden">
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
|
@ -30,7 +38,8 @@
|
|||
var baseURL = '<%== url_for('/')->to_abs() %>';
|
||||
var counterURL = '<%== url_for('counter') %>';
|
||||
var i18n = {
|
||||
noExpiration: '<%= l('No expiration delay') %>',
|
||||
noExpiration: '<%= l('No expiration delay') %>',
|
||||
importProcessed: '<%= l('The data has been successfully imported.') %>',
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
populateFilesTable();
|
||||
|
|
Loading…
Reference in New Issue