commit a730807d4ff624e4463ad471084c9fce4bf4af61
parent 73fe5f45f62be458428dfc09d7970d7562a535ee
Author: Alex Balgavy <alex@balgavy.eu>
Date: Sun, 8 Oct 2023 15:07:46 +0200
linkhandler: unfurl redirects on links
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/scripts/linkhandler b/scripts/linkhandler
@@ -29,6 +29,10 @@ sub untrack {
$orig_link =~ s/https?(?::|%3A)(?:%2F%2F|\/\/).*(https?(?::|%3A)(?:%2F%2F|\/\/).*)/$1/;
$orig_link =~ s/utm_[^&]*&?//g;
$orig_link =~ s/\?$//;
+
+ if ($orig_link =~ /lnks\.gd\// or $orig_link =~ /url.*\.creators\.gumroad\.com/) {
+ $orig_link = `curl --silent --head --write-out '%{redirect_url}' --output /dev/null "$orig_link"`;
+ }
return $orig_link;
}