Browse Source

go get

tags/v1.2.0-rc1
Unknown 11 years ago
parent
commit
4c1452574a
5 changed files with 3 additions and 23 deletions
  1. +0
    -12
      modules/base/template.go
  2. +2
    -1
      modules/middleware/repo.go
  3. +0
    -5
      routers/dashboard.go
  4. +0
    -4
      routers/repo/repo.go
  5. +1
    -1
      templates/base/head.tmpl

+ 0
- 12
modules/base/template.go View File

@@ -197,15 +197,3 @@ 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()
}

+ 2
- 1
modules/middleware/repo.go View File

@@ -135,7 +135,8 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
ctx.Data["CloneLink"] = ctx.Repo.CloneLink ctx.Data["CloneLink"] = ctx.Repo.CloneLink


if ctx.Repo.Repository.IsGoget { if ctx.Repo.Repository.IsGoget {
ctx.Data["GoGetLink"] = strings.TrimSuffix(ctx.Repo.CloneLink.HTTPS, ".git")
ctx.Data["GoGetLink"] = fmt.Sprintf("%s%s/%s", base.AppUrl, user.LowerName, repo.LowerName)
ctx.Data["GoGetImport"] = fmt.Sprintf("%s/%s/%s", base.Domain, user.LowerName, repo.LowerName)
} }


// when repo is bare, not valid branch // when repo is bare, not valid branch


+ 0
- 5
routers/dashboard.go View File

@@ -11,11 +11,6 @@ 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


+ 0
- 4
routers/repo/repo.go View File

@@ -107,10 +107,6 @@ 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


+ 1
- 1
templates/base/head.tmpl View File

@@ -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}}{{end}}">
{{if .Repository.IsGoget}}<meta name="go-import" content="{{.GoGetImport}} git {{.GoGetLink}}">{{end}}


<!-- Stylesheets --> <!-- Stylesheets -->
{{if IsProdMode}} {{if IsProdMode}}


Loading…
Cancel
Save