mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-28 06:01:27 +00:00
Added manage followings function: add and delete
This commit is contained in:
parent
bfdce6ecf0
commit
eeb88482f6
|
@ -300,9 +300,12 @@ followings_menu()
|
||||||
"Main menu") sub_menu_lvl=0 ;;
|
"Main menu") sub_menu_lvl=0 ;;
|
||||||
"Next") offset=$(echo "$followings" | jj $(expr $(echo "$followings" | jj \#) - 1).id) ;;
|
"Next") offset=$(echo "$followings" | jj $(expr $(echo "$followings" | jj \#) - 1).id) ;;
|
||||||
*)
|
*)
|
||||||
index=$(echo "$choice" | cut -f 1 -d:)
|
index=$(echo "$choice" | cut -f 1 -d:)
|
||||||
statuses_view_menu "$(echo "$followings" | jj "$index".acct)"
|
case "$1" in
|
||||||
;;
|
'Remove following') unfollow_account "$(echo "$followings" | jj "$index".id)" ;;
|
||||||
|
'') statuses_view_menu "$(echo "$followings" | jj "$index".acct)" ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -322,6 +325,17 @@ reject_follow_request()
|
||||||
post_request "$instance_point/follow_requests/$1/reject"
|
post_request "$instance_point/follow_requests/$1/reject"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
follow_account()
|
||||||
|
{
|
||||||
|
acct_id=$(account_api_get "$1" | jj id)
|
||||||
|
post_request "$instance_point/accounts/$acct_id/follow"
|
||||||
|
}
|
||||||
|
|
||||||
|
unfollow_account()
|
||||||
|
{
|
||||||
|
post_request "$instance_point/accounts/$1/unfollow"
|
||||||
|
}
|
||||||
|
|
||||||
menu_follow_requests()
|
menu_follow_requests()
|
||||||
{
|
{
|
||||||
follow_req=$(following_requests)
|
follow_req=$(following_requests)
|
||||||
|
@ -385,6 +399,11 @@ delqse()
|
||||||
sed 's/^"//g; s/"$//g'
|
sed 's/^"//g; s/"$//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
account_api_get()
|
||||||
|
{
|
||||||
|
default_curl_opt "$instance_point/accounts/$1"
|
||||||
|
}
|
||||||
|
|
||||||
statuses_api_account()
|
statuses_api_account()
|
||||||
{
|
{
|
||||||
default_curl_opt "$instance_point/accounts/$1/statuses?limit=$max_statuses&max_id=$2&min_id=$3"
|
default_curl_opt "$instance_point/accounts/$1/statuses?limit=$max_statuses&max_id=$2&min_id=$3"
|
||||||
|
@ -853,11 +872,12 @@ 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'
|
|
||||||
followrequests='Follow requests'
|
|
||||||
my_account='Account'
|
my_account='Account'
|
||||||
|
followingsmenu='Followings'
|
||||||
|
followrequests='Follow requests'
|
||||||
|
backup_restore='Backup/Restore'
|
||||||
|
manage_followings='Manage followings'
|
||||||
authmake='Auth'
|
authmake='Auth'
|
||||||
backup_restore='Backup/Restore'
|
|
||||||
switchinstance='Switch instance'
|
switchinstance='Switch instance'
|
||||||
Exit='Exit'
|
Exit='Exit'
|
||||||
|
|
||||||
|
@ -875,10 +895,20 @@ while true; do
|
||||||
;;
|
;;
|
||||||
"$notif") notif_menu ;;
|
"$notif") notif_menu ;;
|
||||||
"$my_account")
|
"$my_account")
|
||||||
my_account_menu=$(echo "$followingsmenu\n$followrequests\n$backup_restore" | fzy)
|
my_account_menu=$(echo "$followingsmenu\n$followrequests\n$manage_followings\n$backup_restore" | fzy)
|
||||||
case $my_account_menu in
|
case $my_account_menu in
|
||||||
"$followingsmenu") followings_menu ;;
|
"$followingsmenu") followings_menu ;;
|
||||||
"$followrequests") menu_follow_requests ;;
|
"$followrequests") menu_follow_requests ;;
|
||||||
|
"$manage_followings")
|
||||||
|
action_manage=$(echo 'Add following\nRemove following' | fzy)
|
||||||
|
if [ "$action_manage" = 'Add following' ]; then
|
||||||
|
echo 'Input nick or full address (ex. example_nick or example@domain'
|
||||||
|
read add_account
|
||||||
|
follow_account "$add_account"
|
||||||
|
else
|
||||||
|
followings_menu "$action_manage"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
"$backup_restore") backup_restore_menu ;;
|
"$backup_restore") backup_restore_menu ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue