Whoopsies...

This commit is contained in:
swagg boi 2023-11-13 21:13:20 -05:00
parent 78b81897c9
commit 93b7ba6717
2 changed files with 9 additions and 8 deletions

View file

@ -4,10 +4,11 @@ use Humming-Bird::Advice;
use Template::Mustache; use Template::Mustache;
use Base64; use Base64;
use Libarchive::Filter :gzip; use Libarchive::Filter :gzip;
use Helpers;
# Normally would 'use' local libs here for Controller and Model and # Normally would 'use' local libs here for Controller and Model and
# what not but keeping it simple for now... # 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?) # Set things up (config stuff would go here?)
my $template = Template::Mustache.new: :from<../templates>; my $template = Template::Mustache.new: :from<../templates>;
@ -28,8 +29,8 @@ $router.get(-> $request, $response {
$router.post(-> $request, $response { $router.post(-> $request, $response {
my Str $return-url = fix-protocol($request.content<hyperlink>); my Str $return-url = fix-protocol($request.content<hyperlink>);
my Bool $meta-refresh = $request.content<meta-refresh>.defined; my Bool $meta-refresh = $request.content<meta-refresh>.defined;
my Str $url-scheme = $request.headers<X-Forwarded-Proto> || 'http'; my Str $url-scheme = $request.headers<x-forwarded-proto> || 'http';
my Str $url-host = $request.headers<Host>; my Any $url-host = $request.headers<host>;
my (Str $base-url, Str $hyperlink, Str %stash); my (Str $base-url, Str $hyperlink, Str %stash);
$base-url = $url-scheme ~ '://' ~ $url-host ~ $base-url = $url-scheme ~ '://' ~ $url-host ~

View file

@ -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; return "http://" ~ $url unless $url ~~ $starts-with-protocol;
} }
@ -10,10 +10,10 @@ sub dbug($message) {
} }
#error types #error types
# Just string is provided: # Just string is provided:
# ERROR: Malformed UTF-8 near byte 81 at line 1 col 2 # ERROR: Malformed UTF-8 near byte 81 at line 1 col 2
# TYPE: X::AdHoc # TYPE: X::AdHoc
# ERROR: Stringification of a Buf is not done with 'Stringy'. The 'decode' # 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 # TYPE: X::Buf::AsStr