perf: Speed of database initialization (#7694)
* perf: 优化非sqlite3数据库时初始化慢的问题 * refactor
This commit is contained in:
@ -12,16 +12,16 @@ import (
|
||||
func GetApiUrl(r *http.Request) string {
|
||||
api := conf.Conf.SiteURL
|
||||
if strings.HasPrefix(api, "http") {
|
||||
return api
|
||||
return strings.TrimSuffix(api, "/")
|
||||
}
|
||||
if r != nil {
|
||||
protocol := "http"
|
||||
if r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https" {
|
||||
protocol = "https"
|
||||
}
|
||||
host := r.Host
|
||||
if r.Header.Get("X-Forwarded-Host") != "" {
|
||||
host = r.Header.Get("X-Forwarded-Host")
|
||||
host := r.Header.Get("X-Forwarded-Host")
|
||||
if host == "" {
|
||||
host = r.Host
|
||||
}
|
||||
api = fmt.Sprintf("%s://%s", protocol, stdpath.Join(host, api))
|
||||
}
|
||||
|
Reference in New Issue
Block a user