[object Object]

← back to Pattern Vault

capture-session: WebKit (Safari engine) default per Steve; cookies are engine-portable

a0ae52d9346e45f6f322baa09ddec6b91d2c95e5 · 2026-07-09 22:19:10 -0700 · Steve

Files touched

Diff

commit a0ae52d9346e45f6f322baa09ddec6b91d2c95e5
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Jul 9 22:19:10 2026 -0700

    capture-session: WebKit (Safari engine) default per Steve; cookies are engine-portable
---
 wpb-uploaders/capture-session.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/wpb-uploaders/capture-session.js b/wpb-uploaders/capture-session.js
index ba46b30..0c15246 100644
--- a/wpb-uploaders/capture-session.js
+++ b/wpb-uploaders/capture-session.js
@@ -11,7 +11,10 @@
  * Writes sessions/<platform>-state.json. Nothing is uploaded — this only captures the login.
  */
 const path = require('path'), fs = require('fs');
-const { chromium } = require('/Users/macstudio3/.npm-global/lib/node_modules/playwright');
+const { chromium, webkit } = require('/Users/macstudio3/.npm-global/lib/node_modules/playwright');
+// Engine: WebKit = Safari's engine (Steve prefers Safari). Cookies are engine-portable, so a
+// session captured in WebKit loads fine in the chromium uploader. Override with WPB_ENGINE.
+const ENGINE = process.env.WPB_ENGINE === 'chromium' ? chromium : webkit;
 
 const platform = process.argv[2];
 const PLATFORMS = ['creativemarket', 'redbubble', 'society6', 'patternbank'];
@@ -55,14 +58,16 @@ async function sessionAuthenticated(ctx) {
   console.log(`   Log in fully (SSO / 2FA / CAPTCHA all OK) and reach your dashboard.`);
   console.log(`   I'll auto-detect the login and save it — no keypress needed.\n`);
 
-  const b = await chromium.launch({ headless: false, args: ['--start-maximized'] });
+  const b = await ENGINE.launch({ headless: false });
   const ctx = await b.newContext({ viewport: null });
   const pg = await ctx.newPage();
   await pg.goto(LOGIN, { waitUntil: 'domcontentloaded', timeout: 60000 }).catch(() => {});
 
   // nudge the window to the front (Playwright's browser often opens behind others)
   const { exec } = require('child_process');
-  exec(`osascript -e 'tell application "System Events" to set frontmost of (first process whose name contains "Chrome for Testing") to true' 2>/dev/null`);
+  for (const nm of ['Playwright', 'WebKit', 'Chrome for Testing', 'Safari']) {
+    exec(`osascript -e 'tell application "System Events" to set frontmost of (first process whose name contains "${nm}") to true' 2>/dev/null`);
+  }
 
   const start = Date.now();
   const deadline = start + 10 * 60 * 1000; // 10 min

← 71d3222 capture-session: authoritative session probe (load account p  ·  back to Pattern Vault  ·  wpb-uploaders: control panel (:9813) — click-to-launch per-p 7dbc8b4 →