Add option for disabling quote-posts
This commit is contained in:
parent
3b130b7a28
commit
ee5e64e5d1
10
manicito
10
manicito
|
@ -17,6 +17,7 @@ usage() {
|
||||||
echo
|
echo
|
||||||
echo ' -h print this message and exit'
|
echo ' -h print this message and exit'
|
||||||
echo ' -H file used to store/check quoted posts; to avoid duplicates'
|
echo ' -H file used to store/check quoted posts; to avoid duplicates'
|
||||||
|
echo ' -Q disable actual quote-posting (which Mastodon doesn’t support)'
|
||||||
echo ' -s scope for posts, one of: public/[unlisted]/private/direct'
|
echo ' -s scope for posts, one of: public/[unlisted]/private/direct'
|
||||||
echo
|
echo
|
||||||
echo 'Posts tagged under HASHTAG will all be quote-posted to the'
|
echo 'Posts tagged under HASHTAG will all be quote-posted to the'
|
||||||
|
@ -94,7 +95,9 @@ quote_posts() {
|
||||||
post_json() {
|
post_json() {
|
||||||
local tagged_post_json="$1"
|
local tagged_post_json="$1"
|
||||||
printf '{ "content_type": "text/html", "visibility": "%s",' "$FEDI_SCOPE"
|
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 '"expires_in": %s,' 864000
|
||||||
printf '"status": "%s" }\n' "$(post_body "$tagged_post_json")"
|
printf '"status": "%s" }\n' "$(post_body "$tagged_post_json")"
|
||||||
}
|
}
|
||||||
|
@ -180,7 +183,7 @@ env_subst() {
|
||||||
FEDI_SCOPE="unlisted" # Default value.
|
FEDI_SCOPE="unlisted" # Default value.
|
||||||
|
|
||||||
|
|
||||||
while getopts 'hH:s:' arg; do
|
while getopts 'hH:s:Q' arg; do
|
||||||
case $arg in
|
case $arg in
|
||||||
h)
|
h)
|
||||||
usage
|
usage
|
||||||
|
@ -205,6 +208,9 @@ while getopts 'hH:s:' arg; do
|
||||||
exit 6
|
exit 6
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
Q)
|
||||||
|
NO_QUOTE_POSTS="1"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue