mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-26 13:01:28 +00:00
Compare commits
2 commits
d721fdc833
...
5eb9853a1c
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | 5eb9853a1c | ||
localhost_frssoft | b1ca069656 |
|
@ -60,9 +60,14 @@ make_login()
|
||||||
{
|
{
|
||||||
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
|
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
|
||||||
}
|
}
|
||||||
|
put_request()
|
||||||
|
{
|
||||||
|
curl -s --compressed -X PUT -H "Authorization: Bearer $auth" "$@"
|
||||||
|
}
|
||||||
echo '+Authorized account+'
|
echo '+Authorized account+'
|
||||||
export default_curl_opt
|
export default_curl_opt
|
||||||
export post_request
|
export post_request
|
||||||
|
export put_request
|
||||||
else
|
else
|
||||||
default_curl_opt()
|
default_curl_opt()
|
||||||
{
|
{
|
||||||
|
@ -904,6 +909,38 @@ notif_api_remove_all()
|
||||||
post_request --url "$instance_point"/notifications/clear
|
post_request --url "$instance_point"/notifications/clear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
custom_manual_api_request()
|
||||||
|
{
|
||||||
|
while true; do
|
||||||
|
echo 'Select request method:'
|
||||||
|
method=$(echo 'get\npost\nput' | fzy)
|
||||||
|
echo 'Input api request: api/v1/...'
|
||||||
|
case $method in
|
||||||
|
'get')
|
||||||
|
read raw_api
|
||||||
|
default_curl_opt "https://$instance/$raw_api" | jj -p
|
||||||
|
;;
|
||||||
|
'post')
|
||||||
|
read raw_api
|
||||||
|
echo 'input curl data flags: --data-urlencode "example=example"'
|
||||||
|
read flags
|
||||||
|
post_request $flags --url "https://$instance/$raw_api" | jj -p
|
||||||
|
;;
|
||||||
|
'put')
|
||||||
|
read raw_api
|
||||||
|
echo 'input curl data flags: --data-urlencode "example=example"'
|
||||||
|
read flags
|
||||||
|
put_request $flags --url "https://$instance/$raw_api" | jj -p
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "Done, exit? (y/N)"
|
||||||
|
read yn
|
||||||
|
if [ "$yn" = 'y' ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
menu_write_status='Write status'
|
menu_write_status='Write status'
|
||||||
menu_timeline='Timelines'
|
menu_timeline='Timelines'
|
||||||
notif='Notifications'
|
notif='Notifications'
|
||||||
|
@ -913,13 +950,14 @@ my_account='Account'
|
||||||
backup_restore='Backup/Restore'
|
backup_restore='Backup/Restore'
|
||||||
manage_followings='Manage followings'
|
manage_followings='Manage followings'
|
||||||
search_menu='Search'
|
search_menu='Search'
|
||||||
|
custom_request='Make custom api request'
|
||||||
authmake='Auth'
|
authmake='Auth'
|
||||||
switchinstance='Switch instance'
|
switchinstance='Switch instance'
|
||||||
Exit='Exit'
|
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$my_account\n$search_menu\n$switchinstance\n$Exit" | fzy)
|
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$my_account\n$search_menu\n$custom_request\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
|
||||||
|
@ -949,6 +987,7 @@ while true; do
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
"$search_menu") search_api_statuses ;;
|
"$search_menu") search_api_statuses ;;
|
||||||
|
"$custom_request") custom_manual_api_request ;;
|
||||||
"$switchinstance")
|
"$switchinstance")
|
||||||
empty=0
|
empty=0
|
||||||
case $(echo 'Recently used\nChoice from list\nManual input' | fzy) in
|
case $(echo 'Recently used\nChoice from list\nManual input' | fzy) in
|
||||||
|
|
Loading…
Reference in a new issue