mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-21 19:41:30 +00:00
Notifications improvments: count of new notifications and read function
This commit is contained in:
parent
c51983961a
commit
3ced170a0a
|
@ -640,19 +640,25 @@ notif_menu()
|
|||
json=$(notif_api_get_all)
|
||||
while [ $sub_menu_lvl -eq 1 ]; do
|
||||
clear
|
||||
echo "Notifications: $(echo $json | jj \#)"
|
||||
count_new_notif=$(echo $json | jj -l '#[pleroma.is_seen=false]#.pleroma.is_seen' | wc -w)
|
||||
echo "New notifications: $count_new_notif"
|
||||
for i in $(echo $json | jj -l \#.id); do
|
||||
date_utc=$(echo $json | jj \#[id=$i].created_at)
|
||||
date -d "$date_utc" "$format_time"
|
||||
acct=$(echo $json | jj \#[id=$i].account.acct)
|
||||
status_id=$(echo $json | jj \#[id=$i].status.id)
|
||||
typenotif=$(echo $json | jj \#[id=$i].type)
|
||||
echo "$typenotif <- $acct"
|
||||
echo $json | jj \#[id=$i].status.pleroma.content.text/plain
|
||||
echo "<$status_id> $typenotif <- $acct"
|
||||
echo $json | jj -r \#[id=$i].status.content | delqse | html_to_txt_render
|
||||
echo '___'
|
||||
done
|
||||
menu_choice=$(echo "Main menu\nRefresh\n$clrnotif" | fzy)
|
||||
menu_choice=$(echo "Main menu\nRead\nRefresh\n$clrnotif" | fzy)
|
||||
case "$menu_choice" in
|
||||
"Main menu") sub_menu_lvl=0 ;;
|
||||
"Read")
|
||||
notif_api_read "$(echo $json | jj 0.id)"
|
||||
json=$(notif_api_get_all)
|
||||
;;
|
||||
"Refresh") json=$(notif_api_get_all) ;;
|
||||
"$clrnotif") notif_api_remove_all && json=$(notif_api_get_all) ;;
|
||||
esac
|
||||
|
@ -661,7 +667,14 @@ notif_menu()
|
|||
|
||||
notif_api_get_all()
|
||||
{
|
||||
default_curl_opt "$instance_point/notifications" | jj -p
|
||||
default_curl_opt "$instance_point/notifications?limit=$max_statuses" | jj -p
|
||||
}
|
||||
|
||||
notif_api_read()
|
||||
{
|
||||
post_request --url "$instance_point/pleroma/notifications/read" \
|
||||
--data-urlencode "max_id=$1" \
|
||||
--output /dev/null
|
||||
}
|
||||
|
||||
notif_api_remove_all()
|
||||
|
|
Loading…
Reference in a new issue