mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 13:44:15 +01:00
#2229 adjust URL verbose depth for reverse proxy sub-path
This commit is contained in:
parent
57c10aae33
commit
4848620594
5 changed files with 15 additions and 10 deletions
|
@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
||||||
|
|
||||||
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
|
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
|
||||||
|
|
||||||
##### Current version: 0.8.25
|
##### Current version: 0.8.26
|
||||||
|
|
||||||
| Web | UI | Preview |
|
| Web | UI | Preview |
|
||||||
|:-------------:|:-------:|:-------:|
|
|:-------------:|:-------:|:-------:|
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.8.25.0131"
|
const APP_VER = "0.8.26.0131"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -21,6 +21,8 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO: put this into 'markdown' module.
|
||||||
|
|
||||||
func isletter(c byte) bool {
|
func isletter(c byte) bool {
|
||||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
|
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
|
||||||
}
|
}
|
||||||
|
@ -187,7 +189,7 @@ func cutoutVerbosePrefix(prefix string) string {
|
||||||
if prefix[i] == '/' {
|
if prefix[i] == '/' {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
if count >= 3 {
|
if count >= 3+setting.AppSubUrlDepth {
|
||||||
return prefix[:i]
|
return prefix[:i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,12 +48,13 @@ var (
|
||||||
BuildGitHash string
|
BuildGitHash string
|
||||||
|
|
||||||
// App settings
|
// App settings
|
||||||
AppVer string
|
AppVer string
|
||||||
AppName string
|
AppName string
|
||||||
AppUrl string
|
AppUrl string
|
||||||
AppSubUrl string
|
AppSubUrl string
|
||||||
AppPath string
|
AppSubUrlDepth int // Number of slashes
|
||||||
AppDataPath = "data"
|
AppPath string
|
||||||
|
AppDataPath = "data"
|
||||||
|
|
||||||
// Server settings
|
// Server settings
|
||||||
Protocol Scheme
|
Protocol Scheme
|
||||||
|
@ -299,7 +300,9 @@ func NewContext() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppUrl, err)
|
log.Fatal(4, "Invalid ROOT_URL '%s': %s", AppUrl, err)
|
||||||
}
|
}
|
||||||
|
// Suburl should start with '/' and end without '/', such as '/{subpath}'.
|
||||||
AppSubUrl = strings.TrimSuffix(url.Path, "/")
|
AppSubUrl = strings.TrimSuffix(url.Path, "/")
|
||||||
|
AppSubUrlDepth = strings.Count(AppSubUrl, "/")
|
||||||
|
|
||||||
Protocol = HTTP
|
Protocol = HTTP
|
||||||
if sec.Key("PROTOCOL").String() == "https" {
|
if sec.Key("PROTOCOL").String() == "https" {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.8.25.0131
|
0.8.26.0131
|
Loading…
Reference in a new issue