Support configuring posts’ scope
This commit is contained in:
parent
61b22d1e09
commit
1e2eaf0dbe
|
@ -14,8 +14,9 @@ usage() {
|
||||||
echo "Posts sfeed(1) feed data from stdin to Mastodon-compatible servers."
|
echo "Posts sfeed(1) feed data from stdin to Mastodon-compatible servers."
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h print this message and exit"
|
echo " -h print this message and exit"
|
||||||
echo " -a the authorization token for your account; see below"
|
echo " -a the authorization token for your account"
|
||||||
echo " -t template for post contents; see below"
|
echo " -s the scope for posts, one of: public/unlisted/private/direct"
|
||||||
|
echo " -t template for post contents"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To find your authorization token, you can snoop through request headers in"
|
echo "To find your authorization token, you can snoop through request headers in"
|
||||||
echo "your web-browser. In Firefox, this can be done through:"
|
echo "your web-browser. In Firefox, this can be done through:"
|
||||||
|
@ -43,7 +44,7 @@ url_deescape() {
|
||||||
# Takes a post’s contents and create the corresponding client-API JSON.
|
# Takes a post’s contents and create the corresponding client-API JSON.
|
||||||
post_json() {
|
post_json() {
|
||||||
local message_text="$1"
|
local message_text="$1"
|
||||||
printf '{ "content_type": "text/html", "visibility": "unlisted",'
|
printf '{ "content_type": "text/html", "visibility": "%s",' "$FEDI_SCOPE"
|
||||||
printf '"status": "%s" }\n' "$message_text"
|
printf '"status": "%s" }\n' "$message_text"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +103,9 @@ while getopts 'ha:t:' arg; do
|
||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
s)
|
||||||
|
FEDI_SCOPE="$OPTARG"
|
||||||
|
;;
|
||||||
a)
|
a)
|
||||||
FEDI_AUTH="$OPTARG"
|
FEDI_AUTH="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
@ -133,6 +137,11 @@ if test -z "$SERVER_URL"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test -z "$FEDI_SCOPE"; then
|
||||||
|
FEDI_SCOPE="public"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
IFS="
|
IFS="
|
||||||
"
|
"
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
|
|
Ŝarĝante…
Reference in New Issue