diff --git a/pkg/api/server.go b/pkg/api/server.go index cf5f4041a..b162312d3 100644 --- a/pkg/api/server.go +++ b/pkg/api/server.go @@ -206,13 +206,15 @@ func Start(uiBox embed.FS, loginUIBox embed.FS) { } if ext == ".html" || ext == "" { + themeColor := c.GetThemeColor() data, err := uiBox.ReadFile(uiRootDir + "/index.html") if err != nil { panic(err) } prefix := getProxyPrefix(r.Header) - baseURLIndex := strings.ReplaceAll(string(data), "/%BASE_URL%", prefix) + baseURLIndex := strings.ReplaceAll(string(data), "%COLOR%", themeColor) + baseURLIndex = strings.ReplaceAll(baseURLIndex, "/%BASE_URL%", prefix) baseURLIndex = strings.Replace(baseURLIndex, "base href=\"/\"", fmt.Sprintf("base href=\"%s\"", prefix+"/"), 1) _, _ = w.Write([]byte(baseURLIndex)) } else { diff --git a/pkg/manager/config/config.go b/pkg/manager/config/config.go index 07780db8c..9af0070a0 100644 --- a/pkg/manager/config/config.go +++ b/pkg/manager/config/config.go @@ -151,6 +151,9 @@ const ( HandyKey = "handy_key" FunscriptOffset = "funscript_offset" + ThemeColor = "theme_color" + DefaultThemeColor = "#202b33" + // Security dangerousAllowPublicWithoutAuth = "dangerous_allow_public_without_auth" dangerousAllowPublicWithoutAuthDefault = "false" @@ -619,6 +622,10 @@ func (i *Instance) GetPort() int { return ret } +func (i *Instance) GetThemeColor() string { + return i.getString(ThemeColor) +} + func (i *Instance) GetExternalHost() string { return i.getString(ExternalHost) } @@ -1175,6 +1182,8 @@ func (i *Instance) setDefaultValues(write bool) error { i.main.SetDefault(PreviewAudio, previewAudioDefault) i.main.SetDefault(SoundOnPreview, false) + i.main.SetDefault(ThemeColor, DefaultThemeColor) + i.main.SetDefault(WriteImageThumbnails, writeImageThumbnailsDefault) i.main.SetDefault(Database, defaultDatabaseFilePath) diff --git a/ui/v2.5/index.html b/ui/v2.5/index.html index f103a9650..5a1a71ce2 100755 --- a/ui/v2.5/index.html +++ b/ui/v2.5/index.html @@ -9,7 +9,7 @@ name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> - +