mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-20 12:46:17 +08:00

* Revert "fix(ci):fixed webversion (#332)"
This reverts commit 9e69b2aaa3
.
* Fixed webversion
Signed-off-by: Suyunjing <69945917+Suyunmeng@users.noreply.github.com>
---------
Signed-off-by: Suyunjing <69945917+Suyunmeng@users.noreply.github.com>
28 lines
633 B
Go
28 lines
633 B
Go
package static
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/OpenListTeam/OpenList/internal/conf"
|
|
"github.com/OpenListTeam/OpenList/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", strings.TrimPrefix(conf.WebVersion, "v"),),
|
|
}
|
|
if siteConfig.BasePath != "" {
|
|
siteConfig.BasePath = utils.FixAndCleanPath(siteConfig.BasePath)
|
|
}
|
|
if siteConfig.Cdn == "" {
|
|
siteConfig.Cdn = strings.TrimSuffix(siteConfig.BasePath, "/")
|
|
}
|
|
return siteConfig
|
|
}
|