From b7d4ea0a23f3d37eda4bcdc5a431f41cadd5503d Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Mon, 5 Jun 2017 17:57:03 +0200 Subject: [PATCH] Fix #27 Handle too much images in zip download URL This commit is dedicated to Schoumi, who is supporting me on Tipeee. Many thanks :-) --- lib/Lutim.pm | 1 + lib/Lutim/Controller.pm | 178 +++++++++++++++------------ lutim.conf.template | 8 ++ themes/default/lib/Lutim/I18N/de.po | 26 +++- themes/default/lib/Lutim/I18N/en.po | 26 +++- themes/default/lib/Lutim/I18N/es.po | 26 +++- themes/default/lib/Lutim/I18N/fr.po | 28 ++++- themes/default/lib/Lutim/I18N/oc.po | 26 +++- themes/default/templates/zip.html.ep | 31 +++++ 9 files changed, 254 insertions(+), 96 deletions(-) create mode 100644 themes/default/templates/zip.html.ep diff --git a/lib/Lutim.pm b/lib/Lutim.pm index 6958a30..e356406 100644 --- a/lib/Lutim.pm +++ b/lib/Lutim.pm @@ -41,6 +41,7 @@ sub startup { thumbnail_size => 100, theme => 'default', dbtype => 'sqlite', + max_files_in_zip => 15, } }); diff --git a/lib/Lutim/Controller.pm b/lib/Lutim/Controller.pm index bff11ee..54acf3e 100644 --- a/lib/Lutim/Controller.pm +++ b/lib/Lutim/Controller.pm @@ -1,7 +1,7 @@ # vim:set sw=4 ts=4 sts=4 expandtab: package Lutim::Controller; use Mojo::Base 'Mojolicious::Controller'; -use Mojo::Util qw(url_unescape b64_encode); +use Mojo::Util qw(url_escape url_unescape b64_encode); use Mojo::Asset::Memory; use Mojo::JSON qw(true false); use Lutim::DB::Image; @@ -625,101 +625,119 @@ sub zip { my $c = shift; my $imgs = $c->every_param('i'); - my $zip = Archive::Zip->new(); + my $img_nb = scalar(@{$imgs}); + my $max_zip = $c->config('max_files_in_zip'); - # We HAVE to add a png file at the beginning, otherwise the $zip - # could use the mimetype of an SVG file if it's the first file asked. - $zip->addFile('themes/default/public/img/favicon.png', 'hosted_with_lutim.png'); + if ($img_nb <= $max_zip) { + my $zip = Archive::Zip->new(); - $zip->addDirectory('images/'); - for my $img (@{$imgs}) { - my ($short, $key) = split('/', $img); - if (defined $key) { - $key =~ s/\.[^.]*//; - } else { - $short =~ s/\.[^.]*//; - } - my $image = Lutim::DB::Image->new(app => $c->app, short => $short); + # We HAVE to add a png file at the beginning, otherwise the $zip + # could use the mimetype of an SVG file if it's the first file asked. + $zip->addFile('themes/default/public/img/favicon.png', 'hosted_with_lutim.png'); - if ($image->enabled && $image->path) { - my $filename = $image->filename; - if($image->delete_at_day && $image->created_at + $image->delete_at_day * 86400 <= time()) { - # Log deletion - $c->app->log->info('[DELETION] someone tried to view '.$image->filename.' but it has been removed by expiration (path: '.$image->path.')'); - - # Delete image - $c->delete_image($image); - - # Warn user - $zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$filename.'.txt'); - next; - } - - # Delete image if needed - if ($image->delete_at_first_view && $image->counter >= 1) { - # Log deletion - $c->app->log->info('[DELETION] someone made '.$image->filename.' removed (path: '.$image->path.')'); - - # Delete image - $c->delete_image($image); - - $zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$filename.'.txt'); - next; + $zip->addDirectory('images/'); + for my $img (@{$imgs}) { + my ($short, $key) = split('/', $img); + if (defined $key) { + $key =~ s/\.[^.]*//; } else { - my $expires = ($image->delete_at_day) ? $image->delete_at_day : 360; - my $dt = DateTime->from_epoch( epoch => $expires * 86400 + $image->created_at); - $dt->set_time_zone('GMT'); - $expires = $dt->strftime("%a, %d %b %Y %H:%M:%S GMT"); + $short =~ s/\.[^.]*//; + } + my $image = Lutim::DB::Image->new(app => $c->app, short => $short); - my $path = $image->path; - unless ( -f $path && -r $path ) { - $c->app->log->error("Cannot read file [$path]. error [$!]"); + if ($image->enabled && $image->path) { + my $filename = $image->filename; + if($image->delete_at_day && $image->created_at + $image->delete_at_day * 86400 <= time()) { + # Log deletion + $c->app->log->info('[DELETION] someone tried to view '.$image->filename.' but it has been removed by expiration (path: '.$image->path.')'); + + # Delete image + $c->delete_image($image); + + # Warn user $zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$filename.'.txt'); next; } - if ($key) { - $zip->addString($c->decrypt($key, $path)->slurp, "images/$filename"); + # Delete image if needed + if ($image->delete_at_first_view && $image->counter >= 1) { + # Log deletion + $c->app->log->info('[DELETION] someone made '.$image->filename.' removed (path: '.$image->path.')'); + + # Delete image + $c->delete_image($image); + + $zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$filename.'.txt'); + next; } else { - $zip->addFile($path, "images/$filename"); + my $expires = ($image->delete_at_day) ? $image->delete_at_day : 360; + my $dt = DateTime->from_epoch( epoch => $expires * 86400 + $image->created_at); + $dt->set_time_zone('GMT'); + $expires = $dt->strftime("%a, %d %b %Y %H:%M:%S GMT"); + + my $path = $image->path; + unless ( -f $path && -r $path ) { + $c->app->log->error("Cannot read file [$path]. error [$!]"); + $zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$filename.'.txt'); + next; + } + + if ($key) { + $zip->addString($c->decrypt($key, $path)->slurp, "images/$filename"); + } else { + $zip->addFile($path, "images/$filename"); + } + + # Log access + $c->app->log->info('[VIEW] someone viewed '.$image->filename.' (path: '.$image->path.')'); + # Update counter and record + $image->counter($image->counter + 1) + ->last_access_at(time) + ->write; } + } elsif ($image->path && !$image->enabled) { + # Log access try + $c->app->log->info('[NOT FOUND] someone tried to view '.$short.' but it does\'nt exist anymore.'); - # Log access - $c->app->log->info('[VIEW] someone viewed '.$image->filename.' (path: '.$image->path.')'); - # Update counter and record - $image->counter($image->counter + 1) - ->last_access_at(time) - ->write; + # Warn user + $zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$image->filename.'.txt'); + next; + } else { + $zip->addString($c->l('Image not found.'), 'images/'.$short.'.txt'); + next; } - } elsif ($image->path && !$image->enabled) { - # Log access try - $c->app->log->info('[NOT FOUND] someone tried to view '.$short.' but it does\'nt exist anymore.'); - - # Warn user - $zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$image->filename.'.txt'); - next; - } else { - $zip->addString($c->l('Image not found.'), 'images/'.$short.'.txt'); - next; } - } - my ($fh, $zipfile) = Archive::Zip::tempFile(); - unless ($zip->writeToFileNamed($zipfile) == AZ_OK) { - $c->flash( - msg => $c->l('Something went wrong when creating the zip file. Try again later or contact the administrator (%1).', $c->config('contact')) + my ($fh, $zipfile) = Archive::Zip::tempFile(); + unless ($zip->writeToFileNamed($zipfile) == AZ_OK) { + $c->flash( + msg => $c->l('Something went wrong when creating the zip file. Try again later or contact the administrator (%1).', $c->config('contact')) + ); + return $c->redirect_to('/'); + } + $c->res->content->headers->content_type('application/zip;name=images.zip'); + $c->res->content->headers->content_disposition('attachment;filename=images.zip');; + + my $asset = Mojo::Asset::File->new(path => $zipfile); + $c->res->content->asset($asset); + $c->res->content->headers->content_length($asset->size); + + unlink $zipfile; + + return $c->rendered(200); + } else { + my $i = -1; + my @urls = (); + my @esc_imgs = map { my $e = $_; $e = url_escape($e); $e =~ s#%2F#/#g; $e } @{$imgs}; + while (++$i < $img_nb) { + my $stop = ($i + $max_zip - 1 < $img_nb) ? $i + $max_zip - 1 : $img_nb - 1; + push @urls, $c->url_for('/zip')->to_abs->to_string.'?i='.join('&i=', @esc_imgs[$i..$stop]); + $i = $stop; + } + $c->render( + template => 'zip', + urls => \@urls ); - return $c->redirect_to('/'); } - $c->res->content->headers->content_type('application/zip;name=images.zip'); - $c->res->content->headers->content_disposition('attachment;filename=images.zip');; - - my $asset = Mojo::Asset::File->new(path => $zipfile); - $c->res->content->asset($asset); - $c->res->content->headers->content_length($asset->size); - - unlink $zipfile; - - return $c->rendered(200); } 1; diff --git a/lutim.conf.template b/lutim.conf.template index e7f3836..9aaa1a6 100644 --- a/lutim.conf.template +++ b/lutim.conf.template @@ -138,6 +138,14 @@ # optional, default is 100 (pixels) #thumbnail_size => 100, + # maximum number of files that can be downloaded as a single zip archive + # if too many files are asked, it results a timeout, so Lutim split the zip URL + # in multiple URLs, each with max_file_size images. + # timeout behavior depends heavily on your server ressources (CPU) and if images + # are encrypted + # optional, default is 15 + #max_files_in_zip => 15, + ########################## # Lutim cron jobs settings ########################## diff --git a/themes/default/lib/Lutim/I18N/de.po b/themes/default/lib/Lutim/I18N/de.po index 6d9c5cb..d22e7f0 100644 --- a/themes/default/lib/Lutim/I18N/de.po +++ b/themes/default/lib/Lutim/I18N/de.po @@ -55,6 +55,10 @@ msgstr "" msgid "An error occured while downloading the image." msgstr "Beim Herunterladen des Bildes ist ein Fehler aufgetreten." +#: themes/default/templates/zip.html.ep:2 +msgid "Archives download" +msgstr "" + #: themes/default/templates/about.html.ep:41 themes/default/templates/myfiles.html.ep:64 themes/default/templates/stats.html.ep:25 msgid "Back to homepage" msgstr "Zurück zur Hauptseite" @@ -187,7 +191,7 @@ msgstr "Bild-URL" msgid "Image delay" msgstr "" -#: lib/Lutim/Controller.pm:702 +#: lib/Lutim/Controller.pm:706 msgid "Image not found." msgstr "Bild nicht gefunden" @@ -235,6 +239,10 @@ msgstr "Lizenz:" msgid "Link for share on social networks" msgstr "Links zum teilen auf sozialen Netzwerken" +#: themes/default/templates/zip.html.ep:7 +msgid "Lutim can't zip so many images at once, so it splitted your demand in multiple URLs." +msgstr "" + #: themes/default/templates/about.html.ep:4 msgid "Lutim is a free (as in free beer) and anonymous image hosting service. It's also the name of the free (as in free speech) software which provides this service." msgstr "" @@ -269,6 +277,10 @@ msgstr "Nur die Bilder, die über diesen Browser versendet wurden, werden hier a msgid "Only the uploader! (well, only if he's the only owner of the images' rights before the upload)" msgstr "Nur der Hochladende (natürlich nur, wenn er vorher auch Rechteinhaber des Bildes war)" +#: themes/default/templates/zip.html.ep:12 +msgid "Please click on each URL to download the different zip files." +msgstr "" + #. (config('contact') #: themes/default/templates/about.html.ep:19 msgid "Please contact the administrator: %1" @@ -295,7 +307,7 @@ msgid "Something bad happened" msgstr "Es ist ein Fehler aufgetreten" #. ($c->config('contact') -#: lib/Lutim/Controller.pm:709 +#: lib/Lutim/Controller.pm:713 msgid "Something went wrong when creating the zip file. Try again later or contact the administrator (%1)." msgstr "Es ist ein Fehler aufgetreten. Versuche es erneut oder kontaktiere den Administrator (%1)." @@ -319,6 +331,10 @@ msgstr "Lutim ist freie msgid "The URL is not valid." msgstr "Die URL ist nicht gültig." +#: themes/default/templates/zip.html.ep:16 +msgid "The automatic download process will open a tab in your browser for each link. You need to allow popups for Lutim." +msgstr "" + #: lib/Lutim/Controller.pm:120 lib/Lutim/Controller.pm:188 msgid "The delete token is invalid." msgstr "Das Token zum Löschen ist ungültig." @@ -383,7 +399,7 @@ msgstr "Twittere es!" msgid "Unable to find the image %1." msgstr "Konnte das Bild %1 nicht finden." -#: lib/Lutim/Controller.pm:529 lib/Lutim/Controller.pm:574 lib/Lutim/Controller.pm:615 lib/Lutim/Controller.pm:654 lib/Lutim/Controller.pm:666 lib/Lutim/Controller.pm:677 lib/Lutim/Controller.pm:699 lib/Lutim/Plugin/Helpers.pm:61 +#: lib/Lutim/Controller.pm:529 lib/Lutim/Controller.pm:574 lib/Lutim/Controller.pm:615 lib/Lutim/Controller.pm:658 lib/Lutim/Controller.pm:670 lib/Lutim/Controller.pm:681 lib/Lutim/Controller.pm:703 lib/Lutim/Plugin/Helpers.pm:61 msgid "Unable to find the image: it has been deleted." msgstr "Dieses Bild wurde gelöscht." @@ -436,6 +452,10 @@ msgstr "Ja, ist es! Auf der anderen Seite wird deine IP-Adresse, wegen rechtlich msgid "Yes, it is! On the other side, if you want to support the developer, you can do it via Tipeee or via Liberapay." msgstr "Ja, ist es! Auf der anderen Seite kannst du den Entwickler via Tipeee oder Liberapay unterstützen." +#: themes/default/templates/zip.html.ep:6 +msgid "You asked to download a zip archive for too much files." +msgstr "" + #: themes/default/templates/about.html.ep:8 msgid "You can, optionally, request that the image(s) posted on Lutim to be deleted at first view (or download) or after the delay selected from those proposed." msgstr "Du kannst Bilder, die du auf Lutim hochlädst, entweder nach dem ernsten Ansehen (oder Herunterladen) oder nach einem der vorgeschlagenen Zeiten löschen lassen." diff --git a/themes/default/lib/Lutim/I18N/en.po b/themes/default/lib/Lutim/I18N/en.po index f7d14cd..a80d497 100644 --- a/themes/default/lib/Lutim/I18N/en.po +++ b/themes/default/lib/Lutim/I18N/en.po @@ -53,6 +53,10 @@ msgstr "" msgid "An error occured while downloading the image." msgstr "An error occured while downloading the image." +#: themes/default/templates/zip.html.ep:2 +msgid "Archives download" +msgstr "" + #: themes/default/templates/about.html.ep:41 themes/default/templates/myfiles.html.ep:64 themes/default/templates/stats.html.ep:25 msgid "Back to homepage" msgstr "Back to homepage" @@ -185,7 +189,7 @@ msgstr "Image URL" msgid "Image delay" msgstr "" -#: lib/Lutim/Controller.pm:702 +#: lib/Lutim/Controller.pm:706 msgid "Image not found." msgstr "" @@ -233,6 +237,10 @@ msgstr "License:" msgid "Link for share on social networks" msgstr "Link for share on social networks" +#: themes/default/templates/zip.html.ep:7 +msgid "Lutim can't zip so many images at once, so it splitted your demand in multiple URLs." +msgstr "" + #: themes/default/templates/about.html.ep:4 msgid "Lutim is a free (as in free beer) and anonymous image hosting service. It's also the name of the free (as in free speech) software which provides this service." msgstr "Lutim is a free (as in free beer) and anonymous image hosting service. It's also the name of the free (as in free speech) software which provides this service." @@ -265,6 +273,10 @@ msgstr "" msgid "Only the uploader! (well, only if he's the only owner of the images' rights before the upload)" msgstr "Only the uploader! (well, only if he's the only owner of the images' rights before the upload)" +#: themes/default/templates/zip.html.ep:12 +msgid "Please click on each URL to download the different zip files." +msgstr "" + #. (config('contact') #: themes/default/templates/about.html.ep:19 msgid "Please contact the administrator: %1" @@ -291,7 +303,7 @@ msgid "Something bad happened" msgstr "Something bad happened" #. ($c->config('contact') -#: lib/Lutim/Controller.pm:709 +#: lib/Lutim/Controller.pm:713 msgid "Something went wrong when creating the zip file. Try again later or contact the administrator (%1)." msgstr "" @@ -315,6 +327,10 @@ msgstr "The Lutim software is a Tipeee or via Liberapay." msgstr "" +#: themes/default/templates/zip.html.ep:6 +msgid "You asked to download a zip archive for too much files." +msgstr "" + #: themes/default/templates/about.html.ep:8 msgid "You can, optionally, request that the image(s) posted on Lutim to be deleted at first view (or download) or after the delay selected from those proposed." msgstr "You can, optionally, request that the image(s) posted on Lutim to be deleted at first view (or download) or after the delay selected from those proposed." diff --git a/themes/default/lib/Lutim/I18N/es.po b/themes/default/lib/Lutim/I18N/es.po index f75d248..959b67f 100644 --- a/themes/default/lib/Lutim/I18N/es.po +++ b/themes/default/lib/Lutim/I18N/es.po @@ -55,6 +55,10 @@ msgstr "" msgid "An error occured while downloading the image." msgstr "Error al intentar modificar la imagen." +#: themes/default/templates/zip.html.ep:2 +msgid "Archives download" +msgstr "" + #: themes/default/templates/about.html.ep:41 themes/default/templates/myfiles.html.ep:64 themes/default/templates/stats.html.ep:25 msgid "Back to homepage" msgstr "Volver a la página inicial" @@ -187,7 +191,7 @@ msgstr "URL de la imagen" msgid "Image delay" msgstr "" -#: lib/Lutim/Controller.pm:702 +#: lib/Lutim/Controller.pm:706 msgid "Image not found." msgstr "Imagen no encontrada." @@ -235,6 +239,10 @@ msgstr "Licencia:" msgid "Link for share on social networks" msgstr "Enlace para compartir en redes sociales" +#: themes/default/templates/zip.html.ep:7 +msgid "Lutim can't zip so many images at once, so it splitted your demand in multiple URLs." +msgstr "" + #: themes/default/templates/about.html.ep:4 msgid "Lutim is a free (as in free beer) and anonymous image hosting service. It's also the name of the free (as in free speech) software which provides this service." msgstr "Lutim es un servicio de alojamiento de imágenes anónimo y gratuito. También es el nombre del software libre que proporciona este servicio." @@ -267,6 +275,10 @@ msgstr "Sólo se enumeran aquí las imágenes enviadas con este navegador. Las i msgid "Only the uploader! (well, only if he's the only owner of the images' rights before the upload)" msgstr "¡Sólo el usuario! (bueno, sólo si él/ela es el único titular de los derechos de las imágenes antes de subirlas)" +#: themes/default/templates/zip.html.ep:12 +msgid "Please click on each URL to download the different zip files." +msgstr "" + #. (config('contact') #: themes/default/templates/about.html.ep:19 msgid "Please contact the administrator: %1" @@ -293,7 +305,7 @@ msgid "Something bad happened" msgstr "Algo malo ha pasado" #. ($c->config('contact') -#: lib/Lutim/Controller.pm:709 +#: lib/Lutim/Controller.pm:713 msgid "Something went wrong when creating the zip file. Try again later or contact the administrator (%1)." msgstr "Algo malo ha pasado. Inténtelo de nuevo más tarde o contacte con el administrador (%1)." @@ -317,6 +329,10 @@ msgstr "El software Lutim es Tipeee or via Liberapay." msgstr "¡Sí, lo es! Por otro lado, si quiere ayudar a apoyar al desarrollador, puede hacerlo vía Tipeee o con Liberapay." +#: themes/default/templates/zip.html.ep:6 +msgid "You asked to download a zip archive for too much files." +msgstr "" + #: themes/default/templates/about.html.ep:8 msgid "You can, optionally, request that the image(s) posted on Lutim to be deleted at first view (or download) or after the delay selected from those proposed." msgstr "Puede, opcionalmente, solicitar que la imagen publicada en Lutim se elimine con la primera vista (o descarga) o tras un tiempo seleccionado de entre varios propuestos." diff --git a/themes/default/lib/Lutim/I18N/fr.po b/themes/default/lib/Lutim/I18N/fr.po index 98f0448..0f8f4c6 100644 --- a/themes/default/lib/Lutim/I18N/fr.po +++ b/themes/default/lib/Lutim/I18N/fr.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Lutim\n" "POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" -"PO-Revision-Date: 2015-09-17 22:02+0000\n" +"PO-Revision-Date: 2017-06-05 15:54+0000\n" "Last-Translator: Luc Didry \n" "Language-Team: French (http://www.transifex.com/fiat-tux/lutim/language/fr/)\n" "MIME-Version: 1.0\n" @@ -55,6 +55,10 @@ msgstr "Images actives" msgid "An error occured while downloading the image." msgstr "Une erreur est survenue lors du téléchargement de l’image." +#: themes/default/templates/zip.html.ep:2 +msgid "Archives download" +msgstr "Téléchargement d’archives" + #: themes/default/templates/about.html.ep:41 themes/default/templates/myfiles.html.ep:64 themes/default/templates/stats.html.ep:25 msgid "Back to homepage" msgstr "Retour à la page d’accueil" @@ -187,7 +191,7 @@ msgstr "URL de l’image" msgid "Image delay" msgstr "Durée de rétention de l’image" -#: lib/Lutim/Controller.pm:702 +#: lib/Lutim/Controller.pm:706 msgid "Image not found." msgstr "Image non trouvée." @@ -235,6 +239,10 @@ msgstr "Licence :" msgid "Link for share on social networks" msgstr "Lien pour partager sur les réseaux sociaux" +#: themes/default/templates/zip.html.ep:7 +msgid "Lutim can't zip so many images at once, so it splitted your demand in multiple URLs." +msgstr "Lutim ne peut zipper autant d’images à la fois, votre demande a donc été découpée en plusieurs URL." + #: themes/default/templates/about.html.ep:4 msgid "Lutim is a free (as in free beer) and anonymous image hosting service. It's also the name of the free (as in free speech) software which provides this service." msgstr "Lutim est un service gratuit et anonyme d’hébergement d’images. Il s’agit aussi du nom du logiciel (libre) qui fournit ce service." @@ -267,6 +275,10 @@ msgstr "Seules les images envoyées avec ce navigateur seront listées ici. Les msgid "Only the uploader! (well, only if he's the only owner of the images' rights before the upload)" msgstr "Seulement l’envoyeur ! (enfin, seulement s’il possède des droits exclusifs sur les images avant de les envoyer)" +#: themes/default/templates/zip.html.ep:12 +msgid "Please click on each URL to download the different zip files." +msgstr "Veuillez cliquer sur chaque URL pour télécharger les différents fichiers zip." + #. (config('contact') #: themes/default/templates/about.html.ep:19 msgid "Please contact the administrator: %1" @@ -293,7 +305,7 @@ msgid "Something bad happened" msgstr "Un problème est survenu" #. ($c->config('contact') -#: lib/Lutim/Controller.pm:709 +#: lib/Lutim/Controller.pm:713 msgid "Something went wrong when creating the zip file. Try again later or contact the administrator (%1)." msgstr "Quelque chose s’est mal passé lors de la création de l’archive. Veuillez réessayer plus tard ou contactez l’administrateur (%1)." @@ -319,6 +331,10 @@ msgstr "Le logiciel Lutim est un Tipeee or via Liberapay." msgstr "Oui, ça l’est ! Par contre, si vous avez envie de soutenir le développeur, vous pouvez faire un microdon avec Tipeee ou via Liberapay." +#: themes/default/templates/zip.html.ep:6 +msgid "You asked to download a zip archive for too much files." +msgstr "Vous avez demandé de télécharger une archive zip pour trop de fichiers." + #: themes/default/templates/about.html.ep:8 msgid "You can, optionally, request that the image(s) posted on Lutim to be deleted at first view (or download) or after the delay selected from those proposed." msgstr "Vous pouvez, de façon facultative, demander à ce que la ou les images déposées sur Lutim soient supprimées après leur premier affichage (ou téléchargement) ou au bout d’un délai choisi parmi ceux proposés." diff --git a/themes/default/lib/Lutim/I18N/oc.po b/themes/default/lib/Lutim/I18N/oc.po index 1bdaa5e..d935ebd 100644 --- a/themes/default/lib/Lutim/I18N/oc.po +++ b/themes/default/lib/Lutim/I18N/oc.po @@ -54,6 +54,10 @@ msgstr "Imatges actius" msgid "An error occured while downloading the image." msgstr "Una error es apareguda pendent lo telecargament de l'imatge." +#: themes/default/templates/zip.html.ep:2 +msgid "Archives download" +msgstr "" + #: themes/default/templates/about.html.ep:41 themes/default/templates/myfiles.html.ep:64 themes/default/templates/stats.html.ep:25 msgid "Back to homepage" msgstr "Tornar a la pagina d'acuèlh" @@ -186,7 +190,7 @@ msgstr "URL de l'imatge" msgid "Image delay" msgstr "Delai de l'imatge" -#: lib/Lutim/Controller.pm:702 +#: lib/Lutim/Controller.pm:706 msgid "Image not found." msgstr "Imatge pas trobat." @@ -234,6 +238,10 @@ msgstr "Licéncia :" msgid "Link for share on social networks" msgstr "Ligam per partejar suls malhums socials" +#: themes/default/templates/zip.html.ep:7 +msgid "Lutim can't zip so many images at once, so it splitted your demand in multiple URLs." +msgstr "" + #: themes/default/templates/about.html.ep:4 msgid "Lutim is a free (as in free beer) and anonymous image hosting service. It's also the name of the free (as in free speech) software which provides this service." msgstr "Lutim es un servici gratuit e anonim d’albergament d’imatges. S’agís tanben del nom del logicial (liure) que fornís aqueste servici." @@ -266,6 +274,10 @@ msgstr "Solament los imatges mandats amb aqueste navigador seràn listats aquí. msgid "Only the uploader! (well, only if he's the only owner of the images' rights before the upload)" msgstr "Solament lo qu'a mandat ! (ben, solament se ten los dreits exclusius dels imatges abans de los mandar)" +#: themes/default/templates/zip.html.ep:12 +msgid "Please click on each URL to download the different zip files." +msgstr "" + #. (config('contact') #: themes/default/templates/about.html.ep:19 msgid "Please contact the administrator: %1" @@ -292,7 +304,7 @@ msgid "Something bad happened" msgstr "Un problèma es aparegut" #. ($c->config('contact') -#: lib/Lutim/Controller.pm:709 +#: lib/Lutim/Controller.pm:713 msgid "Something went wrong when creating the zip file. Try again later or contact the administrator (%1)." msgstr "Quicòm a trucat pendent la creacion de l'archiu. Mercés de tornar ensajar pus tard o de contactar l'administrator (%1)." @@ -316,6 +328,10 @@ msgstr "Lo logicial Lutim es un Tipeee or via Liberapay." msgstr "Òc, o es ! Al contrari, s'avètz enveja de sosténer lo desvolopaire, podètz far un microdon amb Tipeee o via Liberapay." +#: themes/default/templates/zip.html.ep:6 +msgid "You asked to download a zip archive for too much files." +msgstr "" + #: themes/default/templates/about.html.ep:8 msgid "You can, optionally, request that the image(s) posted on Lutim to be deleted at first view (or download) or after the delay selected from those proposed." msgstr "Podètz, d'un biais facultatiu, demandar que l'imatge o los imatges depausats sus Lutim sián suprimits aprèp lor primièr afichatge (o telecargament) o al cap d'un delai causit entre las prepausadas." diff --git a/themes/default/templates/zip.html.ep b/themes/default/templates/zip.html.ep new file mode 100644 index 0000000..6c6e1c5 --- /dev/null +++ b/themes/default/templates/zip.html.ep @@ -0,0 +1,31 @@ +% # vim:set sts=4 sw=4 ts=4 ft=html.epl expandtab: +

<%= l('Archives download') %>

+
+
+

+ <%= l('You asked to download a zip archive for too much files.') %> + <%= l('Lutim can\'t zip so many images at once, so it splitted your demand in multiple URLs.') %> +

+
+ +
+

<%= l('The automatic download process will open a tab in your browser for each link. You need to allow popups for Lutim.') %>

+
+ + +%= javascript begin +$(document).ready(function() { + $('.jsononly').show(); + $('.dl-zip').each(function(index) { + this.click(); + }); +}); +% end