Add GET /api/v1/download/linux-package
CI / docker (push) Failing after 20s
CI / test (push) Successful in 23s
CI / integration (push) Successful in 25s
CI / publish (push) Skipped

Redirects to the newest MusicPlayer release's _linux.tar.gz, which has the
icon, a menu entry and install.sh. /download/linux keeps serving the bare
.x86_64, which updating in place needs. Releases without the package get 404.

Closes #34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SansanandClaude Opus 5.5 committed 2026-10-15 19:40:22 +02:00
1 parent bb8de5548d
commit c70eb4d13c
4 files changed
+44

No files matched your search

+20
View File
@@ -222,7 +222,27 @@ func TestDownloadEndpoints(t *testing.T) {
assert.Equal(t, http.StatusFound, rec.Code)
assert.Equal(t, "https://example.com/Player.exe", rec.Header().Get("Location"))
// A release without Linux files, like those before 1.9.
assert.Equal(t, http.StatusNotFound, e.do(http.MethodGet, "/api/v1/download/linux").Code)
assert.Equal(t, http.StatusNotFound, e.do(http.MethodGet, "/api/v1/download/linux-package").Code)
}
func TestDownloadLinuxBinaryAndPackage(t *testing.T) {
gitea := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`{"id":1,"name":"v1.9.0","assets":[` +
`{"name":"MusicPlayer_1.9.0_linux.tar.gz","browser_download_url":"https://example.com/package"},` +
`{"name":"MusicPlayer_1.9.0.x86_64","browser_download_url":"https://example.com/binary"}]}`))
}))
t.Cleanup(gitea.Close)
e := newTestEnv(t, func(c *config.Config) { c.ReleasesURL = gitea.URL })
rec := e.do(http.MethodGet, "/api/v1/download/linux")
assert.Equal(t, http.StatusFound, rec.Code)
assert.Equal(t, "https://example.com/binary", rec.Header().Get("Location"), "the bare binary, for updating in place")
rec = e.do(http.MethodGet, "/api/v1/download/linux-package")
assert.Equal(t, http.StatusFound, rec.Code)
assert.Equal(t, "https://example.com/package", rec.Header().Get("Location"))
}
func TestDownloadUpstreamDown(t *testing.T) {