Added gotify monitor shell script with dunst notify-send support

This commit is contained in:
Dionysus 2024-07-14 23:38:47 -04:00
parent 2abc922dd1
commit 489853226a
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
2 changed files with 30 additions and 3 deletions

27
scripts/gotimon Normal file
View File

@ -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

6
setup
View File

@ -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