feat: fs link api

This commit is contained in:
Noah Hsu
2022-06-29 16:08:55 +08:00
parent f275f83de0
commit 40548926e6
11 changed files with 174 additions and 96 deletions

18
server/common/base.go Normal file
View File

@ -0,0 +1,18 @@
package common
import (
"fmt"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/setting"
"net/http"
"strings"
)
func GetBaseUrl(r *http.Request) string {
baseUrl := setting.GetByKey(conf.BaseUrl)
if baseUrl == "" {
baseUrl = fmt.Sprintf("//%s", r.Host)
}
strings.TrimSuffix(baseUrl, "/")
return baseUrl
}