mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
Wire up GET /System/Info returning the previously unused dto.SystemInfo, available to any authenticated user, matching real Jellyfin's authorization (FirstTimeSetupOrIgnoreParentalControl, not admin-only). Feishin calls this endpoint on connect and reads Version to feature-gate; it previously got the unhandled-route 404. The advertised version stays 10.8.13: Feishin unlocks structured lyrics and public-playlist share permissions at >=10.9.0, and this API serves neither (no lyrics endpoint; playlist user permissions are stubs), so a higher version would falsely advertise capabilities.
77 lines
2.3 KiB
Go
77 lines
2.3 KiB
Go
package e2e
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("System", func() {
|
|
BeforeEach(func() { setupTestDB() })
|
|
|
|
Describe("GET /System/Info/Public", func() {
|
|
It("returns public server info without authentication", func() {
|
|
w := rawReq("GET", "/System/Info/Public", "")
|
|
Expect(w.Code).To(Equal(http.StatusOK))
|
|
var info map[string]any
|
|
parseInto(w, &info)
|
|
Expect(info["ServerName"]).To(HavePrefix("Navidrome"))
|
|
Expect(info["ProductName"]).To(Equal("Jellyfin Server"))
|
|
Expect(info["StartupWizardCompleted"]).To(BeTrue())
|
|
Expect(info["Id"]).ToNot(BeEmpty())
|
|
Expect(info["Version"]).ToNot(BeEmpty())
|
|
})
|
|
|
|
It("routes case-insensitively (lowercase path)", func() {
|
|
w := rawReq("GET", "/system/info/public", "")
|
|
Expect(w.Code).To(Equal(http.StatusOK))
|
|
})
|
|
})
|
|
|
|
Describe("GET /System/Info", func() {
|
|
It("returns system info to any authenticated user, matching the public Version", func() {
|
|
w := getAs(regularUser, "/System/Info")
|
|
var info map[string]any
|
|
parseInto(w, &info)
|
|
Expect(info["Version"]).ToNot(BeEmpty())
|
|
Expect(info["SupportsLibraryMonitor"]).To(BeTrue())
|
|
|
|
pub := rawReq("GET", "/System/Info/Public", "")
|
|
var pubInfo map[string]any
|
|
parseInto(pub, &pubInfo)
|
|
Expect(info["Version"]).To(Equal(pubInfo["Version"]))
|
|
Expect(info["Id"]).To(Equal(pubInfo["Id"]))
|
|
})
|
|
|
|
It("rejects unauthenticated requests", func() {
|
|
w := rawReq("GET", "/System/Info", "")
|
|
Expect(w.Code).To(Equal(http.StatusUnauthorized))
|
|
})
|
|
})
|
|
|
|
Describe("GET/POST /System/Ping", func() {
|
|
It("answers GET with a plain-text server name", func() {
|
|
w := rawReq("GET", "/System/Ping", "")
|
|
Expect(w.Code).To(Equal(http.StatusOK))
|
|
Expect(w.Header().Get("Content-Type")).To(HavePrefix("text/plain"))
|
|
Expect(w.Body.String()).To(HavePrefix("Navidrome"))
|
|
})
|
|
|
|
It("answers POST identically", func() {
|
|
w := rawReq("POST", "/System/Ping", "")
|
|
Expect(w.Code).To(Equal(http.StatusOK))
|
|
Expect(strings.TrimSpace(w.Body.String())).To(HavePrefix("Navidrome"))
|
|
})
|
|
})
|
|
|
|
Describe("GET /QuickConnect/Enabled", func() {
|
|
It("reports QuickConnect disabled", func() {
|
|
w := rawReq("GET", "/QuickConnect/Enabled", "")
|
|
Expect(w.Code).To(Equal(http.StatusOK))
|
|
Expect(strings.TrimSpace(w.Body.String())).To(Equal("false"))
|
|
})
|
|
})
|
|
})
|