diff --git a/apps/web/src/routes/dashboard.ts b/apps/web/src/routes/dashboard.ts index 71036eb..a3f5d86 100644 --- a/apps/web/src/routes/dashboard.ts +++ b/apps/web/src/routes/dashboard.ts @@ -9,6 +9,8 @@ import { createHash } from "crypto"; // Generate a cache-buster hash from the CSS file content at startup const cssFile = Bun.file(resolve(import.meta.dir, "../dashboard/tailwind.css")); const cssHash = createHash("md5").update(await cssFile.bytes()).digest("hex").slice(0, 8); +const jsFile = Bun.file(resolve(import.meta.dir, "../dashboard/app.js")); +const jsHash = createHash("md5").update(await jsFile.bytes()).digest("hex").slice(0, 8); const eta = new Eta({ views: resolve(import.meta.dir, "../views"), cache: true, defaultExtension: ".ejs" }); @@ -61,7 +63,7 @@ function escapeHtmlSSR(str: string): string { } export function html(template: string, data: Record = {}) { - return new Response(eta.render(template, { ...data, timeAgoSSR, sparklineSSR, latencyChartSSR, escapeHtmlSSR, cssHash }), { + return new Response(eta.render(template, { ...data, timeAgoSSR, sparklineSSR, latencyChartSSR, escapeHtmlSSR, cssHash, jsHash }), { headers: { "content-type": "text/html; charset=utf-8" }, }); } diff --git a/apps/web/src/views/partials/head.ejs b/apps/web/src/views/partials/head.ejs index cf767b0..b2199d2 100644 --- a/apps/web/src/views/partials/head.ejs +++ b/apps/web/src/views/partials/head.ejs @@ -6,7 +6,7 @@ PingQL<%= it.title ? ` — ${it.title}` : '' %> - + <% if (it.scripts) { it.scripts.forEach(function(s) { %> <% }) } %>