Read theme color from config file (#2365)

* read theme color from config file
* Update manual page
This commit is contained in:
cj
2022-03-09 15:24:13 -06:00
committed by GitHub
parent a05952829c
commit 7bd47c651c
5 changed files with 15 additions and 2 deletions

View File

@@ -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 {