@@ -41,9 +41,8 @@ func replaceStrings(content string, replacements map[string]string) string {
41
41
return content
42
42
}
43
43
44
- func initIndex () {
44
+ func initIndex (siteConfig SiteConfig ) {
45
45
utils .Log .Debug ("Initializing index.html..." )
46
- siteConfig := getSiteConfig ()
47
46
// dist_dir is empty and cdn is not empty add web_version is empty or beta or dev
48
47
if conf .Conf .DistDir == "" && conf .Conf .Cdn != "" && (conf .WebVersion == "" || conf .WebVersion == "beta" || conf .WebVersion == "dev" ) {
49
48
utils .Log .Infof ("Fetching index.html from CDN: %s/index.html..." , conf .Conf .Cdn )
@@ -89,13 +88,15 @@ func initIndex() {
89
88
func UpdateIndex () {
90
89
utils .Log .Debug ("Updating index.html with settings..." )
91
90
favicon := setting .GetStr (conf .Favicon )
91
+ logo := strings .Split (setting .GetStr (conf .Logo ), "\n " )[0 ]
92
92
title := setting .GetStr (conf .SiteTitle )
93
93
customizeHead := setting .GetStr (conf .CustomizeHead )
94
94
customizeBody := setting .GetStr (conf .CustomizeBody )
95
95
mainColor := setting .GetStr (conf .MainColor )
96
96
utils .Log .Debug ("Applying replacements for default pages..." )
97
97
replaceMap1 := map [string ]string {
98
98
"https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.svg" : favicon ,
99
+ "https://cdn.oplist.org/gh/OpenListTeam/Logo@main/logo.png" : logo ,
99
100
"Loading..." : title ,
100
101
"main_color: undefined" : fmt .Sprintf ("main_color: '%s'" , mainColor ),
101
102
}
@@ -111,8 +112,9 @@ func UpdateIndex() {
111
112
112
113
func Static (r * gin.RouterGroup , noRoute func (handlers ... gin.HandlerFunc )) {
113
114
utils .Log .Debug ("Setting up static routes..." )
115
+ siteConfig := getSiteConfig ()
114
116
initStatic ()
115
- initIndex ()
117
+ initIndex (siteConfig )
116
118
folders := []string {"assets" , "images" , "streamer" , "static" }
117
119
if conf .Conf .Cdn == "" {
118
120
utils .Log .Debug ("Setting up static file serving..." )
@@ -136,7 +138,7 @@ func Static(r *gin.RouterGroup, noRoute func(handlers ...gin.HandlerFunc)) {
136
138
for _ , folder := range folders {
137
139
r .GET (fmt .Sprintf ("/%s/*filepath" , folder ), func (c * gin.Context ) {
138
140
filepath := c .Param ("filepath" )
139
- c .Redirect (http .StatusFound , fmt .Sprintf ("%s/%s%s" , conf . Conf .Cdn , folder , filepath ))
141
+ c .Redirect (http .StatusFound , fmt .Sprintf ("%s/%s%s" , siteConfig .Cdn , folder , filepath ))
140
142
})
141
143
}
142
144
}
0 commit comments