2020-06-14 Using Titan to edit a Gemini wiki

2020-06-17 Tiny Gemini Client in Bash

Community Wiki

---

I’ve set up a Gemini wiki for testing on `gemini://communitywiki.org:1966` – note the non-standard port!

If you want to edit or create a page, use the following shell script if you’re not using Gemini Write, my *Elpher* extension. Use your regular Gemini client to read, of course.

Gemini Write

#!/bin/bash

# If you set HOST, PORT, TOKEN, or PAGE as environment variables,
# those values are used instead. If you want to edit Alex' wiki,
# for example:
# HOST=alexschroeder.ch PORT=1965 TOKEN=hello PAGE=Test ./gemini-wiki

HOST=${HOST:-communitywiki.org}
PORT=${PORT:-1966}
TOKEN=${TOKEN:-Elrond}
FILE=$(tempfile)
PAGE=${PAGE:-$(date --iso-8601=date)}
read -p "Edit which page on $HOST? [$PAGE] "
PAGE=${REPLY:-$PAGE}
PAGE=$(echo "$PAGE" | perl -p -e 'chomp; s/ /_/g; s/([^A-Za-z0-9_-])/sprintf("%%%02X", ord($1))/seg')
echo "Requesting gemini://$HOST/raw/$PAGE"
echo "gemini://$HOST/raw/$PAGE" \
    | openssl s_client -quiet -connect $HOST:$PORT 2>/dev/null \
    | tail --lines=+2 \
    > "$FILE"
$EDITOR "$FILE"
SIZE=$(wc -c < "$FILE")
read -p "Post $SIZE bytes to $PAGE? [y/n] " -n 1
echo
if [[ "$REPLY" == "y" ]]; then
    echo Posting it...
    (echo "titan://$HOST/raw/$PAGE;token=$TOKEN;size=$SIZE;mime=text/plain";
     cat "$FILE" ) \
	| openssl s_client -quiet -connect $HOST:$PORT 2>/dev/null
    echo Verifying gemini://$HOST/$PAGE
    echo "gemini://$HOST/$PAGE" \
	| openssl s_client -quiet -connect $HOST:$PORT 2>/dev/null
else
    echo Abort!
    echo Your page was left here: $FILE
fi

​#Gemini ​#Bash ​#Wikis

Comments

(Please contact me if you want to remove your comment.)

⁂

Slowly starting to add peer review features to the Gemini side of things. Today: page history.

Things I’d like to see:

1. diff links

2. reverts or rollbacks

– Alex Schroeder 2020-06-15 15:29 UTC