← back to Rentv 2026
5x sweep 2: 'Make this the site' works in preview mode (PUBLIC/OPEN), stays adminOnly on prod
a6b6120d3fc7da333b984a0a21067c937696639a · 2026-08-07 14:19:58 -0700 · Steve (RENTV 2026)
Files touched
Diff
commit a6b6120d3fc7da333b984a0a21067c937696639a
Author: Steve (RENTV 2026) <steve@designerwallcoverings.com>
Date: Fri Aug 7 14:19:58 2026 -0700
5x sweep 2: 'Make this the site' works in preview mode (PUBLIC/OPEN), stays adminOnly on prod
---
src/ad-system.cjs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/ad-system.cjs b/src/ad-system.cjs
index 38daa6b2..51232472 100644
--- a/src/ad-system.cjs
+++ b/src/ad-system.cjs
@@ -278,7 +278,14 @@ module.exports = function mountAdSystem(app, opts) {
});
// Record the chosen template ("Make this the site")
- app.post('/api/ad/admin/site-template', adminOnly, (req, r) => {
+ // "Make this the site" pick. adminOnly on real prod; but in PREVIEW mode (PUBLIC=1/OPEN=1)
+ // the local sandbox lets the picker lock a choice without a login — it only writes a local
+ // file (site-template.json), no prod/money impact. On prod (no PUBLIC/OPEN) it stays gated.
+ const pickGate = (req, res, next) => {
+ if (process.env.PUBLIC === '1' || process.env.OPEN === '1') { req.role = 'admin'; return next(); }
+ return adminOnly(req, res, next);
+ };
+ app.post('/api/ad/admin/site-template', pickGate, (req, r) => {
const chosen = esc((req.body || {}).chosen).toLowerCase();
if (!['classic', 'a', 'b', 'c', 'd', 'e'].includes(chosen)) return r.status(400).json({ ok: false, error: 'chosen must be classic|a|b|c|d|e' });
const rec = { chosen, options: ['classic', 'a', 'b', 'c', 'd', 'e'], updated_at: nowISO(), note: 'Local selection only — going live is a separate Steve-gated deploy.' };
← fb82cb6c 5x sweep 1: add favicon.ico + favicon.svg (fixes /favicon.ic
·
back to Rentv 2026
·
chore: gitignore node_modules symlink (was leaking as untrac ed7346a7 →