From fad96ea0fed3e2c43d3cad3d9a4e44d0798bbba1 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 14 Oct 2026 23:47:52 +0800 Subject: [PATCH] =?UTF-8?q?gui,=20cli:=20sync=20and=20backup=20say=20the?= =?UTF-8?q?=20synced=20settings=20use=20a=20subscription=20not=20signed=20?= =?UTF-8?q?in=20here,=20and=20that=20one=20not=20used=20here=20needs=20not?= =?UTF-8?q?hing=20(=E6=82=A0=E6=82=A0=E5=93=A5=20on=20Discord)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 悠悠哥 asked why the sync card said ChatGPT wasn't signed in. The line was right (the synced settings carry ChatGPT's picks, and this computer has no ChatGPT account; sync carries no sign-in) but didn't say why ChatGPT was named or that it can be left alone. It now reads "Your synced settings use {names}, which isn't signed in on this computer. Sync carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing." The backup import's sibling says the same of the backup, in en, zh, zh-TW, ja and de, and the CLI's `magpie webdav` status and `magpie backup import` lines say it too. Which subscriptions are named is unchanged. Run: - sync-sign-in.test.cjs, now with zh-TW and widths 1100/900/440/420: chromium + webkit, 40/40; screenshots of zh at 420 looked at. - go test ./internal/cli: ok. go test ./internal/gui: ok except TestMainWindowCorners killed at its 40s deadline (load average ~180), which is #1936; alone it passes (36s). - gofmt -l clean; go vet darwin, windows, linux -tags nogui on cli. Not tried: the real app with a real WebDAV sync. --- internal/cli/backup_cmd.go | 2 +- internal/cli/webdav_cli.go | 2 +- internal/gui/assets/app.js | 9 ++++++--- internal/gui/assets/i18n.js | 16 ++++++++-------- internal/gui/tests/sync-sign-in.test.cjs | 22 ++++++++++++++-------- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/internal/cli/backup_cmd.go b/internal/cli/backup_cmd.go index a84841f13..d479cb90d 100644 --- a/internal/cli/backup_cmd.go +++ b/internal/cli/backup_cmd.go @@ -119,7 +119,7 @@ func restoreCmd(args []string) error { fmt.Println(muted.Render("Needs a key (magpie provider key ): " + strings.Join(r.NeedKey, ", "))) } if len(r.SignIn) > 0 { - fmt.Println(muted.Render("Not signed in on this computer (a backup carries no sign-in; magpie accounts add ): " + strings.Join(r.SignIn, ", "))) + fmt.Println(muted.Render("The backup's settings use these, not signed in on this computer (a backup carries settings, not sign-ins; to use one here: magpie accounts add ): " + strings.Join(r.SignIn, ", "))) } if len(r.Plugins) > 0 { fmt.Println(muted.Render("Plugins added: " + strings.Join(r.Plugins, ", "))) diff --git a/internal/cli/webdav_cli.go b/internal/cli/webdav_cli.go index c5c0d9a52..dddc79a2b 100644 --- a/internal/cli/webdav_cli.go +++ b/internal/cli/webdav_cli.go @@ -512,7 +512,7 @@ func syncShow(k syncKind) error { fmt.Println(" couldn't share usage:", v.UsageError) } if len(v.SignIn) > 0 { - fmt.Println(" not signed in on this computer (sync carries no sign-in; magpie accounts add ):", strings.Join(v.SignIn, ", ")) + fmt.Println(" synced settings use these, not signed in on this computer (sync carries settings, not sign-ins; to use one here: magpie accounts add ):", strings.Join(v.SignIn, ", ")) } if n := v.Notice; n != nil && n.Restored { fmt.Println(" Restored from the server:", partNames(n.Here)) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index d06a69222..3d45bdb87 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -21516,8 +21516,11 @@ async function renderSync(v) { // (#1259) if (v.on && !v.error && v.usageError) sub.after(el("div", "sub bad wraps sync-usage-err", t("Couldn't share usage: {error}", { error: v.usageError }))); // subscriptions whose settings sync brought with no account here: sync - // carries no sign-in, and they are listed once signed in to here - if (v.on && v.signIn?.length) sub.after(el("div", "sub wraps sync-sign-in", t("Not signed in on this computer: {names}. Sync carries no sign-in: sign in to them in Providers → Add a provider.", { names: subNames(v.signIn) }))); + // carries no sign-in, and they are listed once signed in to here. It says + // the synced settings are why they are named, and that one not used here + // needs nothing (悠悠哥 on Discord asked why sync said ChatGPT wasn't + // signed in) + if (v.on && v.signIn?.length) sub.after(el("div", "sub wraps sync-sign-in", t("Your synced settings use {names}, which isn't signed in on this computer. Sync carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.", { names: subNames(v.signIn) }))); // the server's file isn't a backup a sync can read, and is a file: this // computer's setup can go up in its place, the user choosing it if (v.on && v.error && v.serverFile?.replace) { @@ -21883,7 +21886,7 @@ function importForm() { const lines = [t("Providers: {added} added, {replaced} replaced; {profiles} profiles; {agents} agent settings changed", { added: r.Added, replaced: r.Replaced, profiles: r.Profiles, agents: r.Agents })]; if (r.NeedKey?.length) lines.push(t("Needs a key: {names}", { names: r.NeedKey.join(", ") })); // a backup carries a subscription's settings, never its sign-in - if (r.SignIn?.length) lines.push(t("Not signed in on this computer: {names}. A backup carries no sign-in: sign in to them in Providers → Add a provider.", { names: subNames(r.SignIn) })); + if (r.SignIn?.length) lines.push(t("This backup's settings use {names}, which isn't signed in on this computer. A backup carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.", { names: subNames(r.SignIn) })); if (r.Plugins?.length) lines.push(t("Plugins added: {names}", { names: r.Plugins.join(", ") })); for (const [spec, error] of Object.entries(r.PluginErrors || {})) lines.push(t("Couldn't add the plugin {spec}: {error}", { spec, error })); if (r.Library) lines.push(t("Library brought in and written into the agents")); diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index a96283666..841d7df97 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -2365,8 +2365,8 @@ const I18N = { "Choose a file first": "请先选择文件", "Providers: {added} added, {replaced} replaced; {profiles} profiles; {agents} agent settings changed": "供应商:新增 {added} 个,替换 {replaced} 个;Profile {profiles} 个;agent 设置改动 {agents} 项", "Needs a key: {names}": "需要填写 Key:{names}", - "Not signed in on this computer: {names}. A backup carries no sign-in: sign in to them in Providers → Add a provider.": "本机尚未登录:{names}。备份不含登录信息,请在 供应商 → 添加供应商 中登录。", - "Not signed in on this computer: {names}. Sync carries no sign-in: sign in to them in Providers → Add a provider.": "本机尚未登录:{names}。同步不含登录信息,请在 供应商 → 添加供应商 中登录。", + "This backup's settings use {names}, which isn't signed in on this computer. A backup carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.": "这份备份的设置用到了 {names},但本机尚未登录。备份只带设置,不带登录信息:要在本机使用,请在 供应商 → 添加供应商 中登录;不在本机使用可忽略。", + "Your synced settings use {names}, which isn't signed in on this computer. Sync carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.": "同步过来的设置用到了 {names},但本机尚未登录。同步只带设置,不带登录信息:要在本机使用,请在 供应商 → 添加供应商 中登录;不在本机使用可忽略。", "Plugins added: {names}": "已添加插件:{names}", "Couldn't add the plugin {spec}: {error}": "无法添加插件 {spec}:{error}", "Library brought in and written into the agents": "资源库已导入,并已写入各 agent", @@ -6581,8 +6581,8 @@ const I18N = { "Choose a file first": "請先選擇檔案", "Providers: {added} added, {replaced} replaced; {profiles} profiles; {agents} agent settings changed": "供應商:新增 {added} 個,替換 {replaced} 個;Profile {profiles} 個;agent 設定改動 {agents} 項", "Needs a key: {names}": "需要填寫 Key:{names}", - "Not signed in on this computer: {names}. A backup carries no sign-in: sign in to them in Providers → Add a provider.": "本機尚未登入:{names}。備份不含登入資訊,請在 供應商 → 新增供應商 中登入。", - "Not signed in on this computer: {names}. Sync carries no sign-in: sign in to them in Providers → Add a provider.": "本機尚未登入:{names}。同步不含登入資訊,請在 供應商 → 新增供應商 中登入。", + "This backup's settings use {names}, which isn't signed in on this computer. A backup carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.": "這份備份的設定用到了 {names},但本機尚未登入。備份只帶設定,不帶登入資訊:要在本機使用,請在 供應商 → 新增供應商 中登入;不在本機使用可忽略。", + "Your synced settings use {names}, which isn't signed in on this computer. Sync carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.": "同步過來的設定用到了 {names},但本機尚未登入。同步只帶設定,不帶登入資訊:要在本機使用,請在 供應商 → 新增供應商 中登入;不在本機使用可忽略。", "Plugins added: {names}": "已新增外掛:{names}", "Couldn't add the plugin {spec}: {error}": "無法新增外掛 {spec}:{error}", "Library brought in and written into the agents": "資源庫已匯入,並已寫入各 agent", @@ -10779,8 +10779,8 @@ const I18N = { "Choose a file first": "先にファイルを選んでください", "Providers: {added} added, {replaced} replaced; {profiles} profiles; {agents} agent settings changed": "プロバイダ:{added} 件追加、{replaced} 件置換。プロファイル {profiles} 件。エージェント設定 {agents} 件を変更", "Needs a key: {names}": "キーが必要です:{names}", - "Not signed in on this computer: {names}. A backup carries no sign-in: sign in to them in Providers → Add a provider.": "このコンピュータではまだサインインしていません:{names}。バックアップにサインイン情報は含まれません。プロバイダ → プロバイダを追加 でサインインしてください。", - "Not signed in on this computer: {names}. Sync carries no sign-in: sign in to them in Providers → Add a provider.": "このコンピュータではまだサインインしていません:{names}。同期にサインイン情報は含まれません。プロバイダ → プロバイダを追加 でサインインしてください。", + "This backup's settings use {names}, which isn't signed in on this computer. A backup carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.": "このバックアップの設定は {names} を使っていますが、このコンピュータではまだサインインしていません。バックアップに含まれるのは設定だけで、サインイン情報は含まれません。ここで使うなら プロバイダ → プロバイダを追加 でサインインしてください。使わないなら何もしなくて構いません。", + "Your synced settings use {names}, which isn't signed in on this computer. Sync carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.": "同期した設定は {names} を使っていますが、このコンピュータではまだサインインしていません。同期で届くのは設定だけで、サインイン情報は含まれません。ここで使うなら プロバイダ → プロバイダを追加 でサインインしてください。使わないなら何もしなくて構いません。", "Plugins added: {names}": "追加したプラグイン:{names}", "Couldn't add the plugin {spec}: {error}": "プラグイン {spec} を追加できませんでした:{error}", "Library brought in and written into the agents": "ライブラリを取り込み、エージェントに書き込みました", @@ -14994,8 +14994,8 @@ const I18N = { "Choose a file first": "Wählen Sie zuerst eine Datei", "Providers: {added} added, {replaced} replaced; {profiles} profiles; {agents} agent settings changed": "Anbieter: {added} hinzugefügt, {replaced} ersetzt; {profiles} Profile; {agents} Agenteneinstellungen geändert", "Needs a key: {names}": "Schlüssel erforderlich: {names}", - "Not signed in on this computer: {names}. A backup carries no sign-in: sign in to them in Providers → Add a provider.": "Auf diesem Computer nicht angemeldet: {names}. Eine Sicherung enthält keine Anmeldungen: Melde dich unter Anbieter → Anbieter hinzufügen an.", - "Not signed in on this computer: {names}. Sync carries no sign-in: sign in to them in Providers → Add a provider.": "Auf diesem Computer nicht angemeldet: {names}. Die Synchronisierung überträgt keine Anmeldungen: Melde dich unter Anbieter → Anbieter hinzufügen an.", + "This backup's settings use {names}, which isn't signed in on this computer. A backup carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.": "Die Einstellungen dieser Sicherung nutzen {names}, auf diesem Computer aber nicht angemeldet. Eine Sicherung enthält Einstellungen, keine Anmeldungen: Um es hier zu nutzen, melde dich unter Anbieter → Anbieter hinzufügen an; sonst ist nichts zu tun.", + "Your synced settings use {names}, which isn't signed in on this computer. Sync carries settings, not sign-ins: to use it here, sign in in Providers → Add a provider; if you don't, nothing needs doing.": "Deine synchronisierten Einstellungen nutzen {names}, auf diesem Computer aber nicht angemeldet. Die Synchronisierung überträgt Einstellungen, keine Anmeldungen: Um es hier zu nutzen, melde dich unter Anbieter → Anbieter hinzufügen an; sonst ist nichts zu tun.", "Plugins added: {names}": "Hinzugefügte Erweiterungen: {names}", "Couldn't add the plugin {spec}: {error}": "Die Erweiterung {spec} konnte nicht hinzugefügt werden: {error}", "Library brought in and written into the agents": "Bibliothek importiert und in die Agenten geschrieben", diff --git a/internal/gui/tests/sync-sign-in.test.cjs b/internal/gui/tests/sync-sign-in.test.cjs index f78b774ba..7f9acfe5b 100644 --- a/internal/gui/tests/sync-sign-in.test.cjs +++ b/internal/gui/tests/sync-sign-in.test.cjs @@ -6,7 +6,9 @@ // name the subscriptions not signed in on this computer (by the name the // Add sheet gives them), and the import says which plugins it added and // which it couldn't. In English, Chinese, Japanese and German, Chromium and -// WebKit, at 900 and 440px. The API is faked; nothing is synced. +// WebKit, at 900 and 440px. 悠悠哥 on Discord asked why sync said ChatGPT +// wasn't signed in: the line says the synced settings use it, and that one +// not used here needs nothing (zh-TW too, 1100 and 420px). The API is faked; nothing is synced. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); const path = require("node:path"); @@ -43,10 +45,11 @@ function serve(lang, sync, imported) { } const words = { - en: { sync: "Not signed in on this computer: Claude, Cursor. Sync carries no sign-in", backup: "Not signed in on this computer: Claude, Cursor. A backup carries no sign-in", added: "Plugins added: ", failed: "Couldn't add the plugin github:x/y: " }, - zh: { sync: "本机尚未登录:Claude, Cursor。同步不含登录信息", backup: "本机尚未登录:Claude, Cursor。备份不含登录信息", added: "已添加插件:", failed: "无法添加插件 github:x/y:" }, - ja: { sync: "このコンピュータではまだサインインしていません:Claude, Cursor。同期に", backup: "このコンピュータではまだサインインしていません:Claude, Cursor。バックアップに", added: "追加したプラグイン:", failed: "プラグイン github:x/y を追加できませんでした:" }, - de: { sync: "Auf diesem Computer nicht angemeldet: Claude, Cursor. Die Synchronisierung", backup: "Auf diesem Computer nicht angemeldet: Claude, Cursor. Eine Sicherung", added: "Hinzugefügte Erweiterungen: ", failed: "Die Erweiterung github:x/y konnte nicht hinzugefügt werden: " }, + en: { sync: "Your synced settings use Claude, Cursor, which isn't signed in on this computer. Sync carries settings, not sign-ins", backup: "This backup's settings use Claude, Cursor, which isn't signed in on this computer. A backup carries settings, not sign-ins", added: "Plugins added: ", failed: "Couldn't add the plugin github:x/y: " }, + zh: { sync: "同步过来的设置用到了 Claude, Cursor,但本机尚未登录。同步只带设置", backup: "这份备份的设置用到了 Claude, Cursor,但本机尚未登录。备份只带设置", added: "已添加插件:", failed: "无法添加插件 github:x/y:" }, + "zh-TW": { sync: "同步過來的設定用到了 Claude, Cursor,但本機尚未登入。同步只帶設定", backup: "這份備份的設定用到了 Claude, Cursor,但本機尚未登入。備份只帶設定", added: null, failed: null }, + ja: { sync: "同期した設定は Claude, Cursor を使っていますが、このコンピュータではまだサインインしていません。", backup: "このバックアップの設定は Claude, Cursor を使っていますが、このコンピュータではまだサインインしていません。", added: "追加したプラグイン:", failed: "プラグイン github:x/y を追加できませんでした:" }, + de: { sync: "Deine synchronisierten Einstellungen nutzen Claude, Cursor, auf diesem Computer aber nicht angemeldet.", backup: "Die Einstellungen dieser Sicherung nutzen Claude, Cursor, auf diesem Computer aber nicht angemeldet.", added: "Hinzugefügte Erweiterungen: ", failed: "Die Erweiterung github:x/y konnte nicht hinzugefügt werden: " }, }; const base = { on: true, kind: "webdav", url: "https://dav.example.invalid/dav/", user: "me", passwordSet: true, passphraseSet: true, keys: true, agents: true, library: true, usage: true, last: new Date(Date.now() - 60000).toISOString() }; @@ -54,7 +57,7 @@ const imported = { Added: 3, Replaced: 0, Profiles: 0, Agents: 0, NeedKey: ["Acm for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { for (const lang of Object.keys(words)) { - for (const width of [900, 440]) { + for (const width of [1100, 900, 440, 420]) { const w = words[lang]; test(`${engine} ${lang} ${width}px: the subscriptions to sign in to here are named`, async (t) => { const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); @@ -99,8 +102,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await done.first().waitFor({ state: "visible" }); const lines = await done.allTextContents(); assert.ok(lines.some((l) => l.startsWith(w.backup)), `import names what to sign in to: ${lines.join(" | ")}`); - assert.ok(lines.includes(w.added + "@magpie-community/opencode-cursor-auth"), lines.join(" | ")); - assert.ok(lines.includes(w.failed + "no such repository"), lines.join(" | ")); + // zh-TW: the plugin lines' own words aren't this test's; their presence is + if (w.added) assert.ok(lines.includes(w.added + "@magpie-community/opencode-cursor-auth"), lines.join(" | ")); + else assert.ok(lines.some((l) => l.endsWith("@magpie-community/opencode-cursor-auth")), lines.join(" | ")); + if (w.failed) assert.ok(lines.includes(w.failed + "no such repository"), lines.join(" | ")); + else assert.ok(lines.some((l) => l.endsWith("no such repository")), lines.join(" | ")); assert.ok(!lines.some((l) => /: ,|:,|:\s*$/.test(l)), `no empty name: ${lines.join(" | ")}`); const over = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth); assert.ok(over <= 0, `no sideways scroll: ${over}`);