2018-05-20 09:39:59 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-01-12 21:19:21 +00:00
|
|
|
|
|
|
|
# Simple, minimalist command line tool to post status to hubzilla via the API. Requires curl.
|
|
|
|
# Put it in your path, and sneeze your statuses to the zot network from your shell.
|
|
|
|
|
2020-07-02 06:03:34 +00:00
|
|
|
CONF=${HOME}/.zap_post
|
2016-01-12 21:19:21 +00:00
|
|
|
|
|
|
|
usage () {
|
2020-07-02 06:03:34 +00:00
|
|
|
echo "usage: util/zap_post [conffile]"
|
|
|
|
echo "Create a conf file, either in .zap_post in your home directory, or supplied as an arg"
|
2016-01-12 21:19:21 +00:00
|
|
|
echo " USER=youruserame "
|
|
|
|
echo " PASS=yourpass"
|
|
|
|
echo " HUB=your.hub.domain.org"
|
|
|
|
echo
|
2020-07-02 06:03:34 +00:00
|
|
|
echo "Type \"zap_post\" (with or without a conf file as an arg), then enter your message. Use ctrl-D to send.."
|
2016-01-12 21:19:21 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CUR=`which curl`
|
|
|
|
|
|
|
|
[ "$CUR" ] || { echo "curl is not installed or on your path"; usage; exit 1; }
|
|
|
|
|
|
|
|
[ "$1" ] && CONF="$1"
|
|
|
|
|
2016-01-12 21:20:37 +00:00
|
|
|
|
|
|
|
. ${CONF}
|
|
|
|
|
2016-01-12 21:19:21 +00:00
|
|
|
[ "$USER" ] || { echo "no USER"; usage; exit 1; }
|
|
|
|
[ "$PASS" ] || { echo "no PASS"; usage; exit 1; }
|
|
|
|
[ "$HUB" ] || { echo "no HUB"; usage; exit 1; }
|
|
|
|
|
2016-01-15 05:05:36 +00:00
|
|
|
echo "enter your message to be posted as $USER @ $HUB, then hit Ctrl-D to send."
|
2016-01-12 21:19:21 +00:00
|
|
|
|
2016-01-15 05:05:36 +00:00
|
|
|
MSG=$(cat)
|
|
|
|
|
2016-12-22 00:44:33 +00:00
|
|
|
curl -ssl -u${USER}:${PASS} --data-urlencode "body=${MSG}" https://${HUB}/api/z/1.0/item/update
|
2016-01-12 21:19:21 +00:00
|
|
|
|
|
|
|
|