fix: cancel api replace to avoid missing host

pull/3556/head
Andy Hsu 2023-02-21 19:45:09 +08:00
parent e39299bfe2
commit 50579fef84
2 changed files with 0 additions and 3 deletions

View File

@ -8,14 +8,12 @@ import (
)
type SiteConfig struct {
ApiURL string
BasePath string
Cdn string
}
func getSiteConfig() SiteConfig {
siteConfig := SiteConfig{
ApiURL: conf.Conf.SiteURL,
BasePath: conf.URL.Path,
Cdn: strings.ReplaceAll(strings.TrimSuffix(conf.Conf.Cdn, "/"), "$version", conf.WebVersion),
}

View File

@ -29,7 +29,6 @@ func InitIndex() {
replaceMap := map[string]string{
"cdn: undefined": fmt.Sprintf("cdn: '%s'", siteConfig.Cdn),
"base_path: undefined": fmt.Sprintf("base_path: '%s'", siteConfig.BasePath),
"api: undefined": fmt.Sprintf("api: '%s'", siteConfig.ApiURL),
}
for k, v := range replaceMap {
conf.RawIndexHtml = strings.Replace(conf.RawIndexHtml, k, v, 1)