fix(download): serve lovisual.jar from our own origin, not GitHub

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
This commit is contained in:
loki5512344 2026-09-28 22:32:21 +02:00
parent f97f1a7117
commit e79b0aedd2
Signed by: boba
GPG key ID: 253067914055423B
2 changed files with 8 additions and 6 deletions

View file

@ -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/<asset>`
* 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 = {

View file

@ -23,9 +23,7 @@ afterEach(() => vi.restoreAllMocks())
test('DownloadButton links straight to the latest lovisual.jar', () => {
const { container } = withQuery(<DownloadButton />)
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)
})