diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a3d9dab..50d967e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,8 +79,8 @@ variables: ## # include: - - 'https://framagit.org/fiat-tux/gitlabci-snippets/raw/master/publish_changelog.yml' - - 'https://framagit.org/fiat-tux/gitlabci-snippets/raw/master/pouet-it-from-ci.yml' + - 'https://framagit.org/fiat-tux/gitlabci-snippets/raw/4e4e03322e95e9b0124c714456ebf1bdc02ad43f/publish_changelog.gitlab-ci.yml' + - 'https://framagit.org/fiat-tux/gitlabci-snippets/raw/4e4e03322e95e9b0124c714456ebf1bdc02ad43f/pouet-it-from-ci.gitlab-ci.yml' ### Podcheck ## diff --git a/AUTHORS.md b/AUTHORS.md index b93db5f..cbfbe5f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -28,6 +28,7 @@ - alexandre.LG, http://inios.fr/ - Mildis (bugfix) - TECH'advantage, https://www.tech-advantage.com/ (paid for LDAP invitations feature) +- pi2 (typo) ## Vulnerabilities / bug hunters 🐛 diff --git a/CHANGELOG b/CHANGELOG index 7a45ce7..8dcb619 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,15 @@ 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 + - Fix bug on cookie-based language choice when using two instances on same + domain, with one’s path is the beginning of the other instance’s path. + WARNING! You need to do a `carton install --deployment …` to have the fix. + - Fix navbar bug (there can be too much items in it, depending on Lufi + settings (LDAP, invitations…), trouble beginning at screens < 1800px) + - Add setting to customize the instance name (#156) 0.04.0 2019-08-04 - Allow to zip the files before upload diff --git a/cpanfile b/cpanfile index bf8f1ee..b6909da 100644 --- a/cpanfile +++ b/cpanfile @@ -6,7 +6,7 @@ requires 'Mojolicious::Plugin::Mail'; requires 'Mojolicious::Plugin::GzipStatic'; requires 'Mojolicious::Plugin::StaticCache'; requires 'Mojolicious::Plugin::CSPHeader', '>= 0.06'; -requires 'Mojolicious::Plugin::FiatTux::Helpers', '== 0.08', url => 'https://framagit.org/fiat-tux/mojolicious/mojolicious-plugin-fiattux-helpers/-/archive/0.08/mojolicious-plugin-fiattux-helpers-0.08.tar.gz'; +requires 'Mojolicious::Plugin::FiatTux::Helpers', '== 0.10', url => 'https://framagit.org/fiat-tux/mojolicious/mojolicious-plugin-fiattux-helpers/-/archive/0.10/mojolicious-plugin-fiattux-helpers-0.10.tar.gz'; requires 'Mojolicious::Plugin::FiatTux::GrantAccess', '== 0.06', url => 'https://framagit.org/fiat-tux/mojolicious/mojolicious-plugin-fiattux-grantaccess/-/archive/0.06/mojolicious-plugin-fiattux-grantaccess-0.06.tar.gz'; requires 'Mojolicious::Plugin::FiatTux::Themes', '== 0.02', url => 'https://framagit.org/fiat-tux/mojolicious/mojolicious-plugin-fiattux-themes/-/archive/0.02/mojolicious-plugin-fiattux-themes-0.02.tar.gz'; requires 'Filesys::DiskUsage'; diff --git a/lib/Lufi/DefaultConfig.pm b/lib/Lufi/DefaultConfig.pm index bc802f7..7385778 100644 --- a/lib/Lufi/DefaultConfig.pm +++ b/lib/Lufi/DefaultConfig.pm @@ -4,6 +4,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw($default_config); our $default_config = { + instance_name => 'Lufi', prefix => '/', provisioning => 100, provis_step => 5, diff --git a/lufi.conf.template b/lufi.conf.template index 647d944..bb01829 100644 --- a/lufi.conf.template +++ b/lufi.conf.template @@ -32,6 +32,10 @@ # optional, default is ['fdjsofjoihrei'], PLEASE, CHANGE IT #secrets => ['fdjsofjoihrei'], + # Name of the instance, displayed next to the logo + # optional, default is Lufi + #instance_name => 'Lufi', + # Choose a theme. See the available themes in `themes` directory # Optional, default is 'default' #theme => 'default', diff --git a/themes/default/lib/Lufi/I18N/ar.po b/themes/default/lib/Lufi/I18N/ar.po index 4d2bd74..bfa417e 100644 --- a/themes/default/lib/Lufi/I18N/ar.po +++ b/themes/default/lib/Lufi/I18N/ar.po @@ -419,6 +419,14 @@ msgid "Lufi is a free (as in free speech) file hosting software." msgstr "" "لوفي أو 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 will ask you this." +msgstr "" + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "البريد" diff --git a/themes/default/lib/Lufi/I18N/ca.po b/themes/default/lib/Lufi/I18N/ca.po index 0ee9db9..e11d319 100644 --- a/themes/default/lib/Lufi/I18N/ca.po +++ b/themes/default/lib/Lufi/I18N/ca.po @@ -441,6 +441,14 @@ msgstr "Sortida" msgid "Lufi is a free (as in free speech) file hosting software." 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 will ask you this." +msgstr "" + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "Mail" diff --git a/themes/default/lib/Lufi/I18N/de.po b/themes/default/lib/Lufi/I18N/de.po index 9a8ecb1..fa007ff 100644 --- a/themes/default/lib/Lufi/I18N/de.po +++ b/themes/default/lib/Lufi/I18N/de.po @@ -451,6 +451,14 @@ msgid "Lufi is a free (as in free speech) file hosting software." msgstr "" "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 will ask you this." +msgstr "" + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "E-Mail" diff --git a/themes/default/lib/Lufi/I18N/en.po b/themes/default/lib/Lufi/I18N/en.po index b29bf89..02469ea 100644 --- a/themes/default/lib/Lufi/I18N/en.po +++ b/themes/default/lib/Lufi/I18N/en.po @@ -8,7 +8,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2019-08-04 05:31+0000\n" +"PO-Revision-Date: 2019-08-09 05:52+0000\n" "Last-Translator: Luc Didry \n" "Language-Team: English\n" "Language: en\n" @@ -435,6 +435,18 @@ msgstr "Logout" msgid "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 will ask you this." +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 will ask you this." + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "Mail" diff --git a/themes/default/lib/Lufi/I18N/fr.po b/themes/default/lib/Lufi/I18N/fr.po index cbda1ec..2e9b7f8 100644 --- a/themes/default/lib/Lufi/I18N/fr.po +++ b/themes/default/lib/Lufi/I18N/fr.po @@ -11,7 +11,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2019-08-04 05:33+0000\n" +"PO-Revision-Date: 2019-08-09 05:52+0000\n" "Language-Team: \n" "X-Generator: Zanata 4.6.2\n" "Last-Translator: Luc Didry \n" @@ -452,6 +452,19 @@ msgstr "Déconnexion" msgid "Lufi is a free (as in free speech) file hosting software." 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 will ask you this." +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 vous " +"poserons cette question." + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "Mail" diff --git a/themes/default/lib/Lufi/I18N/fr_FR.po b/themes/default/lib/Lufi/I18N/fr_FR.po index 6bf9f89..4103681 100644 --- a/themes/default/lib/Lufi/I18N/fr_FR.po +++ b/themes/default/lib/Lufi/I18N/fr_FR.po @@ -11,7 +11,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2019-08-04 05:34+0000\n" +"PO-Revision-Date: 2019-08-09 05:52+0000\n" "Language-Team: \n" "X-Generator: Zanata 4.6.2\n" "Last-Translator: Luc Didry \n" @@ -452,6 +452,19 @@ msgstr "Déconnexion" msgid "Lufi is a free (as in free speech) file hosting software." 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 will ask you this." +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 vous " +"poserons cette question." + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "Mail" diff --git a/themes/default/lib/Lufi/I18N/it.po b/themes/default/lib/Lufi/I18N/it.po index 436c980..e855d33 100644 --- a/themes/default/lib/Lufi/I18N/it.po +++ b/themes/default/lib/Lufi/I18N/it.po @@ -435,6 +435,14 @@ msgstr "Logout" msgid "Lufi is a free (as in free speech) file hosting software." 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 will ask you this." +msgstr "" + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "" diff --git a/themes/default/lib/Lufi/I18N/lufi.pot b/themes/default/lib/Lufi/I18N/lufi.pot index c1c09fb..9510c42 100644 --- a/themes/default/lib/Lufi/I18N/lufi.pot +++ b/themes/default/lib/Lufi/I18N/lufi.pot @@ -393,6 +393,10 @@ msgstr "" msgid "Lufi is a free (as in free speech) file hosting software." 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 will ask you this." +msgstr "" + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "" diff --git a/themes/default/lib/Lufi/I18N/nl.po b/themes/default/lib/Lufi/I18N/nl.po index 8801b88..4b84d06 100644 --- a/themes/default/lib/Lufi/I18N/nl.po +++ b/themes/default/lib/Lufi/I18N/nl.po @@ -433,6 +433,14 @@ msgstr "Logout" msgid "Lufi is a free (as in free speech) file 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 will ask you this." +msgstr "" + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "" diff --git a/themes/default/lib/Lufi/I18N/oc.po b/themes/default/lib/Lufi/I18N/oc.po index fda28df..1fc5e0e 100644 --- a/themes/default/lib/Lufi/I18N/oc.po +++ b/themes/default/lib/Lufi/I18N/oc.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2019-08-04 05:34+0000\n" -"Last-Translator: Luc Didry \n" +"PO-Revision-Date: 2019-08-09 05:54+0000\n" +"Last-Translator: Quentí\n" "Language-Team: Tot en òc (totenoc.eu)\n" "Language: oc\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" @@ -450,6 +450,19 @@ msgstr "Desconnexion" msgid "Lufi is a free (as in free speech) file hosting software." 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 will ask you this." +msgstr "" +"Lufi cambièt recentament son biais de gardar las informacions dels fichièrs." +"\\n\\nCap de fichièr es estat trobat dins ’emplaçament del novèl " +"localStorage mas avèm trobat de fichièrs dins l’ancian.\\nVolètz importar " +"aquelas informacions ?\\n\\nNotatz que serà lo sol còp que vos demandarem " +"aquò." + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "Corrièl" diff --git a/themes/default/lib/Lufi/I18N/pt.po b/themes/default/lib/Lufi/I18N/pt.po index 291baa4..c71ee67 100644 --- a/themes/default/lib/Lufi/I18N/pt.po +++ b/themes/default/lib/Lufi/I18N/pt.po @@ -443,6 +443,14 @@ msgstr "" "Lufi é um programa de reserva gratuita (como na liberdade de expressão) de " "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 will ask you this." +msgstr "" + #: themes/default/templates/files.html.ep:33 msgid "Mail" msgstr "" diff --git a/themes/default/public/css/lufi.css b/themes/default/public/css/lufi.css index ea2433f..5277c63 100644 --- a/themes/default/public/css/lufi.css +++ b/themes/default/public/css/lufi.css @@ -223,6 +223,31 @@ button.pulse { .small-h1 { font-size: 2.2rem; } + +@media only screen and (max-width: 1800px) { + ul.hide-on-med-and-down { + display: none !important; + } + nav a.button-collapse { + display: block !important; + } + nav .brand-logo { + left: 50%; + transform: translateX(-50%); + } + nav .brand-logo.left, nav .brand-logo.right { + padding: 0; + transform: none; + } + nav .brand-logo.left { + left: 0.5rem; + } + nav .brand-logo.right { + right: 0.5rem; + left: auto; + } +} + .white-background { background-color: #FFF; } diff --git a/themes/default/public/js/lufi-files.js b/themes/default/public/js/lufi-files.js index 0910f1d..18ce122 100644 --- a/themes/default/public/js/lufi-files.js +++ b/themes/default/public/js/lufi-files.js @@ -1,18 +1,18 @@ // vim:set sw=4 ts=4 sts=4 ft=javascript expandtab: // Add item to localStorage function addItem(item) { - var files = localStorage.getItem('files'); + var files = localStorage.getItem(window.prefix + 'files'); if (files === null) { files = new Array(); } else { files = JSON.parse(files); } files.push(item); - localStorage.setItem('files', JSON.stringify(files)); + localStorage.setItem(window.prefix + 'files', JSON.stringify(files)); } function delItem(name) { - var files = localStorage.getItem('files'); + var files = localStorage.getItem(window.prefix + 'files'); if (files === null) { files = new Array(); } else { @@ -24,11 +24,11 @@ function delItem(name) { files.splice(i, 1); } } - localStorage.setItem('files', JSON.stringify(files)); + localStorage.setItem(window.prefix + 'files', JSON.stringify(files)); } function itemExists(name) { - var files = localStorage.getItem('files'); + var files = localStorage.getItem(window.prefix + 'files'); if (files === null) { return false; } else { @@ -45,7 +45,7 @@ function itemExists(name) { function purgeExpired(event) { event.preventDefault(); - var files = JSON.parse(localStorage.getItem('files')); + var files = JSON.parse(localStorage.getItem(window.prefix + 'files')); files.forEach(function(element, index, array) { $.ajax({ @@ -74,7 +74,7 @@ function exportStorage(event) { a.hide(); $('body').append(a); - var storageData = [localStorage.getItem('files')]; + var storageData = [localStorage.getItem(window.prefix + 'files')]; var exportFile = new Blob(storageData, {type : 'application/json'}); var url = window.URL.createObjectURL(exportFile); @@ -164,9 +164,20 @@ function massDelete(event) { function populateFilesTable() { $('#myfiles').empty(); - var files = localStorage.getItem('files'); + var files = localStorage.getItem(window.prefix + 'files'); 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 { files = JSON.parse(files); } diff --git a/themes/default/public/js/lufi-up.js b/themes/default/public/js/lufi-up.js index 42a6352..caca705 100644 --- a/themes/default/public/js/lufi-up.js +++ b/themes/default/public/js/lufi-up.js @@ -68,14 +68,14 @@ function copyAllToClipboard(event) { // Add item to localStorage 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) { files = new Array(); } else { 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 }); - localStorage.setItem('files', JSON.stringify(files)); + localStorage.setItem(window.prefix + 'files', JSON.stringify(files)); } // Remove a file block diff --git a/themes/default/templates/invitations/invite.html.ep b/themes/default/templates/invitations/invite.html.ep index 65124cf..fee45f7 100644 --- a/themes/default/templates/invitations/invite.html.ep +++ b/themes/default/templates/invitations/invite.html.ep @@ -39,7 +39,7 @@ - +