From 01dbf71df708773e4a8453ffa068dbf67c515b88 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Wed, 5 Nov 2025 17:30:03 -0800 Subject: [PATCH] New backup 2025-11-05 17:30:03 --- de/home/.config/eww/modules/home/mcstatus.yuck | 8 ++++---- de/home/.config/eww/scripts/home/mcstatus | 18 +++--------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/de/home/.config/eww/modules/home/mcstatus.yuck b/de/home/.config/eww/modules/home/mcstatus.yuck index 95f272c..cb43897 100644 --- a/de/home/.config/eww/modules/home/mcstatus.yuck +++ b/de/home/.config/eww/modules/home/mcstatus.yuck @@ -1,4 +1,4 @@ -(defpoll servers_status :initial '[{"online": true,"kind":"Java","status":{"players":{"online":0,"max":0,"sample":null},"version":{"name":"version","protocol":0},"motd":"Message of the day","latency":0,"icon":""},"address":"ip.addre.ss"}]' +(defpoll servers_status :initial '[{"online": true,"kind":"Java","players":{"online":0,"max":0,"list":null},"version":{"name":"version","protocol":0},"motd":"Message of the day","ping":0,"address":"ip.addre.ss"}]' :interval "21600s" 'scripts/home/mcstatus') @@ -45,18 +45,18 @@ ) (label :xalign 0 - :text "${server.status.players.online}/${server.status.players.max} players online" + :text "${server.players.online}/${server.players.max} players online" ) (label :class 'motd' - :text "${replace(server.status.motd,'§.','')}" + :text "${server.motd}" :wrap true :wrap-mode 'word' ; :truncate true ) (label :xalign 0 - :text " ${round(server.status.latency,0)}ms" + :text " ${round(server.ping,0)}ms" ) ) ) diff --git a/de/home/.config/eww/scripts/home/mcstatus b/de/home/.config/eww/scripts/home/mcstatus index d0a458a..cce5f05 100755 --- a/de/home/.config/eww/scripts/home/mcstatus +++ b/de/home/.config/eww/scripts/home/mcstatus @@ -1,25 +1,13 @@ #!/usr/bin/env bash -cache_path="${HOME}/.cache/mcstatus" -mcstatus_cache="${cache_path}/mcstatus.json" +cache_path="${HOME}/.cache/mc-server-info" +mcstatus_cache="${cache_path}/cache.json" mkdir -p "${cache_path}" -#server_list=("mc.pogmom.me" "wedontownit.duckdns.org" "ian.hotn.gay") -server_list=("mc.pogmom.me" "ian.hotn.gay") update_cache_json(){ - - for s in "${server_list[@]}";do - mcstatus "${s}" json | jq '. += {"address":"'"${s}"'","icon_path":"'"${cache_path}/${s}"'.png"}' - done | jq -n '[inputs]' | tee "${mcstatus_cache}" >/dev/null - jq -rc '.[] | "\(.address) \(.status.icon)"' "${mcstatus_cache}" | while read name icon;do -# echo "${name}" -# echo "${icon/*base64,/}" - echo "${icon/*base64,/}" | base64 --decode > "${cache_path}/${name}.png" - done + mc-server-info json | tee "${mcstatus_cache}" >/dev/null } - if [[ ! $(find "${mcstatus_cache}" -cmin -15 -print 2>/dev/null) ]]; then update_cache_json fi - cat "${mcstatus_cache}"