diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index e94705af1..b4156255e 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -13075,6 +13075,13 @@ function renderSigning(sub) { : signing.code && sub.agent === "codex" ? t("magpie opened ChatGPT's device page. Enter this code there; the account shows up here as soon as you're done.") : signing.code && sub.agent === "factory" ? t("magpie opened Factory's sign-in page. Check it shows this code and confirm it; the account shows up here as soon as you're done.") : signing.code ? t("magpie opened GitHub's device page. Enter this code there; the account shows up here as soon as you're done.") : t("magpie opened the sign-in page. The account shows up here as soon as you're done."))); + // "as set in Settings" leads there: Privacy's Sign-in pages + if (signing.state !== "starting" && signing.linkOnly && !signing.opened) { + const go = el("button", "text", t("Settings") + " ›"); + go.type = "button"; + go.onclick = (e) => openSettingsAt(e, "privacy", "#signInOpenRow"); + tt.lastChild.append(" ", go); + } if (signing.code) { const code = el("span", "devcode"); code.append(el("code", "", signing.code), copyBtn(signing.code, t("Code"))); @@ -13082,8 +13089,7 @@ function renderSigning(sub) { } box.append(tt); if (signing.url) { - // the link itself, to select or copy into another browser or profile - // than the one magpie opened it in + // the link, to copy into another browser or profile const link = el("span", "signlink"); const u = el("code", "", signing.url); u.title = t("Open it in another browser or profile: copy it there"); diff --git a/internal/gui/tests/signin-link-only.test.cjs b/internal/gui/tests/signin-link-only.test.cjs index c8f8a19ee..17496d68a 100644 --- a/internal/gui/tests/signin-link-only.test.cjs +++ b/internal/gui/tests/signin-link-only.test.cjs @@ -6,7 +6,8 @@ // saves signInLinkOnly. A sign-in the server says it kept to its link // (linkOnly) opens no page in a browser tab either, says so, and offers its // link to copy and Open (not "Open again"); one without it opens its page as -// before. Every language, Chromium and WebKit, a narrow window; no click +// before, and "as set in Settings" leads to the setting. Every language, +// Chromium and WebKit, a narrow window; no click // moves the page. No backend, the API is faked here. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); @@ -19,11 +20,11 @@ const assets = path.resolve(__dirname, "../assets"); const LINK = "https://accounts.example/o/oauth2/auth?client_id=x&redirect_uri=http%3A%2F%2F127.0.0.1%3A51234%2Fcallback&state=" + "s".repeat(80); const W = { - en: { head: "Sign-in pages", name: "Open sign-in pages in the browser", anyway: "Sign in anyway", said: "magpie didn't open the sign-in page", open: "Open", again: "Open again", copy: "Copy link" }, - zh: { head: "登录页", name: "在浏览器中打开登录页", anyway: "仍然登录", said: "magpie 按设置没有打开登录页", open: "打开", again: "重新打开", copy: "复制链接" }, - "zh-TW": { head: "登入頁", name: "在瀏覽器中開啟登入頁", anyway: "仍然登入", said: "magpie 依設定沒有開啟登入頁", open: "開啟", again: "重新開啟", copy: "複製連結" }, - ja: { head: "サインインページ", name: "サインインページをブラウザで開く", anyway: "それでもサインイン", said: "設定に従い、magpie はサインインページを開いていません", open: "開く", again: "もう一度開く", copy: "リンクをコピー" }, - de: { head: "Anmeldeseiten", name: "Anmeldeseiten im Browser öffnen", anyway: "Trotzdem anmelden", said: "magpie hat die Anmeldeseite wie in den Einstellungen festgelegt nicht geöffnet", open: "Öffnen", again: "Erneut öffnen", copy: "Link kopieren" }, + en: { settings: "Settings", head: "Sign-in pages", name: "Open sign-in pages in the browser", anyway: "Sign in anyway", said: "magpie didn't open the sign-in page", open: "Open", again: "Open again", copy: "Copy link" }, + zh: { settings: "设置", head: "登录页", name: "在浏览器中打开登录页", anyway: "仍然登录", said: "magpie 按设置没有打开登录页", open: "打开", again: "重新打开", copy: "复制链接" }, + "zh-TW": { settings: "設定", head: "登入頁", name: "在瀏覽器中開啟登入頁", anyway: "仍然登入", said: "magpie 依設定沒有開啟登入頁", open: "開啟", again: "重新開啟", copy: "複製連結" }, + ja: { settings: "設定", head: "サインインページ", name: "サインインページをブラウザで開く", anyway: "それでもサインイン", said: "設定に従い、magpie はサインインページを開いていません", open: "開く", again: "もう一度開く", copy: "リンクをコピー" }, + de: { settings: "Einstellungen", head: "Anmeldeseiten", name: "Anmeldeseiten im Browser öffnen", anyway: "Trotzdem anmelden", said: "magpie hat die Anmeldeseite wie in den Einstellungen festgelegt nicht geöffnet", open: "Öffnen", again: "Erneut öffnen", copy: "Link kopieren" }, }; function settingsPayload(lang, over) { @@ -135,9 +136,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert(said.startsWith(w.said), said); assert.equal(await box.locator(".acts button", { hasText: new RegExp("^" + w.open + "$") }).count(), 1, "Open"); assert.equal(await box.locator(".acts button", { hasText: w.again }).count(), 0, "not Open again"); + // "as set in Settings" leads to the setting + const go = box.locator(".tt > .s button"); + assert.equal((await go.textContent()).trim(), w.settings + " ›"); + await go.click(); + await page.locator("#view-settings #signInOpenRow.flash").waitFor(); } else { assert.deepEqual(opened, [LINK], "the page opened once"); assert(!said.startsWith(w.said), said); + assert.equal(await box.locator(".tt > .s button").count(), 0, "nothing to lead to"); assert.equal(await box.locator(".acts button", { hasText: w.again }).count(), 1, "Open again"); } assert.deepEqual(errors, []);