From 2085b4cac3a86d59360531d48251c8ab39dec0dd Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 9 Jun 2022 21:12:03 +0530 Subject: Initial Gallery version - Handles login, logout, simple directories. --- lib/Crater/Routes/Gallery.rakumod | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/Crater/Routes/Gallery.rakumod (limited to 'lib/Crater/Routes/Gallery.rakumod') diff --git a/lib/Crater/Routes/Gallery.rakumod b/lib/Crater/Routes/Gallery.rakumod new file mode 100644 index 0000000..04c8d74 --- /dev/null +++ b/lib/Crater/Routes/Gallery.rakumod @@ -0,0 +1,25 @@ +use Cro::HTTP::Router; +use Cro::WebApp::Template; + +use Crater::Gallery; +use Crater::Session; + +sub gallery-routes( + Crater::Gallery :$gallery!, #= gallery object +) is export { + route { + get -> LoggedIn $session { + template 'gallery.crotmp', { + gallery => $gallery.list(), + title => "Gallery" + }; + } + + get -> { + redirect '/login', :see-other; + } + get -> *@path { + static $gallery.directory, @path; + } + } +} -- cgit 1.4.1-2-gfad0