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