4 Commits
0.8 ... 0.8.2

Author SHA1 Message Date
Luc Didry
ec6b9ce028 Update cpanfile: enforce Mojolicious::Plugin::AssetPack version 2017-06-14 12:00:35 +02:00
Luc Didry
321b8bbf97 Update CHANGELOG - 0.8.1 2017-06-13 23:08:08 +02:00
Luc Didry
78ce5dc69d Fix CI oblivion 2017-06-13 22:42:27 +02:00
Luc Didry
82289ece59 Fix #46 Server error if trying to zip an unexisting file 2017-06-13 22:10:59 +02:00
5 changed files with 12 additions and 8 deletions

View File

@@ -29,6 +29,7 @@ sqlite2:
script:
- make podcheck
- MOJO_CONFIG=t/sqlite2.conf make minion &
- sleep 3
- MOJO_CONFIG=t/sqlite2.conf make test-sqlite
- MOJO_CONFIG=t/sqlite2.conf make watch
- MOJO_CONFIG=t/sqlite2.conf make cleanbdd

View File

@@ -1,5 +1,8 @@
Revision history for Lutim
0.8.1 2017-06-13
- Fix #46
0.8 2017-06-13
- Improve statistics page
- Add database abstraction layer (#42)

View File

@@ -5,7 +5,7 @@ requires 'Data::Validate::URI';
requires 'Net::Domain::TLD', '>= 1.73'; # Must have the last version to handle (at least) .xyz and .link
requires 'Mojo::Pg';
requires 'Mojolicious::Plugin::I18N';
requires 'Mojolicious::Plugin::AssetPack';
requires 'Mojolicious::Plugin::AssetPack', '>= 1.44';
requires 'Mojolicious::Plugin::DebugDumperHelper';
requires 'Mojolicious::Plugin::PgURLHelper';
requires "Minion", "== 4.06";

View File

@@ -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_escape url_unescape b64_encode);
use Mojo::Util qw(url_escape url_unescape b64_encode encode);
use Mojo::Asset::Memory;
use Mojo::JSON qw(true false);
use Lutim::DB::Image;
@@ -656,7 +656,7 @@ sub zip {
$c->delete_image($image);
# Warn user
$zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$filename.'.txt');
$zip->addString(encode('UTF-8', $c->l('Unable to find the image: it has been deleted.')), 'images/'.$filename.'.txt');
next;
}
@@ -668,7 +668,7 @@ sub zip {
# Delete image
$c->delete_image($image);
$zip->addString($c->l('Unable to find the image: it has been deleted.'), 'images/'.$filename.'.txt');
$zip->addString(encode('UTF-8', $c->l('Unable to find the image: it has been deleted.')), 'images/'.$filename.'.txt');
next;
} else {
my $expires = ($image->delete_at_day) ? $image->delete_at_day : 360;
@@ -679,7 +679,7 @@ sub zip {
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');
$zip->addString(encode('UTF-8', $c->l('Unable to find the image: it has been deleted.')), 'images/'.$filename.'.txt');
next;
}
@@ -704,10 +704,10 @@ sub zip {
$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');
$zip->addString(encode('UTF-8', $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');
$zip->addString(encode('UTF-8', $c->l('Image not found.')), 'images/'.$short.'.txt');
next;
}
}

View File

@@ -16,7 +16,7 @@ sub register {
# Database migration
my $migrations = Mojo::Pg::Migrations->new(pg => $app->pg);
if ($app->mode eq 'development') {
if ($app->mode eq 'development' && $ENV{LUTIM_DEBUG}) {
$migrations->from_file('utilities/migrations.sql')->migrate(0)->migrate(1);
} else {
$migrations->from_file('utilities/migrations.sql')->migrate(1);