New backup 2025-10-09 17:15:02
This commit is contained in:
parent
682d634196
commit
7552a772bf
3 changed files with 57 additions and 11 deletions
|
@ -147,6 +147,12 @@ revealer.home {
|
|||
border-radius: $home-widget-border-radius;
|
||||
box-shadow: inset 0 0 0px 2px $home-widget-border-color, 0px 0px 9px 0px $home-widget-bg-color;
|
||||
}
|
||||
.mc_server {
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
margin: 10px;
|
||||
}
|
||||
.weather {
|
||||
color: $home-button-fg-color;
|
||||
padding: 8px;
|
||||
|
|
|
@ -16,19 +16,37 @@
|
|||
(defwidget mcstatus [json]
|
||||
(box
|
||||
:orientation 'v'
|
||||
(for server in json
|
||||
(box
|
||||
:class 'mc_server'
|
||||
:style 'background-image: url("/home/${USER}/.cache/mcstatus/${server.status.name}.png");'
|
||||
:orientation 'v'
|
||||
(label
|
||||
:text "${server.address}"
|
||||
)
|
||||
(label
|
||||
:text "${replace(server.status.motd,'§.','')}"
|
||||
:truncate true
|
||||
:space-evenly false
|
||||
(box
|
||||
:orientation 'v'
|
||||
:space-evenly true
|
||||
(for server in json
|
||||
(box
|
||||
:orientation 'h'
|
||||
:space-evenly false
|
||||
(box
|
||||
:class 'mc_server'
|
||||
:width 75
|
||||
:height 75
|
||||
:style 'background-image: url("${server.icon_path}");'
|
||||
)
|
||||
(box
|
||||
:orientation 'v'
|
||||
(label
|
||||
:text "${server.address}"
|
||||
)
|
||||
(label
|
||||
:text "${replace(server.status.motd,'§.','')}"
|
||||
:truncate true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(button
|
||||
(label
|
||||
:text "reload now"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cache_path="${HOME}/.cache/mcstatus"
|
||||
mcstatus_cache="${cache_path}/mcstatus.json"
|
||||
mkdir -p "${cache_path}"
|
||||
server_list=("mc.pogmom.me" "mc.pogmom.me")
|
||||
|
||||
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)"' ~/.cache/mcstatus.json | while read name icon;do
|
||||
echo "${icon/*base64,/}" | base64 --decode > "${cache_path}/${name}.png"
|
||||
done
|
||||
}
|
||||
|
||||
if [[ ! $(find "${mcstatus_cache}" -cmin -60 -print 2>/dev/null) ]]; then
|
||||
update_cache_json
|
||||
fi
|
||||
|
||||
cat "${mcstatus_cache}"
|
Loading…
Add table
Reference in a new issue