[object Object]

← back to 1930swallpaper

server: fix /api/facets total to count niche-filtered list, add /about clean-URL route, 404-guard .bak/.pre- paths

bc264e55ec06864f2b9034b8af34d61243088719 · 2026-05-19 08:25:00 -0700 · SteveStudio2

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit bc264e55ec06864f2b9034b8af34d61243088719
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date:   Tue May 19 08:25:00 2026 -0700

    server: fix /api/facets total to count niche-filtered list, add /about clean-URL route, 404-guard .bak/.pre- paths
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 server.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index de77969..f3be795 100644
--- a/server.js
+++ b/server.js
@@ -138,8 +138,19 @@ app.use(express.json({ limit: '256kb' }));
 require('./_universal-contact')(app, { siteName: "1930s Wallpaper", zdColor: "#9eb8c8", zdPosition: 'right' });
 require('./_universal-auth')(app, { siteName: "1930swallpaper" });
 
+// Never serve editor/snapshot artifacts from the static root.
+app.use((req, res, next) => {
+  if (/\.bak(\.|$)|\.pre-/i.test(req.path)) {
+    return res.status(404).send('Not found');
+  }
+  next();
+});
+
 app.use(express.static(path.join(__dirname, 'public')));
 
+// Clean-URL route — /about maps to the short-history page (no about.html exists).
+app.get('/about', (req, res) => res.sendFile(path.join(__dirname, 'public', 'history.html')));
+
 app.get('/api/products', (req, res) => {
   const { q, aesthetic, vendor, page = 1, limit = 24, sort = 'newest'} = req.query;
   let list = PRODUCTS_NICHE;
@@ -174,7 +185,7 @@ app.get('/api/facets', (req, res) => {
     aesthetics[p.aesthetic] = (aesthetics[p.aesthetic] || 0) + 1;
     vendors[p.vendor] = (vendors[p.vendor] || 0) + 1;
   }
-  res.json({ aesthetics, vendors, total: PRODUCTS.length });
+  res.json({ aesthetics, vendors, total: PRODUCTS_NICHE.length });
 });
 
 app.get('/api/health', (req, res) => res.json({ status: 'ok', count: PRODUCTS_NICHE.length, dropped: DROPPED }));

← e0311ad fix: product grid sort now functional — send state.sort to /  ·  back to 1930swallpaper  ·  chore: untrack 30 .bak/.pre- snapshot files, broaden .gitign dba6a4b →