diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d30e45..cb58cb8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -179,8 +179,10 @@ jobs: draft: false make_latest: true - # Point the public in-app update feeds at this release: appcast.xml (Sparkle, - # SUFeedURL) and appcast.json (the old updater in copies up to 0.18.5). Done inline + # Legacy feeds for installed copies up to 0.19.10, which read them from + # stroke-app/ewiz-releases: appcast.xml (Sparkle) and appcast.json (the old updater + # in copies up to 0.18.5). Newer builds read https://ewiz.app/appcast.xml, which + # serves this release's own asset. Remove this step once old copies have updated. Done inline # here rather than in a separate `release: published` workflow because releases # published by the default GITHUB_TOKEN do NOT emit an event that can # trigger another workflow — so that feed workflow never fired on its own. diff --git a/apps/macos/DISTRIBUTION.md b/apps/macos/DISTRIBUTION.md index 87be865..ed5c975 100644 --- a/apps/macos/DISTRIBUTION.md +++ b/apps/macos/DISTRIBUTION.md @@ -148,7 +148,11 @@ for Updates…" and the menu's Update banner. Sparkle's window shows the check, the download's progress and the install, then relaunches the new version. - The app reads `SUFeedURL` from Info.plist (written by `scripts/package-app.sh`): - `raw.githubusercontent.com/stroke-app/ewiz-releases/main/appcast.xml`. + `https://ewiz.app/appcast.xml`. The website (`apps/web/src/routes/appcast[.]xml.ts`) + proxies the `appcast.xml` attached to the latest GitHub release, so publishing the + release is all it takes. Copies up to 0.19.10 still read + `raw.githubusercontent.com/stroke-app/ewiz-releases/main/appcast.xml`, which the + release workflow keeps updating until those copies have moved on. - **Trust** is the EdDSA key, not a Developer ID: `SUPublicEDKey` in Info.plist is `UpdateSignature.publicKeyBase64`, and every DMG in the feed carries that key's `sparkle:edSignature`, made by `licensetool sign-update` from the diff --git a/apps/macos/scripts/package-app.sh b/apps/macos/scripts/package-app.sh index 77e39bd..93c098e 100755 --- a/apps/macos/scripts/package-app.sh +++ b/apps/macos/scripts/package-app.sh @@ -123,7 +123,7 @@ strip -x "$CONTENTS/MacOS/ewiz-mcp" # the proof Sparkle relies on; with it valid, Sparkle also accepts a change of code-signing # identity, which is what carries ad-hoc installs over to the self-signed certificate. BUILD_NUMBER="$("$REPO_DIR/scripts/build-number.sh" "$VERSION")" -SPARKLE_FEED="https://raw.githubusercontent.com/stroke-app/ewiz-releases/main/appcast.xml" +SPARKLE_FEED="https://ewiz.app/appcast.xml" # Read from the source so the key the app trusts and the key licensetool checks its # signatures against are one constant. SPARKLE_PUBLIC_KEY="$(sed -n 's/.*publicKeyBase64 = "\([A-Za-z0-9+\/=]*\)".*/\1/p' "$REPO_DIR/Sources/EWizKit/UpdateSignature.swift")" diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts index f7baf06..46005d7 100644 --- a/apps/web/src/routeTree.gen.ts +++ b/apps/web/src/routeTree.gen.ts @@ -21,6 +21,8 @@ import { Route as DownloadRouteImport } from './routes/download' import { Route as DonateRouteImport } from './routes/donate' import { Route as ChangelogRouteImport } from './routes/changelog' import { Route as BuyRouteImport } from './routes/buy' +import { Route as AppcastDotxmlRouteImport } from './routes/appcast[.]xml' +import { Route as AppcastDotjsonRouteImport } from './routes/appcast[.]json' import { Route as LegalRouteRouteImport } from './routes/legal/route' import { Route as BlogRouteRouteImport } from './routes/blog/route' import { Route as GuestRouteRouteImport } from './routes/_guest/route' @@ -96,6 +98,16 @@ const BuyRoute = BuyRouteImport.update({ path: '/buy', getParentRoute: () => rootRouteImport, } as any) +const AppcastDotxmlRoute = AppcastDotxmlRouteImport.update({ + id: '/appcast.xml', + path: '/appcast.xml', + getParentRoute: () => rootRouteImport, +} as any) +const AppcastDotjsonRoute = AppcastDotjsonRouteImport.update({ + id: '/appcast.json', + path: '/appcast.json', + getParentRoute: () => rootRouteImport, +} as any) const LegalRouteRoute = LegalRouteRouteImport.update({ id: '/legal', path: '/legal', @@ -169,6 +181,8 @@ export interface FileRoutesByFullPath { '/': typeof IndexRoute '/blog': typeof BlogRouteRouteWithChildren '/legal': typeof LegalRouteRouteWithChildren + '/appcast.json': typeof AppcastDotjsonRoute + '/appcast.xml': typeof AppcastDotxmlRoute '/buy': typeof BuyRoute '/changelog': typeof ChangelogRoute '/donate': typeof DonateRoute @@ -194,6 +208,8 @@ export interface FileRoutesByFullPath { export interface FileRoutesByTo { '/': typeof IndexRoute '/legal': typeof LegalRouteRouteWithChildren + '/appcast.json': typeof AppcastDotjsonRoute + '/appcast.xml': typeof AppcastDotxmlRoute '/buy': typeof BuyRoute '/changelog': typeof ChangelogRoute '/donate': typeof DonateRoute @@ -222,6 +238,8 @@ export interface FileRoutesById { '/_guest': typeof GuestRouteRouteWithChildren '/blog': typeof BlogRouteRouteWithChildren '/legal': typeof LegalRouteRouteWithChildren + '/appcast.json': typeof AppcastDotjsonRoute + '/appcast.xml': typeof AppcastDotxmlRoute '/buy': typeof BuyRoute '/changelog': typeof ChangelogRoute '/donate': typeof DonateRoute @@ -250,6 +268,8 @@ export interface FileRouteTypes { | '/' | '/blog' | '/legal' + | '/appcast.json' + | '/appcast.xml' | '/buy' | '/changelog' | '/donate' @@ -275,6 +295,8 @@ export interface FileRouteTypes { to: | '/' | '/legal' + | '/appcast.json' + | '/appcast.xml' | '/buy' | '/changelog' | '/donate' @@ -302,6 +324,8 @@ export interface FileRouteTypes { | '/_guest' | '/blog' | '/legal' + | '/appcast.json' + | '/appcast.xml' | '/buy' | '/changelog' | '/donate' @@ -331,6 +355,8 @@ export interface RootRouteChildren { GuestRouteRoute: typeof GuestRouteRouteWithChildren BlogRouteRoute: typeof BlogRouteRouteWithChildren LegalRouteRoute: typeof LegalRouteRouteWithChildren + AppcastDotjsonRoute: typeof AppcastDotjsonRoute + AppcastDotxmlRoute: typeof AppcastDotxmlRoute BuyRoute: typeof BuyRoute ChangelogRoute: typeof ChangelogRoute DonateRoute: typeof DonateRoute @@ -432,6 +458,20 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof BuyRouteImport parentRoute: typeof rootRouteImport } + '/appcast.xml': { + id: '/appcast.xml' + path: '/appcast.xml' + fullPath: '/appcast.xml' + preLoaderRoute: typeof AppcastDotxmlRouteImport + parentRoute: typeof rootRouteImport + } + '/appcast.json': { + id: '/appcast.json' + path: '/appcast.json' + fullPath: '/appcast.json' + preLoaderRoute: typeof AppcastDotjsonRouteImport + parentRoute: typeof rootRouteImport + } '/legal': { id: '/legal' path: '/legal' @@ -605,6 +645,8 @@ const rootRouteChildren: RootRouteChildren = { GuestRouteRoute: GuestRouteRouteWithChildren, BlogRouteRoute: BlogRouteRouteWithChildren, LegalRouteRoute: LegalRouteRouteWithChildren, + AppcastDotjsonRoute: AppcastDotjsonRoute, + AppcastDotxmlRoute: AppcastDotxmlRoute, BuyRoute: BuyRoute, ChangelogRoute: ChangelogRoute, DonateRoute: DonateRoute, diff --git a/apps/web/src/routes/appcast[.]json.ts b/apps/web/src/routes/appcast[.]json.ts new file mode 100644 index 0000000..910887e --- /dev/null +++ b/apps/web/src/routes/appcast[.]json.ts @@ -0,0 +1,31 @@ +import { createFileRoute } from "@tanstack/react-router"; + +/** + * The in-app update feed, served from ewiz.app so the app never depends on where + * releases are hosted. Every release attaches appcast.xml (Sparkle, the app's + * SUFeedURL) and appcast.json (the old updater) to its GitHub release; this + * proxies the latest one, cached at the edge for five minutes. + */ +const SOURCE = "https://github.com/stroke-app/ewiz/releases/latest/download/appcast.json"; + +export const Route = createFileRoute("/appcast.json")({ + server: { + handlers: { + GET: async () => { + const upstream = await fetch(SOURCE, { + redirect: "follow", + cf: { cacheTtl: 300, cacheEverything: true }, + } as RequestInit); + if (!upstream.ok) { + return new Response("Update feed unavailable", { status: 502 }); + } + return new Response(upstream.body, { + headers: { + "content-type": "application/json; charset=utf-8", + "cache-control": "public, max-age=300", + }, + }); + }, + }, + }, +}); diff --git a/apps/web/src/routes/appcast[.]xml.ts b/apps/web/src/routes/appcast[.]xml.ts new file mode 100644 index 0000000..9c51f23 --- /dev/null +++ b/apps/web/src/routes/appcast[.]xml.ts @@ -0,0 +1,31 @@ +import { createFileRoute } from "@tanstack/react-router"; + +/** + * The in-app update feed, served from ewiz.app so the app never depends on where + * releases are hosted. Every release attaches appcast.xml (Sparkle, the app's + * SUFeedURL) and appcast.json (the old updater) to its GitHub release; this + * proxies the latest one, cached at the edge for five minutes. + */ +const SOURCE = "https://github.com/stroke-app/ewiz/releases/latest/download/appcast.xml"; + +export const Route = createFileRoute("/appcast.xml")({ + server: { + handlers: { + GET: async () => { + const upstream = await fetch(SOURCE, { + redirect: "follow", + cf: { cacheTtl: 300, cacheEverything: true }, + } as RequestInit); + if (!upstream.ok) { + return new Response("Update feed unavailable", { status: 502 }); + } + return new Response(upstream.body, { + headers: { + "content-type": "application/xml; charset=utf-8", + "cache-control": "public, max-age=300", + }, + }); + }, + }, + }, +});