MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / UpdateIndex

Function UpdateIndex

server/static/static.go:109–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107}
108
109func UpdateIndex() {
110 utils.Log.Debug("Updating index.html with settings...")
111 favicon := setting.GetStr(conf.Favicon)
112 logo := strings.Split(setting.GetStr(conf.Logo), "\n")[0]
113 title := setting.GetStr(conf.SiteTitle)
114 customizeHead := setting.GetStr(conf.CustomizeHead)
115 customizeBody := setting.GetStr(conf.CustomizeBody)
116 mainColor := setting.GetStr(conf.MainColor)
117 utils.Log.Debug("Applying replacements for default pages...")
118 replaceMap1 := map[string]string{
119 "https://res.oplist.org/logo/logo.svg": favicon,
120 "https://res.oplist.org/logo/logo.png": logo,
121 "Loading...": title,
122 "main_color: undefined": fmt.Sprintf("main_color: '%s'", mainColor),
123 }
124 conf.ManageHtml = replaceStrings(conf.RawIndexHtml, replaceMap1)
125 utils.Log.Debug("Applying replacements for manage pages...")
126 replaceMap2 := map[string]string{
127 "<!-- customize head -->": customizeHead,
128 "<!-- customize body -->": customizeBody,
129 }
130 conf.IndexHtml = replaceStrings(conf.ManageHtml, replaceMap2)
131 utils.Log.Debug("Index.html update completed")
132}
133
134func ManifestJSON(c *gin.Context) {
135 // Get site configuration to ensure consistent base path handling

Callers 2

SaveSettingsFunction · 0.92
initIndexFunction · 0.70

Calls 2

GetStrFunction · 0.92
replaceStringsFunction · 0.85

Tested by

no test coverage detected