Added copying mentions from reply status

This commit is contained in:
localhost_frssoft 2022-04-17 03:06:20 +03:00
parent 1e47b96cb5
commit 09922423bf
2 changed files with 16 additions and 2 deletions

View file

@ -9,6 +9,7 @@
"statuses_separator": "\n==========", "statuses_separator": "\n==========",
"reversed_statuses": false, "reversed_statuses": false,
"quoting_reply": true, "quoting_reply": true,
"copy_mentions": true,
"public_list_instances": [ "public_list_instances": [
"outerheaven.club", "outerheaven.club",
"stereophonic.space", "stereophonic.space",

View file

@ -14,6 +14,7 @@ boost_symbol=$(jj -i config.json boost_symbol)
statuses_separator=$(jj -i config.json statuses_separator) statuses_separator=$(jj -i config.json statuses_separator)
reversed_statuses=$(jj -i config.json reversed_statuses) reversed_statuses=$(jj -i config.json reversed_statuses)
quoting_reply=$(jj -i config.json quoting_reply) quoting_reply=$(jj -i config.json quoting_reply)
copy_mentions=$(jj -i config.json copy_mentions)
#[AUTH SECTION] #[AUTH SECTION]
mkdir -m 711 -p .app_sessions mkdir -m 711 -p .app_sessions
@ -477,8 +478,12 @@ reply_mode()
{ {
echo 'Input id' echo 'Input id'
read status_id read status_id
reply_status=$(status_api_one $status_id)
if [ "$quoting_reply" = 'true' ]; then if [ "$quoting_reply" = 'true' ]; then
status_api_one $status_id | jj content | html_to_txt_render | sed 's/^/> /' > tmp_status.md echo "$reply_status" | jj content | html_to_txt_render | sed 's/^/> /' > tmp_status.md
fi
if [ "$copy_mentions" = 'true' ]; then
mentions_reply=$(echo "$reply_status" | jj -l 'mentions.#.acct' | delq | legacy_addr_preprocess | tr '\n' ',' | sed 's/,$//g')
fi fi
write_status_menu $status_id write_status_menu $status_id
} }
@ -550,6 +555,7 @@ write_api_status()
--data-urlencode "visibility=$status_visibility" \ --data-urlencode "visibility=$status_visibility" \
--data-urlencode "in_reply_to_id=$replyto" \ --data-urlencode "in_reply_to_id=$replyto" \
--data-urlencode "media_ids[]=$media" \ --data-urlencode "media_ids[]=$media" \
--data-urlencode "to[]=$mentions_reply" \
--output /dev/null --output /dev/null
echo $http_code echo $http_code
else else
@ -558,6 +564,7 @@ write_api_status()
--data-urlencode "content_type=$content_type" \ --data-urlencode "content_type=$content_type" \
--data-urlencode "visibility=$status_visibility" \ --data-urlencode "visibility=$status_visibility" \
--data-urlencode "in_reply_to_id=$replyto" \ --data-urlencode "in_reply_to_id=$replyto" \
--data-urlencode "to[]=$mentions_reply" \
--output /dev/null --output /dev/null
echo $http_code echo $http_code
fi fi
@ -592,6 +599,9 @@ write_status_menu()
echo "Chars: $(cat tmp_status.md | wc -m)" echo "Chars: $(cat tmp_status.md | wc -m)"
echo "Visiblity: $status_visibility" echo "Visiblity: $status_visibility"
echo "Content type: $content_type" echo "Content type: $content_type"
if [ -n "$mentions_reply" ]; then
echo "Mentions: $mentions_reply"
fi
if [ -n "$replyto" ]; then if [ -n "$replyto" ]; then
echo "Reply to: $replyto" echo "Reply to: $replyto"
fi fi
@ -613,7 +623,10 @@ write_status_menu()
"Visiblity") "Visiblity")
status_visibility=$(echo 'public\nunlisted\nlocal\nprivate\ndirect\nlist' | fzy) status_visibility=$(echo 'public\nunlisted\nlocal\nprivate\ndirect\nlist' | fzy)
;; ;;
"Reset") echo > tmp_status.md ;; "Reset")
echo > tmp_status.md
mentions_reply=
;;
"Back") sub_menu_lvl=$(expr $level - 1) ;; "Back") sub_menu_lvl=$(expr $level - 1) ;;
"Main menu") sub_menu_lvl=0 ;; "Main menu") sub_menu_lvl=0 ;;
esac esac