Fixes send post; Maybe fix mentions

This commit is contained in:
localhost_frssoft 2022-05-08 18:24:53 +03:00
parent b3ed6c4fdb
commit 201025ff77

View file

@ -734,24 +734,20 @@ write_api_status()
{ {
if [ -n "$mediaattach" ]; then if [ -n "$mediaattach" ]; then
media=$(upload_api_media | jj id) media=$(upload_api_media | jj id)
post_request -w "%{http_code}" --url "$instance_point"/statuses \ post_request --url "$instance_point"/statuses \
--data-urlencode "status=$1" \ --data-urlencode "status@$1" \
--data-urlencode "content_type=$content_type" \ --data-raw "content_type=$content_type" \
--data-urlencode "visibility=$status_visibility" \ --data-raw "visibility=$status_visibility" \
--data-urlencode "in_reply_to_id=$replyto" \ --data-raw "in_reply_to_id=$replyto" \
--data-urlencode "media_ids[]=$media" \ --data-raw "media_ids[]=$media" \
--data-urlencode "to[]=$mentions_reply" \ --data-raw "to[]=$mentions_reply"
--output /dev/null
echo "$http_code"
else else
post_request -w "%{http_code}" --url "$instance_point"/statuses \ post_request --url "$instance_point"/statuses \
--data-urlencode "status=$1" \ --data-urlencode "status@$1" \
--data-urlencode "content_type=$content_type" \ --data-raw "content_type=$content_type" \
--data-urlencode "visibility=$status_visibility" \ --data-raw "visibility=$status_visibility" \
--data-urlencode "in_reply_to_id=$replyto" \ --data-raw "in_reply_to_id=$replyto" \
--data-urlencode "to[]=$mentions_reply" \ --data-raw "to[]=$mentions_reply"
--output /dev/null
echo "$http_code"
fi fi
} }
@ -768,7 +764,7 @@ write_status_menu()
status_visibility="$default_visibility" status_visibility="$default_visibility"
replyto=$1 replyto=$1
mediaattach= mediaattach=
http_code= status_data_send=
if [ -n "$sub_menu_lvl" ]; then if [ -n "$sub_menu_lvl" ]; then
sub_menu_lvl=2 sub_menu_lvl=2
level=2 level=2
@ -793,13 +789,15 @@ write_status_menu()
if [ -n "$mediaattach" ]; then if [ -n "$mediaattach" ]; then
echo "Attachments: $mediaattach" echo "Attachments: $mediaattach"
fi fi
if [ -n "$http_code" ]; then if [ -n "$(echo "$status_data_send" | jj id)" ]; then
echo "Send state: $http_code" echo 'Send state: OK'
elif [ -n "$(echo "$status_data_send" | jj error)" ]; then
echo "Send state: ERR: $(echo "$status_data_send" | jj error)"
fi fi
wrirepostmenu=$(echo "Edit\nSend\nAdd attach\nAdd recipient\nChange type\nVisiblity\nReset\nBack\nMain menu" | fzy) wrirepostmenu=$(echo "Edit\nSend\nAdd attach\nAdd recipient\nChange type\nVisiblity\nReset\nBack\nMain menu" | fzy)
case $wrirepostmenu in case $wrirepostmenu in
"Edit") $EDITOR tmp_status.md ;; "Edit") $EDITOR tmp_status.md ;;
"Send") http_code=$(write_api_status "$(cat tmp_status.md)") ;; "Send") status_data_send=$(write_api_status tmp_status.md) ;;
"Add attach") "Add attach")
echo 'Input path to attach (ex. @image.png or @/full/path/to/attach.png)' echo 'Input path to attach (ex. @image.png or @/full/path/to/attach.png)'
read mediaattach read mediaattach