From 09922423bf59cb642d93d43b44f0adf7bd4a0c75 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sun, 17 Apr 2022 03:06:20 +0300 Subject: [PATCH] Added copying mentions from reply status --- config.json | 1 + pleroma-cli.sh | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index e3d084d..8bdfbc2 100644 --- a/config.json +++ b/config.json @@ -9,6 +9,7 @@ "statuses_separator": "\n==========", "reversed_statuses": false, "quoting_reply": true, + "copy_mentions": true, "public_list_instances": [ "outerheaven.club", "stereophonic.space", diff --git a/pleroma-cli.sh b/pleroma-cli.sh index 35ada3c..c176e5f 100755 --- a/pleroma-cli.sh +++ b/pleroma-cli.sh @@ -14,6 +14,7 @@ boost_symbol=$(jj -i config.json boost_symbol) statuses_separator=$(jj -i config.json statuses_separator) reversed_statuses=$(jj -i config.json reversed_statuses) quoting_reply=$(jj -i config.json quoting_reply) +copy_mentions=$(jj -i config.json copy_mentions) #[AUTH SECTION] mkdir -m 711 -p .app_sessions @@ -477,9 +478,13 @@ reply_mode() { echo 'Input id' read status_id + reply_status=$(status_api_one $status_id) 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 write_status_menu $status_id } @@ -550,6 +555,7 @@ write_api_status() --data-urlencode "visibility=$status_visibility" \ --data-urlencode "in_reply_to_id=$replyto" \ --data-urlencode "media_ids[]=$media" \ + --data-urlencode "to[]=$mentions_reply" \ --output /dev/null echo $http_code else @@ -558,6 +564,7 @@ write_api_status() --data-urlencode "content_type=$content_type" \ --data-urlencode "visibility=$status_visibility" \ --data-urlencode "in_reply_to_id=$replyto" \ + --data-urlencode "to[]=$mentions_reply" \ --output /dev/null echo $http_code fi @@ -592,6 +599,9 @@ write_status_menu() echo "Chars: $(cat tmp_status.md | wc -m)" echo "Visiblity: $status_visibility" echo "Content type: $content_type" + if [ -n "$mentions_reply" ]; then + echo "Mentions: $mentions_reply" + fi if [ -n "$replyto" ]; then echo "Reply to: $replyto" fi @@ -613,7 +623,10 @@ write_status_menu() "Visiblity") 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) ;; "Main menu") sub_menu_lvl=0 ;; esac