void

- enter the void 🪐
git clone git://git.acid.vegas/archlinux.git
Log | Files | Refs | Archive

commit 489853226a3541f1033a8d89166e87f374fddd13
parent 2abc922dd17fd8fa87eff2d0c3a13d1f42da59c1
Author: acidvegas <acid.vegas@acid.vegas>
Date: Sun, 14 Jul 2024 23:38:47 -0400

Added gotify monitor shell script with dunst notify-send support

Diffstat:
Ascripts/gotimon | 28++++++++++++++++++++++++++++
Msetup | 6+++---

2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/scripts/gotimon 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
@@ -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