Compare commits

...

2 commits

Author SHA1 Message Date
localhost_frssoft 1e47b96cb5 Extended timelines 2022-04-16 14:41:00 +03:00
localhost_frssoft 311a4e7dea Added: Share + favorite function 2022-04-16 13:39:07 +03:00

View file

@ -365,7 +365,7 @@ statuses_view_menu()
ids_massive=$(echo $json | jj -l \#.id | delq)
jsonmassive=$json
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
"Back") sub_menu_lvl=1 ;;
"Prev")
@ -384,6 +384,7 @@ statuses_view_menu()
"Reply") reply_mode ;;
"Share") share_mode ;;
"Favorite") favourite_mode ;;
"Share and favorite") share_and_favorite_mode ;;
"Thread") thread_open ;;
esac
done
@ -415,19 +416,27 @@ thread_menu()
ids_massive=$(echo $jsonthread | jj -l \#.id | delq)
jsonmassive=$jsonthread
statuses_render
menuthread=$(echo 'Back\nReply\nShare\nFavorite' | fzy)
menuthread=$(echo 'Back\nReply\nShare\nFavorite\nShare and favorite' | fzy)
case "$menuthread" in
"Back") sub_menu_lvl=1 ;;
"Reply") reply_mode ;;
"Share") share_mode ;;
"Favorite") favourite_mode ;;
"Share and favorite") share_and_favorite_mode ;;
esac
done
}
timeline_api()
{
default_curl_opt "$instance_point/$timeline?limit=$max_statuses&max_id=$1&min_id=$2"
case "$timeline" in
"home") default_curl_opt "$instance_point/timelines/home?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"home/local") default_curl_opt "$instance_point/timelines/home?local=true&limit=$max_statuses&max_id=$1&min_id=$2" ;;
"favourites") default_curl_opt "$instance_point/favourites?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"direct") default_curl_opt "$instance_point/timelines/direct?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"public") default_curl_opt "$instance_point/timelines/public?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"local") default_curl_opt "$instance_point/timelines/public?local=true&limit=$max_statuses&max_id=$1&min_id=$2" ;;
esac
}
timeline_menu()
@ -439,7 +448,7 @@ timeline_menu()
ids_massive=$(echo $json | jj -l \#.id | delq)
jsonmassive=$json
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
"Prev")
indexator=$(expr $max_statuses - 1)
@ -457,6 +466,7 @@ timeline_menu()
"Reply") reply_mode ;;
"Share") share_mode ;;
"Favorite") favourite_mode ;;
"Share and favorite") share_and_favorite_mode ;;
"Thread") thread_open ;;
"Main menu") sub_menu_lvl=0 ;;
esac
@ -473,6 +483,23 @@ reply_mode()
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()
{
post_request -w "%{http_code}" --url $instance_point/statuses/$1/reblog --output /dev/null
@ -647,7 +674,7 @@ fi
case $main_menu in
"$menu_write_status") write_status_menu ;;
"$menu_timeline")
timeline=$(echo 'timelines/home\nfavourites\ntimelines/direct\ntimelines/public' | fzy)
timeline=$(echo 'home\nhome/local\nfavourites\ndirect\nlocal\npublic' | fzy)
timeline_menu
;;
"$notif") notif_menu ;;