0.3.03
This commit is contained in:
@@ -62,6 +62,7 @@ var configurationCatalogue = []configurationDefinition{
|
||||
{Key: "continueWatching.enabled", Name: "Continue Watching", Description: "Show the Continue Watching row.", Type: "boolean", Scopes: []string{"global", "user", "device"}, Default: true},
|
||||
{Key: "continueWatching.showNextUp", Name: "Continue Watching: Next Up", Description: "Include an unstarted next episode in Continue Watching.", Type: "boolean", Scopes: []string{"global", "user", "device"}, Default: true},
|
||||
{Key: "continueWatching.progressColour", Name: "Progress bar colour", Description: "Choose the progress bar treatment.", Type: "enum", Scopes: []string{"global", "user", "device"}, Default: "emby", Options: []string{"emby", "white"}},
|
||||
{Key: "presentation.fontFamily", Name: "App font family", Description: "Choose the bundled font used in Memby’s typography trial areas.", Type: "enum", Scopes: []string{"global"}, Default: "system", Options: []string{"system", "inter"}},
|
||||
{Key: "ratings.enabled", Name: "Ratings", Description: "Show ratings throughout the catalogue.", Type: "boolean", Scopes: []string{"global", "user", "device"}, Default: true},
|
||||
{Key: "genres.enabled", Name: "Genres", Description: "Show genre browsing controls.", Type: "boolean", Scopes: []string{"global", "user", "device"}, Default: true},
|
||||
{Key: "trailers.enabled", Name: "Trailers", Description: "Offer trailers where available.", Type: "boolean", Scopes: []string{"global", "device", "experimental"}, Default: true},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
@@ -75,6 +76,19 @@ func TestContinueWatchingIsServerControlledAndOnByDefault(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppFontFamilyIsAValidatedGlobalConfiguration(t *testing.T) {
|
||||
definition, ok := configurationDefinitionFor("presentation.fontFamily")
|
||||
if !ok || definition.Type != "enum" || len(definition.Scopes) != 1 || definition.Scopes[0] != "global" {
|
||||
t.Fatalf("font family definition = %+v, found=%v", definition, ok)
|
||||
}
|
||||
if err := validateConfigurationValue(definition, json.RawMessage(`"inter"`)); err != nil {
|
||||
t.Fatalf("Inter was rejected: %v", err)
|
||||
}
|
||||
if err := validateConfigurationValue(definition, json.RawMessage(`"unknown"`)); err == nil {
|
||||
t.Fatal("unknown font family was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientCapabilitiesAreNormalizedAndBounded(t *testing.T) {
|
||||
req := httptest.NewRequest(http.MethodGet, "/v1/status", nil)
|
||||
req.Header.Set("X-Memby-Capabilities", " Sonarr_Preroll_V1,server_features_v1,sonarr_preroll_v1,"+
|
||||
|
||||
@@ -107,6 +107,10 @@ func applyGlobalConfiguration(document *config.RemoteConfig, policy store.Featur
|
||||
if v, ok := value.(string); ok {
|
||||
document.ContinueWatching.ProgressColour = v
|
||||
}
|
||||
case "presentation.fontFamily":
|
||||
if v, ok := value.(string); ok && (v == "system" || v == "inter") {
|
||||
document.Presentation.FontFamily = v
|
||||
}
|
||||
case "home.heroRefreshSeconds":
|
||||
if v, ok := value.(float64); ok {
|
||||
document.Home.HeroRefreshSeconds = int(v)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/ponzischeme89/memby/server/internal/config"
|
||||
"github.com/ponzischeme89/memby/server/internal/store"
|
||||
)
|
||||
|
||||
func TestRemoteConfigSupportsETagRevalidationWithoutAuthentication(t *testing.T) {
|
||||
@@ -31,3 +33,15 @@ func TestRemoteConfigSupportsETagRevalidationWithoutAuthentication(t *testing.T)
|
||||
t.Fatalf("revalidation status = %d", second.Code)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGlobalFontFamilyConfigurationIsDelivered(t *testing.T) {
|
||||
document := config.DefaultRemoteConfig()
|
||||
policy := store.DefaultFeaturePolicy()
|
||||
policy.Values["presentation.fontFamily"] = json.RawMessage(`"inter"`)
|
||||
|
||||
applyGlobalConfiguration(&document, policy)
|
||||
|
||||
if document.Presentation.FontFamily != "inter" {
|
||||
t.Fatalf("font family = %q, want inter", document.Presentation.FontFamily)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user