Added some dependencies for gzip/base64; need to switch computers for libarchive support...

This commit is contained in:
swagg boi 2023-10-07 21:10:33 -04:00
parent 71ea81d18e
commit 4bfa6b1b0f
3 changed files with 11 additions and 3 deletions

View file

@ -2,7 +2,9 @@
"name": "Hyperlink-Redirect",
"depends": [
"Humming-Bird",
"Template6"
"Template6",
"Base64",
"Libarchive::Filter"
],
"provides": {
"Hyperlink-Redirect": "lib/Hyperlink-Redirect.rakumod"

View file

@ -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

View file

@ -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