fix(cdn): fix cdn replace

This commit is contained in:
kumfo
2024-07-22 14:05:14 +08:00
committed by kumfo
parent 4a92adfcc2
commit 70ddccc27e
2 changed files with 6 additions and 0 deletions
@@ -517,6 +517,9 @@ func (tc *TemplateController) html(ctx *gin.Context, code int, tpl string, siteI
})
if prefix != "" {
if prefix[len(prefix)-1:] == "/" {
prefix = strings.TrimSuffix(prefix, "/")
}
cssPath = prefix + tc.cssPath
for i, path := range tc.scriptPath {
scriptPath[i] = prefix + path
+3
View File
@@ -148,6 +148,9 @@ func (a *UIRouter) Register(r *gin.Engine, baseURLPath string) {
return nil
})
if cdnPrefix != "" {
if cdnPrefix[len(cdnPrefix)-1:] == "/" {
cdnPrefix = strings.TrimSuffix(cdnPrefix, "/")
}
c.String(http.StatusOK, strings.ReplaceAll(string(file), "/static", cdnPrefix+"/static"))
return
}