5 Commits
Author SHA1 Message Date
ZacharyZhang-NYandClaude Opus 5.5 991bfb78ad Site: download and Gitea icons on the hero links [skip ci]
The Gitea mark is its logo's two cup paths in the link color.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:52:35 -04:00
ZacharyZhang-NYandClaude Opus 5.5 f447cdca5c Site: downloads in the hero; hero links on one baseline, Source translated [skip ci]
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:47:15 -04:00
ZacharyZhang-NYandClaude Opus 5.5 854c360ea1 Site: show downloads across every release [skip ci]
/release.json adds the sum of every release asset's downloads; the
update manifests are the apps' checks, not downloads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:43:38 -04:00
ZacharyZhang-NYandClaude Opus 5.5 87c42fde0e Site: read the newest version from Gitea; links follow releases/latest [skip ci]
A worker answers /release.json from the Gitea API (Gitea sends no
CORS headers, so the page cannot ask it directly).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:35:58 -04:00
ZacharyZhang-NYandClaude Opus 5.5 48306fcd16 Site: link downloads to v0.1.4 [skip ci]
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:33:25 -04:00
17 changed files with 203 additions and 28 deletions

No files matched your search

+1 -1
View File
@@ -173,7 +173,7 @@ tests/scripts/show-fullscreen.sh 真窗口 ElyShow:F5 放映的窗口盖住
tests/scripts/types.sh packaging/types.tsv 的文件类型在 Linux 桌面项、Windows 安装程序与 macOS 文档类型里一致,从不设为默认
tests/scripts/layout.sh 真窗口:六个应用在 640、800、1100 宽下无元素越出窗口左右,留截图(需辅助功能与屏幕录制权限)
tests/scripts/ooxml.py <用例> <文件> 不经 LibreOffice 读 DOCX、XLSX、PPTX 并按自算的预期核对(往返用例调用)
cd site && pnpm deploy 官网构建并经 wrangler 发到 Cloudflare Workers(只有静态资源),地址 https://ely-office.zhangyanghaha0407.workers.dev
cd site && pnpm deploy 官网构建并经 wrangler 发到 Cloudflare Workers(静态资源,另有 `site/worker` 只答 `/release.json`:Gitea API 的最新版本与全部发布的下载总数(不计更新清单 `.json`),缓存 5 分钟;下载链接指向 `releases/latest`),地址 https://ely-office.zhangyanghaha0407.workers.dev
cd site && pnpm test && pnpm e2e 官网单测(几何、道路连通)与 Playwright 端到端(悬停、聚焦、按压、命中归属)
cd site/video/scenes && npm run verify 发布视频:群像与离场两个渲染器在切场处屏幕角点一致,离场全程各屏播自己的录屏帧(真页面渲染)
cargo check --workspace
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const PAGE = "/";
+17
View File
@@ -0,0 +1,17 @@
import { test as base } from "@playwright/test";
export { expect, type Page } from "@playwright/test";
export const VERSION = "9.9.9";
export const DOWNLOADS = 12345;
// Every page reads this version.
export const test = base.extend<{ release: void }>({
release: [
async ({ context }, use) => {
await context.route("**/release.json", (r) => r.fulfill({ json: { version: VERSION, downloads: DOWNLOADS } }));
await use();
},
{ auto: true },
],
});
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const PAGE = "/";
const DESK = { light: "rgb(230, 230, 226)", dark: "rgb(58, 58, 58)" };
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const TREE = "Open a Markdown file's history in ElyTree.";
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"];
+55 -5
View File
@@ -1,9 +1,9 @@
import { expect, test, type Page } from "@playwright/test";
import { TEXT, type Key, type Lang } from "../src/text.ts";
import { DOWNLOADS, expect, test, VERSION, type Page } from "./fixtures.ts";
import { TEXT, word, type Key, type Lang } from "../src/text.ts";
const REPO = "https://git.zacharyzhang.com/ZacharyZhang-NY/ElyOffice";
const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"];
const RELEASES = `${REPO}/releases/tag/v0.1.3`;
const RELEASES = `${REPO}/releases/latest`;
test.use({ reducedMotion: "reduce" });
@@ -23,11 +23,13 @@ const keyed = (page: Page) =>
/** Asserts every keyed element reads in `lang`. */
async function reads(page: Page, lang: Lang) {
await expect(page.locator("html")).toHaveAttribute("lang", lang === "zh" ? "zh-CN" : "en");
await expect(page.locator("[data-t=count]")).toHaveCount(2);
for (const c of await page.locator("[data-t=count]").all()) await expect(c).toBeVisible();
const found = await keyed(page);
expect(found.length).toBeGreaterThan(0);
for (const [key, text] of found) {
expect(text, key).not.toBe("");
expect(text, key).toBe(TEXT[lang][key as Key]);
expect(text, key).toBe(word(lang, key as Key, key === "count" ? DOWNLOADS : undefined));
}
}
@@ -66,6 +68,15 @@ test.describe("English locale", () => {
await expect(lang).toHaveCSS("opacity", "1");
});
test("the hero links keep their icons in either language", async ({ page }) => {
await page.goto("/");
const icons = page.locator(".hero .links a > svg[aria-hidden=true]");
await expect(icons).toHaveCount(2);
await page.locator(".lang").click();
await expect(icons).toHaveCount(2);
await expect(page.locator(".hero .links a")).toHaveText(["前往下载", "源码"]);
});
test("the language button switches every text and back", async ({ page }) => {
await page.goto("/");
const lang = page.locator(".lang");
@@ -86,13 +97,32 @@ test.describe("English locale", () => {
await expect(page.locator("#download [data-t=get]")).toHaveAttribute("href", RELEASES);
await expect(page.locator(".hero .links a").last()).toHaveText("Source");
await expect(page.locator(".hero .links a").last()).toHaveAttribute("href", REPO);
await expect(page.locator(".hero [data-t=get]")).toHaveAttribute("href", RELEASES);
await expect(page.locator(".hero .links a").first()).toHaveAttribute("href", RELEASES);
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("the hero and download area name the newest version and all downloads", async ({ page }) => {
await page.goto("/");
await expect(page.locator("#download h2")).toHaveText(`Ely Office ${VERSION}`);
const counts = page.locator("[data-t=count]");
await expect(counts).toHaveText(["12,345 downloads so far.", "12,345 downloads so far."]);
await page.locator(".lang").click();
await expect(counts).toHaveText(["已下载 12,345 次。", "已下载 12,345 次。"]);
});
test("a failed version read shows as an error", async ({ page }) => {
await page.route("**/release.json", (r) => r.fulfill({ status: 502, body: "Gitea answered 500" }));
await page.goto("/");
await expect.poll(() => errors.length).toBe(1);
expect(errors[0]).toContain("Gitea answered 500");
await expect(page.locator("#download h2")).toHaveText("Ely Office");
for (const c of await page.locator("[data-t=count]").all()) await expect(c).toBeHidden();
errors = [];
});
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));
@@ -125,6 +155,26 @@ test.describe("English locale", () => {
});
});
test("the hero links share one baseline in either language", async ({ browser }) => {
for (const locale of ["en-US", "zh-CN"]) {
const page = await browser.newPage({ locale, reducedMotion: "reduce" });
await page.goto("/");
const lines = await page.locator(".hero .links a").evaluateAll((as) =>
as.map((a) => {
const mark = document.createElement("span");
mark.style.display = "inline-block";
a.prepend(mark);
const y = mark.getBoundingClientRect().bottom;
mark.remove();
return y;
}),
);
expect(lines).toHaveLength(2);
expect(Math.abs(lines[0] - lines[1]), locale).toBeLessThan(0.5);
await page.close();
}
});
test("the download area tells how to open an unnotarized app", async ({ browser }) => {
for (const [locale, words] of [
["en-US", ["System Settings", "Privacy & Security", "Open Anyway"]],
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const CELL = 28;
const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"];
+1 -1
View File
@@ -1,4 +1,4 @@
import { expect, test, type Page } from "@playwright/test";
import { expect, test, type Page } from "./fixtures.ts";
const APPS = ["ElyDoc", "ElyTable", "ElyShow", "ElyPDF", "ElyTree", "ElyMark"];
+18
View File
@@ -0,0 +1,18 @@
// Link icons, drawn in the link's color.
import { said, type Key } from "./text.ts";
const ICONS = {
download: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4v11M7 10l5 5 5-5M5 20h14"/></svg>`,
gitea: `<svg viewBox="4 140 632 392" fill="currentColor"><path d="M622.7 149.8c-4.1-4.1-9.6-4-9.6-4s-117.2 6.6-177.9 8c-13.3.3-26.5.6-39.6.7v117.2c-5.5-2.6-11.1-5.3-16.6-7.9 0-36.4-.1-109.2-.1-109.2-29 .4-89.2-2.2-89.2-2.2s-141.4-7.1-156.8-8.5c-9.8-.6-22.5-2.1-39 1.5-8.7 1.8-33.5 7.4-53.8 26.9C-4.9 212.4 6.6 276.2 8 285.8c1.7 11.7 6.9 44.2 31.7 72.5 45.8 56.1 144.4 54.8 144.4 54.8s12.1 28.9 30.6 55.5c25 33.1 50.7 58.9 75.7 62 63 0 188.9-.1 188.9-.1s12 .1 28.3-10.3c14-8.5 26.5-23.4 26.5-23.4S547 483 565 451.5c5.5-9.7 10.1-19.1 14.1-28 0 0 55.2-117.1 55.2-231.1-1.1-34.5-9.6-40.6-11.6-42.6M125.6 353.9c-25.9-8.5-36.9-18.7-36.9-18.7S69.6 321.8 60 295.4c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5 38.5-30c13.8-3.7 31-3.1 31-3.1s7.1 59.4 15.7 94.2c7.2 29.2 24.8 77.7 24.8 77.7s-26.1-3.1-43-9.1m300.3 107.6s-6.1 14.5-19.6 15.4c-5.8.4-10.3-1.2-10.3-1.2s-.3-.1-5.3-2.1l-112.9-55s-10.9-5.7-12.8-15.6c-2.2-8.1 2.7-18.1 2.7-18.1L322 273s4.8-9.7 12.2-13c.6-.3 2.3-1 4.5-1.5 8.1-2.1 18 2.8 18 2.8L467.4 315s12.6 5.7 15.3 16.2c1.9 7.4-.5 14-1.8 17.2-6.3 15.4-55 113.1-55 113.1"/><path d="M326.8 380.1c-8.2.1-15.4 5.8-17.3 13.8s2 16.3 9.1 20c7.7 4 17.5 1.8 22.7-5.4 5.1-7.1 4.3-16.9-1.8-23.1l24-49.1c1.5.1 3.7.2 6.2-.5 4.1-.9 7.1-3.6 7.1-3.6 4.2 1.8 8.6 3.8 13.2 6.1 4.8 2.4 9.3 4.9 13.4 7.3.9.5 1.8 1.1 2.8 1.9 1.6 1.3 3.4 3.1 4.7 5.5 1.9 5.5-1.9 14.9-1.9 14.9-2.3 7.6-18.4 40.6-18.4 40.6-8.1-.2-15.3 5-17.7 12.5-2.6 8.1 1.1 17.3 8.9 21.3s17.4 1.7 22.5-5.3c5-6.8 4.6-16.3-1.1-22.6 1.9-3.7 3.7-7.4 5.6-11.3 5-10.4 13.5-30.4 13.5-30.4.9-1.7 5.7-10.3 2.7-21.3-2.5-11.4-12.6-16.7-12.6-16.7-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3 4.7-9.7 9.4-19.3 14.1-29-4.1-2-8.1-4-12.2-6.1-4.8 9.8-9.7 19.7-14.5 29.5-6.7-.1-12.9 3.5-16.1 9.4-3.4 6.3-2.7 14.1 1.9 19.8z"/></svg>`,
};
/** A link with `icon` before its keyed text. */
export function iconLink(icon: keyof typeof ICONS, key: Key, href: string): HTMLAnchorElement {
const a = document.createElement("a");
a.href = href;
a.className = "icon";
a.innerHTML = ICONS[icon];
a.firstElementChild!.setAttribute("aria-hidden", "true");
a.append(said("span", key));
return a;
}
+20 -10
View File
@@ -7,8 +7,9 @@ import { night } from "./night.ts";
import { rhythm } from "./rhythm.ts";
import { playground } from "./play.ts";
import { film } from "./film.ts";
import { said, speak, type Lang } from "./text.ts";
import { RELEASES, VERSION } from "./release.ts";
import { said, speak, word, type Lang } from "./text.ts";
import { RELEASES, latest } from "./release.ts";
import { iconLink } from "./icons.ts";
const REPO = "https://git.zacharyzhang.com/ZacharyZhang-NY/ElyOffice";
@@ -18,15 +19,14 @@ if (!app) throw new Error("index.html has no #app");
const hero = document.createElement("header");
const title = document.createElement("h1");
title.textContent = "Ely Office";
const source = document.createElement("a");
source.href = REPO;
source.textContent = "Source";
const download = said("a", "get");
download.href = RELEASES;
const source = iconLink("gitea", "source", REPO);
const download = iconLink("download", "get", RELEASES);
const links = document.createElement("div");
links.className = "links";
links.append(download, source);
hero.append(title, said("p", "tagline"), said("p", "platforms"), links);
const heroCount = said("p", "count");
heroCount.hidden = true;
hero.append(title, said("p", "tagline"), said("p", "platforms"), heroCount, links);
const { section, host, svg } = tour(hero);
rhythm(host, svg);
@@ -35,10 +35,12 @@ const shelf = props();
const footer = document.createElement("footer");
footer.id = "download";
const version = document.createElement("h2");
version.textContent = `Ely Office ${VERSION}`;
version.textContent = "Ely Office";
const count = said("p", "count");
count.hidden = true;
const get = said("a", "get");
get.href = RELEASES;
footer.append(version, said("p", "platforms"), said("p", "needs"), said("p", "unsigned"), get);
footer.append(version, count, said("p", "platforms"), said("p", "needs"), said("p", "unsigned"), get);
const toggle = said("button", "other");
toggle.className = "lang";
@@ -56,3 +58,11 @@ main.append(section, playground(), shelf, film());
app.append(night(), toggle, main, footer);
say(lang);
reveal([shelf]);
void latest().then(({ version: v, downloads }) => {
version.textContent = `Ely Office ${v}`;
for (const el of [heroCount, count]) {
el.dataset.n = String(downloads);
el.textContent = word(lang, "count", downloads);
el.hidden = false;
}
});
+11 -3
View File
@@ -1,3 +1,11 @@
// This version's release page holds every download.
export const VERSION = "0.1.3";
export const RELEASES = "https://git.zacharyzhang.com/ZacharyZhang-NY/ElyOffice/releases/tag/v0.1.3";
// Gitea redirects this to the newest release.
export const RELEASES = "https://git.zacharyzhang.com/ZacharyZhang-NY/ElyOffice/releases/latest";
export type Release = { version: string; downloads: number };
/** The newest release and all downloads, from the worker. */
export async function latest(): Promise<Release> {
const res = await fetch("/release.json");
if (!res.ok) throw new Error(`release.json: ${res.status} ${await res.text()}`);
return (await res.json()) as Release;
}
+8
View File
@@ -62,9 +62,17 @@ button:focus-visible {
.hero .links {
display: flex;
align-items: baseline;
gap: 1.5rem;
}
a.icon svg {
height: 1em;
width: auto;
margin-inline-end: 0.35em;
vertical-align: -0.125em;
}
.stage {
display: block;
max-width: 100%;
+12 -1
View File
@@ -17,6 +17,8 @@ const en = {
needs: "macOS 14 or later, Apple silicon.",
unsigned: "Not notarized. If macOS blocks the app, open System Settings › Privacy & Security and click Open Anyway.",
get: "Download",
count: "{n} downloads so far.",
source: "Source",
other: "中文",
roads: "Drag a file down the road.",
fileDoc: "ElyDoc file",
@@ -53,6 +55,8 @@ const zh: typeof en = {
needs: "macOS 14 或更新,Apple 芯片。",
unsigned: "未经公证。macOS 拦下应用时,打开“系统设置 › 隐私与安全性”,点“仍要打开”。",
get: "前往下载",
count: "已下载 {n} 次。",
source: "源码",
other: "English",
roads: "把文件沿着路拖过去。",
fileDoc: "ElyDoc 文件",
@@ -83,10 +87,17 @@ export function said<K extends keyof HTMLElementTagNameMap>(tag: K, key: Key): H
return el;
}
/** `key` in `lang`, with `n` written for {n}. */
export function word(lang: Lang, key: Key, n?: number): string {
const text = TEXT[lang][key];
return n === undefined ? text : text.replace("{n}", n.toLocaleString(lang === "zh" ? "zh-CN" : "en"));
}
/** Writes every keyed text in `lang`. */
export function speak(lang: Lang): void {
document.documentElement.lang = lang === "zh" ? "zh-CN" : "en";
for (const el of document.querySelectorAll<HTMLElement>("[data-t]")) {
el.textContent = TEXT[lang][el.dataset.t as Key];
const { n } = el.dataset;
el.textContent = word(lang, el.dataset.t as Key, n === undefined ? undefined : Number(n));
}
}
+1 -1
View File
@@ -16,5 +16,5 @@
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
"include": ["src", "worker"]
}
+51
View File
@@ -0,0 +1,51 @@
// Answers /release.json with the newest release and downloads.
const REPO = "https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/ElyOffice";
const PAGE = 50;
type Cached = RequestInit & { cf: { cacheTtl: number; cacheEverything: boolean } };
type Asset = { name: string; download_count: number };
type Release = { tag_name: string; assets: Asset[] };
const init: Cached = {
headers: { accept: "application/json", "user-agent": "ely-office-site" },
cf: { cacheTtl: 300, cacheEverything: true },
};
async function read<T>(path: string): Promise<T> {
const res = await fetch(`${REPO}${path}`, init);
if (!res.ok) throw new Error(`Gitea answered ${res.status} for ${path}`);
return (await res.json()) as T;
}
/** The newest release's version, without the v. */
async function version(): Promise<string> {
const { tag_name: tag } = await read<Release>("/releases/latest");
if (!/^v\d+\.\d+\.\d+$/.test(tag)) throw new Error(`Gitea's latest tag is ${JSON.stringify(tag)}`);
return tag.slice(1);
}
/** Downloads of every release; update manifests are checks, not downloads. */
async function downloads(): Promise<number> {
let total = 0;
for (let page = 1; ; page++) {
const releases = await read<Release[]>(`/releases?limit=${PAGE}&page=${page}`);
for (const { assets } of releases) {
for (const a of assets) {
if (!Number.isInteger(a.download_count)) throw new Error(`${a.name} has no download count`);
if (!a.name.endsWith(".json")) total += a.download_count;
}
}
if (releases.length < PAGE) return total;
}
}
export default {
async fetch(): Promise<Response> {
try {
const [v, n] = await Promise.all([version(), downloads()]);
return Response.json({ version: v, downloads: n }, { headers: { "cache-control": "public, max-age=300" } });
} catch (e) {
return new Response(String(e), { status: 502 });
}
},
};
+3 -1
View File
@@ -1,8 +1,10 @@
{
"name": "ely-office",
"main": "worker/index.ts",
"compatibility_date": "2026-10-08",
"assets": {
"directory": "./dist",
"not_found_handling": "404-page"
"not_found_handling": "404-page",
"run_worker_first": ["/release.json"]
}
}