Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
update: a Stable channel in Settings → About, and magpie update channel
yetone4a33cf0a986e
diff --git a/docs/reference.md b/docs/reference.mdindex 68b5d3c2c..082a4213b 100644--- a/docs/reference.md+++ b/docs/reference.md@@ -2372,6 +2372,36 @@ downloads a new version in the background and installs it when you restarta terminal. Every release is on[yetone/magpie-releases](https://github.com/yetone/magpie-releases/releases).+### Update channel++magpie takes every version as it comes out unless you choose Stable, in+*Settings → About → Update channel* or with `magpie update channel stable`+(`magpie update channel every` goes back; `magpie update channel` prints+the one in use). It is saved as `"updateChannel": "stable"` in+settings.json, and the app and `magpie update` both follow it.++Stable is one version a week. Each Monday at 00:00 UTC it becomes the+newest release that had been out for three days by then (Friday 00:00+UTC), so every Stable version has had three days of use on the Every+version channel first. A release marked urgent goes to Stable at once.+When Stable moves past several versions, What's new lists the notes of+every version since yours as one list.++The update feed works this out from the release list+(`https://usemagpie.ai/api/latest?channel=stable`); nothing is promoted+by hand. A release is urgent when its notes have a line that starts with+`**Urgent release:**` and says why, for example:++```md+**Urgent release:** the gateway sent requests without a key to a page on another site.+```++magpie-releases' release run writes it from an `Urgent: <why>` trailer on+any commit since the version before. It can also be added to a published+release with `gh release edit` while the release is among the newest 100+(about a day of releases); the feed's ledger reads them every quarter+hour. A release is never marked prerelease for this.+From source:```shdiff --git a/internal/cli/main.go b/internal/cli/main.goindex cab7505cc..ddde18717 100644--- a/internal/cli/main.go+++ b/internal/cli/main.go@@ -142,6 +142,8 @@ const usage = `magpie — one place to pick every agent's modelhttp(s):// or socks5:// proxy for it; --mirror: a GitHub download mirror putbefore the github.com URL (none unless given; still checked against usemagpie.ai's SHA-256)magpie update mirror [<prefix>|off] the mirror every update, the app's own too, is downloaded through+ magpie update channel [stable|every] which versions updates offer: stable (one a week, an urgent one at+ once) or every version as it comes out (the default)magpie update auto [on|off] [download|notify] [30m|1h|6h|24h]whether the app looks for updates by itself, how often (6h), and whetherit downloads one at once or only says it is out (notify: for metered networks)diff --git a/internal/cli/update_channel_cli_test.go b/internal/cli/update_channel_cli_test.gonew file mode 100644index 000000000..296e819a9--- /dev/null+++ b/internal/cli/update_channel_cli_test.go@@ -0,0 +1,56 @@+package cli++import (+ "bytes"+ "os"+ "testing"++ "github.com/yetone/magpie/internal/settings"+)++// magpie update channel stable|every saves Settings' Update channel+// (ssharpcc on X); with nothing after it, it only says which; anything+// else is refused and nothing is saved.+func TestUpdateChannelCmd(t *testing.T) {+ groupsHome(t)+ for _, c := range []struct {+ args []string+ want string+ bad bool+ }{+ {[]string{"update", "channel"}, "", false},+ {[]string{"update", "channel", "stable"}, "stable", false},+ {[]string{"update", "channel"}, "stable", false},+ {[]string{"update", "channel", "beta"}, "stable", true},+ {[]string{"update", "channel", "stable", "every"}, "stable", true},+ {[]string{"update", "channel", "every"}, "", false},+ {[]string{"update", "channel", "Stable"}, "stable", false},+ {[]string{"update", "channel", "all"}, "", false},+ } {+ err := updateCmd(c.args)+ if (err != nil) != c.bad {+ t.Fatalf("%v: %v", c.args, err)+ }+ if got := settings.Load().UpdateChannel; got != c.want {+ t.Fatalf("%v: saved %q, want %q", c.args, got, c.want)+ }+ }+}++// A settings.json that can't be read is never written over by it.+func TestUpdateChannelKeepsCorruptSettings(t *testing.T) {+ groupsHome(t)+ if err := os.MkdirAll(settings.Dir(), 0o755); err != nil {+ t.Fatal(err)+ }+ original := []byte(`{"theme":"dark","githubToken":"SYNTHETIC_PRIVATE_TOKEN"`)+ if err := os.WriteFile(settings.Path(), original, 0o600); err != nil {+ t.Fatal(err)+ }+ if err := updateCmd([]string{"update", "channel", "stable"}); err == nil {+ t.Error("the command reported success with corrupt settings")+ }+ if after, err := os.ReadFile(settings.Path()); err != nil || !bytes.Equal(after, original) {+ t.Errorf("the command overwrote the corrupt settings: %v", err)+ }+}diff --git a/internal/cli/update_cli.go b/internal/cli/update_cli.goindex 2fc52789a..c107ccede 100644--- a/internal/cli/update_cli.go+++ b/internal/cli/update_cli.go@@ -102,6 +102,36 @@ func updateMirrorCmd(args []string) error {return nil}+// updateChannelCmd is `magpie update channel [stable|every]`: which+// versions an update is offered (settings.UpdateChannel, ssharpcc on X):+// Stable, one a week and an urgent one at once, or every version as it+// comes out. With none, it says which.+func updateChannelCmd(args []string) error {+ s := settings.Load()+ if len(args) > 1 {+ return fmt.Errorf("magpie update channel takes stable or every")+ }+ if len(args) == 1 {+ switch strings.ToLower(strings.TrimSpace(args[0])) {+ case "stable":+ s.UpdateChannel = settings.UpdateStable+ case "every", "all":+ s.UpdateChannel = ""+ default:+ return fmt.Errorf("magpie update channel takes stable or every, not %q", args[0])+ }+ if err := settings.Save(s); err != nil {+ return err+ }+ }+ if s.UpdateChannel == settings.UpdateStable {+ fmt.Println("update channel: stable", muted.Render("· a version a week, the newest out three days as the week began, and an urgent one at once · magpie update channel every: each one as it comes out"))+ return nil+ }+ fmt.Println("update channel: every version", muted.Render("· each one as it comes out · magpie update channel stable: one a week, an urgent one at once"))+ return nil+}+// updateFlags takes --proxy and --mirror (each as --flag value or// --flag=value) out of args.func updateFlags(args []string) (rest []string, proxy, mirror string, err error) {@@ -149,6 +179,9 @@ func updateCmd(args []string) error {if len(args) > 1 && args[1] == "mirror" {return updateMirrorCmd(args[2:])}+ if len(args) > 1 && args[1] == "channel" {+ return updateChannelCmd(args[2:])+ }if len(args) > 2 || len(args) == 2 && args[1] != "check" {return fmt.Errorf("usage: magpie update [check] [--proxy <url>] [--mirror <prefix>]")}@@ -161,7 +194,11 @@ func updateCmd(args []string) error {}if !update.Newer(rel.Version, version) {if update.Released(version) {- fmt.Println(green.Render("✓"), "magpie", version, muted.Render("is the latest"))+ if update.Stable() {+ fmt.Println(green.Render("✓"), "magpie", version, muted.Render("is up to date on the stable channel (stable is "+rel.Version+")"))+ } else {+ fmt.Println(green.Render("✓"), "magpie", version, muted.Render("is the latest"))+ }} else {fmt.Println("magpie", version, muted.Render("was built from source; the latest release is "+rel.Version))}diff --git a/internal/gui/api.go b/internal/gui/api.goindex 20afc51cc..02d25113b 100644--- a/internal/gui/api.go+++ b/internal/gui/api.go@@ -1222,6 +1222,10 @@ func Handler(w Windows, gw *gateway.Server) http.Handler {if _, sent := fields["noAutoDownload"]; !sent {in.NoAutoDownload = cur.NoAutoDownload}+ // nor the update channel (ssharpcc on X)+ if _, sent := fields["updateChannel"]; !sent {+ in.UpdateChannel = cur.UpdateChannel+ }// nor whether the masked words match in any caseif _, sent := fields["redactWordsAnyCase"]; !sent {in.RedactWordsAnyCase = cur.RedactWordsAnyCase@@ -1388,6 +1392,13 @@ func Handler(w Windows, gw *gateway.Server) http.Handler {if strings.TrimSpace(in.Proxy) != strings.TrimSpace(cur.Proxy) && updates.json().State == "error" && updates.begin() {go updates.run()}+ // another update channel: the feed is asked again on it, so the+ // version row and the header's Update follow (a download from+ // every version is dropped on Stable, run), unless automatic+ // updates are off and nothing was found+ if in.UpdateChannel != cur.UpdateChannel && (!in.NoAutoUpdate || updates.json().Latest != "") && updates.begin() {+ go updates.run()+ }writeJSON(rw, settingsState())})// whether usage reads as used or left: the Usage page's toggle anddiff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.jsindex dc1b4246e..d20ff72f6 100644--- a/internal/gui/assets/app.js+++ b/internal/gui/assets/app.js@@ -19419,6 +19419,15 @@ function renderSettings() {row(t("Check every"), s.noAutoUpdate ? t("While automatic updates are on") : t("How often magpie looks for a newer version"), "",segs(UPDATE_EVERY.map((m) => [m, m < 60 ? t("{n} min", { n: m }) : t("{n} h", { n: m / 60 })]), s.updateEvery || 360,(updateEvery) => savePrefs({ ...keep, updateEvery }))).classList.add("update-every-row", ...(s.noAutoUpdate ? ["off"] : []));+ // which versions an update offers (ssharpcc on X): every one as it comes+ // out, or Stable, one a week and an urgent one at once, chosen by the+ // update feed. It holds for the version row's Check too, so it stays lit+ // with automatic updates off.+ row(t("Update channel"), s.updateChannel === "stable"+ ? t("One version a week, out for three days first, and urgent fixes at once. What's new lists every change since yours")+ : t("Every version as soon as it is out"), "",+ segs([["every", t("Every version")], ["stable", t("Stable")]], s.updateChannel === "stable" ? "stable" : "every",+ (v) => savePrefs({ ...keep, updateChannel: v === "stable" ? "stable" : "" }))).classList.add("update-channel-row");// whether a newer version found is downloaded at once, or only said to// be out and downloaded on a click (#2296): a metered network or a// proxy billed by traffic. It holds for the version row's Check too.@@ -22815,7 +22824,7 @@ function prefsKeep(s) {claudeWarmup: s.claudeWarmup || "", codexWarmAt: s.codexWarmAt || "", claudeWarmAt: s.claudeWarmAt || "",codexWarmAts: warmTimes(s.codexWarmAts, s.codexWarmAt), claudeWarmAts: warmTimes(s.claudeWarmAts, s.claudeWarmAt), workbuddyCheckin: !!s.workbuddyCheckin, traeCheckin: !!s.traeCheckin, minimaxCheckin: !!s.minimaxCheckin, qoderCheckin: !!s.qoderCheckin, noStats: !!s.noStats, noUsageStats: !!s.noUsageStats,memberModel: !!s.memberModel, noLoopGuard: !!s.noLoopGuard, claudeLeanPrompt: !!s.claudeLeanPrompt, refusalRetries: s.refusalRetries ?? null,- noUpdatePill: !!s.noUpdatePill, noAutoUpdate: !!s.noAutoUpdate, updateEvery: s.updateEvery || 360, autoRestart: !!s.autoRestart, noAutoDownload: !!s.noAutoDownload,+ noUpdatePill: !!s.noUpdatePill, noAutoUpdate: !!s.noAutoUpdate, updateEvery: s.updateEvery || 360, autoRestart: !!s.autoRestart, noAutoDownload: !!s.noAutoDownload, updateChannel: s.updateChannel || "",trayUsage: s.trayUsage || "", trayUsageEvery: s.trayUsageEvery || 3, trayNoLogos: !!s.trayNoLogos, trayNoBird: !!s.trayNoBird, trayPace: !!s.trayPace, trayNoCost: !!s.trayNoCost, vision: s.vision || "", visionEffort: s.visionEffort || "", searcherEffort: s.searcherEffort || "", imageGen: s.imageGen || "", imageTimeout: s.imageTimeout || 0, classifyTimeout: s.classifyTimeout || 0, searcher: s.searcher || "", searchFirst: s.searchFirst || "", currency: s.currency || "usd",chineseUnits: !!s.chineseUnits, usageAlert: s.usageAlert || 0, balanceAlert: s.balanceAlert || 0, resetReminder: s.resetReminder || 0,turnDoneAlert: s.turnDoneAlert || 0 };diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.jsindex 51c91d9ee..b1b2248b2 100644--- a/internal/gui/assets/i18n.js+++ b/internal/gui/assets/i18n.js@@ -2995,6 +2995,11 @@ const I18N = {"Automatic updates": "自动更新","Checks for a newer magpie and downloads it": "自动检查 magpie 新版本并下载","Check every": "检查间隔",+ "Update channel": "更新渠道",+ "Every version": "每个版本",+ "Stable": "稳定版",+ "Every version as soon as it is out": "每个版本一发布就更新",+ "One version a week, out for three days first, and urgent fixes at once. What's new lists every change since yours": "每周一个版本,发布满三天后才推送;紧急修复立即推送。「更新内容」会列出你当前版本以来的全部改动","While automatic updates are on": "自动更新开启时生效","Restart automatically": "自动重启更新","Download updates automatically": "自动下载更新",@@ -6947,6 +6952,11 @@ const I18N = {"Automatic updates": "自動更新","Checks for a newer magpie and downloads it": "自動檢查 magpie 新版本並下載","Check every": "檢查間隔",+ "Update channel": "更新管道",+ "Every version": "每個版本",+ "Stable": "穩定版",+ "Every version as soon as it is out": "每個版本一發布就更新",+ "One version a week, out for three days first, and urgent fixes at once. What's new lists every change since yours": "每週一個版本,發布滿三天後才推送;緊急修正立即推送。「更新內容」會列出你目前版本以來的全部變更","While automatic updates are on": "自動更新開啟時生效","Restart automatically": "自動重新啟動更新","Download updates automatically": "自動下載更新",@@ -10911,6 +10921,11 @@ const I18N = {"Automatic updates": "自動アップデート","Checks for a newer magpie and downloads it": "新しい magpie を確認してダウンロードします","Check every": "確認間隔",+ "Update channel": "アップデートチャネル",+ "Every version": "すべてのバージョン",+ "Stable": "安定版",+ "Every version as soon as it is out": "新しいバージョンが出るたびに更新します",+ "One version a week, out for three days first, and urgent fixes at once. What's new lists every change since yours": "公開から 3 日経ったバージョンを週に 1 回、緊急の修正はすぐに届けます。新機能には今のバージョン以降のすべての変更がまとめて表示されます","While automatic updates are on": "自動アップデートがオンのとき","Restart automatically": "自動で再起動","Download updates automatically": "アップデートを自動でダウンロード",@@ -14885,6 +14900,11 @@ const I18N = {"Automatic updates": "Automatische Updates","Checks for a newer magpie and downloads it": "Sucht nach einer neueren magpie-Version und lädt sie herunter","Check every": "Prüfen alle",+ "Update channel": "Update-Kanal",+ "Every version": "Jede Version",+ "Stable": "Stabil",+ "Every version as soon as it is out": "Jede Version, sobald sie erscheint",+ "One version a week, out for three days first, and urgent fixes at once. What's new lists every change since yours": "Eine Version pro Woche, die schon drei Tage draußen ist, dringende Korrekturen sofort. Neuigkeiten listet alle Änderungen seit Ihrer Version","While automatic updates are on": "Solange automatische Updates aktiv sind","Restart automatically": "Automatisch neu starten","Download updates automatically": "Updates automatisch herunterladen",diff --git a/internal/gui/tests/update-channel.test.cjs b/internal/gui/tests/update-channel.test.cjsnew file mode 100644index 000000000..d94b71755--- /dev/null+++ b/internal/gui/tests/update-channel.test.cjs@@ -0,0 +1,157 @@+// Run with Node's test runner and Playwright on the module path; see README.md.+// Settings → About → Update channel (ssharpcc on X): Every version, the+// default, takes each release as it comes out; Stable takes one a week+// and an urgent one at once, from the update feed's ?channel=stable. The+// choice is saved as updateChannel ("" or "stable"), kept by every other+// save, and survives a reload. No click moves the page; at 420 wide the+// row fits without a sideways scroll. Every language; no backend, the API+// is faked.+const assert = require("node:assert/strict");+const fs = require("node:fs/promises");+const path = require("node:path");+const { test } = require("node:test");+const { chromium, webkit } = require("playwright");+const { watchSettingsReads, settingsDrawn, openPart } = require("./reader.cjs");++const assets = path.resolve(__dirname, "../assets");++const words = {+ en: { name: "Update channel", every: "Every version", stable: "Stable", auto: "Automatic updates", off: "Off",+ everySub: "Every version as soon as it is out", stableSub: "One version a week" },+ zh: { name: "更新渠道", every: "每个版本", stable: "稳定版", auto: "自动更新", off: "关闭", everySub: "每个版本一发布就更新", stableSub: "每周一个版本" },+ "zh-TW": { name: "更新管道", every: "每個版本", stable: "穩定版", auto: "自動更新", off: "關閉", everySub: "每個版本一發布就更新", stableSub: "每週一個版本" },+ ja: { name: "アップデートチャネル", every: "すべてのバージョン", stable: "安定版", auto: "自動アップデート", off: "オフ", everySub: "新しいバージョンが出るたびに更新します", stableSub: "週に 1 回" },+ de: { name: "Update-Kanal", every: "Jede Version", stable: "Stabil", auto: "Automatische Updates", off: "Aus", everySub: "Jede Version, sobald sie erscheint", stableSub: "Eine Version pro Woche" },+};++function settingsPayload(lang, ctl) {+ const s = {+ theme: "light", lang, tray: "panel", quotaLeft: false, currency: "usd",+ dock: false, dockWindow: false, proxy: "", redact: false, redactPersonal: false, redactWords: [],+ codexWarmup: "", claudeWarmup: "", codexWarmAt: "", claudeWarmAt: "", workbuddyCheckin: false, noStats: false,+ trayUsage: "", trayUsageEvery: 3, vision: "", imageGen: "",+ version: "0.1.400", dir: "~/.config/magpie", gateway: "http://127.0.0.1:3425",+ proxyNow: "none", proxySource: "none", login: false,+ visionModels: [], imageGenModels: [], workbuddyCheckins: [], lanURLs: [],+ fx: { rate: 7.2, at: new Date().toISOString(), stale: false },+ };+ // as the backend sends them: left out while they are their defaults+ if (ctl.channel) s.updateChannel = ctl.channel;+ if (ctl.off) s.noAutoUpdate = true;+ return s;+}++function server(lang, ctl) {+ return async (route) => {+ const req = route.request(), url = new URL(req.url());+ const json = (data) => route.fulfill({ json: data });+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:false};` });+ if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });+ if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: settingsPayload(lang, ctl), fx: settingsPayload(lang, ctl).fx });+ if (url.pathname === "/api/settings") {+ if (req.method() === "POST") {+ const body = req.postDataJSON();+ ctl.channel = body.updateChannel || "";+ ctl.off = !!body.noAutoUpdate;+ ctl.saves.push(body);+ }+ return json(settingsPayload(lang, ctl));+ }+ if (url.pathname === "/api/update") return json({ state: "latest", current: "0.1.400", latest: "0.1.400" });+ if (url.pathname === "/api/plugins") return json({ plugins: [] });+ if (url.pathname === "/api/usage/quotas") return json([]);+ if (url.pathname === "/api/groups") return json({ groups: [], models: [] });+ if (url.pathname.startsWith("/api/")) return json({});+ const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);+ const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];+ await route.fulfill({ body: await fs.readFile(file), contentType });+ };+}++// wheel a row into sight, as a user would; a click must then not move the page+async function showRow(page, row) {+ await page.locator("#view-settings").hover();+ for (let i = 0; i < 40; i++) {+ const box = await row.boundingBox();+ const view = await page.locator("#view-settings").boundingBox();+ if (box && view && box.y >= view.y + 4 && box.y + box.height <= view.y + view.height - 4) break;+ await page.mouse.wheel(0, 180);+ await page.waitForTimeout(16);+ }+ await page.waitForTimeout(250);+}+const scrolls = (page) => page.evaluate(() => [window.scrollY, document.scrollingElement.scrollTop, ...[...document.querySelectorAll(".view")].map((v) => v.scrollTop)].join(","));++for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {+ test(engine + ": the update channel", async (t) => {+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));+ t.after(() => browser.close());+ for (const lang of Object.keys(words)) {+ const w = words[lang];+ for (const width of [900, 420]) {+ await t.test(`${lang} at ${width}: Every version by default, Stable saved and kept`, async () => {+ const ctl = { channel: "", off: false, saves: [] };+ const errors = [];+ const page = await (await browser.newContext({ viewport: { width, height: 640 }, reducedMotion: "reduce" })).newPage();+ page.setDefaultTimeout(5000);+ page.on("pageerror", (e) => errors.push(e.message));+ await page.route("**/*", server(lang, ctl));+ await watchSettingsReads(page);+ await page.goto("http://magpie.test/?view=settings");+ await settingsDrawn(page);+ const aboutTab = async () => {+ await openPart(page, "about");+ await page.locator("#setPage-about").waitFor({ state: "visible" });+ };+ await aboutTab();+ const rowOf = (name) => page.locator("#about .row.pref", { has: page.locator(".name", { hasText: new RegExp("^" + name + "$") }) });+ const channel = rowOf(w.name), auto = rowOf(w.auto);+ await channel.waitFor();+ assert.deepEqual((await channel.locator(".opt").allInnerTexts()).map((s) => s.trim()), [w.every, w.stable]);+ assert.equal((await channel.locator(".opt.on").innerText()).trim(), w.every);+ await channel.locator(".sub", { hasText: w.everySub }).waitFor();++ // the row fits: its switch inside the window, nothing scrolls sideways+ await showRow(page, channel);+ const right = await channel.locator(".opt").last().evaluate((o) => o.getBoundingClientRect().right);+ assert.ok(right <= width, `the switch ends at ${right}, past ${width}`);+ assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth), true, "no sideways scroll");++ // Stable+ let before = await scrolls(page);+ await channel.locator(".opt", { hasText: w.stable }).click();+ await channel.locator(".sub", { hasText: w.stableSub }).waitFor();+ assert.equal((await channel.locator(".opt.on").innerText()).trim(), w.stable);+ assert.equal(ctl.saves.at(-1).updateChannel, "stable");+ assert.equal(await scrolls(page), before, "the click must not scroll the page");++ // another setting's save keeps it+ await showRow(page, auto);+ before = await scrolls(page);+ await auto.locator(".opt", { hasText: w.off }).click();+ await page.waitForFunction(() => document.querySelector(".update-auto-row .opt.on") && document.querySelector(".update-auto-row .opt.on") === document.querySelector(".update-auto-row .opt"));+ assert.equal(ctl.saves.at(-1).noAutoUpdate, true);+ assert.equal(ctl.saves.at(-1).updateChannel, "stable");+ assert.equal(await scrolls(page), before, "the click must not scroll the page");+ // and with automatic updates off it is still lit: Check asks on it+ assert.equal(await channel.evaluate((r) => r.classList.contains("off")), false);++ // after a reload: still Stable+ await page.reload();+ await aboutTab();+ await channel.waitFor();+ assert.equal((await channel.locator(".opt.on").innerText()).trim(), w.stable);++ // back to every version+ await showRow(page, channel);+ before = await scrolls(page);+ await channel.locator(".opt", { hasText: w.every }).click();+ await channel.locator(".sub", { hasText: w.everySub }).waitFor();+ assert.equal(ctl.saves.at(-1).updateChannel, "");+ assert.equal(await scrolls(page), before, "the click must not scroll the page");+ assert.deepEqual(errors, []);+ });+ }+ }+ });+}diff --git a/internal/gui/update.go b/internal/gui/update.goindex fcbe157fb..48d98e896 100644--- a/internal/gui/update.go+++ b/internal/gui/update.go@@ -326,6 +326,13 @@ func (u *updater) run() {rel, err := update.LatestIn(ctx, lang)u.mu.Lock()defer u.mu.Unlock()+ // the feed names an older version than the one found before: Settings'+ // Update channel went to Stable since (ssharpcc on X). What was+ // downloaded from every version isn't put in, and the version found+ // is the feed's again, as if never found.+ if err == nil && u.latest != nil && update.Newer(u.latest.Version, rel.Version) {+ u.staged, u.latest = "", nil+ }// a version downloaded on a click stays the one restarted into while// downloads wait for a click: a newer one out since isn't fetchedif u.staged != "" && u.latest != nil && (err != nil || !update.Newer(rel.Version, u.latest.Version) || hold) {diff --git a/internal/gui/update_channel_test.go b/internal/gui/update_channel_test.gonew file mode 100644index 000000000..3d5089d63--- /dev/null+++ b/internal/gui/update_channel_test.go@@ -0,0 +1,160 @@+package gui++import (+ "crypto/sha256"+ "encoding/hex"+ "encoding/json"+ "fmt"+ "net/http"+ "net/http/httptest"+ "os"+ "strings"+ "sync/atomic"+ "testing"+ "time"++ "github.com/yetone/magpie/internal/settings"+ "github.com/yetone/magpie/internal/update"+)++// Settings' Update channel (ssharpcc on X). Every version found 0.1.12+// and downloaded it; Stable's version is 0.1.11. Turning Stable on asks+// the feed again on it at once, and what was downloaded from every+// version is dropped for Stable's, never restarted into. A save from a+// page that doesn't send the channel keeps it.+func TestUpdateChannelSwitch(t *testing.T) {+ sandboxHome(t)+ body := []byte("new magpie")+ sum := sha256.Sum256(body)+ var downloads atomic.Int32+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.URL.Path == "/asset" {+ downloads.Add(1)+ w.Write(body)+ return+ }+ v := "0.1.12"+ if r.URL.Query().Get("channel") == "stable" {+ v = "0.1.11"+ }+ json.NewEncoder(w).Encode(update.Release{Version: v, Notes: "- faster", Assets: map[string]update.Asset{+ update.BinaryAsset(): {URL: "http://" + r.Host + "/asset", Size: int64(len(body)), SHA256: hex.EncodeToString(sum[:])},+ }})+ }))+ defer srv.Close()+ t.Setenv("MAGPIE_UPDATE_FEED", srv.URL)+ oldV := Version+ Version = "0.1.10"+ defer func() { Version = oldV }()+ exe, err := update.Executable()+ if err != nil {+ t.Fatal(err)+ }+ defer os.Remove(exe + ".new")++ o := updates+ u := &updater{exe: exe}+ u.self, _ = os.Stat(exe)+ updates = u+ defer func() { updates = o }()+ settle := func() updateJSON {+ t.Helper()+ for range 1000 {+ if j := u.json(); j.State != "checking" && j.State != "downloading" {+ return j+ }+ time.Sleep(10 * time.Millisecond)+ }+ t.Fatalf("still %s", u.json().State)+ return updateJSON{}+ }+ save := func(in string) {+ t.Helper()+ rec := httptest.NewRecorder()+ Handler(nil, nil).ServeHTTP(rec, httptest.NewRequest("POST", "/api/settings", strings.NewReader(in)))+ if rec.Code != 200 {+ t.Fatalf("%s: %d %s", in, rec.Code, rec.Body)+ }+ }++ // every version: 0.1.12, downloaded+ u.check()+ if j := settle(); j.State != "ready" || j.Latest != "0.1.12" || downloads.Load() != 1 {+ t.Fatalf("every version: %+v, %d downloads", j, downloads.Load())+ }++ // Stable: asked again at once, 0.1.12's download dropped for 0.1.11's+ save(`{"theme":"light","updateChannel":"stable"}`)+ if settings.Load().UpdateChannel != settings.UpdateStable {+ t.Fatal("stable wasn't saved")+ }+ for range 500 {+ if downloads.Load() == 2 {+ break+ }+ time.Sleep(10 * time.Millisecond)+ }+ if j := settle(); j.State != "ready" || j.Latest != "0.1.11" || downloads.Load() != 2 {+ t.Fatalf("on stable: %+v, %d downloads", j, downloads.Load())+ }+ u.mu.Lock()+ staged, latest := u.staged, u.latest.Version+ u.mu.Unlock()+ if staged == "" || latest != "0.1.11" {+ t.Fatalf("staged %q for %s", staged, latest)+ }++ // a save without the channel keeps it+ save(`{"theme":"dark"}`)+ if got := settings.Load().UpdateChannel; got != settings.UpdateStable {+ t.Fatalf("a save without updateChannel set it to %q", got)+ }+ // a check on Stable keeps the download+ u.check()+ if j := settle(); j.State != "ready" || j.Latest != "0.1.11" || downloads.Load() != 2 {+ t.Fatalf("checked again on stable: %+v, %d downloads", j, downloads.Load())+ }+ // a value the channel doesn't have is refused+ rec := httptest.NewRecorder()+ Handler(nil, nil).ServeHTTP(rec, httptest.NewRequest("POST", "/api/settings", strings.NewReader(`{"updateChannel":"beta"}`)))+ if rec.Code == 200 || settings.Load().UpdateChannel != settings.UpdateStable {+ t.Fatalf("beta: %d, saved %q", rec.Code, settings.Load().UpdateChannel)+ }+}++// What's new's notes are kept by language and channel: Stable shows every+// release since the one installed, every version at most 40, and the list+// asked on one isn't the other's.+func TestWhatsNewKeyedByChannel(t *testing.T) {+ sandboxHome(t)+ if got := notesKey("zh"); got != "zh" {+ t.Fatalf("every version: %q", got)+ }+ s := settings.Load()+ s.UpdateChannel = settings.UpdateStable+ if err := settings.Save(s); err != nil {+ t.Fatal(err)+ }+ if got := notesKey("zh"); got != "zh|stable" {+ t.Fatalf("stable: %q", got)+ }+ t.Setenv("MAGPIE_NOTES_FEED", "http://127.0.0.1:1/") // never the real one+ oldV := Version+ Version = "0.1.100"+ defer func() { Version = oldV }()+ var list []update.Note+ for i := range 100 {+ list = append(list, update.Note{Version: fmt.Sprintf("0.1.%d", 100-i), Notes: "- x"})+ }+ waiting := updateJSON{State: "available", Latest: "0.1.200", Notes: "- the next one"}+ if got := withWaiting(t.Context(), list, waiting, "en"); len(got) != 101 || got[0].Version != "0.1.200" {+ t.Fatalf("stable keeps %d of 101", len(got))+ }+ s.UpdateChannel = ""+ if err := settings.Save(s); err != nil {+ t.Fatal(err)+ }+ if got := withWaiting(t.Context(), list, waiting, "en"); len(got) != update.MaxNotes {+ t.Fatalf("every version keeps %d", len(got))+ }+}diff --git a/internal/gui/whatsnew.go b/internal/gui/whatsnew.goindex a79948c06..d4862be31 100644--- a/internal/gui/whatsnew.go+++ b/internal/gui/whatsnew.go@@ -39,7 +39,7 @@ type whatsNew struct {pending bool // an upgrade whose notes are still to be shownquiet bool // the upgrade was the user's own restart to update: not shown by itselfshown bool // a page has shown them- notes map[string][]update.Note // by language+ notes map[string][]update.Note // by language and channel (notesKey)back map[string]backNotes // Settings' "this version and n before it", by language}@@ -162,7 +162,8 @@ func (n *whatsNew) get(ctx context.Context, all bool, lang string) whatsNewJSONif !pending {after = ""}- notes := n.notes[lang]+ key := notesKey(lang)+ notes := n.notes[key]// shown by itself: not after a restart to update, nor on a day it was// asked not to bepopup := pending && !shown && !n.quiet && !quietToday()@@ -183,7 +184,7 @@ func (n *whatsNew) get(ctx context.Context, all bool, lang string) whatsNewJSONif n.notes == nil {n.notes = map[string][]update.Note{}}- n.notes[lang] = notes+ n.notes[key] = notesn.mu.Unlock()}}@@ -194,6 +195,16 @@ func (n *whatsNew) get(ctx context.Context, all bool, lang string) whatsNewJSONreturn j}+// notesKey is what the notes since the last update are kept by: their+// language, and the channel, whose cap on how many are shown (MostNotes)+// differs.+func notesKey(lang string) string {+ if update.Stable() {+ return lang + "|" + settings.UpdateStable+ }+ return lang+}+// before is Settings' other ranges (Linka on Discord): this version's notes// and those of the count releases before it, newest first. They are asked// of the site once per language for the longest count asked so far, and@@ -272,8 +283,8 @@ func withWaiting(ctx context.Context, list []update.Note, u updateJSON, lang str}}out = append(out, list...)- if len(out) > update.MaxNotes {- out = out[:update.MaxNotes]+ if most := update.MostNotes(); len(out) > most {+ out = out[:most]}return out}diff --git a/internal/settings/settings.go b/internal/settings/settings.goindex b31d3ccaf..aa51759ef 100644--- a/internal/settings/settings.go+++ b/internal/settings/settings.go@@ -339,6 +339,13 @@ type Settings struct {// checked against the SHA-256 the update feed at usemagpie.ai gives,// never one from the mirror. magpie update mirror sets it.UpdateMirror string `json:"updateMirror,omitempty"`+ // UpdateChannel is which versions an update is offered: "" every+ // version as it comes out, the default; UpdateStable ("stable") one a+ // week, the newest that had been out three days as the week began, or+ // an urgent one (a security hole, a ban risk, lost data) at once, from+ // the update feed's ?channel=stable (ssharpcc on X). Settings' Update+ // channel and magpie update channel set it.+ UpdateChannel string `json:"updateChannel,omitempty"`// Vision is the model that describes an image to a model that can't see// it: a model's id (provider/model, group/<id>), "off" to turn such an// image away, or empty for one magpie picks (see gateway.seer).@@ -853,6 +860,10 @@ func CheckModelPrice(key string, m ModelPrice) error {// provider it came through, its id lower-cased after it.const AnyProvider = "*/"+// UpdateStable is UpdateChannel's Stable: a version a week, an urgent one+// at once.+const UpdateStable = "stable"+// anArticle is the article a word takes where a message names it, so that an// input price is not "a input price".func anArticle(word string) string {@@ -946,6 +957,8 @@ var (Warmups = []string{"", "week", "all"}// TrayEvery are TrayUsageEvery's values, in minutes.TrayEvery = []int{1, 3, 5, 10, 30}+ // UpdateChannels are UpdateChannel's values: every version, Stable.+ UpdateChannels = []string{"", UpdateStable}// UpdateEveries are UpdateEvery's values, in minutes.UpdateEveries = []int{30, 60, 360, 1440}// TextSizes are TextSize's values, in percent. None is under 100: the@@ -1468,6 +1481,9 @@ func save(s Settings, recording bool) error {if !slices.Contains(UpdateEveries, s.UpdateEvery) {return fmt.Errorf("magpie checks for updates every %v minutes, not %d", UpdateEveries, s.UpdateEvery)}+ if !slices.Contains(UpdateChannels, s.UpdateChannel) {+ return fmt.Errorf("the update channel is %q (stable) or empty (every version), not %q", UpdateStable, s.UpdateChannel)+ }if m := s.UpdateMirror; m != "" {if u, err := url.Parse(m); err != nil || (u.Scheme != "https" && u.Scheme != "http") || u.Host == "" {return fmt.Errorf("an update mirror is an http(s) address put before the github.com URL, like https://mirror.example/, not %q", m)diff --git a/internal/update/channel_test.go b/internal/update/channel_test.gonew file mode 100644index 000000000..494e1aeef--- /dev/null+++ b/internal/update/channel_test.go@@ -0,0 +1,115 @@+package update++import (+ "context"+ "encoding/json"+ "fmt"+ "net/http"+ "net/http/httptest"+ "sync"+ "testing"++ "github.com/yetone/magpie/internal/settings"+)++// stableFor saves Settings' Update channel for one test and puts the one+// before back after it.+func stableFor(t *testing.T, channel string) {+ t.Helper()+ before := settings.Load()+ s := before+ s.UpdateChannel = channel+ if err := settings.Save(s); err != nil {+ t.Fatal(err)+ }+ t.Cleanup(func() { settings.Save(before) })+}++// The Stable channel (ssharpcc on X): the feed is asked with+// channel=stable, and only then; every version asks it as before. The+// language goes with it either way.+func TestLatestAsksTheChannel(t *testing.T) {+ var (+ mu sync.Mutex+ asked []string+ )+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ mu.Lock()+ asked = append(asked, r.URL.RawQuery)+ mu.Unlock()+ v := "0.1.1600"+ if r.URL.Query().Get("channel") == "stable" {+ v = "0.1.1550"+ }+ json.NewEncoder(w).Encode(Release{Version: v})+ }))+ defer srv.Close()+ t.Setenv("MAGPIE_UPDATE_FEED", srv.URL+"/api/latest")+ ctx := context.Background()++ for _, c := range []struct{ channel, lang, query, version string }{+ {"", "zh", "lang=zh", "0.1.1600"},+ {"", "", "", "0.1.1600"},+ {settings.UpdateStable, "zh", "channel=stable&lang=zh", "0.1.1550"},+ {settings.UpdateStable, "", "channel=stable", "0.1.1550"},+ } {+ t.Run(fmt.Sprintf("%q %q", c.channel, c.lang), func(t *testing.T) {+ stableFor(t, c.channel)+ mu.Lock()+ asked = nil+ mu.Unlock()+ rel, err := LatestIn(ctx, c.lang)+ if err != nil {+ t.Fatal(err)+ }+ mu.Lock()+ defer mu.Unlock()+ if len(asked) != 1 || asked[0] != c.query {+ t.Fatalf("asked %q, want %q", asked, c.query)+ }+ if rel.Version != c.version {+ t.Fatalf("got %s, want %s", rel.Version, c.version)+ }+ })+ }+}++// What's new after a Stable update is every release since the one+// installed, read as one list: the cap of 40 is every version's only.+func TestStableNotesAreAll(t *testing.T) {+ var notes []Note+ for i := 1; i <= 120; i++ {+ notes = append(notes, Note{Version: fmt.Sprintf("0.1.%d", 1000+i), Notes: fmt.Sprintf("- change %d", i)})+ }+ stableFor(t, "")+ if got := Between(notes, "0.1.1000", "0.1.1120"); len(got) != MaxNotes || got[0].Version != "0.1.1120" {+ t.Fatalf("every version: %d notes, first %s", len(got), got[0].Version)+ }+ stableFor(t, settings.UpdateStable)+ got := Between(notes, "0.1.1000", "0.1.1120")+ if len(got) != 120 || got[0].Version != "0.1.1120" || got[119].Version != "0.1.1001" {+ t.Fatalf("stable: %d notes", len(got))+ }+ if MostNotes() != StableMaxNotes {+ t.Fatalf("MostNotes on stable: %d", MostNotes())+ }+}++// Settings take "stable" or nothing; anything else is refused, and the+// value is kept as saved.+func TestUpdateChannelSaved(t *testing.T) {+ stableFor(t, settings.UpdateStable)+ if got := settings.Load().UpdateChannel; got != "stable" || !Stable() {+ t.Fatalf("saved stable, read %q", got)+ }+ for _, bad := range []string{"Stable", "beta", "every", " stable"} {+ s := settings.Load()+ s.UpdateChannel = bad+ if err := settings.Save(s); err == nil {+ t.Errorf("%q was saved", bad)+ }+ }+ if got := settings.Load().UpdateChannel; got != "stable" {+ t.Fatalf("a refused save changed it: %q", got)+ }+}diff --git a/internal/update/notes.go b/internal/update/notes.goindex 3e08f4dad..d2bcf9721 100644--- a/internal/update/notes.go+++ b/internal/update/notes.go@@ -12,6 +12,8 @@ import ("sort""strconv""strings"++ "github.com/yetone/magpie/internal/settings")// Note is one release's notes, as the app shows them after an update.@@ -138,8 +140,46 @@ func withLang(feed, lang string) string {// often, and a long-unopened one would have pages of them.const MaxNotes = 40+// StableMaxNotes is MaxNotes on the Stable channel, where an update is a+// week of releases and its notes are read as one list (ssharpcc on X):+// every one of them, as far as the site keeps them.+const StableMaxNotes = 1500++// MostNotes is how many releases' notes are shown at most on the channel+// Settings name.+func MostNotes() int {+ if Stable() {+ return StableMaxNotes+ }+ return MaxNotes+}++// Stable is whether Settings' Update channel is Stable: the update feed is+// asked for a version a week, the newest that had been out three days as+// the week began (Monday 00:00 UTC), or an urgent one (a security hole, a+// ban risk, lost data) as soon as it is out. usemagpie.ai chooses it from+// the release list (site/worker.js, "The Stable channel"); a release is+// urgent when a line of its notes starts with "**Urgent release:**".+func Stable() bool { return settings.Load().UpdateChannel == settings.UpdateStable }++// withChannel is feed asking for Stable's release on the Stable channel,+// and feed as it is on every version.+func withChannel(feed string) string {+ if !Stable() {+ return feed+ }+ u, err := url.Parse(feed)+ if err != nil {+ return feed+ }+ q := u.Query()+ q.Set("channel", settings.UpdateStable)+ u.RawQuery = q.Encode()+ return u.String()+}+// Between keeps the notes of the releases after after up to and including-// upto, newest first, at most MaxNotes; with after "" only upto's. Each+// upto, newest first, at most MostNotes; with after "" only upto's. Each// one's Install section is taken out, and one left empty is dropped.func Between(notes []Note, after, upto string) []Note {var out []Note@@ -164,8 +204,8 @@ func Between(notes []Note, after, upto string) []Note {out = append(out, n)}sort.SliceStable(out, func(i, j int) bool { return Newer(out[i].Version, out[j].Version) })- if len(out) > MaxNotes {- out = out[:MaxNotes]+ if most := MostNotes(); len(out) > most {+ out = out[:most]}return out}diff --git a/internal/update/update.go b/internal/update/update.goindex 040d0235b..a0656a9ba 100644--- a/internal/update/update.go+++ b/internal/update/update.go@@ -80,9 +80,10 @@ func proxied() http.RoundTripper {func Latest(ctx context.Context) (*Release, error) { return LatestIn(ctx, "") }// LatestIn asks the feed for the newest release, its notes in lang (see-// InLang): the app's language, which What's new follows.+// InLang): the app's language, which What's new follows. On Settings'+// Stable channel it is Stable's release (see Stable).func LatestIn(ctx context.Context, lang string) (*Release, error) {- req, err := http.NewRequestWithContext(ctx, "GET", withLang(Feed(), lang), nil)+ req, err := http.NewRequestWithContext(ctx, "GET", withChannel(withLang(Feed(), lang)), nil)if err != nil {return nil, err}diff --git a/site/public/docs/ja/privacy.html b/site/public/docs/ja/privacy.htmlindex d797f8ba9..e077e0fdd 100644--- a/site/public/docs/ja/privacy.html+++ b/site/public/docs/ja/privacy.html@@ -171,7 +171,7 @@<h2 id="site"><a class="anchor" href="#site">usemagpie.ai に見えるもの</a></h2><p>magpie はプライバシー設定にかかわらず、どのアプリも自分の更新サーバーに尋ねるのと同じように、自分のサイトにいくつか尋ねます。どのリクエストにもインストール ID やアカウントは付きません。</p><ul>- <li><code>/api/latest</code>:更新情報。<code>noAutoUpdate</code> がオンでなければ 6 時間ごと。<code>?lang=</code> であなたの言語のノートを取ります。<code>/api/notes</code> は更新後の「新機能」です。</li>+ <li><code>/api/latest</code>:更新情報。<code>noAutoUpdate</code> がオンでなければ 6 時間ごと。<code>?lang=</code> であなたの言語のノートを取ります。<span class="ui">設定</span> → <span class="ui">情報</span> → <span class="ui">アップデートチャネル</span>が安定版なら <code>?channel=stable</code> も付けます。どちらもあなたが誰かは含みません。<code>/api/notes</code> は更新後の「新機能」です。</li><li><code>/api/partners</code>:プロバイダー追加シートのパートナー一覧。6 時間ごと。パートナーが載っている間、10 回に 1 回の取得を Cloudflare が示す国とともに <code>magpie partners fetch</code> として数えます。</li><li><code>/go/<パートナー>/site</code> と <code>/go/<パートナー>/keys</code>:パートナーの公式サイトとキーのページへのリンクをブラウザーで開くと、移動の前に <code>magpie partner go</code>(どのパートナーか、どのリンクか、地域、国)として数えます。</li><li><code>/api/icon?url=…</code>:プラグイン、インポートリンク、ライブラリが示すアイコンはここを経由して取得するので、アイコンのあるホストに見えるのはあなたではなく Cloudflare のアドレスです。画像を中継するだけで、数えることも記録することもしません。</li>diff --git a/site/public/docs/privacy.html b/site/public/docs/privacy.htmlindex 20ba8b52f..b582f7f5a 100644--- a/site/public/docs/privacy.html+++ b/site/public/docs/privacy.html@@ -171,7 +171,7 @@<h2 id="site"><a class="anchor" href="#site">What usemagpie.ai sees</a></h2><p>magpie asks its own site for a few things, whatever the privacy settings say, as any app asks its update server. None of these requests carries the install id or an account.</p><ul>- <li><code>/api/latest</code>: the update feed, every 6 hours unless <code>noAutoUpdate</code> is on, with <code>?lang=</code> for the notes in your language. <code>/api/notes</code> gives What’s new after an update.</li>+ <li><code>/api/latest</code>: the update feed, every 6 hours unless <code>noAutoUpdate</code> is on, with <code>?lang=</code> for the notes in your language, and <code>?channel=stable</code> when <span class="ui">Settings</span> → <span class="ui">About</span> → <span class="ui">Update channel</span> is Stable. Neither says who you are. <code>/api/notes</code> gives What’s new after an update.</li><li><code>/api/partners</code>: the add sheet’s partner list, every 6 hours. One fetch in ten is counted as a <code>magpie partners fetch</code> event, with the country Cloudflare gives, while a partner is listed.</li><li><code>/go/<partner>/site</code> and <code>/go/<partner>/keys</code>: a partner’s website and key-page links, opened in your browser, are counted (the partner, which link, a region, a country) as <code>magpie partner go</code> before you are sent on.</li><li><code>/api/icon?url=…</code>: icons named by a plugin, an import link or the library are fetched through it, so their hosts see Cloudflare’s address, not yours. The worker passes the picture on and counts and keeps nothing.</li>diff --git a/site/public/docs/zh/privacy.html b/site/public/docs/zh/privacy.htmlindex eedf923d2..a44b9b3cf 100644--- a/site/public/docs/zh/privacy.html+++ b/site/public/docs/zh/privacy.html@@ -171,7 +171,7 @@<h2 id="site"><a class="anchor" href="#site">usemagpie.ai 能看到什么</a></h2><p>magpie 会向自己的网站请求几样东西,不受隐私设置影响,就像任何应用访问自己的更新服务器。这些请求都不带安装 ID 或账号。</p><ul>- <li><code>/api/latest</code>:更新信息,每 6 小时一次(开了 <code>noAutoUpdate</code> 则不请求),带 <code>?lang=</code> 取对应语言的说明。<code>/api/notes</code> 在更新后给出“新功能”。</li>+ <li><code>/api/latest</code>:更新信息,每 6 小时一次(开了 <code>noAutoUpdate</code> 则不请求),带 <code>?lang=</code> 取对应语言的说明;<span class="ui">设置</span> → <span class="ui">关于</span> → <span class="ui">更新渠道</span>选了稳定版时还带 <code>?channel=stable</code>。两者都不含你是谁。<code>/api/notes</code> 在更新后给出“新功能”。</li><li><code>/api/partners</code>:添加供应商页的合作伙伴列表,每 6 小时一次。在有合作伙伴上架时,每十次拉取记一次 <code>magpie partners fetch</code> 事件,附 Cloudflare 给出的国家。</li><li><code>/go/<合作伙伴>/site</code> 和 <code>/go/<合作伙伴>/keys</code>:在浏览器里打开合作伙伴的官网和 Key 页面链接时,先记一次 <code>magpie partner go</code>(哪个合作伙伴、哪个链接、地区、国家),再跳转。</li><li><code>/api/icon?url=…</code>:插件、导入链接和库里的图标经它获取,图标所在的服务器只看到 Cloudflare 的地址,看不到你的。它只转发图片,不计数也不记录。</li>