summaryrefslogtreecommitdiffstats
path: root/modules/middleware
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-02-22 22:51:25 -0500
committerUnknwon <u@gogs.io>2015-02-22 22:51:25 -0500
commit7ccab9cd09eca8fa60fdd519c97c259d4b521abd (patch)
tree914ea87da32fd27d889b2145f559c0fdad8c62af /modules/middleware
parent25f5a8d7986a710cef01d02725071d2de0a6b143 (diff)
parent2369881808a906f3072c935ab0575f08bd358821 (diff)
downloadgitea-7ccab9cd09eca8fa60fdd519c97c259d4b521abd.tar.gz
gitea-7ccab9cd09eca8fa60fdd519c97c259d4b521abd.zip
Merge branch 'dev' of github.com:gogits/gogs into access
Conflicts: gogs.go models/models.go models/user.go templates/.VERSION templates/org/home.tmpl
Diffstat (limited to 'modules/middleware')
-rw-r--r--modules/middleware/context.go12
-rw-r--r--modules/middleware/repo.go3
2 files changed, 13 insertions, 2 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go
index 28be3a3025..45779d5800 100644
--- a/modules/middleware/context.go
+++ b/modules/middleware/context.go
@@ -130,6 +130,18 @@ func (ctx *Context) Handle(status int, title string, err error) {
ctx.HTML(status, base.TplName(fmt.Sprintf("status/%d", status)))
}
+func (ctx *Context) HandleAPI(status int, obj interface{}) {
+ var message string
+ if err, ok := obj.(error); ok {
+ message = err.Error()
+ } else {
+ message = obj.(string)
+ }
+ ctx.JSON(status, map[string]string{
+ "message": message,
+ })
+}
+
func (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{}) {
modtime := time.Now()
for _, p := range params {
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index bd298819d7..8188deb534 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -317,8 +317,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
}
ctx.Data["CloneLink"] = ctx.Repo.CloneLink
- if ctx.Repo.Repository.IsGoget {
- ctx.Data["GoGetLink"] = fmt.Sprintf("%s%s/%s", setting.AppUrl, u.LowerName, repo.LowerName)
+ if ctx.Query("go-get") == "1" {
ctx.Data["GoGetImport"] = fmt.Sprintf("%s/%s/%s", setting.Domain, u.LowerName, repo.LowerName)
}