Compare commits

..

2 commits

View file

@ -60,9 +60,14 @@ make_login()
{
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
}
put_request()
{
curl -s --compressed -X PUT -H "Authorization: Bearer $auth" "$@"
}
echo '+Authorized account+'
export default_curl_opt
export post_request
export put_request
else
default_curl_opt()
{
@ -904,6 +909,38 @@ notif_api_remove_all()
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_timeline='Timelines'
notif='Notifications'
@ -913,13 +950,14 @@ my_account='Account'
backup_restore='Backup/Restore'
manage_followings='Manage followings'
search_menu='Search'
custom_request='Make custom api request'
authmake='Auth'
switchinstance='Switch instance'
Exit='Exit'
while true; do
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
main_menu=$(echo "$authmake\n$menu_timeline\n$switchinstance\n$Exit" | fzy)
fi
@ -949,6 +987,7 @@ while true; do
esac
;;
"$search_menu") search_api_statuses ;;
"$custom_request") custom_manual_api_request ;;
"$switchinstance")
empty=0
case $(echo 'Recently used\nChoice from list\nManual input' | fzy) in