| 1 | package Arepa::Web; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use base 'Mojolicious'; | ||
| 7 | |||
| 8 | sub startup { | ||
| 9 | my $self = shift; | ||
| 10 | |||
| 11 | $self->secret("b1Tx3z.duN'tKn0Wbout4r3p4"); | ||
| 12 | $self->plugin("more_tag_helpers"); | ||
| 13 | |||
| 14 | # Stash defaults | ||
| 15 | $self->defaults(is_synced => undef, | ||
| 16 | remote_repo_path => undef, | ||
| 17 | is_user_admin => 0); | ||
| 18 | |||
| 19 | # Routes | ||
| 20 | my $r = $self->routes; | ||
| 21 | my $auth = $r->bridge->to('auth#login'); | ||
| 22 | # Default route | ||
| 23 | $auth->route('/')->to('dashboard#index')->name('home'); | ||
| 24 | $auth->route('/public/rss/repository')->name('rss_repository')-> | ||
| 25 | to(controller => 'public', action => 'rss_repository'); | ||
| 26 | $auth->route('/public/rss/queue')->name('rss_queue')-> | ||
| 27 | to(controller => 'public', action => 'rss_queue'); | ||
| 28 | $auth->route('/public/rss')->name('rss_legacy')-> | ||
| 29 | to(controller => 'public', action => 'rss_queue'); | ||
| 30 | $auth->route('/:controller/:action/:id')->name('generic_id'); | ||
| 31 | $auth->route('/:controller/:action')->name('generic'); | ||
| 32 | $auth->route('/:controller')->name('generic_wo_action'); | ||
| 33 | } | ||
| 34 | |||
| 35 | 1; |