mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-22 02:01:27 +00:00
Implemented notification menu; Change date format
This commit is contained in:
parent
834a97b154
commit
fd84258d8d
|
@ -6,6 +6,7 @@ instance_hist='instance.hist'
|
|||
max_statuses=$(jj -i config.json max_statuses)
|
||||
default_visibility=$(jj -i config.json default_visibility)
|
||||
default_content_type=$(jj -i config.json default_content_type)
|
||||
format_time='+%d.%m.%Y %H:%M:%S'
|
||||
|
||||
mkdir -m 711 -p .app_sessions
|
||||
touch .auth.json
|
||||
|
@ -82,7 +83,7 @@ timeline_menu()
|
|||
uri=$(echo $status | jj uri)
|
||||
id_status=$(echo $status | jj id)
|
||||
dateutc=$(echo $status | jj created_at)
|
||||
echo "$(date -d $dateutc) <$id_status> $uri"
|
||||
echo "$(date -d $dateutc "$format_time") <$id_status> $uri"
|
||||
echo $status | jj content | sed -e 's/<br[^>]*>/\n/g ; s/<[^>]*>//g ; s/>*/>/g ; s/<*/</g ; s/"/"/g'
|
||||
attachments=$(echo $status | jj -l media_attachments.#.remote_url | sed 's/"//g')
|
||||
if [ -n "$attachments" ]; then
|
||||
|
@ -168,6 +169,32 @@ write_status_menu()
|
|||
done
|
||||
}
|
||||
|
||||
notif_menu()
|
||||
{
|
||||
sub_menu_lvl=1
|
||||
clrnotif='Clear all notifications'
|
||||
json=$(notif_api_get_all)
|
||||
while [ $sub_menu_lvl -eq 1 ]; do
|
||||
clear
|
||||
echo "Notifications: $(echo $json | jj \#)"
|
||||
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)
|
||||
typenotif=$(echo $json | jj \#[id=$i].type)
|
||||
echo "$typenotif <- $acct"
|
||||
echo $json | jj \#[id=$i].status.pleroma.content.text/plain
|
||||
echo '___'
|
||||
done
|
||||
menu_choice=$(echo "Main menu\nRefresh\n$clrnotif" | fzy)
|
||||
case "$menu_choice" in
|
||||
"Main menu") sub_menu_lvl=0 ;;
|
||||
"Refresh") json=$(notif_api_get_all) ;;
|
||||
"$clrnotif") notif_api_remove_all && json=$(notif_api_get_all) ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
notif_api_get_all()
|
||||
{
|
||||
default_curl_opt "$instance_point/notifications" | jj -p
|
||||
|
@ -180,17 +207,16 @@ notif_api_remove_all()
|
|||
|
||||
menu_write_status='Write status'
|
||||
menu_timeline='Timelines'
|
||||
notif='Notifications (raw)'
|
||||
clrnotif='Clear all notifications'
|
||||
notif='Notifications'
|
||||
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$clrnotif\n$switchinstance\n$Exit" | fzy)
|
||||
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$switchinstance\n$Exit" | fzy)
|
||||
else
|
||||
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$clrnotif\n$authmake\n$switchinstance\n$Exit" | fzy)
|
||||
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$authmake\n$switchinstance\n$Exit" | fzy)
|
||||
fi
|
||||
case $main_menu in
|
||||
"$menu_write_status") write_status_menu ;;
|
||||
|
@ -198,7 +224,7 @@ case $main_menu in
|
|||
timeline=$(echo 'timelines/home\nfavourites\ntimelines/direct\ntimelines/public' | fzy)
|
||||
timeline_menu
|
||||
;;
|
||||
"$notif") notif_api_get_all | more ;;
|
||||
"$notif") notif_menu ;;
|
||||
"$clrnotif") notif_api_remove_all ;;
|
||||
"$switchinstance")
|
||||
empty=0
|
||||
|
|
Loading…
Reference in a new issue