summaryrefslogtreecommitdiff
path: root/bin/extra/ntfy
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-07-01 01:14:59 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-07-01 01:14:59 +0200
commite1de506156454ba1d324faf548ad15fe804aa806 (patch)
tree1ca249b22bace59d41e950b7482443440ccc8c5e /bin/extra/ntfy
parentfecb6306631aaec1774497093b7da44ab5950d92 (diff)
parentb2077bbddf86dbdbf6cc63aaf2ceb8a2da614ebc (diff)
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/extra/ntfy')
-rwxr-xr-xbin/extra/ntfy15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/extra/ntfy b/bin/extra/ntfy
new file mode 100755
index 0000000..0522499
--- /dev/null
+++ b/bin/extra/ntfy
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+which jq > /dev/null || exit 1
+
+[ "$1" ] || exit 1
+
+curl -s -N "http://debuc.com:32336/$1/json?since=60m" |
+while read -r notification
+do
+ s="$(printf '%s' "$notification" | jq -r -c '"\(.title)@@@@@\(.message)"')"
+ message="${s#*@@@@@}"
+ title="${s%%@@@@@*}"
+ [ "$message" = "null" ] && [ "$title" = "null" ] && continue
+ herbe "$title" "$message" &
+done