🎇 close #512 favicon redirect

pull/548/head
Xhofe 2022-02-08 18:07:13 +08:00
parent bef3d2f88d
commit 4f81735af6
5 changed files with 14 additions and 3 deletions

View File

@ -74,7 +74,7 @@ func InitSettings() {
}, },
{ {
Key: "music cover", Key: "music cover",
Value: "https://store.heytapimage.com/cdo-portal/feedback/202110/30/d43c41c5d257c9bc36366e310374fb19.png", Value: "https://cdn.jsdelivr.net/gh/alist-org/logo@main/circle_center.svg",
Description: "music cover image", Description: "music cover image",
Type: "string", Type: "string",
Access: model.PUBLIC, Access: model.PUBLIC,

View File

@ -78,7 +78,7 @@ var (
"check parent folder", "check down link", "WebDAV username", "WebDAV password", "check parent folder", "check down link", "WebDAV username", "WebDAV password",
"Visitor WebDAV username", "Visitor WebDAV password", "Visitor WebDAV username", "Visitor WebDAV password",
"default page size", "load type", "default page size", "load type",
"ocr api", "ocr api", "favicon",
} }
) )

View File

@ -97,7 +97,7 @@ 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.ManageHtml = 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://cdn.jsdelivr.net/gh/alist-org/logo@main/logo.svg", favicon.Value, 1)
} }
title, err := GetSettingByKey("title") title, err := GetSettingByKey("title")
if err == nil { if err == nil {

View File

@ -0,0 +1,10 @@
package controllers
import (
"github.com/Xhofe/alist/conf"
"github.com/gin-gonic/gin"
)
func Favicon(c *gin.Context) {
c.Redirect(302, conf.GetStr("favicon"))
}

View File

@ -15,6 +15,7 @@ func InitApiRouter(r *gin.Engine) {
Cors(r) Cors(r)
r.GET("/d/*path", middlewares.DownCheck, controllers.Down) r.GET("/d/*path", middlewares.DownCheck, controllers.Down)
r.GET("/p/*path", middlewares.DownCheck, controllers.Proxy) r.GET("/p/*path", middlewares.DownCheck, controllers.Proxy)
r.GET("/favicon.ico", controllers.Favicon)
api := r.Group("/api") api := r.Group("/api")
public := api.Group("/public") public := api.Group("/public")