Add option for disabling quote-posts

This commit is contained in:
Jaidyn Ann 2024-04-10 22:10:48 -05:00
parent 3b130b7a28
commit ee5e64e5d1

View File

@ -17,6 +17,7 @@ usage() {
echo
echo ' -h print this message and exit'
echo ' -H file used to store/check quoted posts; to avoid duplicates'
echo ' -Q disable actual quote-posting (which Mastodon doesnt support)'
echo ' -s scope for posts, one of: public/[unlisted]/private/direct'
echo
echo 'Posts tagged under HASHTAG will all be quote-posted to the'
@ -94,7 +95,9 @@ quote_posts() {
post_json() {
local tagged_post_json="$1"
printf '{ "content_type": "text/html", "visibility": "%s",' "$FEDI_SCOPE"
printf '"quote_id": "%s",' "$(echo "$tagged_post_json" | jq -r .id)"
if test -z "$NO_QUOTE_POSTS"; then
printf '"quote_id": "%s",' "$(echo "$tagged_post_json" | jq -r .id)"
fi
printf '"expires_in": %s,' 864000
printf '"status": "%s" }\n' "$(post_body "$tagged_post_json")"
}
@ -180,7 +183,7 @@ env_subst() {
FEDI_SCOPE="unlisted" # Default value.
while getopts 'hH:s:' arg; do
while getopts 'hH:s:Q' arg; do
case $arg in
h)
usage
@ -205,6 +208,9 @@ while getopts 'hH:s:' arg; do
exit 6
fi
;;
Q)
NO_QUOTE_POSTS="1"
;;
esac
done