[object Object]

← back to Wallco Ai

/brief: add If-None-Match ETag short-circuit (ids+project+client sig) on top of existing Last-Modified

ae55f6d9f2ba28c6374a4238a89d574b1573a156 · 2026-05-13 06:42:11 -0700 · SteveStudio2

Files touched

Diff

commit ae55f6d9f2ba28c6374a4238a89d574b1573a156
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date:   Wed May 13 06:42:11 2026 -0700

    /brief: add If-None-Match ETag short-circuit (ids+project+client sig) on top of existing Last-Modified
---
 server.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/server.js b/server.js
index c5aaa28..ab2bb7c 100644
--- a/server.js
+++ b/server.js
@@ -6486,6 +6486,13 @@ app.get('/brief', (req, res) => {
     return t && (!acc || t > acc) ? t : acc;
   }, null) || new Date();
   if (maybe304(req, res, briefLM)) return;
+  // ETag covers (ordered ids, project, client) alongside the briefLM that maybe304 already
+  // handles via If-Modified-Since. If-None-Match short-circuit catches the case where the
+  // designer comes back to the same brief link — share-link reopen, tab restore.
+  const _briefSig = require('crypto').createHash('sha1').update(rawIds.join(',') + '|' + projectName + '|' + clientName).digest('hex').slice(0, 16);
+  const _briefEtag = `"brief-${briefLM.getTime()}-${_briefSig}"`;
+  res.setHeader('ETag', _briefEtag);
+  if (req.headers['if-none-match'] === _briefEtag) return res.status(304).end();
   res.setHeader('Cache-Control', 'public, max-age=3600, must-revalidate');
   const today = new Date().toISOString().slice(0, 10);
   const tearsheet = (d) => {

← 0aaed9d drunk-animals: ready-to-fire prod-sync script (manual auth r  ·  back to Wallco Ai  ·  by-color: emit ETag on every response + 304 short-circuit on c3467a1 →