💾 Archived View for midnight.pub › posts › 381 captured on 2022-06-03 at 23:43:47. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

Midnight Pub

My midnight.sh

~coldwave

I changed midnight.sh to post the contents of a file which is given as first argument, instead of from stdin. Run like "bash ./midnight.sh post.txt ". The file should contain: title, one blank line, body.

--form-string instead of -F to read the text as literal; I had some problems with semicolons read as field seperators in the posting form

Haven't gotten to the reply and thread options yet.

#!/bin/bash

 host=https://midnight.pub

 if [ $# -eq 1 ]
 then
	file=$1
	echo "$(sed -n '1p' $file)"
	echo "$(tail -n +2 $file)"
  curl --form-string title="$(sed -n '1p' $file)"\
	    --form-string content="$(tail -n +2 $file)"\
	 -b midn="$(cat ~/.config/.midnight)"\
	 $host/posts/save
fi

Write a reply

Replies

~zampano wrote (thread):

If I'm reading this right, it's also loading your login credentials from a local file?