commit 438f33ad39a4fcf7cd791d1d54a52bd844ea5654 parent 41c65341609270303ad1585c3770842caa613fe5 Author: Alex Balgavy <alex@balgavy.eu> Date: Wed, 22 Dec 2021 00:00:53 +0100 w3m: magnet links Diffstat:
A | w3m/cgi-bin/magnet.cgi | | | 9 | +++++++++ |
M | w3m/urimethodmap | | | 1 | + |
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/w3m/cgi-bin/magnet.cgi b/w3m/cgi-bin/magnet.cgi @@ -0,0 +1,9 @@ +#!/bin/sh +uri="$QUERY_STRING" +referer="$HTTP_REFERER" + +[ -z "$uri" ] && printf "Error: No URI\n" >&2 && exit 1 + +open "$uri" + +[ -n "$referer" ] && printf "HTTP/1.1 303 See Other\nLocation %s\n" "$referer" diff --git a/w3m/urimethodmap b/w3m/urimethodmap @@ -1 +1,2 @@ gemini: file:/cgi-bin/uri-handler-gemini.cgi?%s +magnet: file:/cgi-bin/magnet.cgi?%s