From 93b7ba6717c46dea61bfed999f309844d3a59d70 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Mon, 13 Nov 2023 21:13:20 -0500 Subject: [PATCH] Whoopsies... --- lib/Hyperlink-Redirect.rakumod | 7 ++++--- lib/{ => Hyperlink-Redirect}/Helpers.rakumod | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) rename lib/{ => Hyperlink-Redirect}/Helpers.rakumod (58%) diff --git a/lib/Hyperlink-Redirect.rakumod b/lib/Hyperlink-Redirect.rakumod index 2e1904f..874d2bf 100644 --- a/lib/Hyperlink-Redirect.rakumod +++ b/lib/Hyperlink-Redirect.rakumod @@ -4,10 +4,11 @@ use Humming-Bird::Advice; use Template::Mustache; use Base64; use Libarchive::Filter :gzip; -use Helpers; # Normally would 'use' local libs here for Controller and Model and # what not but keeping it simple for now... +# UPDATE: We now have local lib (sry libs) +use Hyperlink-Redirect::Helpers; # Set things up (config stuff would go here?) my $template = Template::Mustache.new: :from<../templates>; @@ -28,8 +29,8 @@ $router.get(-> $request, $response { $router.post(-> $request, $response { my Str $return-url = fix-protocol($request.content); my Bool $meta-refresh = $request.content.defined; - my Str $url-scheme = $request.headers || 'http'; - my Str $url-host = $request.headers; + my Str $url-scheme = $request.headers || 'http'; + my Any $url-host = $request.headers; my (Str $base-url, Str $hyperlink, Str %stash); $base-url = $url-scheme ~ '://' ~ $url-host ~ diff --git a/lib/Helpers.rakumod b/lib/Hyperlink-Redirect/Helpers.rakumod similarity index 58% rename from lib/Helpers.rakumod rename to lib/Hyperlink-Redirect/Helpers.rakumod index 954a427..c6d61d2 100644 --- a/lib/Helpers.rakumod +++ b/lib/Hyperlink-Redirect/Helpers.rakumod @@ -1,6 +1,6 @@ -my $starts-with-protocol = rx:i/ ^https? '://'/; +my $starts-with-protocol = rx:i/ ^https? '://'/; -sub fix-protocol ($url) is export { +sub fix-protocol($url) is export { return "http://" ~ $url unless $url ~~ $starts-with-protocol; } @@ -10,10 +10,10 @@ sub dbug($message) { } #error types -# Just string is provided: -# ERROR: Malformed UTF-8 near byte 81 at line 1 col 2 +# Just string is provided: +# ERROR: Malformed UTF-8 near byte 81 at line 1 col 2 # TYPE: X::AdHoc # ERROR: Stringification of a Buf is not done with 'Stringy'. The 'decode' -# method should be used to convert a Buf to a Str. +# method should be used to convert a Buf to a Str. # TYPE: X::Buf::AsStr