Gallery: fix iframe cache-bust by versioning loader URL in dashboard YAML
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user