From 7083310a416eed5e488cd98a9622ef47bdc99fde Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 14 Apr 2022 22:14:43 +0300 Subject: [PATCH] implemented followings menu --- pleroma-cli.sh | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/pleroma-cli.sh b/pleroma-cli.sh index f308306..8e7afdf 100755 --- a/pleroma-cli.sh +++ b/pleroma-cli.sh @@ -245,6 +245,29 @@ followings_api_get() 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() { default_curl_opt "$instance_point/blocks?limit=40&max_id=$offset" @@ -275,6 +298,11 @@ delqse() sed 's/^"//g; s/"$//g' } +statuses_api_account() +{ + default_curl_opt "accounts/$1/statuses?limit=$max_statuses" +} + thread_menu() { sub_menu_lvl=2 @@ -549,6 +577,7 @@ notif_api_remove_all() menu_write_status='Write status' menu_timeline='Timelines' notif='Notifications' +followingsmenu='Followings' authmake='Auth' backup_restore='Backup/Restore' switchinstance='Switch instance' @@ -556,7 +585,7 @@ Exit='Exit' while true; do 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 main_menu=$(echo "$authmake\n$menu_timeline\n$switchinstance\n$Exit" | fzy) fi @@ -567,7 +596,7 @@ case $main_menu in timeline_menu ;; "$notif") notif_menu ;; - "$clrnotif") notif_api_remove_all ;; + "$followingsmenu") followings_menu ;; "$backup_restore") backup_restore_menu ;; "$switchinstance") empty=0