implemented followings menu

This commit is contained in:
localhost_frssoft 2022-04-14 22:14:43 +03:00
parent 7f44893d7b
commit 7083310a41

View file

@ -245,6 +245,29 @@ followings_api_get()
default_curl_opt "$instance_point/accounts/$1/following?limit=40&max_id=$offset" default_curl_opt "$instance_point/accounts/$1/following?limit=40&max_id=$offset"
} }
followings_menu()
{
account_info=$(account_api_me)
acc_id=$(echo $account_info | jj id)
acc_following_count=$(echo $account_info | jj following_count)
echo "Followers: $acc_following_count"
sub_menu_lvl=1
while [ $sub_menu_lvl -eq 1 ]; do
followings=$(followings_api_get $acc_id)
accts=$(echo $followings | jj -l \#.acct | nl -s: -v0 -w1)
choice=$(echo "Main menu\n$accts\nNext" | fzy)
case $choice in
"Main menu") sub_menu_lvl=0 ;;
"Next") offset=$(echo $followings | jj $(expr $(echo $followings | jj \#) - 1).id) ;;
*)
index=$(echo $choice | cut -f 1 -d:)
statuses_view_menu "$(echo $followings | jj $index.acct)"
;;
esac
done
}
blocks_api_get() blocks_api_get()
{ {
default_curl_opt "$instance_point/blocks?limit=40&max_id=$offset" default_curl_opt "$instance_point/blocks?limit=40&max_id=$offset"
@ -275,6 +298,11 @@ delqse()
sed 's/^"//g; s/"$//g' sed 's/^"//g; s/"$//g'
} }
statuses_api_account()
{
default_curl_opt "accounts/$1/statuses?limit=$max_statuses"
}
thread_menu() thread_menu()
{ {
sub_menu_lvl=2 sub_menu_lvl=2
@ -549,6 +577,7 @@ notif_api_remove_all()
menu_write_status='Write status' menu_write_status='Write status'
menu_timeline='Timelines' menu_timeline='Timelines'
notif='Notifications' notif='Notifications'
followingsmenu='Followings'
authmake='Auth' authmake='Auth'
backup_restore='Backup/Restore' backup_restore='Backup/Restore'
switchinstance='Switch instance' switchinstance='Switch instance'
@ -556,7 +585,7 @@ Exit='Exit'
while true; do while true; do
if [ -n "$auth" ]; then if [ -n "$auth" ]; then
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$backup_restore\n$switchinstance\n$Exit" | fzy) main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$followingsmenu\n$backup_restore\n$switchinstance\n$Exit" | fzy)
else else
main_menu=$(echo "$authmake\n$menu_timeline\n$switchinstance\n$Exit" | fzy) main_menu=$(echo "$authmake\n$menu_timeline\n$switchinstance\n$Exit" | fzy)
fi fi
@ -567,7 +596,7 @@ case $main_menu in
timeline_menu timeline_menu
;; ;;
"$notif") notif_menu ;; "$notif") notif_menu ;;
"$clrnotif") notif_api_remove_all ;; "$followingsmenu") followings_menu ;;
"$backup_restore") backup_restore_menu ;; "$backup_restore") backup_restore_menu ;;
"$switchinstance") "$switchinstance")
empty=0 empty=0