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
|
||||
|
||||
@@ -48,6 +48,9 @@ func NewFuncMap() []template.FuncMap {
|
||||
"AppSubUrl": func() string {
|
||||
return setting.AppSubURL
|
||||
},
|
||||
"StaticUrlPrefix": func() string {
|
||||
return setting.StaticURLPrefix
|
||||
},
|
||||
"AppUrl": func() string {
|
||||
return setting.AppURL
|
||||
},
|
||||
@@ -110,12 +113,12 @@ func NewFuncMap() []template.FuncMap {
|
||||
}
|
||||
return str[start:end]
|
||||
},
|
||||
"EllipsisString": base.EllipsisString,
|
||||
"DiffTypeToStr": DiffTypeToStr,
|
||||
"DiffLineTypeToStr": DiffLineTypeToStr,
|
||||
"Sha1": Sha1,
|
||||
"ShortSha": base.ShortSha,
|
||||
"MD5": base.EncodeMD5,
|
||||
"EllipsisString": base.EllipsisString,
|
||||
"DiffTypeToStr": DiffTypeToStr,
|
||||
"DiffLineTypeToStr": DiffLineTypeToStr,
|
||||
"Sha1": Sha1,
|
||||
"ShortSha": base.ShortSha,
|
||||
"MD5": base.EncodeMD5,
|
||||
"ActionContent2Commits": ActionContent2Commits,
|
||||
"PathEscape": url.PathEscape,
|
||||
"EscapePound": func(str string) string {
|
||||
|
||||
Reference in New Issue
Block a user