Add GET /api/v1/download/linux-package
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:
1 parent
bb8de5548d
commit
c70eb4d13c
4 files changed
+44
No files matched your search
@@ -52,6 +52,26 @@ func TestReleaseService(t *testing.T) {
|
||||
assert.ErrorIs(t, err, ErrNotFound)
|
||||
}
|
||||
|
||||
func TestReleaseServiceLinuxBinaryAndPackage(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
json.NewEncoder(w).Encode(giteaRelease{Id: 1, Name: "v1.9.0", Assets: []giteaAsset{
|
||||
{Name: "MusicPlayer_1.9.0.exe", DownloadUrl: "https://example.com/exe"},
|
||||
{Name: "MusicPlayer_1.9.0_linux.tar.gz", DownloadUrl: "https://example.com/package"},
|
||||
{Name: "MusicPlayer_1.9.0.x86_64", DownloadUrl: "https://example.com/binary"},
|
||||
}})
|
||||
}))
|
||||
t.Cleanup(server.Close)
|
||||
r := NewReleaseService(server.URL)
|
||||
ctx := context.Background()
|
||||
|
||||
binary, err := r.AssetURL(ctx, ".x86_64")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "https://example.com/binary", binary)
|
||||
pkg, err := r.AssetURL(ctx, "_linux.tar.gz")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "https://example.com/package", pkg)
|
||||
}
|
||||
|
||||
func TestReleaseServiceCachesRelease(t *testing.T) {
|
||||
server, calls := newGitea(t, http.StatusOK)
|
||||
r := NewReleaseService(server.URL)
|
||||
|
||||
Reference in new issue
Block a user