mirror of https://github.com/stashapp/stash.git
Read theme color from config file (#2365)
* read theme color from config file * Update manual page
This commit is contained in:
parent
a05952829c
commit
7bd47c651c
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1"
|
||||
/>
|
||||
<meta name="theme-color" content="#202b33" />
|
||||
<meta name="theme-color" content="%COLOR%" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
### 🎨 Improvements
|
||||
* Allow customisation of UI theme color using `theme_color` property in `config.yml` ([#2365](https://github.com/stashapp/stash/pull/2365))
|
||||
* Improved autotag performance. ([#2368](https://github.com/stashapp/stash/pull/2368))
|
||||
|
|
|
@ -120,6 +120,7 @@ These options are typically not exposed in the UI and must be changed manually i
|
|||
| `custom_served_folders` | A map of URLs to file system folders. See below. |
|
||||
| `custom_ui_location` | The file system folder where the UI files will be served from, instead of using the embedded UI. Empty to disable. Stash must be restarted to take effect. |
|
||||
| `max_upload_size` | Maximum file upload size for import files. Defaults to 1GB. |
|
||||
| `theme_color` | Sets the `theme-color` property in the UI. |
|
||||
|
||||
### Custom served folders
|
||||
|
||||
|
|
Loading…
Reference in New Issue