diff --git a/internal/cli/update_cli.go b/internal/cli/update_cli.go index ab6060bf2..ef93e1bfd 100644 --- a/internal/cli/update_cli.go +++ b/internal/cli/update_cli.go @@ -78,7 +78,7 @@ func updateAutoCmd(args []string) error { } // updateMirrorCmd is `magpie update mirror [|off]`: the GitHub -// download mirror every update goes through, the app's own among them +// download mirror an update goes through when usemagpie.ai's file fails, the app's own among them // (settings.UpdateMirror). With nothing, it says which. func updateMirrorCmd(args []string) error { s := settings.Load() @@ -100,10 +100,10 @@ func updateMirrorCmd(args []string) error { } } if s.UpdateMirror == "" { - fmt.Println("updates are downloaded from GitHub", muted.Render("· magpie update mirror has them come through a mirror; the checksum is still usemagpie.ai's")) + fmt.Println("updates are downloaded from usemagpie.ai, and from GitHub when that fails", muted.Render("· magpie update mirror has GitHub's come through a mirror; the checksum is still usemagpie.ai's")) return nil } - fmt.Println("updates are downloaded through", bold.Render(s.UpdateMirror), muted.Render("· each is checked against usemagpie.ai's checksum · magpie update mirror off goes back to GitHub")) + fmt.Println("updates are downloaded from usemagpie.ai, and through", bold.Render(s.UpdateMirror), "when that fails", muted.Render("· each is checked against usemagpie.ai's checksum · magpie update mirror off goes back to GitHub")) return nil } diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 1cc83599e..f11cc53ef 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -19840,10 +19840,11 @@ function renderCLI(r) { } // Settings' Download source (#893): where an update's file is downloaded -// from — GitHub, or a GitHub download mirror put before its URL, the same -// setting `magpie update mirror` writes. magpie names no mirror of its -// own; the feed and each file's SHA-256 still come from usemagpie.ai, and a -// file that doesn't match is never installed. A draft and its error are +// from — usemagpie.ai (R2), and github.com when that fails, or a GitHub +// download mirror put before github.com's URL, the same setting `magpie +// update mirror` writes. magpie names no mirror of its own; the feed and +// each file's SHA-256 still come from usemagpie.ai, and a file that doesn't +// match is never installed. A draft and its error are // kept across the page being drawn again. let mirrorEditing = false, mirrorDraft = "", mirrorErr = ""; function setUpdateMirror(mirror) { @@ -19858,13 +19859,13 @@ function renderUpdateMirror(r, s) { const sub = el("div", "sub"); who.append(sub); const m = s.updateMirror || ""; - sub.textContent = mirrorErr || (m ? t("Updates are downloaded through this mirror, each checked against usemagpie.ai's checksum") - : t("Updates are downloaded from GitHub; a mirror can be used where GitHub is slow")); + sub.textContent = mirrorErr || (m ? t("Updates are downloaded from usemagpie.ai, and through this mirror when that fails, each checked against usemagpie.ai's checksum") + : t("Updates are downloaded from usemagpie.ai, and from GitHub when that fails; a mirror can stand in for GitHub where it is slow")); sub.classList.toggle("err", !!mirrorErr); sub.title = t("The update and its checksum always come from usemagpie.ai; a file from the mirror that doesn't match it is not installed."); if (!mirrorEditing) { if (m) { - const official = el("button", "text", t("Use GitHub")); + const official = el("button", "text", t("Remove mirror")); official.onclick = () => setUpdateMirror("").catch(statusTErr); const change = el("button", "text", t("Change")); change.onclick = () => { mirrorEditing = true; mirrorDraft = m; renderUpdateMirror(r, s); }; @@ -19872,7 +19873,7 @@ function renderUpdateMirror(r, s) { } else { const add = el("button", "text", t("Use a mirror…")); add.onclick = () => { mirrorEditing = true; mirrorDraft = ""; renderUpdateMirror(r, s); }; - val.append(el("code", "", "GitHub"), add); + val.append(el("code", "", "usemagpie.ai"), add); } return; } diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 6ce9d44f4..6f50c890d 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -3706,10 +3706,10 @@ const I18N = { "Checking your shells…": "正在检查你的 shell…", "Add to PATH": "添加到 PATH", "Download source": "下载源", - "Updates are downloaded through this mirror, each checked against usemagpie.ai's checksum": "更新经此镜像下载,每个文件都按 usemagpie.ai 的校验和核对", - "Updates are downloaded from GitHub; a mirror can be used where GitHub is slow": "更新从官方 GitHub 下载;GitHub 慢时可以改用镜像", + "Updates are downloaded from usemagpie.ai, and through this mirror when that fails, each checked against usemagpie.ai's checksum": "更新从 usemagpie.ai 下载,失败时经此镜像下载,每个文件都按 usemagpie.ai 的校验和核对", + "Updates are downloaded from usemagpie.ai, and from GitHub when that fails; a mirror can stand in for GitHub where it is slow": "更新从 usemagpie.ai 下载,失败时改从 GitHub 下载;GitHub 慢时可以给它配镜像", "The update and its checksum always come from usemagpie.ai; a file from the mirror that doesn't match it is not installed.": "更新信息和校验和始终来自 usemagpie.ai;从镜像下载的文件如果与校验和不符,magpie 不会安装它。", - "Use GitHub": "恢复官方", + "Remove mirror": "不用镜像", "Change": "修改", "Use a mirror…": "使用镜像…", "Mirror address": "镜像地址", @@ -8429,10 +8429,10 @@ const I18N = { "Checking your shells…": "正在檢查你的 shell…", "Add to PATH": "新增到 PATH", "Download source": "下載源", - "Updates are downloaded through this mirror, each checked against usemagpie.ai's checksum": "更新經此鏡像下載,每個檔案都按 usemagpie.ai 的檢查碼核對", - "Updates are downloaded from GitHub; a mirror can be used where GitHub is slow": "更新從官方 GitHub 下載;GitHub 慢時可以改用鏡像", + "Updates are downloaded from usemagpie.ai, and through this mirror when that fails, each checked against usemagpie.ai's checksum": "更新從 usemagpie.ai 下載,失敗時經此鏡像下載,每個檔案都按 usemagpie.ai 的檢查碼核對", + "Updates are downloaded from usemagpie.ai, and from GitHub when that fails; a mirror can stand in for GitHub where it is slow": "更新從 usemagpie.ai 下載,失敗時改從 GitHub 下載;GitHub 慢時可以給它配鏡像", "The update and its checksum always come from usemagpie.ai; a file from the mirror that doesn't match it is not installed.": "更新資訊和檢查碼始終來自 usemagpie.ai;從鏡像下載的檔案如果與檢查碼不符,magpie 不會安裝它。", - "Use GitHub": "恢復官方", + "Remove mirror": "不用鏡像", "Change": "修改", "Use a mirror…": "使用鏡像…", "Mirror address": "鏡像位址", @@ -13163,10 +13163,10 @@ const I18N = { "Checking your shells…": "シェルを確認しています…", "Add to PATH": "PATH に追加", "Download source": "ダウンロード元", - "Updates are downloaded through this mirror, each checked against usemagpie.ai's checksum": "更新はこのミラー経由でダウンロードし、それぞれ usemagpie.ai のチェックサムで照合します", - "Updates are downloaded from GitHub; a mirror can be used where GitHub is slow": "更新は GitHub からダウンロードします。GitHub が遅い場合はミラーを使えます", + "Updates are downloaded from usemagpie.ai, and through this mirror when that fails, each checked against usemagpie.ai's checksum": "更新は usemagpie.ai からダウンロードし、失敗したときはこのミラー経由で取得します。それぞれ usemagpie.ai のチェックサムで照合します", + "Updates are downloaded from usemagpie.ai, and from GitHub when that fails; a mirror can stand in for GitHub where it is slow": "更新は usemagpie.ai からダウンロードし、失敗したときは GitHub から取得します。GitHub が遅い場合はミラーを使えます", "The update and its checksum always come from usemagpie.ai; a file from the mirror that doesn't match it is not installed.": "更新情報とチェックサムは常に usemagpie.ai から取得します。ミラーから取得したファイルがチェックサムと一致しない場合、magpie はインストールしません。", - "Use GitHub": "公式に戻す", + "Remove mirror": "ミラーをやめる", "Change": "変更", "Use a mirror…": "ミラーを使う…", "Mirror address": "ミラーのアドレス", @@ -17908,10 +17908,10 @@ const I18N = { "Checking your shells…": "Shells werden geprüft…", "Add to PATH": "Zum PATH hinzufügen", "Download source": "Downloadquelle", - "Updates are downloaded through this mirror, each checked against usemagpie.ai's checksum": "Updates werden über diesen Spiegel geladen und jeweils mit der Prüfsumme von usemagpie.ai abgeglichen", - "Updates are downloaded from GitHub; a mirror can be used where GitHub is slow": "Updates werden von GitHub geladen; wo GitHub langsam ist, hilft ein Spiegel", + "Updates are downloaded from usemagpie.ai, and through this mirror when that fails, each checked against usemagpie.ai's checksum": "Updates werden von usemagpie.ai geladen, und über diesen Spiegel, wenn das scheitert; jeweils mit der Prüfsumme von usemagpie.ai abgeglichen", + "Updates are downloaded from usemagpie.ai, and from GitHub when that fails; a mirror can stand in for GitHub where it is slow": "Updates werden von usemagpie.ai geladen, und von GitHub, wenn das scheitert; wo GitHub langsam ist, hilft ein Spiegel", "The update and its checksum always come from usemagpie.ai; a file from the mirror that doesn't match it is not installed.": "Update und Prüfsumme kommen immer von usemagpie.ai; eine Datei vom Spiegel, die nicht zur Prüfsumme passt, wird nicht installiert.", - "Use GitHub": "GitHub verwenden", + "Remove mirror": "Spiegel entfernen", "Change": "Ändern", "Use a mirror…": "Spiegel verwenden…", "Mirror address": "Spiegel-Adresse", diff --git a/internal/gui/tests/README.md b/internal/gui/tests/README.md index 853b0d41a..f213abdf6 100644 --- a/internal/gui/tests/README.md +++ b/internal/gui/tests/README.md @@ -2505,10 +2505,10 @@ node --test internal/gui/tests/cli-path.test.cjs ``` `update-mirror.test.cjs` checks Settings › About › Download source (#893): -the row says updates come from GitHub; Use a mirror… opens an address field, +the row says updates come from usemagpie.ai, then GitHub; Use a mirror… opens an address field, an http:// address is refused with the reason in red and the draft kept, an https:// one saved with Enter posts `/api/settings/update-mirror` and is -shown, and Use GitHub posts an empty mirror. A download that failed through +shown, and Remove mirror posts an empty mirror. A download that failed through the mirror says so on the Version row and offers Download from GitHub, which posts the empty mirror then `/api/update/install`. No native select, no left border, no click scrolls. English and Chinese, Chromium and WebKit; the API diff --git a/internal/gui/tests/update-mirror.test.cjs b/internal/gui/tests/update-mirror.test.cjs index 2a8bf0f8c..606860b84 100644 --- a/internal/gui/tests/update-mirror.test.cjs +++ b/internal/gui/tests/update-mirror.test.cjs @@ -1,7 +1,7 @@ // Run with Node's test runner and Playwright on the module path; see README.md. -// Settings › About › Download source (#893): updates come from GitHub, or -// through a mirror typed in (a full https:// address, the same setting as -// `magpie update mirror`), and GitHub is one click back. A download that +// Settings › About › Download source (#893): updates come from usemagpie.ai, +// then GitHub, or a mirror typed in for GitHub (a full https:// address, the +// same setting as `magpie update mirror`), and no mirror is one click back. A download that // failed through the mirror says it's the mirror's and offers GitHub, which // takes the mirror away and downloads again. No click moves the page, // nothing is a native select, no left border. English and Chinese; no @@ -16,12 +16,12 @@ const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs"); const assets = path.resolve(__dirname, "../assets"); const words = { - en: { row: "Download source", use: "Use a mirror…", save: "Save", github: "Use GitHub", change: "Change", bad: "full https:// address", + en: { row: "Download source", use: "Use a mirror…", save: "Save", github: "Remove mirror", change: "Change", bad: "full https:// address", tip: "a file from the mirror that doesn't match it is not installed", - viaGitHub: "downloaded from GitHub", viaMirror: "through this mirror", failed: "through the mirror", official: "Download from GitHub" }, - zh: { row: "下载源", use: "使用镜像…", save: "保存", github: "恢复官方", change: "修改", bad: "完整的 https:// 地址", + viaGitHub: "from usemagpie.ai, and from GitHub when that fails", viaMirror: "and through this mirror when that fails", failed: "through the mirror", official: "Download from GitHub" }, + zh: { row: "下载源", use: "使用镜像…", save: "保存", github: "不用镜像", change: "修改", bad: "完整的 https:// 地址", tip: "从镜像下载的文件如果与校验和不符,magpie 不会安装它", - viaGitHub: "从官方 GitHub 下载", viaMirror: "经此镜像下载", failed: "经镜像", official: "改用官方下载" }, + viaGitHub: "从 usemagpie.ai 下载,失败时改从 GitHub 下载", viaMirror: "失败时经此镜像下载", failed: "经镜像", official: "改用官方下载" }, }; const M = "https://mirror.example/gh/"; @@ -105,7 +105,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const { page, row } = await open(browser, lang, ctl, errors); assert.equal((await row.locator(".name").innerText()).trim(), w.row); await row.locator(".sub", { hasText: w.viaGitHub }).waitFor(); - assert.equal((await row.locator("code").innerText()).trim(), "GitHub"); + assert.equal((await row.locator("code").innerText()).trim(), "usemagpie.ai"); // the tooltip's second half reads as a sentence (AlwaySleepyZzz on Discord) assert.ok((await row.locator(".sub").getAttribute("title")).includes(w.tip), "the tooltip says a mismatched mirror file is not installed"); assert.equal(await page.locator("#about select").count(), 0, "no native select");