-- Leo's gemini proxy

-- Connecting to m15o.midnight.pub:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

#!/bin/bash

host=https://midnight.pub

if [ $# -eq 0 ]
then
    curl -F title="$(head -1 /dev/stdin)"\
	 -F content="$(tail -n +2 /dev/stdin)"\
	 -b midn="$(cat ~/.config/.midnight)"\
	 $host/posts/save
fi

while getopts "r:t:" OPTION; do
    case $OPTION in
	r)
	    curl -F reply="$(cat /dev/stdin)"\
		 -b midn="$(cat ~/.config/.midnight)"\
		 $host/posts/$OPTARG/reply
            ;;
	t)
	    curl -F reply="$(cat /dev/stdin)"\
		 -b midn="$(cat ~/.config/.midnight)"\
		 $host/replies/$OPTARG/save
            ;;
	*)
            echo "Incorrect options provided"
            exit 1
            ;;
    esac
done

-- Response ended

-- Page fetched on Fri Apr 19 15:25:36 2024