Gallery: fix iframe cache-bust by versioning loader URL in dashboard YAML

This commit is contained in:
2026-05-16 10:27:23 +02:00
parent fa64223630
commit c394d6b974
6 changed files with 217 additions and 196 deletions
@@ -5,5 +5,5 @@ panel: true
cards:
- type: iframe
url: /local/snapshots/indkorsel_loader.html
url: /local/snapshots/indkorsel_loader.html?v=20260516130000
aspect_ratio: 100%
@@ -153,3 +153,20 @@ with open(LOADER_FILE, "w", encoding="utf-8") as fh:
fh.write(loader)
print(f"Gallery updated: {len(files)} snapshots -> {OUTPUT_FILE}")
# Update dashboard YAML iframe URL version so browser always fetches fresh loader
DASHBOARD_VIEW = "/config/dashboards/views/06c_indkorsel_snapshots.yaml"
try:
import re as _re
with open(DASHBOARD_VIEW, "r", encoding="utf-8") as fh:
dash = fh.read()
updated = _re.sub(
r'(url: /local/snapshots/indkorsel_loader\.html)(\?v=\d+)?',
rf'\1?v={version}',
dash
)
if updated != dash:
with open(DASHBOARD_VIEW, "w", encoding="utf-8") as fh:
fh.write(updated)
except Exception as _e:
print(f"Warning: could not update dashboard YAML: {_e}")
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -3,5 +3,5 @@
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="refresh" content="0; url=/local/snapshots/indkorsel_gallery.html?v=20260516100041">
<meta http-equiv="refresh" content="0; url=/local/snapshots/indkorsel_gallery.html?v=20260516130000">
</head><body></body></html>