Changeset b5924eb in Klonkt
- Timestamp:
- 07/24/2026 08:07:47 PM (7 weeks ago)
- Branches:
- main
- Children:
- c502242
- Parents:
- 780a7c6
- Location:
- src
- Files:
-
- 2 edited
-
routes/guardian.js (modified) (3 diffs)
-
views/pages/guardian.ejs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/guardian.js
r780a7c6 rb5924eb 10 10 */ 11 11 import express from 'express'; 12 import fs from 'fs'; 13 import path from 'path'; 14 import { fileURLToPath } from 'url'; 12 15 import db from '../config/database.js'; 13 16 import { requireAuth } from '../middleware/auth.js'; … … 17 20 18 21 const router = express.Router(); 22 23 // Cache-bust the PWA assets: /assets is served with a 1-year cache, so without 24 // a per-build version the browser keeps running an old guardian.js/css after a 25 // deploy (that was exactly the "no feedback / not arriving" bug). The version 26 // is the file's mtime at process start; a redeploy restarts us and bumps it. 27 const __dir = path.dirname(fileURLToPath(import.meta.url)); 28 function assetVersion(rel) { 29 try { return Math.floor(fs.statSync(path.join(__dir, '..', 'assets', rel)).mtimeMs).toString(36); } 30 catch { return '0'; } 31 } 32 const ASSET_V = { js: assetVersion('js/guardian.js'), css: assetVersion('css/guardian.css') }; 19 33 20 34 /** The acting site: ?site=slug when owned, else the user's first site. */ … … 64 78 sites, 65 79 lang: L, 80 assetV: ASSET_V, 66 81 t: (k, v) => i18nT(L, k, v), 67 82 cspNonce: res.locals.cspNonce, -
src/views/pages/guardian.ejs
r780a7c6 rb5924eb 8 8 <link rel="icon" href="/guardian/icon.svg" type="image/svg+xml"> 9 9 <meta name="theme-color" content="#ff6b35"> 10 <link rel="stylesheet" href="/assets/css/guardian.css ">10 <link rel="stylesheet" href="/assets/css/guardian.css?v=<%= assetV.css %>"> 11 11 </head> 12 12 <body> … … 77 77 78 78 <script type="application/json" id="guardian-state"><%- JSON.stringify(state) %></script> 79 <script src="/assets/js/guardian.js " defer></script>79 <script src="/assets/js/guardian.js?v=<%= assetV.js %>" defer></script> 80 80 </body> 81 81 </html>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)