From 234c399f59a23ef5af86148a67526319b8a79b8d Mon Sep 17 00:00:00 2001 From: Andinus Date: Sat, 11 Jun 2022 21:26:49 +0530 Subject: Code cleanup, document blocks --- lib/Crater/Routes/Auth.rakumod | 1 + lib/Crater/Routes/Gallery.rakumod | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/Crater/Routes') diff --git a/lib/Crater/Routes/Auth.rakumod b/lib/Crater/Routes/Auth.rakumod index aef2c48..46100f5 100644 --- a/lib/Crater/Routes/Auth.rakumod +++ b/lib/Crater/Routes/Auth.rakumod @@ -3,6 +3,7 @@ use Cro::WebApp::Template; use Crater::Session; +#| auth-routes contains routes related to authentication. sub auth-routes( Str :$password!, #= password for authentication ) is export { diff --git a/lib/Crater/Routes/Gallery.rakumod b/lib/Crater/Routes/Gallery.rakumod index ebf40b4..9c7fc0a 100644 --- a/lib/Crater/Routes/Gallery.rakumod +++ b/lib/Crater/Routes/Gallery.rakumod @@ -4,6 +4,8 @@ use Cro::WebApp::Template; use Crater::Gallery; use Crater::Session; +#| gallery-routes contains routes for gallery view, images. Routes in +#| this block must be authenticated. sub gallery-routes( Crater::Gallery :$gallery!, #= gallery object ) is export { @@ -21,24 +23,21 @@ sub gallery-routes( # Generates a navigation bar for nested directories. my @nav = %(name => "home", url => "/"), ; for @path.kv -> $idx, $p { - next if $p eq ""; - push @nav, %( - name => $p, - url => (@nav[*-1] ~ $p ~ "/") - ); + next if $p eq ''; + @nav.push: %(name => $p, url => (@nav[*-1] ~ $p ~ "/")); } template 'gallery.crotmp', { + :@nav, + show-nav => @path.elems ?? True !! False, gallery => $gallery.list(sub-dir => @path), title => $gallery.title() // "Gallery", - nav => @nav, - show-nav => @path.elems ?? True !! False }; } # Redirect to login page if not logged in. get -> *@path { - redirect '/login', :see-other; + response.status = 401; } } } -- cgit 1.4.1-2-gfad0