fix(jellycompat): include Wholphin display preference dimensions (#102)

This commit is contained in:
Quick
2026-06-08 22:36:07 -04:00
committed by GitHub
parent 5855cebe75
commit 2fa30379ad
2 changed files with 39 additions and 10 deletions
+12 -10
View File
@@ -14,16 +14,18 @@ import (
// displayPreferencesDTO mirrors Jellyfin's DisplayPreferences response.
type displayPreferencesDTO struct {
ID string `json:"Id"`
SortBy string `json:"SortBy"`
SortOrder string `json:"SortOrder"`
RememberIndexing bool `json:"RememberIndexing"`
RememberSorting bool `json:"RememberSorting"`
ScrollDirection string `json:"ScrollDirection"`
ShowBackdrop bool `json:"ShowBackdrop"`
ShowSidebar bool `json:"ShowSidebar"`
Client string `json:"Client"`
CustomPrefs map[string]string `json:"CustomPrefs"`
ID string `json:"Id"`
SortBy string `json:"SortBy"`
SortOrder string `json:"SortOrder"`
RememberIndexing bool `json:"RememberIndexing"`
RememberSorting bool `json:"RememberSorting"`
ScrollDirection string `json:"ScrollDirection"`
ShowBackdrop bool `json:"ShowBackdrop"`
ShowSidebar bool `json:"ShowSidebar"`
PrimaryImageHeight int `json:"PrimaryImageHeight"`
PrimaryImageWidth int `json:"PrimaryImageWidth"`
Client string `json:"Client"`
CustomPrefs map[string]string `json:"CustomPrefs"`
}
// DisplayPreferencesHandler serves Jellyfin display preferences endpoints,
@@ -0,0 +1,27 @@
package jellycompat
import (
"encoding/json"
"testing"
)
func TestDefaultDisplayPreferencesIncludesRequiredImageDimensions(t *testing.T) {
dto := defaultDisplayPreferences("default", "Wholphin")
body, err := json.Marshal(dto)
if err != nil {
t.Fatalf("marshal default display preferences: %v", err)
}
var raw map[string]any
if err := json.Unmarshal(body, &raw); err != nil {
t.Fatalf("unmarshal default display preferences: %v", err)
}
if _, ok := raw["PrimaryImageHeight"]; !ok {
t.Fatal("PrimaryImageHeight missing from display preferences JSON")
}
if _, ok := raw["PrimaryImageWidth"]; !ok {
t.Fatal("PrimaryImageWidth missing from display preferences JSON")
}
}