workaround for reverse proxy, ssh, submodule

tokarchuk/v1.17
Matthias Pioch 9 years ago
parent 71d8ff247d
commit 78a4e71245
  1. 3
      modules/base/template.go
  2. 10
      modules/git/submodule.go
  3. 4
      templates/repo/view_list.tmpl

@ -141,6 +141,9 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"AppName": func() string { "AppName": func() string {
return setting.AppName return setting.AppName
}, },
"AppUrl": func() string {
return setting.AppUrl
},
"AppSubUrl": func() string { "AppSubUrl": func() string {
return setting.AppSubUrl return setting.AppSubUrl
}, },

@ -30,7 +30,7 @@ func NewSubModuleFile(c *Commit, refUrl, refId string) *SubModuleFile {
} }
// RefUrl guesses and returns reference URL. // RefUrl guesses and returns reference URL.
func (sf *SubModuleFile) RefUrl() string { func (sf *SubModuleFile) RefUrl(appUrl string) string {
if sf.refUrl == "" { if sf.refUrl == "" {
return "" return ""
} }
@ -51,8 +51,14 @@ func (sf *SubModuleFile) RefUrl() string {
i := strings.Index(url, "@") i := strings.Index(url, "@")
j := strings.LastIndex(url, ":") j := strings.LastIndex(url, ":")
if i > -1 && j > -1 { if i > -1 && j > -1 {
return "http://" + url[i+1:j] + "/" + url[j+1:] // fix problem with reverse proxy works only with local server
if strings.Contains(appUrl,url[i+1:j]) {
return appUrl + url[j+1:]
} else {
return "http://" + url[i+1:j] + "/" + url[j+1:]
}
} }
return url return url
} }

@ -39,8 +39,8 @@
<span class="octicon octicon-file-submodule"></span> <span class="octicon octicon-file-submodule"></span>
</td> </td>
<td class="name"> <td class="name">
{{if $commit.RefUrl}} {{if $commit.RefUrl AppUrl}}
<a href="{{$commit.RefUrl}}" class="text-truncate">{{$entry.Name}}</a> @ <a href="{{$commit.RefUrl}}/commit/{{$commit.RefId}}">{{ShortSha $commit.RefId}}</a> <a href="{{$commit.RefUrl AppUrl}}" class="text-truncate">{{$entry.Name}}</a> @ <a href="{{$commit.RefUrl AppUrl}}/commit/{{$commit.RefId}}">{{ShortSha $commit.RefId}}</a>
{{else}} {{else}}
{{$entry.Name}} @ {{ShortSha $commit.RefId}} {{$entry.Name}} @ {{ShortSha $commit.RefId}}
{{end}} {{end}}

Loading…
Cancel
Save