Unknown 11 rokov pred
rodič
commit
ea74be2f2e

+ 2 - 0
modules/base/base.go

@@ -54,3 +54,5 @@ const (
 	BindingBooleanTypeError     string = "BooleanTypeError"
 	BindingFloatTypeError       string = "FloatTypeError"
 )
+
+var GoGetMetas = make(map[string]bool)

+ 12 - 0
modules/base/template.go

@@ -197,3 +197,15 @@ func DiffLineTypeToStr(diffType int) string {
 	}
 	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()
+}

+ 5 - 0
routers/dashboard.go

@@ -11,6 +11,11 @@ import (
 )
 
 func Home(ctx *middleware.Context) {
+	if ctx.Query("go-get") == "1" {
+		ctx.Write(base.GetGoGetMetaList())
+		return
+	}
+
 	if ctx.IsSigned {
 		user.Dashboard(ctx)
 		return

+ 4 - 0
routers/repo/repo.go

@@ -107,6 +107,10 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
 }
 
 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
 	userName := ctx.Repo.Owner.Name
 	repoName := ctx.Repo.Repository.Name

+ 1 - 1
templates/base/head.tmpl

@@ -9,7 +9,7 @@
 		<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="_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 -->
 		{{if IsProdMode}}

PANIC: session(release): write data/sessions/b/6/b6b821cb60222279: no space left on device

PANIC

session(release): write data/sessions/b/6/b6b821cb60222279: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)