-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: webmention-tools
action: commit
revision:
path_from:
revision_from: 71be0d75fff863807b60d8ba58ccdf8958e55f06:
path_to:
revision_to:

git.thebackupbox.net

webmention-tools

git://git.thebackupbox.net/webmention-tools

commit 71be0d75fff863807b60d8ba58ccdf8958e55f06
Author: epoch <epoch@thebackupbox.net>
Date:   Sat Oct 1 10:26:09 2022 +0000

    look at this crap. it is crap.

diff --git a/webmention-discover.sh b/webmention-discover.sh
new file mode 100755
index 0000000000000000000000000000000000000000..95b25ab55ed7db88224dd0ebeae50e69f77dd6a4
--- /dev/null
+++ b/webmention-discover.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+target="$1"
+
+line="$(curl -sI "$target" | grep -i ^link: | grep webmention)"
+
+uri="$(printf "%s\n" "$line" | tr '>' '<' | cut '-d<' -f2)"
+
+printf "<%s>\n" "${uri}" | uri-absolution "$target"
diff --git a/webmention.sh b/webmention.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d2ce63d7f2222773629fad6295ec49e809104d58
--- /dev/null
+++ b/webmention.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+export TZ=epoch
+
+target="$1"
+
+webmention_url="$(./webmention-discover.sh "$target")"
+
+timestamp="$(date +%s)"
+
+date="$(date --iso-8601=seconds "--date=@${timestamp}")"
+source_filename="${timestamp}.html"
+mkdir -p "/home/epoch/public_html/webmention"
+source_abs_path="/home/epoch/public_html/webmention/${source_filename}"
+source_abs_url="https://thebackupbox.net/~epoch/webmention/${source_filename}"
+
+if [ ! "$webmention_url" ];then
+  printf "target url <%s> does not support webmention\n" "${target}" >&2
+  exit 1
+else
+
+cat <<EOF
+<html>
+  <head><title></title></head>
+  <body class="h-entry">
+     <p>in reply to: <a class="u-in-reply-to" href="$target">$target</a></p>
+    <div class="p-author h-card">
+      <a class="u-url" rel="me" href="https://thebackupbox.net/~epoch/">
+        <img class="u-photo" alt="epoch" src="https://thebackupbox.net/cgi-bin/xface.cgi?IlrD8fxN=HlbdLwwiJkkn=qs4%3EtlW=8)AJX~vDBf8=,%7B4m5iD0Rt@uJMy%25c%5C%5Ez%3E0%25.N$,QXXY)A@GPVl%3CtFo3A%605XDxcUh%7BtZj=]%3Co[%5EGH-Thr%7Cl+F)x~j%25Gb4U!XyXX;?a(hC6@yPNl5V%7B7[$~P=M" />
+      </a>
+    </div>
+     <div class="p-name e-content"><p>
+EOF
+echo "plaintext response goes here" | vipe | html_entities_encode
+cat <<EOF
+    </p></div>
+    <time class="dt-published" datetime="${date}">${date}</time>
+    <a class="u-url" href="${source_abs_url}">permalink</a>
+   </div>
+  </body>
+</html>
+EOF
+
+fi >> "${source_abs_path}"
+
+curl -d "source=${source_abs_url}" -d "target=${target}" "${webmention_url}";echo

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 10:44:00 2024