← back to 1980swallpaper
server: facets total counts niche list, .bak 404-guard, clean-URL static (extensions:html)
7fc94bf5d2c82de15b617ed7fa7dafccd0185537 · 2026-05-19 08:41:06 -0700 · SteveStudio2
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 7fc94bf5d2c82de15b617ed7fa7dafccd0185537
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date: Tue May 19 08:41:06 2026 -0700
server: facets total counts niche list, .bak 404-guard, clean-URL static (extensions:html)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
server.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/server.js b/server.js
index ccd0ef7..0bba578 100644
--- a/server.js
+++ b/server.js
@@ -138,7 +138,14 @@ app.use(express.json({ limit: '256kb' }));
require('./_universal-contact')(app, { siteName: "1980s Wallpaper", zdColor: "#ff007a", zdPosition: 'right' });
require('./_universal-auth')(app, { siteName: "1980swallpaper" });
-app.use(express.static(path.join(__dirname, 'public')));
+// Block snapshot/backup files from ever serving out of the static root.
+app.use((req, res, next) => {
+ if (/\.(bak|pre-[\w.-]+|orig|tmp)$|\.bak\.|\.pre-/i.test(req.path)) return res.status(404).send('Not found');
+ next();
+});
+
+// Clean URLs: serve /care -> care.html etc.
+app.use(express.static(path.join(__dirname, 'public'), { extensions: ['html'] }));
app.get('/api/products', (req, res) => {
const { q, aesthetic, vendor, page = 1, limit = 24, sort = 'newest'} = req.query;
@@ -174,7 +181,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 }));
← 18c97fc sort: pass state.sort to /api/products so the sort select ac
·
back to 1980swallpaper
·
untrack *.bak/*.pre-* snapshot files, broaden .gitignore to e04f330 →