Site: downloads go to the GitHub release page (R2.18)
This commit is contained in:
5 files changed
+22
-43
No files matched your search
+10
-13
@@ -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);
|
||||
|
||||
+5
-24
@@ -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<HTMLElement>("#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";
|
||||
|
||||
@@ -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";
|
||||
+2
-4
@@ -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: "把文件沿着路拖过去。",
|
||||
|
||||
+2
-2
@@ -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]);
|
||||
|
||||
Reference in new issue
Block a user