settings: Download source says usemagpie.ai first, GitHub when it fails
Since v0.1.3345 an update's files come from usemagpie.ai (R2) and go to
github.com only when that fails; a mirror stands in for github.com only.
Settings › About › Download source still showed "GitHub", said updates
come from GitHub, and its button "Use GitHub" (zh 恢复官方) read as
switching back to GitHub. Now it shows usemagpie.ai, says GitHub (or the
mirror) is the fallback, and the button is Remove mirror (不用镜像), in
en, zh, zh-TW, ja and de. `magpie update mirror` says the same.
Run on mote (update-mirror, i18n-en-no-cjk, i18n-keys and cli vet again at the rebased head: ok but #5332):
- update-mirror, i18n-keys, i18n-en-no-cjk and every GUI file that opens
About (19 files), chromium + webkit: update-mirror and i18n-en-no-cjk ok.
The reds, rerun one file at a time:
- i18n-keys "a plugin's words are its own" and segs-press-redraw
"clicks its new self once": red the same at origin/main 26e9c9566,
filed as #5332/#5426/#5482 and #4566/#3922.
- lan-docker, public-url-default: red at load ~400, 62/62 ok at load 36.
- about-*, cli-path, settings-sections, statusline-remote,
uninstall-settings: ok alone (red only at load 278 to 400).
- go test ./internal/cli ok, go vet ./internal/cli ok, gofmt clean.
Broken by hand: the new update-mirror test run against origin/main's
app.js and i18n.js: 0 of 10 pass.
Not tried: the real app's About page; the whole GUI suite.
This commit is contained in:
@@ -78,7 +78,7 @@ func updateAutoCmd(args []string) error {
|
||||
}
|
||||
|
||||
// updateMirrorCmd is `magpie update mirror [<prefix>|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 <prefix> 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 <prefix> 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
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+12
-12
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user