[object Object]

← back to Dw Marketing Viewer

auto-save: 2026-06-23T15:52:50 (1 files) — site-deploy/_remote-edit-chips.py

f4e8fa72d75b2f21e2c5bcf5aef4fae4f34a5182 · 2026-06-23 15:52:54 -0700 · Steve Abrams

Files touched

Diff

commit f4e8fa72d75b2f21e2c5bcf5aef4fae4f34a5182
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Jun 23 15:52:54 2026 -0700

    auto-save: 2026-06-23T15:52:50 (1 files) — site-deploy/_remote-edit-chips.py
---
 site-deploy/_remote-edit-chips.py | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/site-deploy/_remote-edit-chips.py b/site-deploy/_remote-edit-chips.py
new file mode 100644
index 0000000..87ab42e
--- /dev/null
+++ b/site-deploy/_remote-edit-chips.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+# Runs ON the Kamatera server. Adds the 76 AI-design collections as browse chips
+# in loadFacets() on wallpapersback.com (DTD verdict A). Backup-safe, idempotent.
+import time
+idx = "/root/public-projects/wallpapersback/public/index.html"
+s = open(idx, encoding="utf-8").read()
+ts = int(time.time())
+
+if "/api/categories" in s:
+    print("  · design-collection chips already present — skipping")
+    raise SystemExit(0)
+
+old = ("  const _chipEntries = Object.entries(f.aesthetics).sort((a,b) => b[1] - a[1]);\n"
+       "  const _CHIP_VISIBLE = 8;")
+new = ("  const _chipEntries = Object.entries(f.aesthetics).sort((a,b) => b[1] - a[1]);\n"
+       "  // DTD verdict A 2026-06-23: append the AI-design collections (de-duped vs rails,\n"
+       "  // colorway combos excluded) so they're browsable under \"Show all\".\n"
+       "  try {\n"
+       "    const _cr = await fetch('/api/categories');\n"
+       "    if (_cr.ok) {\n"
+       "      const _have = new Set(_chipEntries.map(([k]) => k.toLowerCase()));\n"
+       "      (((await _cr.json()).items) || [])\n"
+       "        .filter(c => c.category && c.count > 0 && !c.category.includes(' · ') && !_have.has(c.category.toLowerCase()))\n"
+       "        .forEach(c => { _have.add(c.category.toLowerCase()); _chipEntries.push([c.category, c.count]); });\n"
+       "    }\n"
+       "  } catch (e) { console.error('loadCategories failed:', e); }\n"
+       "  const _CHIP_VISIBLE = 8;")
+
+if old not in s:
+    print("  ! ERROR: loadFacets anchor not found — aborting, NO changes")
+    raise SystemExit(1)
+
+open(idx + ".bak-collections-chips-%d" % ts, "w", encoding="utf-8").write(s)
+s = s.replace(old, new, 1)
+open(idx, "w", encoding="utf-8").write(s)
+print("  ✓ design-collection chips added to loadFacets (backup .bak-collections-chips-%d)" % ts)

← eef0c27 Stage dead-script removal (zd-loader.js, sku-redact.js) in W  ·  back to Dw Marketing Viewer  ·  chore: macstudio3 migration — reconcile from mac2 + repoint e73dfa8 →