diff --git a/glance-system/glance-kisfenyo.yaml b/glance-system/glance-kisfenyo.yaml index 98d14ee..77ad8f4 100644 --- a/glance-system/glance-kisfenyo.yaml +++ b/glance-system/glance-kisfenyo.yaml @@ -627,6 +627,158 @@ data: url: https://pihole.dooplex.hu/admin icon: si:pihole + - type: custom-api + title: Meal for the Day + cache: 1d + url: ${TANDOOR_URL}/api/recipe/flat/ + headers: + Accept: application/json + Authorization: Bearer ${TANDOOR_TOKEN} + + # We use Prometheus just to get a stable "today" number (Unix time), + # so the 3 picks are deterministic for the day. + subrequests: + epoch: + url: ${PROMETHEUS_URL}/api/v1/query + parameters: + query: time() + + template: | + + + {{ $recipes := .JSON.Array "" }} + {{ $n := len $recipes }} + + {{ if lt $n 1 }} +
+
No recipes returned from Tandoor.
+
+ Check token / permissions + Open Tandoor +
+
+ {{ else }} + + {{ $epoch := (.Subrequest "epoch").JSON.Float "data.result.0.value.1" }} + {{ $day := div $epoch 86400.0 | toInt }} + + {{/* pick a "base" index for today; then next 2 indices */}} + {{ $i0 := mod $day $n }} + {{ $i1 := mod (add $i0 1) $n }} + {{ $i2 := mod (add $i0 2) $n }} + + {{ $r0 := index $recipes $i0 }} + {{ $r1 := index $recipes $i1 }} + {{ $r2 := index $recipes $i2 }} + + {{ $base := env "TANDOOR_URL" }} + + {{/* helper: ensure absolute image URL */}} + {{ $img0 := $r0.String "image" }} + {{ if and $img0 (not (hasPrefix "http" $img0)) }}{{ $img0 = print $base $img0 }}{{ end }} + + {{ $img1 := $r1.String "image" }} + {{ if and $img1 (not (hasPrefix "http" $img1)) }}{{ $img1 = print $base $img1 }}{{ end }} + + {{ $img2 := $r2.String "image" }} + {{ if and $img2 (not (hasPrefix "http" $img2)) }}{{ $img2 = print $base $img2 }}{{ end }} + +
+
+ Today’s picks ({{ printf "%d" $n }} total) + Open Tandoor +
+ +
+ {{/* Slide 1 */}} + + + {{/* Slide 2 */}} + + + {{/* Slide 3 */}} + +
+
+ + {{ end }} + # ---------- CENTER COLUMN ---------- - size: full widgets: @@ -2069,6 +2221,10 @@ spec: value: "http://uptimekuma.uptimekuma-system.svc.cluster.local:3001" - name: UPTIME_KUMA_STATUS_SLUG value: "homepage" + - name: TANDOOR_URL + value: "https://tandoor.dooplex.hu" + - name: TANDOOR_TOKEN + value: "tda_069f4aa1_ed21_454c_987f_641a523a6cdc" ports: - name: http containerPort: 8080