1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00

fix workaround for reverse proxy, ssh, submodule

This commit is contained in:
Matthias Pioch 2015-10-24 22:46:13 +02:00
parent 78a4e71245
commit 8b92f9cca6
3 changed files with 6 additions and 8 deletions

View File

@ -141,9 +141,6 @@ 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
}, },

View File

@ -6,6 +6,7 @@ package git
import ( import (
"strings" "strings"
"github.com/gogits/gogs/modules/setting"
) )
type SubModule struct { type SubModule struct {
@ -30,7 +31,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(appUrl string) string { func (sf *SubModuleFile) RefUrl() string {
if sf.refUrl == "" { if sf.refUrl == "" {
return "" return ""
} }
@ -52,8 +53,8 @@ func (sf *SubModuleFile) RefUrl(appUrl string) string {
j := strings.LastIndex(url, ":") j := strings.LastIndex(url, ":")
if i > -1 && j > -1 { if i > -1 && j > -1 {
// fix problem with reverse proxy works only with local server // fix problem with reverse proxy works only with local server
if strings.Contains(appUrl,url[i+1:j]) { if strings.Contains(setting.AppUrl,url[i+1:j]) {
return appUrl + url[j+1:] return setting.AppUrl + url[j+1:]
} else { } else {
return "http://" + url[i+1:j] + "/" + url[j+1:] return "http://" + url[i+1:j] + "/" + url[j+1:]
} }

View File

@ -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 AppUrl}} {{if $commit.RefUrl}}
<a href="{{$commit.RefUrl AppUrl}}" class="text-truncate">{{$entry.Name}}</a> @ <a href="{{$commit.RefUrl AppUrl}}/commit/{{$commit.RefId}}">{{ShortSha $commit.RefId}}</a> <a href="{{$commit.RefUrl}}" class="text-truncate">{{$entry.Name}}</a> @ <a href="{{$commit.RefUrl}}/commit/{{$commit.RefId}}">{{ShortSha $commit.RefId}}</a>
{{else}} {{else}}
{{$entry.Name}} @ {{ShortSha $commit.RefId}} {{$entry.Name}} @ {{ShortSha $commit.RefId}}
{{end}} {{end}}