|
|
@ -257,6 +257,13 @@ func Contexter() macaron.Handler { |
|
|
|
branchName = repo.DefaultBranch |
|
|
|
branchName = repo.DefaultBranch |
|
|
|
} |
|
|
|
} |
|
|
|
prefix := setting.AppURL + path.Join(url.PathEscape(ownerName), url.PathEscape(repoName), "src", "branch", util.PathEscapeSegments(branchName)) |
|
|
|
prefix := setting.AppURL + path.Join(url.PathEscape(ownerName), url.PathEscape(repoName), "src", "branch", util.PathEscapeSegments(branchName)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appURL, _ := url.Parse(setting.AppURL) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insecure := "" |
|
|
|
|
|
|
|
if appURL.Scheme == string(setting.HTTP) { |
|
|
|
|
|
|
|
insecure = "--insecure " |
|
|
|
|
|
|
|
} |
|
|
|
c.Header().Set("Content-Type", "text/html") |
|
|
|
c.Header().Set("Content-Type", "text/html") |
|
|
|
c.WriteHeader(http.StatusOK) |
|
|
|
c.WriteHeader(http.StatusOK) |
|
|
|
c.Write([]byte(com.Expand(`<!doctype html> |
|
|
|
c.Write([]byte(com.Expand(`<!doctype html> |
|
|
@ -266,7 +273,7 @@ func Contexter() macaron.Handler { |
|
|
|
<meta name="go-source" content="{GoGetImport} _ {GoDocDirectory} {GoDocFile}"> |
|
|
|
<meta name="go-source" content="{GoGetImport} _ {GoDocDirectory} {GoDocFile}"> |
|
|
|
</head> |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
<body> |
|
|
|
go get {GoGetImport} |
|
|
|
go get {Insecure}{GoGetImport} |
|
|
|
</body> |
|
|
|
</body> |
|
|
|
</html> |
|
|
|
</html> |
|
|
|
`, map[string]string{ |
|
|
|
`, map[string]string{ |
|
|
@ -274,6 +281,7 @@ func Contexter() macaron.Handler { |
|
|
|
"CloneLink": models.ComposeHTTPSCloneURL(ownerName, repoName), |
|
|
|
"CloneLink": models.ComposeHTTPSCloneURL(ownerName, repoName), |
|
|
|
"GoDocDirectory": prefix + "{/dir}", |
|
|
|
"GoDocDirectory": prefix + "{/dir}", |
|
|
|
"GoDocFile": prefix + "{/dir}/{file}#L{line}", |
|
|
|
"GoDocFile": prefix + "{/dir}/{file}#L{line}", |
|
|
|
|
|
|
|
"Insecure": insecure, |
|
|
|
}))) |
|
|
|
}))) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|