diff options
author | Andinus <andinus@nand.sh> | 2022-06-11 21:26:49 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2022-06-11 21:26:49 +0530 |
commit | 234c399f59a23ef5af86148a67526319b8a79b8d (patch) | |
tree | 90a6fbda1d32fb7e5cb78d7d54d000cafcb7fa66 /lib/Crater/Routes | |
parent | dcceb30788af8433e8184ab15fe8833f5539145b (diff) | |
download | crater-234c399f59a23ef5af86148a67526319b8a79b8d.tar.gz |
Code cleanup, document blocks
Diffstat (limited to 'lib/Crater/Routes')
-rw-r--r-- | lib/Crater/Routes/Auth.rakumod | 1 | ||||
-rw-r--r-- | lib/Crater/Routes/Gallery.rakumod | 15 |
2 files changed, 8 insertions, 8 deletions
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]<url> ~ $p ~ "/") - ); + next if $p eq ''; + @nav.push: %(name => $p, url => (@nav[*-1]<url> ~ $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; } } } |