Changeset b5924eb in Klonkt for src/routes/guardian.js
- Timestamp:
- 07/24/2026 08:07:47 PM (7 weeks ago)
- Branches:
- main
- Children:
- c502242
- Parents:
- 780a7c6
- File:
-
- 1 edited
-
src/routes/guardian.js (modified) (3 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,
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)