Delete gemini-wiki
There are better solutions for this, now.
This commit is contained in:
parent
014c6dc353
commit
50cdfe02bc
36
gemini-wiki
36
gemini-wiki
|
@ -1,36 +0,0 @@
|
|||
#!/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
|
Loading…
Reference in New Issue