diff options
author | Unknwon <u@gogs.io> | 2018-12-01 21:40:19 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-12-01 21:40:19 -0500 |
commit | ce13fbb98a68a39b9b08f07bf7c7444e1e869451 (patch) | |
tree | 707b344d5cb69c0ab535e9a9e154a1e6e8da423a | |
parent | 084d9e0009f9238c349ee8460d0ea82efaa9830c (diff) |
routes/api: allow get repository without login (#5475)
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | routes/api/v1/api.go | 7 | ||||
-rw-r--r-- | templates/.VERSION | 2 |
3 files changed, 6 insertions, 5 deletions
@@ -16,7 +16,7 @@ import ( "github.com/gogs/gogs/pkg/setting" ) -const APP_VER = "0.11.71.1128" +const APP_VER = "0.11.72.1201" func init() { setting.AppVer = APP_VER diff --git a/routes/api/v1/api.go b/routes/api/v1/api.go index f236d9aa..2b4644d4 100644 --- a/routes/api/v1/api.go +++ b/routes/api/v1/api.go @@ -63,7 +63,7 @@ func repoAssignment() macaron.Handler { return } - if c.IsLogged && c.User.IsAdmin { + if c.IsTokenAuth && c.User.IsAdmin { c.Repo.AccessMode = models.ACCESS_MODE_OWNER } else { mode, err := models.AccessLevel(c.User.ID, repo) @@ -238,12 +238,13 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/repos", func() { m.Get("/search", repo.Search) + + m.Get("/:username/:reponame", repoAssignment(), repo.Get) }) m.Group("/repos", func() { m.Post("/migrate", bind(form.MigrateRepo{}), repo.Migrate) - m.Combo("/:username/:reponame", repoAssignment()).Get(repo.Get). - Delete(repo.Delete) + m.Delete("/:username/:reponame", repoAssignment(), repo.Delete) m.Group("/:username/:reponame", func() { m.Group("/hooks", func() { diff --git a/templates/.VERSION b/templates/.VERSION index 22e76322..2f9cfa54 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.11.71.1128 +0.11.72.1201 |