Added: Share + favorite function

This commit is contained in:
localhost_frssoft 2022-04-16 13:39:07 +03:00
parent 0060e6282d
commit 311a4e7dea
1 changed files with 23 additions and 3 deletions

View File

@ -365,7 +365,7 @@ statuses_view_menu()
ids_massive=$(echo $json | jj -l \#.id | delq) ids_massive=$(echo $json | jj -l \#.id | delq)
jsonmassive=$json jsonmassive=$json
statuses_render statuses_render
menustatuses=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nBack' | fzy) menustatuses=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nShare and favorite\nThread\nBack' | fzy)
case "$menustatuses" in case "$menustatuses" in
"Back") sub_menu_lvl=1 ;; "Back") sub_menu_lvl=1 ;;
"Prev") "Prev")
@ -384,6 +384,7 @@ statuses_view_menu()
"Reply") reply_mode ;; "Reply") reply_mode ;;
"Share") share_mode ;; "Share") share_mode ;;
"Favorite") favourite_mode ;; "Favorite") favourite_mode ;;
"Share and favorite") share_and_favorite_mode ;;
"Thread") thread_open ;; "Thread") thread_open ;;
esac esac
done done
@ -415,12 +416,13 @@ thread_menu()
ids_massive=$(echo $jsonthread | jj -l \#.id | delq) ids_massive=$(echo $jsonthread | jj -l \#.id | delq)
jsonmassive=$jsonthread jsonmassive=$jsonthread
statuses_render statuses_render
menuthread=$(echo 'Back\nReply\nShare\nFavorite' | fzy) menuthread=$(echo 'Back\nReply\nShare\nFavorite\nShare and favorite' | fzy)
case "$menuthread" in case "$menuthread" in
"Back") sub_menu_lvl=1 ;; "Back") sub_menu_lvl=1 ;;
"Reply") reply_mode ;; "Reply") reply_mode ;;
"Share") share_mode ;; "Share") share_mode ;;
"Favorite") favourite_mode ;; "Favorite") favourite_mode ;;
"Share and favorite") share_and_favorite_mode ;;
esac esac
done done
} }
@ -439,7 +441,7 @@ timeline_menu()
ids_massive=$(echo $json | jj -l \#.id | delq) ids_massive=$(echo $json | jj -l \#.id | delq)
jsonmassive=$json jsonmassive=$json
statuses_render statuses_render
menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nMain menu' | fzy) menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nShare and favorite\nThread\nMain menu' | fzy)
case $menu in case $menu in
"Prev") "Prev")
indexator=$(expr $max_statuses - 1) indexator=$(expr $max_statuses - 1)
@ -457,6 +459,7 @@ timeline_menu()
"Reply") reply_mode ;; "Reply") reply_mode ;;
"Share") share_mode ;; "Share") share_mode ;;
"Favorite") favourite_mode ;; "Favorite") favourite_mode ;;
"Share and favorite") share_and_favorite_mode ;;
"Thread") thread_open ;; "Thread") thread_open ;;
"Main menu") sub_menu_lvl=0 ;; "Main menu") sub_menu_lvl=0 ;;
esac esac
@ -473,6 +476,23 @@ reply_mode()
write_status_menu $status_id write_status_menu $status_id
} }
share_and_favorite_mode()
{
echo 'Input id (s - stop)'
shareandfavmode=1
while [ $shareandfavmode -eq 1 ]; do
read status_id
if [ "$status_id" = 's' ]; then
shareandfavmode=0
else
share_api_status $status_id
echo $http_code
favorite_api_status $status_id
echo $http_code
fi
done
}
share_api_status() share_api_status()
{ {
post_request -w "%{http_code}" --url $instance_point/statuses/$1/reblog --output /dev/null post_request -w "%{http_code}" --url $instance_point/statuses/$1/reblog --output /dev/null