diff --git a/META6.json b/META6.json index b4c65ef..3a7542d 100644 --- a/META6.json +++ b/META6.json @@ -2,7 +2,9 @@ "name": "Hyperlink-Redirect", "depends": [ "Humming-Bird", - "Template6" + "Template6", + "Base64", + "Libarchive::Filter" ], "provides": { "Hyperlink-Redirect": "lib/Hyperlink-Redirect.rakumod" diff --git a/README.md b/README.md index 9ed5483..1d64107 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A "useful" tool for turning hyperlinks into redirects in the name of shortening ### Run the guy - raku bin/hyperlink-redirect + ./bin/hyperlink-redirect ## TODO diff --git a/lib/Hyperlink-Redirect.rakumod b/lib/Hyperlink-Redirect.rakumod index 4312340..d7c086d 100644 --- a/lib/Hyperlink-Redirect.rakumod +++ b/lib/Hyperlink-Redirect.rakumod @@ -1,5 +1,7 @@ use Humming-Bird::Core; use Template6; +use Base64; +use Libarchive::Filter :gzip; # Normally would 'use' local libs here for Controller and Model and # what not but keeping it simple for now... @@ -16,7 +18,11 @@ $router.get(-> $request, $response { }); $router.post(-> $request, $response { - $response.html($templates.process: 'index'); + my $hyperlink = $request.content.{'hyperlink'}; + + say encode-base64(gzip($hyperlink), :str); + + $response.html($templates.process: 'index', :$hyperlink); }); # Try a wildcard to catch 'all' path