go get
This commit is contained in:
parent
d26a333dfb
commit
ea74be2f2e
5 changed files with 24 additions and 1 deletions
|
@ -54,3 +54,5 @@ const (
|
||||||
BindingBooleanTypeError string = "BooleanTypeError"
|
BindingBooleanTypeError string = "BooleanTypeError"
|
||||||
BindingFloatTypeError string = "FloatTypeError"
|
BindingFloatTypeError string = "FloatTypeError"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var GoGetMetas = make(map[string]bool)
|
||||||
|
|
|
@ -197,3 +197,15 @@ func DiffLineTypeToStr(diffType int) string {
|
||||||
}
|
}
|
||||||
return "same"
|
return "same"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
TPL_GO_GET_META = `<meta name="go-import" content="%s git %s">`
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetGoGetMetaList() []byte {
|
||||||
|
buf := bytes.NewBuffer([]byte(""))
|
||||||
|
for meta := range GoGetMetas {
|
||||||
|
buf.WriteString(fmt.Sprintf(TPL_GO_GET_META, Domain, meta))
|
||||||
|
}
|
||||||
|
return buf.Bytes()
|
||||||
|
}
|
||||||
|
|
|
@ -11,6 +11,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Home(ctx *middleware.Context) {
|
func Home(ctx *middleware.Context) {
|
||||||
|
if ctx.Query("go-get") == "1" {
|
||||||
|
ctx.Write(base.GetGoGetMetaList())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if ctx.IsSigned {
|
if ctx.IsSigned {
|
||||||
user.Dashboard(ctx)
|
user.Dashboard(ctx)
|
||||||
return
|
return
|
||||||
|
|
|
@ -107,6 +107,10 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Single(ctx *middleware.Context, params martini.Params) {
|
func Single(ctx *middleware.Context, params martini.Params) {
|
||||||
|
if ctx.Query("go-get") == "1" {
|
||||||
|
base.GoGetMetas[strings.TrimSuffix(ctx.Repo.CloneLink.HTTPS, ".git")] = true
|
||||||
|
}
|
||||||
|
|
||||||
branchName := ctx.Repo.BranchName
|
branchName := ctx.Repo.BranchName
|
||||||
userName := ctx.Repo.Owner.Name
|
userName := ctx.Repo.Owner.Name
|
||||||
repoName := ctx.Repo.Repository.Name
|
repoName := ctx.Repo.Repository.Name
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<meta name="description" content="Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language" />
|
<meta name="description" content="Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language" />
|
||||||
<meta name="keywords" content="go, git">
|
<meta name="keywords" content="go, git">
|
||||||
<meta name="_csrf" content="{{.CsrfToken}}" />
|
<meta name="_csrf" content="{{.CsrfToken}}" />
|
||||||
<meta name="go-import" content="{{AppDomain}} git {{if .Repository.IsGoget}}{{.GoGetLink}}{{else}}{{AppDomain}}/{{end}}">
|
<meta name="go-import" content="{{AppDomain}} git {{if .Repository.IsGoget}}{{.GoGetLink}}{{end}}">
|
||||||
|
|
||||||
<!-- Stylesheets -->
|
<!-- Stylesheets -->
|
||||||
{{if IsProdMode}}
|
{{if IsProdMode}}
|
||||||
|
|
Reference in a new issue