🔧 change customize settings

This commit is contained in:
微凉 2021-12-05 13:43:08 +08:00
parent bdc1f68746
commit 809850321a
3 changed files with 28 additions and 17 deletions

View File

@ -36,14 +36,14 @@ func InitSettings() {
},
{
Key: "logo",
Value: "https://store.heytapimage.com/cdo-portal/feedback/202110/30/d43c41c5d257c9bc36366e310374fb19.png",
Value: "https://store.heytapimage.com/cdo-portal/feedback/202112/05/1542f45f86b8609495b69c5380753135.png",
Description: "logo",
Type: "string",
Group: model.PUBLIC,
},
{
Key: "favicon",
Value: "https://store.heytapimage.com/cdo-portal/feedback/202110/30/d43c41c5d257c9bc36366e310374fb19.png",
Value: "https://store.heytapimage.com/cdo-portal/feedback/202112/05/1542f45f86b8609495b69c5380753135.png",
Description: "favicon",
Type: "string",
Group: model.PUBLIC,
@ -114,17 +114,34 @@ func InitSettings() {
Group: model.PRIVATE,
},
{
Key: "customize style",
Value: "",
Key: "customize head",
Value: `<style>
.chakra-ui-light{
background-image: linear-gradient(120deg,#e0c3fc 0%,#8ec5fc 100%) !important;
background-attachment: fixed;
}
.main-box {
border-radius: 15px !important;
}
.chakra-ui-light .main-box {
background-color: white !important;
}
.chakra-ui-light .readme-box {
background-color: white !important;
}
.readme-box {
border-radius: 15px !important;
}
</style>`,
Type: "text",
Description: "customize style, don't need add <style></style>",
Description: "Customize head, placed at the beginning of the head",
Group: model.PRIVATE,
},
{
Key: "customize script",
Key: "customize body",
Value: "",
Type: "text",
Description: "customize script, don't need add <script></script>",
Description: "Customize script, placed at the end of the body",
Group: model.PRIVATE,
},
{

View File

@ -41,9 +41,6 @@ var (
RawIndexHtml string
IndexHtml string
CheckParent bool
//CustomizeStyle string
//CustomizeScript string
//Favicon string
CheckDown bool
DavUsername string

View File

@ -72,18 +72,15 @@ func LoadSettings() {
}
title, err := GetSettingByKey("title")
if err == nil {
//conf.CustomizeStyle = customizeStyle.Value
conf.IndexHtml = strings.Replace(conf.IndexHtml, "Loading...", title.Value, 1)
}
customizeStyle, err := GetSettingByKey("customize style")
customizeHead, err := GetSettingByKey("customize head")
if err == nil {
//conf.CustomizeStyle = customizeStyle.Value
conf.IndexHtml = strings.Replace(conf.IndexHtml, "/* customize-style */", customizeStyle.Value, 1)
conf.IndexHtml = strings.Replace(conf.IndexHtml, "<!-- customize head -->", customizeHead.Value, 1)
}
customizeScript, err := GetSettingByKey("customize script")
customizeBody, err := GetSettingByKey("customize body")
if err == nil {
//conf.CustomizeStyle = customizeScript.Value
conf.IndexHtml = strings.Replace(conf.IndexHtml, "// customize-js", customizeScript.Value, 1)
conf.IndexHtml = strings.Replace(conf.IndexHtml, "<!-- customize body -->", customizeBody.Value, 1)
}
davUsername, err := GetSettingByKey("WebDAV username")