From 06096eff7d9889192c29f55b605850030995cb64 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Sun, 10 May 2015 18:58:41 +1000 Subject: [PATCH] + /imgbin routes --- lib/LDV.pm | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/LDV.pm b/lib/LDV.pm index 6e971de..d0b84bd 100644 --- a/lib/LDV.pm +++ b/lib/LDV.pm @@ -42,7 +42,7 @@ sub startup { $user->post('/create') ->to(action => 'create'); $user->post('/update') ->to(action => 'update'); - # /zerobin + { # /zerobin my $zb = $r->route('/zerobin2') -> to(controller => 'zerobin'); $zb->post('/') -> to(action => 'save'); $zb->get ('/') -> to(action => 'create'); @@ -50,8 +50,26 @@ sub startup { ->via('GET') -> to(action => 'view'); $zb->get('/prune') -> to(action => 'prune'); - my $root = $self->app->config->{zerobin}->{root}; - mkdir $self->app->home->rel_dir($root); + my $conf = $self->app->config->{zerobin}; + mkdir $self->app->home->rel_dir($conf->{root}); + } + + { # /imgbin + my $ib = $r->route('/imgbin') -> to(controller => 'imgbin'); + $ib->post('/') -> to(action => 'save'); + $ib->get ('/') -> to(action => 'create'); + $ib->route('/:time', time => qr/\d+/) + ->via('GET') -> to(action => 'view'); + #$ib->get('/prune') -> to(action => 'prune'); + + my $conf = $self->app->config->{imgbin}; + mkdir $self->app->home->rel_dir($conf->{root}); + mkdir $self->app->home->rel_file('public/images'); + mkdir $self->app->home->rel_file('public/images/full'); + mkdir $self->app->home->rel_file('public/images/small'); + + $ENV{MOJO_MAX_MESSAGE_SIZE} = $conf->{maxsize} + 2 * 1024 * 1024; # +2Mb + } } 1;