From 489853226a3541f1033a8d89166e87f374fddd13 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Sun, 14 Jul 2024 23:38:47 -0400 Subject: [PATCH] Added gotify monitor shell script with dunst notify-send support --- scripts/gotimon | 27 +++++++++++++++++++++++++++ setup | 6 +++--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 scripts/gotimon diff --git a/scripts/gotimon b/scripts/gotimon new file mode 100644 index 0000000..6edf1f1 --- /dev/null +++ b/scripts/gotimon @@ -0,0 +1,27 @@ +#!/bin/sh +# Gotify Monitor - developed by acidvegas (https://git.acid.vegas/void) + +GOTIFY_SERVER="push.example.com:3000" +GOTIFY_APP_ID="2" +GOTIFY_CLIENT_TOKEN="changeme" + +while true; do + websocat "wss://$GOTIFY_SERVER/stream?token=$GOTIFY_CLIENT_TOKEN" | while read event; do + appid=$(echo "$event" | jq '.appid') + + [ ! $appid -eq $GOTIFY_APP_ID ] && continue # messages for other apps are ignored + + date=$(echo "$event" | jq -r '.date') + id=$(echo "$event" | jq '.id') + message=$(echo "$event" | jq -r '.message') + priority=$(echo "$event" | jq '.priority') # sets the port to scan + title=$(echo "$event" | jq -r '.title') + formatted_date=$(date -d "$date" +"%m-%d %I:%M") + + printf "%-11s | %-5s | %-10s | %s\n" "$formatted_date" "$id" "$title" "$message" + + notify-send "Gotify - $title" "$message" + done + echo "Connection to gotify server lost, attempting to reconnect in 30 seconds..." + sleep 30 +done \ No newline at end of file diff --git a/setup b/setup index 29eb055..3d9aa22 100755 --- a/setup +++ b/setup @@ -84,7 +84,7 @@ setup_packages() { # Essentials xbps-install -y curl dropbear git jq progress rsync socklog-void tmux tor tree unzip zip - xbps-install -y bandwhich bpfmon glow gnupg2-scdaemon lxc incus incus-client incus-tools lazygit oath-toolkit + xbps-install -y bandwhich bpfmon glow gnupg2-scdaemon lxc incus incus-client incus-tools lazygit oath-toolkit websocat #xbps-install -y earlyoom && ln -sfv /etc/sv/earlyoom /var/service/ # Alternatives @@ -112,8 +112,8 @@ setup_configs() { wget -O $HOME/.$item $GIT_URL/$item done - #mkdir -p $HOME/.config/cmus && wget -O $HOME/.config/cmus/autosave $GIT_URL/cmus/autosave - #mkdir -p $HOME/.config/dunst && wget -O $HOME/.config/dunst/dunstrc $GIT_URL/dunst/dunstrc + mkdir -p $HOME/.config/cmus && wget -O $HOME/.config/cmus/autosave $GIT_URL/cmus/autosave + mkdir -p $HOME/.config/dunst && wget -O $HOME/.config/dunst/dunstrc $GIT_URL/dunst/dunstrc wget -O $HOME/.gitconfig $GIT_URL/git/.gitconfig