From e79b0aedd20b3c9f905f11e4cd52a4c3df3c827d Mon Sep 17 00:00:00 2001 From: loki5512344 Date: Mon, 28 Sep 2026 22:32:21 +0200 Subject: [PATCH] fix(download): serve lovisual.jar from our own origin, not GitHub MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The download button pointed at a github.com releases redirect and the changelog at the GitHub API — both unreachable if GitHub itself is blocked for a visitor. The button now links to /downloads/lovisual.jar, served directly from the site's own nginx. Release notes still read the GitHub API (already degrades gracefully to an empty-state message if that fails) since that's changelog content, not the actual download. Claude-Session: https://claude.ai/code/session_01F1M1Jic1wTSn4igUENynmZ --- frontend/src/features/download/api.ts | 10 +++++++--- frontend/src/features/download/tests/download.test.tsx | 4 +--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/features/download/api.ts b/frontend/src/features/download/api.ts index 0d97847..93370e8 100644 --- a/frontend/src/features/download/api.ts +++ b/frontend/src/features/download/api.ts @@ -4,10 +4,14 @@ const DEFAULT_REPO = 'loki5512344/LoVisual-' export const GITHUB_REPO: string = import.meta.env.VITE_GITHUB_REPO || DEFAULT_REPO /** - * One-click download of the newest build: GitHub redirects `releases/latest/download/` - * straight to the file, so every release must carry an asset named exactly `lovisual.jar`. + * One-click download of the newest build. Served directly from our own origin (not a + * github.com redirect) so the button keeps working even where GitHub itself is blocked. + * The file at `/downloads/lovisual.jar` on the server is NOT rebuilt automatically — + * whoever cuts a mod release has to `./gradlew build` and re-upload it there by hand + * (this is a separate Gradle project from the site, deliberately not wired into + * `backend/deploy/deploy.sh`). */ -export const DOWNLOAD_URL = `https://github.com/${GITHUB_REPO}/releases/latest/download/lovisual.jar` +export const DOWNLOAD_URL = '/downloads/lovisual.jar' /** A published GitHub release, narrowed to the fields the download page renders. */ export type Release = { diff --git a/frontend/src/features/download/tests/download.test.tsx b/frontend/src/features/download/tests/download.test.tsx index 4c26657..92579b0 100644 --- a/frontend/src/features/download/tests/download.test.tsx +++ b/frontend/src/features/download/tests/download.test.tsx @@ -23,9 +23,7 @@ afterEach(() => vi.restoreAllMocks()) test('DownloadButton links straight to the latest lovisual.jar', () => { const { container } = withQuery() const link = container.querySelector('a') - expect(link?.getAttribute('href')).toBe( - 'https://github.com/loki5512344/LoVisual-/releases/latest/download/lovisual.jar', - ) + expect(link?.getAttribute('href')).toBe('/downloads/lovisual.jar') expect(link?.hasAttribute('download')).toBe(true) })