From 2bfe5c5a4a6b1ecd7159f098dfc3c69abbbe5e2a Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Mon, 24 Jul 2023 16:37:34 +0300 Subject: [PATCH] notifs added --- executor.sh | 1 + mastodon_api.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/executor.sh b/executor.sh index b0f455b..2562018 100755 --- a/executor.sh +++ b/executor.sh @@ -49,6 +49,7 @@ while read -r cmd mesg; do reply=$reply_id toot "$status" | jq '.id, .errors' reply='' ;; + "notifs") notifications ;; "home") tlhome=$(timeline_home "$mesg") tlhome_len=$(echo "$tlhome" | wc -l) diff --git a/mastodon_api.sh b/mastodon_api.sh index b61ac87..8acba8a 100755 --- a/mastodon_api.sh +++ b/mastodon_api.sh @@ -12,8 +12,20 @@ timeline_render(){ end | @text' } +notifications_render(){ + cat - | jq -r '.[] | + "[\(.type) \(.created_at) \(.account.acct)]", + if .status then + .status.id, .status.pleroma.content."text/plain" + else empty + end | @text' +} + timeline_home(){ curl -s -H "Authorization: Bearer $instance_token" "https://$instance/api/v1/timelines/home?limit=40&max_id=$1" | timeline_render } +notifications(){ + curl -s -H "Authorization: Bearer $instance_token" "https://$instance/api/v1/notifications?limit=40&max_id=$1" | notifications_render +}