Compare commits

..

2 commits

Author SHA1 Message Date
localhost_frssoft 201025ff77 Fixes send post; Maybe fix mentions 2022-05-08 18:24:53 +03:00
localhost_frssoft b3ed6c4fdb Reorder per_status_menu 2022-05-08 16:17:22 +03:00

View file

@ -453,7 +453,7 @@ statuses_render()
dateutc=$(echo "$status" | jj created_at) dateutc=$(echo "$status" | jj created_at)
reply_to_id=$(echo "$status" | jj in_reply_to_id) reply_to_id=$(echo "$status" | jj in_reply_to_id)
visibility_status=$(echo "$status" | jj visibility) visibility_status=$(echo "$status" | jj visibility)
s_f_menu='\nShare and favorite\nShare' s_f_menu='\nShare\nShare and favorite'
if [ "$visibility_status" = "private" ] || [ "$visibility_status" = "direct" ]; then if [ "$visibility_status" = "private" ] || [ "$visibility_status" = "direct" ]; then
s_f_menu= s_f_menu=
fi fi
@ -487,7 +487,7 @@ statuses_render()
next=0 next=0
force_stop=0 force_stop=0
while [ "$next" -eq 0 ]; do while [ "$next" -eq 0 ]; do
per_status_menu=$(echo "Next$menuattachments"$s_f_menu"\nFavorite\nBookmark\nReply\nBack" | fzy) per_status_menu=$(echo "Next$menuattachments\nFavorite$s_f_menu\nBookmark\nReply\nBack" | fzy)
case "$per_status_menu" in case "$per_status_menu" in
"Next") "Next")
next=1 next=1
@ -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