💾 Archived View for 1436.ninja › Phlog › gmi › 20190824.gmi captured on 2024-05-26 at 15:01:05. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-08)
-=-=-=-=-=-=-
Courtesy of Javier on comp.misc (plus a bit I added for /.):
$ cat doit.cgi #!/bin/bash #depends on curl and gridsite-clients #change this to your server server="rpoa" ths="http:\/\/$server\/cgi-bin\/doit.cgi\?" req=$(urlencode -d "$1") req2="$ths$(urlencode "$req")" dom=$ths"https:\/\/"$( printf "$1" | awk -F[/:] '{print $4}' ) #print your mime header! if [ "$req"=="https://slashdot.org/" ]; then printf "%s\n\n" "Content-Type: text/html" fi curl -sS -I "$req" | \ printf "%s\n\n" "$(grep "^Content-Type:" | sed 's@text/plain@text/html@')" #harvest and massage your content, changing hyperlinks to this proxy curl -sS "$req" | \ sed "/href=\"[[:alnum:]]/ s@href=\"@href=\"$req2@g; \ /href=\"\// s@href=\"@href=\"https://$dom@g; \ /src=\"[[:alnum:]]/ s@src=\"@src=\"$req2@g; \ /src=\"\// s@src=\"@src=\"$dom@g; \ s@"$req2"http@http@g; \ s@https://http://@http://@g"