mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Read theme color from config file (#2365)
* read theme color from config file * Update manual page
This commit is contained in:
@@ -206,13 +206,15 @@ func Start(uiBox embed.FS, loginUIBox embed.FS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ext == ".html" || ext == "" {
|
if ext == ".html" || ext == "" {
|
||||||
|
themeColor := c.GetThemeColor()
|
||||||
data, err := uiBox.ReadFile(uiRootDir + "/index.html")
|
data, err := uiBox.ReadFile(uiRootDir + "/index.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix := getProxyPrefix(r.Header)
|
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)
|
baseURLIndex = strings.Replace(baseURLIndex, "base href=\"/\"", fmt.Sprintf("base href=\"%s\"", prefix+"/"), 1)
|
||||||
_, _ = w.Write([]byte(baseURLIndex))
|
_, _ = w.Write([]byte(baseURLIndex))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ const (
|
|||||||
HandyKey = "handy_key"
|
HandyKey = "handy_key"
|
||||||
FunscriptOffset = "funscript_offset"
|
FunscriptOffset = "funscript_offset"
|
||||||
|
|
||||||
|
ThemeColor = "theme_color"
|
||||||
|
DefaultThemeColor = "#202b33"
|
||||||
|
|
||||||
// Security
|
// Security
|
||||||
dangerousAllowPublicWithoutAuth = "dangerous_allow_public_without_auth"
|
dangerousAllowPublicWithoutAuth = "dangerous_allow_public_without_auth"
|
||||||
dangerousAllowPublicWithoutAuthDefault = "false"
|
dangerousAllowPublicWithoutAuthDefault = "false"
|
||||||
@@ -619,6 +622,10 @@ func (i *Instance) GetPort() int {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Instance) GetThemeColor() string {
|
||||||
|
return i.getString(ThemeColor)
|
||||||
|
}
|
||||||
|
|
||||||
func (i *Instance) GetExternalHost() string {
|
func (i *Instance) GetExternalHost() string {
|
||||||
return i.getString(ExternalHost)
|
return i.getString(ExternalHost)
|
||||||
}
|
}
|
||||||
@@ -1175,6 +1182,8 @@ func (i *Instance) setDefaultValues(write bool) error {
|
|||||||
i.main.SetDefault(PreviewAudio, previewAudioDefault)
|
i.main.SetDefault(PreviewAudio, previewAudioDefault)
|
||||||
i.main.SetDefault(SoundOnPreview, false)
|
i.main.SetDefault(SoundOnPreview, false)
|
||||||
|
|
||||||
|
i.main.SetDefault(ThemeColor, DefaultThemeColor)
|
||||||
|
|
||||||
i.main.SetDefault(WriteImageThumbnails, writeImageThumbnailsDefault)
|
i.main.SetDefault(WriteImageThumbnails, writeImageThumbnailsDefault)
|
||||||
|
|
||||||
i.main.SetDefault(Database, defaultDatabaseFilePath)
|
i.main.SetDefault(Database, defaultDatabaseFilePath)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
name="viewport"
|
name="viewport"
|
||||||
content="width=device-width, initial-scale=1, maximum-scale=1"
|
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
|
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/
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
### 🎨 Improvements
|
### 🎨 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))
|
* 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_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. |
|
| `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. |
|
| `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
|
### Custom served folders
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user