mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
static url
This commit is contained in:
@@ -104,6 +104,7 @@ var (
|
||||
LetsEncryptTOS bool
|
||||
LetsEncryptDirectory string
|
||||
LetsEncryptEmail string
|
||||
StaticURLPrefix string
|
||||
|
||||
SSH = struct {
|
||||
Disabled bool `ini:"DISABLE_SSH"`
|
||||
@@ -582,7 +583,7 @@ func NewContext() {
|
||||
defaultAppURL += ":" + HTTPPort
|
||||
}
|
||||
AppURL = sec.Key("ROOT_URL").MustString(defaultAppURL)
|
||||
AppURL = strings.TrimRight(AppURL, "/") + "/"
|
||||
AppURL = strings.TrimSuffix(AppURL, "/") + "/"
|
||||
|
||||
// Check if has app suburl.
|
||||
appURL, err := url.Parse(AppURL)
|
||||
@@ -592,6 +593,7 @@ func NewContext() {
|
||||
// Suburl should start with '/' and end without '/', such as '/{subpath}'.
|
||||
// This value is empty if site does not have sub-url.
|
||||
AppSubURL = strings.TrimSuffix(appURL.Path, "/")
|
||||
StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/")
|
||||
AppSubURLDepth = strings.Count(AppSubURL, "/")
|
||||
// Check if Domain differs from AppURL domain than update it to AppURL's domain
|
||||
// TODO: Can be replaced with url.Hostname() when minimal GoLang version is 1.8
|
||||
|
||||
Reference in New Issue
Block a user