diff --git a/conf/configuration.go b/conf/configuration.go index 439aee50e..8ec09d928 100644 --- a/conf/configuration.go +++ b/conf/configuration.go @@ -856,7 +856,7 @@ func setViperDefaults() { viper.SetDefault("listenbrainz.artistalgorithm", consts.DefaultListenBrainzArtistAlgorithm) viper.SetDefault("listenbrainz.trackalgorithm", consts.DefaultListenBrainzTrackAlgorithm) viper.SetDefault("jellyfin.enabled", false) - viper.SetDefault("jellyfin.servername", "Navidrome") + viper.SetDefault("jellyfin.servername", "") viper.SetDefault("enablescrobblehistory", true) viper.SetDefault("httpheaders.frameoptions", "DENY") viper.SetDefault("backup.path", "") diff --git a/server/jellyfin/system.go b/server/jellyfin/system.go index 207e2f366..93cd558dd 100644 --- a/server/jellyfin/system.go +++ b/server/jellyfin/system.go @@ -2,6 +2,7 @@ package jellyfin import ( "context" + "fmt" "net/http" "github.com/google/uuid" @@ -11,11 +12,16 @@ import ( "github.com/navidrome/navidrome/server/jellyfin/dto" ) +// jellyfinVersion is the Jellyfin API version we advertise in the handshake. Clients parse +// Version as a Jellyfin release and feature-gate on it, so it must stay a real Jellyfin +// version rather than Navidrome's own. +const jellyfinVersion = "10.8.13" + func (api *Router) serverName() string { if conf.Server.Jellyfin.ServerName != "" { return conf.Server.Jellyfin.ServerName } - return consts.AppName + return fmt.Sprintf("Navidrome %s", consts.Version) } // serverID returns a stable Id that survives restarts, get-or-created in the Property table @@ -46,7 +52,7 @@ func (api *Router) serverID(ctx context.Context) string { func (api *Router) publicInfo(ctx context.Context) dto.PublicSystemInfo { return dto.PublicSystemInfo{ ServerName: api.serverName(), - Version: consts.Version, + Version: jellyfinVersion, ProductName: "Jellyfin Server", Id: api.serverID(ctx), StartupWizardCompleted: true, diff --git a/server/jellyfin/system_test.go b/server/jellyfin/system_test.go index 7f82f5159..e0a0c89a1 100644 --- a/server/jellyfin/system_test.go +++ b/server/jellyfin/system_test.go @@ -6,6 +6,8 @@ import ( "net/http" "net/http/httptest" + "github.com/navidrome/navidrome/conf" + "github.com/navidrome/navidrome/conf/configtest" "github.com/navidrome/navidrome/server/jellyfin/dto" "github.com/navidrome/navidrome/tests" . "github.com/onsi/ginkgo/v2" @@ -17,6 +19,9 @@ var _ = Describe("System", func() { BeforeEach(func() { api = &Router{} }) It("returns public system info without auth", func() { + DeferCleanup(configtest.SetupConfig()) + conf.Server.Jellyfin.ServerName = "" + w := httptest.NewRecorder() r := httptest.NewRequest("GET", "/System/Info/Public", nil) api.getPublicSystemInfo(w, r) @@ -26,8 +31,9 @@ var _ = Describe("System", func() { var info dto.PublicSystemInfo Expect(json.Unmarshal(w.Body.Bytes(), &info)).To(Succeed()) Expect(info.Id).ToNot(BeEmpty()) - Expect(info.Version).ToNot(BeEmpty()) + Expect(info.Version).To(Equal(jellyfinVersion)) Expect(info.ProductName).To(Equal("Jellyfin Server")) + Expect(info.ServerName).To(HavePrefix("Navidrome")) }) It("responds to ping with the server name", func() {