← back to Rentv 2026
fix: inject template-toggle.js (View-all compare) site-wide — was orphaned, only /toggle.js (front/backend switcher) was wired
ee2f9802b143260cd491e7fc09059511aa5f90b1 · 2026-08-07 15:22:58 -0700 · Steve
Files touched
Diff
commit ee2f9802b143260cd491e7fc09059511aa5f90b1
Author: Steve <steve@designerwallcoverings.com>
Date: Fri Aug 7 15:22:58 2026 -0700
fix: inject template-toggle.js (View-all compare) site-wide — was orphaned, only /toggle.js (front/backend switcher) was wired
---
server.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/server.js b/server.js
index f6f4bbcb..d652f6dc 100644
--- a/server.js
+++ b/server.js
@@ -171,6 +171,10 @@ function adminOnly(req, res, next) {
// </body>. Used by every explicit page route AND the static HTML injector below, so the
// toggle is present site-wide from a single include (the widget self-hides for user-tier).
const TOGGLE_TAG = '<script src="/toggle.js" defer></script>';
+// 2026 TEMPLATE switcher (bottom-right #rentv-tt) + "View all — compare" overlay. Distinct
+// widget from TOGGLE_TAG (that one is the front/backend view switcher). Self-gates via
+// /api/whoami (admin/user only) and force-shows on /2026/*, /advertise, ?tt=1 — safe site-wide.
+const TEMPLATE_TOGGLE_TAG = '<script src="/template-toggle.js" defer></script>';
const NAV_TAG = '<script src="/rentv-nav.js" defer></script>'; // rentv.com region+category tab panel (TK-10278), public pages only
// User-facing day/night toggle (sun/moon icon, bottom-right), shown site-wide to EVERY
// visitor. DAYNIGHT_TAG mounts the button; DAYNIGHT_PREAPPLY runs inline in <head> to set
@@ -214,6 +218,11 @@ function sendPage(res, absFile, transform) {
if (html.indexOf('/toggle.js') === -1) {
html = closeBody() ? html.replace('</body>', TOGGLE_TAG + '</body>') : html + TOGGLE_TAG;
}
+ // 2026 template switcher + View-all compare (separate widget, self-gating). The presence
+ // check uses the full filename so it doesn't collide with the /toggle.js check above.
+ if (html.indexOf('/template-toggle.js') === -1) {
+ html = closeBody() ? html.replace('</body>', TEMPLATE_TOGGLE_TAG + '</body>') : html + TEMPLATE_TOGGLE_TAG;
+ }
// rentv.com region+category tab panel (TK-10278) — inject on PUBLIC pages only (skip admin/internal
// tools via INTERNAL_PAGE, same gate the public footer uses). The script self-mounts to whatever
// header/nav the page has and bails on chrome-less pages, so this is safe site-wide.
← ed7346a7 chore: gitignore node_modules symlink (was leaking as untrac
·
back to Rentv 2026
·
fix(login): resolve /api/login against location.origin so Ba d71f0c89 →