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:
parent
f97f1a7117
commit
e79b0aedd2
2 changed files with 8 additions and 6 deletions
|
|
@ -4,10 +4,14 @@ const DEFAULT_REPO = 'loki5512344/LoVisual-'
|
||||||
export const GITHUB_REPO: string = import.meta.env.VITE_GITHUB_REPO || DEFAULT_REPO
|
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>`
|
* One-click download of the newest build. Served directly from our own origin (not a
|
||||||
* straight to the file, so every release must carry an asset named exactly `lovisual.jar`.
|
* 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. */
|
/** A published GitHub release, narrowed to the fields the download page renders. */
|
||||||
export type Release = {
|
export type Release = {
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,7 @@ afterEach(() => vi.restoreAllMocks())
|
||||||
test('DownloadButton links straight to the latest lovisual.jar', () => {
|
test('DownloadButton links straight to the latest lovisual.jar', () => {
|
||||||
const { container } = withQuery(<DownloadButton />)
|
const { container } = withQuery(<DownloadButton />)
|
||||||
const link = container.querySelector('a')
|
const link = container.querySelector('a')
|
||||||
expect(link?.getAttribute('href')).toBe(
|
expect(link?.getAttribute('href')).toBe('/downloads/lovisual.jar')
|
||||||
'https://github.com/loki5512344/LoVisual-/releases/latest/download/lovisual.jar',
|
|
||||||
)
|
|
||||||
expect(link?.hasAttribute('download')).toBe(true)
|
expect(link?.hasAttribute('download')).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue