mirror of https://github.com/Xhofe/alist
28 lines
601 B
Go
28 lines
601 B
Go
package static
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/alist-org/alist/v3/internal/conf"
|
|
"github.com/alist-org/alist/v3/pkg/utils"
|
|
)
|
|
|
|
type SiteConfig struct {
|
|
BasePath string
|
|
Cdn string
|
|
}
|
|
|
|
func getSiteConfig() SiteConfig {
|
|
siteConfig := SiteConfig{
|
|
BasePath: conf.URL.Path,
|
|
Cdn: strings.ReplaceAll(strings.TrimSuffix(conf.Conf.Cdn, "/"), "$version", conf.WebVersion),
|
|
}
|
|
if siteConfig.BasePath != "" {
|
|
siteConfig.BasePath = utils.FixAndCleanPath(siteConfig.BasePath)
|
|
}
|
|
if siteConfig.Cdn == "" {
|
|
siteConfig.Cdn = strings.TrimSuffix(siteConfig.BasePath, "/")
|
|
}
|
|
return siteConfig
|
|
}
|