site: show Stable's version and offer its downloads (fishmagic80 on X)
fishmagic80 asked on X for the site to show the Stable channel's version
and download it directly. The home page now asks /api/latest and
/api/latest?channel=stable together. When Stable is known and isn't the
newest, the hero's version line adds "· Stable <v>", and a quiet
two-button control over the platform cards switches every download link
between the newest (/download/<platform>) and Stable
(/download/stable/<platform>). #stable opens the page on Stable. While
Stable is unknown, or is the newest, the page is as before.
The worker serves /download/stable/<platform or file> from Stable's
release (the same stableOf ledger as ?channel=stable) and answers 503,
not the newest, while Stable is unknown. The download event's link
property gets a "stable/" prefix; no new property is sent.
Words in en, zh, ja, de, matching the app's (稳定版, 安定版, Stabil).
Run at 936c70756 (rebased on origin/main 7b002b6be), on mote:
- node --test site/*.test.mjs: 121/121. The new download/stable test is
red on the old worker.js (broken by hand).
- Playwright (on mica, before the rebase; nothing under site/public/index.html or i18n.js changed in it), Chromium and WebKit × en/zh/ja/de × 1280/390 wide × light
and dark against worker.js served locally with a stubbed feed: the
hero and control show both versions, translated; Stable makes every
card link /download/stable/…, Latest restores them; no horizontal
scroll.
Not tried: the page in Firefox.
This commit is contained in:
@@ -138,6 +138,10 @@ const zh = {
|
||||
"fin.gh": "在 GitHub 上查看",
|
||||
"plat.mac": "11 及以上",
|
||||
"plat.win": "10 及以上",
|
||||
"chan.label": "版本",
|
||||
"chan.latest": "最新版",
|
||||
"chan.stable": "稳定版",
|
||||
"chan.title": "每周一个版本,先经过三天使用",
|
||||
"foot.start": "快速上手",
|
||||
"foot.feed": "更新源",
|
||||
"foot.contrib": "贡献墙",
|
||||
@@ -291,6 +295,10 @@ const ja = {
|
||||
"fin.gh": "GitHub で見る",
|
||||
"plat.mac": "11 以降",
|
||||
"plat.win": "10 以降",
|
||||
"chan.label": "リリース",
|
||||
"chan.latest": "最新版",
|
||||
"chan.stable": "安定版",
|
||||
"chan.title": "週に 1 バージョン、3 日間使われてから",
|
||||
"foot.start": "はじめに",
|
||||
"foot.feed": "更新フィード",
|
||||
"foot.contrib": "コントリビューター",
|
||||
@@ -444,6 +452,10 @@ const de = {
|
||||
"fin.gh": "Auf GitHub ansehen",
|
||||
"plat.mac": "11 oder neuer",
|
||||
"plat.win": "10 oder neuer",
|
||||
"chan.label": "Version",
|
||||
"chan.latest": "Neueste",
|
||||
"chan.stable": "Stabil",
|
||||
"chan.title": "Eine Version pro Woche, nach drei Tagen Nutzung",
|
||||
"foot.start": "Erste Schritte",
|
||||
"foot.feed": "Update-Feed",
|
||||
"foot.contrib": "Mitwirkende",
|
||||
|
||||
+37
-3
@@ -244,6 +244,16 @@ html[data-os="windows"] .btn .os-windows, html[data-os="linux"] .btn .os-linux {
|
||||
.plats span { color: var(--ink3); font-size: 12.5px; justify-self: end; }
|
||||
.plats a { color: var(--ink2); text-decoration: none; }
|
||||
.plats a:hover { color: var(--ink); text-decoration: underline; }
|
||||
/* Latest or Stable: which release the platform links download */
|
||||
.chan { display: inline-flex; gap: 2px; margin-top: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
|
||||
.chan button { display: inline-flex; align-items: baseline; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink3); font: inherit; font-size: 13px; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
|
||||
.chan button b { font-weight: 500; color: var(--ink2); transition: color .15s ease; }
|
||||
.chan button[aria-pressed="true"] { background: var(--card); color: var(--ink2); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
|
||||
.chan button[aria-pressed="true"] b { color: var(--ink); }
|
||||
@media (hover: hover) and (pointer: fine) { .chan button:hover b { color: var(--ink); } }
|
||||
.chan button:focus-visible { outline: 2px solid var(--ink3); outline-offset: 1px; }
|
||||
.chan + .plats { margin-top: 16px; }
|
||||
.chan[hidden], .to-stable[hidden] { display: none; }
|
||||
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 13.5px; color: var(--ink3); }
|
||||
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
|
||||
footer .links { margin-left: auto; display: flex; gap: 20px; }
|
||||
@@ -443,7 +453,7 @@ footer a:hover { color: var(--ink); }
|
||||
</a>
|
||||
<a class="btn ghost" href="#cli" data-i18n="hero.term">Install from terminal</a>
|
||||
</div>
|
||||
<div class="meta"><span class="ver" data-i18n="hero.free">Free</span> · <a href="https://github.com/yetone/magpie" data-i18n="hero.oss">Open source</a> · <span class="os-note">macOS 12+ · <a class="alt" href="/download/mac-intel">Intel Mac</a></span> · <a href="#get" data-i18n="hero.other">Windows & Linux</a></div>
|
||||
<div class="meta"><span class="ver" data-i18n="hero.free">Free</span><span class="to-stable" hidden> · <a href="#get"><span data-i18n="chan.stable">Stable</span> <span class="stable-v"></span></a></span> · <a href="https://github.com/yetone/magpie" data-i18n="hero.oss">Open source</a> · <span class="os-note">macOS 12+ · <a class="alt" href="/download/mac-intel">Intel Mac</a></span> · <a href="#get" data-i18n="hero.other">Windows & Linux</a></div>
|
||||
</div>
|
||||
<div class="shot">
|
||||
<img loading="lazy" class="pick for-light" src="/img/picker-light.png" width="440" height="555" data-i18n-attr="alt:alt.picker" alt="Codex's model picker in magpie, listing DeepSeek, Kimi and GLM models">
|
||||
@@ -740,6 +750,10 @@ magpie tui <span class="c" data-i18n="cli.c.tui"># t
|
||||
<h2 data-i18n="fin.h2">Every agent. Every model.</h2>
|
||||
<p class="sub" style="margin:0 auto 32px" data-i18n="fin.sub">Free, open source, native. For macOS, Windows and Linux.</p>
|
||||
<div class="cta"><a class="btn dl" href="/download"><span class="dl-label" data-i18n="dl.mac">Download for Mac</span></a><a class="btn ghost" href="https://github.com/yetone/magpie"><svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg> <span data-i18n="fin.gh">View on GitHub</span></a></div>
|
||||
<div class="chan" role="group" data-i18n-attr="aria-label:chan.label" aria-label="Release" hidden>
|
||||
<button type="button" data-ch="latest" aria-pressed="true"><b data-i18n="chan.latest">Latest</b><span class="v"></span></button>
|
||||
<button type="button" data-ch="stable" aria-pressed="false" data-i18n-attr="title:chan.title" title="One version a week, after three days of use"><b data-i18n="chan.stable">Stable</b><span class="v"></span></button>
|
||||
</div>
|
||||
<div class="plats" id="get">
|
||||
<div><b>macOS</b><span data-i18n="plat.mac">11 or later</span><a href="/download/mac-arm64">Apple Silicon</a><a href="/download/mac-intel">Intel</a></div>
|
||||
<div><b>Windows</b><span data-i18n="plat.win">10 or later</span><a href="/download/windows-amd64">x64</a><a href="/download/windows-arm64">ARM</a></div>
|
||||
@@ -836,10 +850,30 @@ magpie tui <span class="c" data-i18n="cli.c.tui"># t
|
||||
};
|
||||
try { navigator.userAgentData?.getHighEntropyValues(["architecture"]).then((v) => setArch(v.architecture)).catch(() => {}); } catch {}
|
||||
|
||||
fetch("/api/latest").then((r) => (r.ok ? r.json() : null)).then((rel) => {
|
||||
// The newest version, and Stable's beside it (fishmagic80 on X): the
|
||||
// platform links download either; the hero's Stable link picks Stable.
|
||||
const feed = (q) => fetch("/api/latest" + q).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
||||
const chan = document.querySelector(".chan");
|
||||
const plats = [...document.querySelectorAll(".plats a")].map((a) => [a, a.getAttribute("href").replace("/download/", "")]);
|
||||
const pick = (ch) => {
|
||||
chan.querySelectorAll("button").forEach((b) => b.setAttribute("aria-pressed", String(b.dataset.ch === ch)));
|
||||
plats.forEach(([a, p]) => (a.href = (ch === "stable" ? "/download/stable/" : "/download/") + p));
|
||||
};
|
||||
chan.querySelectorAll("button").forEach((b) => b.addEventListener("click", () => pick(b.dataset.ch)));
|
||||
Promise.all([feed(""), feed("?channel=stable")]).then(([rel, st]) => {
|
||||
if (!rel) return;
|
||||
document.querySelectorAll(".ver").forEach((e) => (e.textContent = T("Version ", "版本 ", "バージョン ", "Version ") + rel.version));
|
||||
}).catch(() => {});
|
||||
if (!st || !st.version || st.version === rel.version) return;
|
||||
chan.querySelector('[data-ch="latest"] .v').textContent = rel.version;
|
||||
document.querySelectorAll('[data-ch="stable"] .v, .stable-v').forEach((e) => (e.textContent = st.version));
|
||||
chan.hidden = false;
|
||||
document.querySelector(".final > .meta").hidden = true; // the choice names both versions
|
||||
document.querySelectorAll(".to-stable").forEach((e) => {
|
||||
e.hidden = false;
|
||||
e.querySelector("a").addEventListener("click", () => pick("stable"));
|
||||
});
|
||||
if (location.hash === "#stable") { pick("stable"); chan.scrollIntoView({ block: "center" }); }
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script>
|
||||
|
||||
@@ -341,6 +341,36 @@ test("latest?channel=stable: unknown (503, never kept) without a ledger that rea
|
||||
assert.equal((await ask("/api/latest?channel=stable", broken)).status, 503);
|
||||
});
|
||||
|
||||
test("download/stable: a platform's link goes to that file of Stable's release; /download stays the newest (fishmagic80 on X)", async () => {
|
||||
const now = Date.now();
|
||||
GITHUB = [
|
||||
{ version: "0.1.4", published: iso(now - 3600e3), notes: "- newest" },
|
||||
{ version: "0.1.2", published: iso(now - 12 * DAY), notes: "- stable one" },
|
||||
{ version: "0.1.1", published: iso(now - 13 * DAY), notes: "- old" },
|
||||
];
|
||||
const env = { LEDGER: kv() };
|
||||
await keepLedger(env, now);
|
||||
store.clear();
|
||||
const go = (path, e = env) => worker.fetch(new Request("https://usemagpie.ai" + path), e, ctx);
|
||||
for (const path of ["/download/stable/linux", "/download/stable/linux-amd64", "/download/stable/magpie-linux-amd64"]) {
|
||||
const res = await go(path);
|
||||
assert.equal(res.status, 302, path);
|
||||
assert.match(res.headers.get("Location"), /0\.1\.2/, path);
|
||||
}
|
||||
const newest = await go("/download/linux");
|
||||
assert.equal(newest.status, 302);
|
||||
assert.match(newest.headers.get("Location"), /0\.1\.4/);
|
||||
// a file the release hasn't
|
||||
assert.equal((await go("/download/stable/nothing-like-it")).status, 404);
|
||||
// Stable unknown: said so, never kept
|
||||
for (const e of [{}, { LEDGER: Object.assign(kv(), { broken: true }) }]) {
|
||||
store.clear();
|
||||
const res = await go("/download/stable/linux", e);
|
||||
assert.equal(res.status, 503);
|
||||
assert.equal(res.headers.get("Cache-Control"), "no-store");
|
||||
}
|
||||
});
|
||||
|
||||
test("notes: a range older than the hundred newest is read on from the ledger, one list", async () => {
|
||||
const now = Date.now();
|
||||
// 250 releases an hour apart: the API's first page has the newest 100
|
||||
|
||||
+10
-4
@@ -33,6 +33,8 @@
|
||||
// /download/windows the Windows app (x64); /download/windows-arm64
|
||||
// /download/linux the Linux app (x86-64); /download/linux-arm64
|
||||
// /download/<file> any file of the newest release, by name
|
||||
// /download/stable, /download/stable/<platform or file>
|
||||
// the same from the Stable channel's release
|
||||
// /files/<tag>/<file> a release's file from R2 (files.js), the feed's
|
||||
// url and /download's for the files R2 holds;
|
||||
// GitHub's own address for any it doesn't
|
||||
@@ -148,12 +150,16 @@ export default {
|
||||
if (dl) return detour(ctx, env, dl[1], dl[2]);
|
||||
if (url.pathname.startsWith(RELAY)) return relay(req, url);
|
||||
if (url.pathname === "/download" || url.pathname.startsWith("/download/")) {
|
||||
const want = url.pathname.split("/")[2] || "mac-arm64";
|
||||
const got = await latest(ctx, env);
|
||||
// /download/stable/...: the same from the Stable channel's release
|
||||
// (the home page's Stable choice, fishmagic80 on X)
|
||||
const parts = url.pathname.split("/");
|
||||
const onStable = parts[2] === "stable";
|
||||
const want = parts[onStable ? 3 : 2] || "mac-arm64";
|
||||
const got = onStable ? await stable(ctx, env, Date.now()).catch(() => null) : await latest(ctx, env);
|
||||
const rel = got && (await fromR2(ctx, env, got.rel));
|
||||
const asset = rel && rel.assets && rel.assets[SHORT[want] || want];
|
||||
if (!asset) return new Response("not found\n", { status: 404 });
|
||||
if (req.method === "GET") ctx.waitUntil(capture("magpie site download", { link: want, file: SHORT[want] || want, client: client(req), country: country(req) }));
|
||||
if (!asset) return new Response(onStable && !got ? "the stable version isn't known yet\n" : "not found\n", { status: onStable && !got ? 503 : 404, headers: NO_STORE });
|
||||
if (req.method === "GET") ctx.waitUntil(capture("magpie site download", { link: onStable ? "stable/" + want : want, file: SHORT[want] || want, client: client(req), country: country(req) }));
|
||||
return Response.redirect(asset.url, 302);
|
||||
}
|
||||
// crawlers and old browsers ask for /favicon.ico whatever the page links
|
||||
|
||||
Reference in New Issue
Block a user