chore: add base path setting

refactor/fs
Noah Hsu 2022-07-02 16:43:07 +08:00
parent fb23758d12
commit 9ba7cf0835
3 changed files with 5 additions and 3 deletions

View File

@ -68,7 +68,8 @@ func initialSettings() {
initialSettingItems = []model.SettingItem{
// site settings
{Key: conf.VERSION, Value: conf.Version, Type: conf.TypeString, Group: model.SITE, Flag: model.READONLY},
{Key: conf.BaseUrl, Value: "", Type: conf.TypeString, Group: model.SITE},
{Key: conf.ApiUrl, Value: "", Type: conf.TypeString, Group: model.SITE},
{Key: conf.BasePath, Value: "", Type: conf.TypeString, Group: model.SITE},
{Key: conf.SiteTitle, Value: "AList", Type: conf.TypeString, Group: model.SITE},
{Key: conf.SiteLogo, Value: "https://cdn.jsdelivr.net/gh/alist-org/logo@main/logo.svg", Type: conf.TypeString, Group: model.SITE},
{Key: conf.Favicon, Value: "https://cdn.jsdelivr.net/gh/alist-org/logo@main/logo.svg", Type: conf.TypeString, Group: model.SITE},

View File

@ -10,7 +10,8 @@ const (
const (
VERSION = "version"
BaseUrl = "base_url"
ApiUrl = "api_url"
BasePath = "base_path"
SiteTitle = "site_title"
SiteLogo = "site_logo"
Favicon = "favicon"

View File

@ -9,7 +9,7 @@ import (
)
func GetBaseUrl(r *http.Request) string {
baseUrl := setting.GetByKey(conf.BaseUrl)
baseUrl := setting.GetByKey(conf.ApiUrl)
protocol := "http"
if r.TLS != nil {
protocol = "https"