From 3917778f3e773c97610b07b9a85ac5c834f001b7 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Mon, 18 Jun 2018 03:03:46 +1000 Subject: [PATCH] * update routing --- lib/LDV.pm | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/LDV.pm b/lib/LDV.pm index e19ce4c..406bb06 100644 --- a/lib/LDV.pm +++ b/lib/LDV.pm @@ -67,23 +67,19 @@ sub startup { $zb->get('/prune') -> to(action => 'prune'); } - { # /imgbin - my $conf = $self->app->config->{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+/) + { # /filebin + my $conf = $self->app->config->{filebin}; + my $fb = $r->route('/filebin') -> to(controller => 'filebin'); + $fb->post('/') -> to(action => 'save'); + $fb->get ('/') -> to(action => 'create'); + $fb->route('/:time', time => qr/\d+/) ->via('GET') -> to(action => 'view'); - $ib->get ('/prune') -> to(action => 'prune'); - $ib->get ('/latest') -> to(action => 'latest') - if ($conf->{show_latest}); + $fb->get ('/prune') -> to(action => 'prune'); + $fb->get ('/latest') -> to(action => 'latest') + if $conf->{show_latest}; - 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 + mkdir $self->app->home->rel_dir('public/files'); + $ENV{MOJO_MAX_MESSAGE_SIZE} = $conf->{file_maxsize} + 2 * 1024 * 1024; # +2Mb } }