Fix #154 — Make localStorage key prefix-dependant
This commit is contained in:
parent
4e36dd2b89
commit
8d85cdf8eb
|
@ -1,6 +1,9 @@
|
||||||
Revision history for Lufi
|
Revision history for Lufi
|
||||||
|
|
||||||
?.??.? ????-??-??
|
?.??.? ????-??-??
|
||||||
|
- LocalStorage key is now prefix-dependant (#154)
|
||||||
|
This allow to not mix up files in localStorage for two instances if they
|
||||||
|
are on the same domain
|
||||||
|
|
||||||
0.04.0 2019-08-04
|
0.04.0 2019-08-04
|
||||||
- Allow to zip the files before upload
|
- Allow to zip the files before upload
|
||||||
|
|
|
@ -419,6 +419,14 @@ msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"لوفي أو Lufi برنامج حر (كما هو الحال في حرية التعبير) لاستضافة الملفات."
|
"لوفي أو Lufi برنامج حر (كما هو الحال في حرية التعبير) لاستضافة الملفات."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr "البريد"
|
msgstr "البريد"
|
||||||
|
|
|
@ -441,6 +441,14 @@ msgstr "Sortida"
|
||||||
msgid "Lufi is a free (as in free speech) file hosting software."
|
msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr "Lufi és programari lliure d'allotjament de fitxers."
|
msgstr "Lufi és programari lliure d'allotjament de fitxers."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr "Mail"
|
msgstr "Mail"
|
||||||
|
|
|
@ -451,6 +451,14 @@ msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Lufi ist eine kostenlose (wie in der Redefreiheit) Datei-Hosting-Software."
|
"Lufi ist eine kostenlose (wie in der Redefreiheit) Datei-Hosting-Software."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr "E-Mail"
|
msgstr "E-Mail"
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgstr ""
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"PO-Revision-Date: 2019-08-04 05:31+0000\n"
|
"PO-Revision-Date: 2019-08-09 05:28+0000\n"
|
||||||
"Last-Translator: Luc Didry <luc@framasoft.org>\n"
|
"Last-Translator: Luc Didry <luc@framasoft.org>\n"
|
||||||
"Language-Team: English\n"
|
"Language-Team: English\n"
|
||||||
"Language: en\n"
|
"Language: en\n"
|
||||||
|
@ -435,6 +435,18 @@ msgstr "Logout"
|
||||||
msgid "Lufi is a free (as in free speech) file hosting software."
|
msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr "Lufi is a free (as in free speech) file hosting software."
|
msgstr "Lufi is a free (as in free speech) file hosting software."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr "Mail"
|
msgstr "Mail"
|
||||||
|
|
|
@ -11,7 +11,7 @@ msgstr ""
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"PO-Revision-Date: 2019-08-04 05:33+0000\n"
|
"PO-Revision-Date: 2019-08-09 05:27+0000\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"X-Generator: Zanata 4.6.2\n"
|
"X-Generator: Zanata 4.6.2\n"
|
||||||
"Last-Translator: Luc Didry <luc@framasoft.org>\n"
|
"Last-Translator: Luc Didry <luc@framasoft.org>\n"
|
||||||
|
@ -452,6 +452,19 @@ msgstr "Déconnexion"
|
||||||
msgid "Lufi is a free (as in free speech) file hosting software."
|
msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr "Lufi est un logiciel libre d’hébergement de fichiers."
|
msgstr "Lufi est un logiciel libre d’hébergement de fichiers."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
"Lufi a récemment changé sa façon de stocker l'information des fichiers."
|
||||||
|
"\\n\\nAucun fichier n'a été trouvé dans le nouvel emplacement localStorage "
|
||||||
|
"mais nous avons trouvé des fichiers dans l'ancien.\\nVoulez-vous importer "
|
||||||
|
"ces informations ?\\n\\nVeuillez noter que c'est la seule fois que nous "
|
||||||
|
"posons cette question."
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr "Mail"
|
msgstr "Mail"
|
||||||
|
|
|
@ -11,7 +11,7 @@ msgstr ""
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"PO-Revision-Date: 2019-08-04 05:34+0000\n"
|
"PO-Revision-Date: 2019-08-09 05:27+0000\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"X-Generator: Zanata 4.6.2\n"
|
"X-Generator: Zanata 4.6.2\n"
|
||||||
"Last-Translator: Luc Didry <luc@framasoft.org>\n"
|
"Last-Translator: Luc Didry <luc@framasoft.org>\n"
|
||||||
|
@ -452,6 +452,19 @@ msgstr "Déconnexion"
|
||||||
msgid "Lufi is a free (as in free speech) file hosting software."
|
msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr "Lufi est un logiciel libre d’hébergement de fichiers."
|
msgstr "Lufi est un logiciel libre d’hébergement de fichiers."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
"Lufi a récemment changé sa façon de stocker l'information des fichiers."
|
||||||
|
"\\n\\nAucun fichier n'a été trouvé dans le nouvel emplacement localStorage "
|
||||||
|
"mais nous avons trouvé des fichiers dans l'ancien.\\nVoulez-vous importer "
|
||||||
|
"ces informations ?\\n\\nVeuillez noter que c'est la seule fois que nous "
|
||||||
|
"posons cette question."
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr "Mail"
|
msgstr "Mail"
|
||||||
|
|
|
@ -435,6 +435,14 @@ msgstr "Logout"
|
||||||
msgid "Lufi is a free (as in free speech) file hosting software."
|
msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr "Lufi è un software libero di file hosting."
|
msgstr "Lufi è un software libero di file hosting."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -393,6 +393,10 @@ msgstr ""
|
||||||
msgid "Lufi is a free (as in free speech) file hosting software."
|
msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid "Lufi recently changed its way to store files information.\\n\\nNo files have been found in the new localStorage location but we found files in the old one.\\nDo you want to import those informations?\\n\\nPlease note that this is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -433,6 +433,14 @@ msgstr "Logout"
|
||||||
msgid "Lufi is a free (as in free speech) file hosting software."
|
msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr "Lufi is een gratis bestand hosting software."
|
msgstr "Lufi is een gratis bestand hosting software."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -450,6 +450,14 @@ msgstr "Desconnexion"
|
||||||
msgid "Lufi is a free (as in free speech) file hosting software."
|
msgid "Lufi is a free (as in free speech) file hosting software."
|
||||||
msgstr "Lufi es un logicial liure d’albèrgament de fichièrs."
|
msgstr "Lufi es un logicial liure d’albèrgament de fichièrs."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr "Corrièl"
|
msgstr "Corrièl"
|
||||||
|
|
|
@ -443,6 +443,14 @@ msgstr ""
|
||||||
"Lufi é um programa de reserva gratuita (como na liberdade de expressão) de "
|
"Lufi é um programa de reserva gratuita (como na liberdade de expressão) de "
|
||||||
"ficheiros."
|
"ficheiros."
|
||||||
|
|
||||||
|
#: themes/default/templates/partial/files.js.ep:12
|
||||||
|
msgid ""
|
||||||
|
"Lufi recently changed its way to store files information.\\n\\nNo files have "
|
||||||
|
"been found in the new localStorage location but we found files in the old "
|
||||||
|
"one.\\nDo you want to import those informations?\\n\\nPlease note that this "
|
||||||
|
"is the only time that we ask this question."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: themes/default/templates/files.html.ep:33
|
#: themes/default/templates/files.html.ep:33
|
||||||
msgid "Mail"
|
msgid "Mail"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
// vim:set sw=4 ts=4 sts=4 ft=javascript expandtab:
|
// vim:set sw=4 ts=4 sts=4 ft=javascript expandtab:
|
||||||
// Add item to localStorage
|
// Add item to localStorage
|
||||||
function addItem(item) {
|
function addItem(item) {
|
||||||
var files = localStorage.getItem('files');
|
var files = localStorage.getItem(window.prefix + 'files');
|
||||||
if (files === null) {
|
if (files === null) {
|
||||||
files = new Array();
|
files = new Array();
|
||||||
} else {
|
} else {
|
||||||
files = JSON.parse(files);
|
files = JSON.parse(files);
|
||||||
}
|
}
|
||||||
files.push(item);
|
files.push(item);
|
||||||
localStorage.setItem('files', JSON.stringify(files));
|
localStorage.setItem(window.prefix + 'files', JSON.stringify(files));
|
||||||
}
|
}
|
||||||
|
|
||||||
function delItem(name) {
|
function delItem(name) {
|
||||||
var files = localStorage.getItem('files');
|
var files = localStorage.getItem(window.prefix + 'files');
|
||||||
if (files === null) {
|
if (files === null) {
|
||||||
files = new Array();
|
files = new Array();
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,11 +24,11 @@ function delItem(name) {
|
||||||
files.splice(i, 1);
|
files.splice(i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
localStorage.setItem('files', JSON.stringify(files));
|
localStorage.setItem(window.prefix + 'files', JSON.stringify(files));
|
||||||
}
|
}
|
||||||
|
|
||||||
function itemExists(name) {
|
function itemExists(name) {
|
||||||
var files = localStorage.getItem('files');
|
var files = localStorage.getItem(window.prefix + 'files');
|
||||||
if (files === null) {
|
if (files === null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,7 +45,7 @@ function itemExists(name) {
|
||||||
|
|
||||||
function purgeExpired(event) {
|
function purgeExpired(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var files = JSON.parse(localStorage.getItem('files'));
|
var files = JSON.parse(localStorage.getItem(window.prefix + 'files'));
|
||||||
|
|
||||||
files.forEach(function(element, index, array) {
|
files.forEach(function(element, index, array) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -74,7 +74,7 @@ function exportStorage(event) {
|
||||||
a.hide();
|
a.hide();
|
||||||
$('body').append(a);
|
$('body').append(a);
|
||||||
|
|
||||||
var storageData = [localStorage.getItem('files')];
|
var storageData = [localStorage.getItem(window.prefix + 'files')];
|
||||||
var exportFile = new Blob(storageData, {type : 'application/json'});
|
var exportFile = new Blob(storageData, {type : 'application/json'});
|
||||||
var url = window.URL.createObjectURL(exportFile);
|
var url = window.URL.createObjectURL(exportFile);
|
||||||
|
|
||||||
|
@ -164,9 +164,20 @@ function massDelete(event) {
|
||||||
function populateFilesTable() {
|
function populateFilesTable() {
|
||||||
$('#myfiles').empty();
|
$('#myfiles').empty();
|
||||||
|
|
||||||
var files = localStorage.getItem('files');
|
var files = localStorage.getItem(window.prefix + 'files');
|
||||||
if (files === null) {
|
if (files === null) {
|
||||||
files = new Array();
|
var filesWithoutPrefix = localStorage.getItem('files');
|
||||||
|
if (filesWithoutPrefix !== null) {
|
||||||
|
if (window.confirm(i18n.importFilesWithoutPrefix)) {
|
||||||
|
localStorage.setItem(window.prefix + 'files', filesWithoutPrefix);
|
||||||
|
files = JSON.parse(filesWithoutPrefix);
|
||||||
|
} else {
|
||||||
|
localStorage.setItem(window.prefix + 'files', JSON.stringify([]));
|
||||||
|
files = new Array();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
files = new Array();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
files = JSON.parse(files);
|
files = JSON.parse(files);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,14 +68,14 @@ function copyAllToClipboard(event) {
|
||||||
|
|
||||||
// Add item to localStorage
|
// Add item to localStorage
|
||||||
function addItem(name, url, size, del_at_first_view, created_at, delay, short, token) {
|
function addItem(name, url, size, del_at_first_view, created_at, delay, short, token) {
|
||||||
var files = localStorage.getItem('files');
|
var files = localStorage.getItem(window.prefix + 'files');
|
||||||
if (files === null) {
|
if (files === null) {
|
||||||
files = new Array();
|
files = new Array();
|
||||||
} else {
|
} else {
|
||||||
files = JSON.parse(files);
|
files = JSON.parse(files);
|
||||||
}
|
}
|
||||||
files.push({ name: name, short: short, url: url, size: size, del_at_first_view: del_at_first_view, created_at: created_at, delay: delay, token: token });
|
files.push({ name: name, short: short, url: url, size: size, del_at_first_view: del_at_first_view, created_at: created_at, delay: delay, token: token });
|
||||||
localStorage.setItem('files', JSON.stringify(files));
|
localStorage.setItem(window.prefix + 'files', JSON.stringify(files));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a file block
|
// Remove a file block
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
var actionURL = '<%= url_for('/')->to_abs() %>';
|
var actionURL = '<%= url_for('/')->to_abs() %>';
|
||||||
var counterURL = '<%== url_for('counter') %>';
|
var counterURL = '<%== url_for('counter') %>';
|
||||||
var i18n = {
|
var i18n = {
|
||||||
noExpiration: '<%= l('No expiration delay') %>',
|
noExpiration: '<%= l('No expiration delay') %>',
|
||||||
importProcessed: '<%= l('The data has been successfully imported.') %>',
|
importProcessed: '<%= l('The data has been successfully imported.') %>',
|
||||||
|
importFilesWithoutPrefix: "<%= l('Lufi recently changed its way to store files information.\n\nNo files have been found in the new localStorage location but we found files in the old one.\nDo you want to import those informations?\n\nPlease note that this is the only time that we ask this question.') %>",
|
||||||
};
|
};
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
populateFilesTable();
|
populateFilesTable();
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
% # vim:set sts=4 sw=4 ts=4 ft=javascript expandtab:
|
% # vim:set sts=4 sw=4 ts=4 ft=javascript expandtab:
|
||||||
var langUrl = '<%= url_for('lang') %>';
|
var langUrl = '<%= url_for('lang') %>';
|
||||||
|
var prefix = '<%= substr(config('prefix'), 1) %>';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
% # vim:set sts=4 sw=4 ts=4 ft=javascript expandtab:
|
% # vim:set sts=4 sw=4 ts=4 ft=javascript expandtab:
|
||||||
function findItem(name) {
|
function findItem(name) {
|
||||||
var files = localStorage.getItem('files');
|
var files = localStorage.getItem(window.prefix + 'files');
|
||||||
if (files === null) {
|
if (files === null) {
|
||||||
files = new Array();
|
files = new Array();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue