← Commit history

Wiki logged-in toggle: when no wiki session exists yet, navigate THIS window to the sign-in page and raise it, instead of showing a dead-end sign-in-in-this-window toast on the public page

John Lauer ·9e58cc09d9 ·3mo ago ·parent c9b30ce
4 files changed +32−7
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.81",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.81/adom-bridge-puppeteer-v1.9.81.zip",-  "sha256": "ae21527ca9ec1cc5e5c8d91f951c2dce8867af0906dd0ca8730160824eec9353",-  "size": 316172,+  "version": "1.9.82",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.82/adom-bridge-puppeteer-v1.9.82.zip",+  "sha256": "4de611dbc3bee8e88324c748384f15a97ea5057d937d4ee384ce4b2d73586883",+  "size": 316912,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.81+1.9.82
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.9.81",+  "version": "1.9.82",   "description": "Drives a browser ALREADY on the machine \u2014 installed Chrome, else Microsoft Edge (every Windows PC ships with Edge) \u2014 launched with a FRESH isolated profile, so the common case has NO ~150 MB Chrome-for-Testing download and it never touches the user's real tabs/logins. Binds its local server to LOOPBACK (127.0.0.1) only, so no Windows Firewall 'allow Node through the firewall' prompt ever pops. Chrome for Testing is fetched only as a LAST RESORT if the machine has no Chromium browser at all. SPAWN-VERIFIED fallback: pup tries each detected browser (Chrome \u2192 Edge \u2192 CfT) and actually launches it, falling through to the next if one won't start (and handling browsers like Edge that relaunch onto another PID), so a corrupt/partial install never hard-fails an open. The browser that launches is cached as the default (persisted across restarts) so it isn't re-probed each time. On spawn the bridge SELF-WARMS: detects browsers + disk, and only if the box has no Chrome/Edge and no cached CfT does it background-fetch CfT so the first open is instant. browser_use pins a specific browser (chrome | edge | cft | auto); {browser:'chrome',install:true} downloads & installs REAL Google Chrome (user-scoped, no admin) on an Edge-only box. browser_readiness (READ-ONLY) reports which browser will be used + the full candidate list + the default + free disk. Every failure returns a specific errorCode + _hint (chrome_install_no_disk, chrome_download_network, chrome_install_permission, chrome_stable_not_detected, \u2026). Launches with FULL browser permissions by default for full debug (strictPermissions:true opts out). Headful automation: open/close windows+tabs, navigate, screenshot, eval JS, record. pup is a GENERIC, non-profile browser only \u2014 every session is a fresh isolated Chrome/Edge process, never the user's real signed-in browser; profile defaults to sessionId. To drive the user's REAL Chrome/Edge (their profile, cookies, SSO), use the Adom browser EXTENSION's nbrowser_* verbs \u2014 a separate bridge, not pup's job.",   "homepage": "https://wiki.adom.inc/adom/adom-desktop",   "author": "Adom Inc.",
src/server.js+26−1
@@ -6156,7 +6156,32 @@ const server = http.createServer(async (req, res) => {                     } catch (e) { return null; }                   }, nextPath);                 }-                if (!targetUrl) console.log(`[wikiview] "${sessionId}" no logged-in page to mint from — falling back to relaunch`);+                if (!targetUrl) {+                  // v1.9.82 — FIRST-EVER LOGIN: no authenticated pup page exists to mint a magic+                  // link from. The old behaviour fell through to a relaunch under the empty shared+                  // authed profile, saw still-not-authed, and popped a "sign in in this window"+                  // toast — but LEFT THE WINDOW ON THE PUBLIC PAGE. The user (John) clicked the task,+                  // got told to sign in, and had no sign-in page to sign in on. Fix: navigate THIS+                  // window to the actual wiki sign-in page and raise it so they SEE it.+                  // /login?redirect=<path> bounces through the hydrogen SSO and returns here signed+                  // in; once signed in this window IS the logged-in view, and every other thread's+                  // toggle can then mint the magic link from it. No relaunch, tabs preserved.+                  const nextPath = (() => { try { const u2 = new URL(url); return u2.pathname + u2.search; } catch (e) { return "/adom"; } })();+                  const loginUrl = "https://wiki.adom.inc/login?redirect=" + encodeURIComponent(nextPath);+                  console.log(`[wikiview] "${sessionId}" no authed session yet — navigating THIS window to the sign-in page: ${loginUrl}`);+                  await session.page.goto(loginUrl, { waitUntil: "domcontentloaded", timeout: 25000 });+                  session._wikiView = "authed";+                  session._foreground = true;+                  try { await session.page.bringToFront(); } catch (e) {}+                  try { await osRaiseSessionWindow(session, sessionId); } catch (e) {}   // user clicked the task — SHOW them the sign-in page+                  try { await setWikiModeGlyph(session.page, "○ Public"); } catch (e) {}+                  wikiCaption("\u{1F513} Adom wiki: finish the one-time sign-in HERE — you'll come back to your page signed in", 9000).catch(() => {});+                  sendJSON(res, { success: true, output: JSON.stringify({+                    ok: true, view: "authed", signInStarted: true, loginUrl, url: session.page.url(),+                    _hint: "No wiki session existed yet, so pup navigated THIS window to the Adom wiki sign-in page (hydrogen SSO) and raised it. The user completes the one-time sign-in and is returned to their wiki page signed in; after that every thread's logged-in view works, because a signed-in window can mint the magic link. This is a USER action (they clicked the taskbar task), so foregrounding is expected.",+                  }) });+                  return;+                }               } else {                 try {                   const cdp = await session.page.target().createCDPSession();