Added bookmark function and timeline:bookmarks

This commit is contained in:
localhost_frssoft 2022-05-06 00:23:16 +03:00
parent 6609a6d169
commit e4daec319b

View file

@ -467,7 +467,7 @@ statuses_render()
next=0 next=0
force_stop=0 force_stop=0
while [ "$next" -eq 0 ]; do while [ "$next" -eq 0 ]; do
per_status_menu=$(echo "Next$menuattachments"$s_f_menu"\nFavorite\nReply\nBack" | fzy) per_status_menu=$(echo "Next$menuattachments"$s_f_menu"\nFavorite\nBookmark\nReply\nBack" | fzy)
case "$per_status_menu" in case "$per_status_menu" in
"Next") next=1; clear ;; "Next") next=1; clear ;;
"Media") "Media")
@ -478,6 +478,7 @@ statuses_render()
"Share and favorite") share_and_favorite_mode "$id_status" ;; "Share and favorite") share_and_favorite_mode "$id_status" ;;
"Share") share_api_status "$id_status" ;; "Share") share_api_status "$id_status" ;;
"Favorite") favorite_api_status "$id_status" ;; "Favorite") favorite_api_status "$id_status" ;;
"Bookmark") bookmark_api_status "$id_status" ;;
"Reply") reply_mode "$id_status" ;; "Reply") reply_mode "$id_status" ;;
"Back") next=1; force_stop=1 ;; "Back") next=1; force_stop=1 ;;
esac esac
@ -565,6 +566,7 @@ timeline_api()
"home") default_curl_opt "$instance_point/timelines/home?limit=$max_statuses&max_id=$1&min_id=$2" ;; "home") default_curl_opt "$instance_point/timelines/home?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"home/local") default_curl_opt "$instance_point/timelines/home?local=true&limit=$max_statuses&max_id=$1&min_id=$2" ;; "home/local") default_curl_opt "$instance_point/timelines/home?local=true&limit=$max_statuses&max_id=$1&min_id=$2" ;;
"favourites") default_curl_opt "$instance_point/favourites?limit=$max_statuses&max_id=$1&min_id=$2" ;; "favourites") default_curl_opt "$instance_point/favourites?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"bookmarks") default_curl_opt "$instance_point/bookmarks?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"direct") default_curl_opt "$instance_point/timelines/direct?limit=$max_statuses&max_id=$1&min_id=$2" ;; "direct") default_curl_opt "$instance_point/timelines/direct?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"public") default_curl_opt "$instance_point/timelines/public?limit=$max_statuses&max_id=$1&min_id=$2" ;; "public") default_curl_opt "$instance_point/timelines/public?limit=$max_statuses&max_id=$1&min_id=$2" ;;
"local") default_curl_opt "$instance_point/timelines/public?local=true&limit=$max_statuses&max_id=$1&min_id=$2" ;; "local") default_curl_opt "$instance_point/timelines/public?local=true&limit=$max_statuses&max_id=$1&min_id=$2" ;;
@ -695,6 +697,13 @@ favourite_mode()
done done
} }
bookmark_api_status()
{
mkdir -p -m 711 bookmarks/"$instance"
post_request "$instance_point/statuses/$1/bookmark" | jj -p -o "bookmarks/$instance/$1"
chmod 600 "bookmarks/$instance/$1"
}
write_api_status() write_api_status()
{ {
if [ -n "$mediaattach" ]; then if [ -n "$mediaattach" ]; then
@ -854,7 +863,7 @@ fi
case $main_menu in case $main_menu in
"$menu_write_status") write_status_menu ;; "$menu_write_status") write_status_menu ;;
"$menu_timeline") "$menu_timeline")
timeline=$(echo 'home\nhome/local\nfavourites\ndirect\nlocal\npublic' | fzy) timeline=$(echo 'home\nhome/local\nfavourites\nbookmarks\ndirect\nlocal\npublic' | fzy)
timeline_menu timeline_menu
;; ;;
"$notif") notif_menu ;; "$notif") notif_menu ;;