From 92702273df41d2ebd4834f1581ef16f41559c980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 9 Oct 2026 01:37:38 -0400 Subject: [PATCH] Site: downloads go to the GitHub release page (R2.18) --- site/e2e/text.spec.ts | 23 ++++++++++------------- site/src/main.ts | 29 +++++------------------------ site/src/release.ts | 3 +++ site/src/text.ts | 6 ++---- site/src/tour.ts | 4 ++-- 5 files changed, 22 insertions(+), 43 deletions(-) create mode 100644 site/src/release.ts diff --git a/site/e2e/text.spec.ts b/site/e2e/text.spec.ts index 33f90af..cdb11ee 100644 --- a/site/e2e/text.spec.ts +++ b/site/e2e/text.spec.ts @@ -3,8 +3,7 @@ import { TEXT, type Key, type Lang } from "../src/text.ts"; const REPO = "https://github.com/ZacharyZhang-NY/ElyOffice"; const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"]; -const dmg = (app: string) => `${REPO}/releases/download/v0.1.0/${app}-0.1.0-arm64.dmg`; -const tarball = (kind: string) => `${REPO}/releases/download/v0.1.0/ElyOffice-0.1.0-${kind}.tar.gz`; +const RELEASES = `${REPO}/releases/latest`; test.use({ reducedMotion: "reduce" }); @@ -79,27 +78,25 @@ test.describe("English locale", () => { await expect(lang).toHaveText("中文"); }); - test("links point at the release and the repository", async ({ page }) => { + test("downloads go to the GitHub release page, never to a file", async ({ page }) => { await page.goto("/"); await expect(page.locator(".tour .get")).toHaveCount(APPS.length); - for (const [i, app] of APPS.entries()) { - await expect(page.locator(".tour .get").nth(i)).toHaveAttribute("href", dmg(app)); - } - await expect(page.locator("#download ul a")).toHaveText([...APPS, TEXT.en.source, TEXT.en.upstream]); - for (const [i, app] of APPS.entries()) { - await expect(page.locator("#download ul a").nth(i)).toHaveAttribute("href", dmg(app)); - } - await expect(page.locator("[data-t=source]")).toHaveAttribute("href", tarball("source")); - await expect(page.locator("[data-t=upstream]")).toHaveAttribute("href", tarball("upstream-source")); + for (const i of APPS.keys()) await expect(page.locator(".tour .get").nth(i)).toHaveAttribute("href", RELEASES); + await expect(page.locator("#download a")).toHaveCount(1); + await expect(page.locator("#download [data-t=github]")).toHaveAttribute("href", RELEASES); await expect(page.locator(".hero > a")).toHaveText("GitHub"); await expect(page.locator(".hero > a")).toHaveAttribute("href", REPO); + const files = await page.locator("a[href]").evaluateAll((as) => + as.map((a) => (a as HTMLAnchorElement).href).filter((h) => /\.(dmg|tar\.gz|zip|exe|AppImage)$/.test(h)), + ); + expect(files).toEqual([]); }); test("every external link answers @net", async ({ page, request }) => { await page.goto("/"); const hrefs = await page.locator("a[href^='http']").evaluateAll((as) => as.map((a) => (a as HTMLAnchorElement).href)); const unique = [...new Set(hrefs)]; - expect(unique.sort()).toEqual([REPO, ...APPS.map(dmg), tarball("source"), tarball("upstream-source")].sort()); + expect(unique.sort()).toEqual([REPO, RELEASES].sort()); for (const url of unique) { const res = await request.head(url); expect(res.status(), url).toBeLessThan(400); diff --git a/site/src/main.ts b/site/src/main.ts index a725457..fa63d4f 100644 --- a/site/src/main.ts +++ b/site/src/main.ts @@ -7,12 +7,10 @@ import { night } from "./night.ts"; import { rhythm } from "./rhythm.ts"; import { playground } from "./play.ts"; import { film } from "./film.ts"; -import { model } from "./model.ts"; import { said, speak, type Lang } from "./text.ts"; +import { RELEASES, VERSION } from "./release.ts"; const REPO = "https://github.com/ZacharyZhang-NY/ElyOffice"; -const RELEASE = `${REPO}/releases/download/v0.1.0`; -const APPS = model.slice(1, -1).map((p) => p.name); const app = document.querySelector("#app"); if (!app) throw new Error("index.html has no #app"); @@ -32,27 +30,10 @@ const shelf = props(); const footer = document.createElement("footer"); footer.id = "download"; const version = document.createElement("h2"); -version.textContent = "Ely Office 0.1.0"; -const list = document.createElement("ul"); -for (const name of APPS) { - const a = document.createElement("a"); - a.href = `${RELEASE}/${name}-0.1.0-arm64.dmg`; - a.textContent = name; - const li = document.createElement("li"); - li.append(a); - list.append(li); -} -for (const [key, file] of [ - ["source", "ElyOffice-0.1.0-source.tar.gz"], - ["upstream", "ElyOffice-0.1.0-upstream-source.tar.gz"], -] as const) { - const a = said("a", key); - a.href = `${RELEASE}/${file}`; - const li = document.createElement("li"); - li.append(a); - list.append(li); -} -footer.append(version, said("p", "platforms"), said("p", "needs"), said("p", "unsigned"), list); +version.textContent = `Ely Office ${VERSION}`; +const get = said("a", "github"); +get.href = RELEASES; +footer.append(version, said("p", "platforms"), said("p", "needs"), said("p", "unsigned"), get); const toggle = said("button", "other"); toggle.className = "lang"; diff --git a/site/src/release.ts b/site/src/release.ts new file mode 100644 index 0000000..f34de31 --- /dev/null +++ b/site/src/release.ts @@ -0,0 +1,3 @@ +// The published release; downloads live on its GitHub page. +export const VERSION = "0.1.0"; +export const RELEASES = "https://github.com/ZacharyZhang-NY/ElyOffice/releases/latest"; diff --git a/site/src/text.ts b/site/src/text.ts index a18a9ab..0ba82ba 100644 --- a/site/src/text.ts +++ b/site/src/text.ts @@ -16,8 +16,7 @@ const en = { platforms: "Out now for macOS. Windows and Linux are coming soon.", needs: "macOS 14 or later, Apple silicon.", unsigned: "Not notarized. If macOS blocks the app, open System Settings › Privacy & Security and click Open Anyway.", - source: "Source code", - upstream: "Upstream source", + github: "Download from GitHub", shot: "screenshot", other: "中文", roads: "Drag a file down the road.", @@ -54,8 +53,7 @@ const zh: typeof en = { platforms: "macOS 版已发布。Windows 与 Linux 版即将推出。", needs: "macOS 14 或更新,Apple 芯片。", unsigned: "未经公证。macOS 拦下应用时,打开“系统设置 › 隐私与安全性”,点“仍要打开”。", - source: "源代码", - upstream: "上游源码", + github: "前往 GitHub 下载", shot: "截图", other: "English", roads: "把文件沿着路拖过去。", diff --git a/site/src/tour.ts b/site/src/tour.ts index 1846db5..eb313ee 100644 --- a/site/src/tour.ts +++ b/site/src/tour.ts @@ -4,8 +4,8 @@ import { grow } from "./beat.ts"; import { model } from "./model.ts"; import { touch } from "./touch.ts"; import { said, TEXT, type Key } from "./text.ts"; +import { RELEASES } from "./release.ts"; -const RELEASE = "https://github.com/ZacharyZhang-NY/ElyOffice/releases/download/v0.1.0"; const SCREEN = "#3a3a3c"; const DESK = "#e6e6e2"; const STEP = 60 / 112 / 4; @@ -227,7 +227,7 @@ export function tour(hero: HTMLElement): { section: HTMLElement; host: HTMLEleme h2.textContent = p.name; const get = said("a", "download"); get.className = "get"; - get.href = `${RELEASE}/${p.name}-0.1.0-arm64.dmg`; + get.href = RELEASES; const acts = document.createElement("div"); acts.className = "acts"; acts.append(get, plays[i]);