void

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

gotimon (925B)

      1 #!/bin/sh
      2 # Gotify Monitor - developed by acidvegas (https://git.acid.vegas/void)
      3 
      4 GOTIFY_SERVER="push.example.com:3000"
      5 GOTIFY_APP_ID="2"
      6 GOTIFY_CLIENT_TOKEN="changeme"
      7 
      8 while true; do
      9 	websocat "wss://$GOTIFY_SERVER/stream?token=$GOTIFY_CLIENT_TOKEN" | while read event; do
     10 		appid=$(echo "$event" | jq '.appid')
     11 
     12         [ ! $appid -eq $GOTIFY_APP_ID ] && continue # messages for other apps are ignored
     13 
     14 		date=$(echo "$event" | jq -r '.date')
     15 		id=$(echo "$event" | jq '.id')
     16 		message=$(echo "$event" | jq -r '.message')
     17 		priority=$(echo "$event" | jq '.priority') # sets the port to scan
     18 		title=$(echo "$event" | jq -r '.title')
     19 		formatted_date=$(date -d "$date" +"%m-%d %I:%M")
     20 
     21 		printf "%-11s | %-5s | %-10s | %s\n" "$formatted_date" "$id" "$title" "$message"
     22 
     23         notify-send "Gotify - $title" "$message"
     24 	done
     25 	echo "Connection to gotify server lost, attempting to reconnect in 30 seconds..."
     26 	sleep 30
     27 done