mirror of https://github.com/Xhofe/alist
🚧 remove customize head and body for manage
parent
0fbbd54b0c
commit
925f386bed
|
@ -83,6 +83,7 @@ var (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
RawIndexHtml string
|
RawIndexHtml string
|
||||||
|
ManageHtml string
|
||||||
IndexHtml string
|
IndexHtml string
|
||||||
Token string
|
Token string
|
||||||
|
|
||||||
|
|
|
@ -97,15 +97,15 @@ func LoadSettings() {
|
||||||
favicon, err := GetSettingByKey("favicon")
|
favicon, err := GetSettingByKey("favicon")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
//conf.Favicon = favicon.Value
|
//conf.Favicon = favicon.Value
|
||||||
conf.IndexHtml = strings.Replace(conf.RawIndexHtml, "https://store.heytapimage.com/cdo-portal/feedback/202110/30/d43c41c5d257c9bc36366e310374fb19.png", favicon.Value, 1)
|
conf.ManageHtml = strings.Replace(conf.RawIndexHtml, "https://store.heytapimage.com/cdo-portal/feedback/202110/30/d43c41c5d257c9bc36366e310374fb19.png", favicon.Value, 1)
|
||||||
}
|
}
|
||||||
title, err := GetSettingByKey("title")
|
title, err := GetSettingByKey("title")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
conf.IndexHtml = strings.Replace(conf.IndexHtml, "Loading...", title.Value, 1)
|
conf.ManageHtml = strings.Replace(conf.ManageHtml, "Loading...", title.Value, 1)
|
||||||
}
|
}
|
||||||
customizeHead, err := GetSettingByKey("customize head")
|
customizeHead, err := GetSettingByKey("customize head")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
conf.IndexHtml = strings.Replace(conf.IndexHtml, "<!-- customize head -->", customizeHead.Value, 1)
|
conf.IndexHtml = strings.Replace(conf.ManageHtml, "<!-- customize head -->", customizeHead.Value, 1)
|
||||||
}
|
}
|
||||||
customizeBody, err := GetSettingByKey("customize body")
|
customizeBody, err := GetSettingByKey("customize body")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitIndex() {
|
func InitIndex() {
|
||||||
|
@ -41,7 +42,11 @@ func Static(r *gin.Engine) {
|
||||||
r.NoRoute(func(c *gin.Context) {
|
r.NoRoute(func(c *gin.Context) {
|
||||||
c.Status(200)
|
c.Status(200)
|
||||||
c.Header("Content-Type", "text/html")
|
c.Header("Content-Type", "text/html")
|
||||||
|
if strings.HasPrefix(c.Request.URL.Path, "/@manage") {
|
||||||
|
_, _ = c.Writer.WriteString(conf.ManageHtml)
|
||||||
|
} else {
|
||||||
_, _ = c.Writer.WriteString(conf.IndexHtml)
|
_, _ = c.Writer.WriteString(conf.IndexHtml)
|
||||||
|
}
|
||||||
c.Writer.Flush()
|
c.Writer.Flush()
|
||||||
c.Writer.WriteHeaderNow()
|
c.Writer.WriteHeaderNow()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue