瀏覽代碼

allow get repository without login

Yoginth 7 年之前
父節點
當前提交
ebbc4731cd
共有 3 個文件被更改,包括 7 次插入7 次删除
  1. 1 1
      public/expansion/expansion.js
  2. 3 3
      routes/api/v1/api.go
  3. 3 3
      templates/base/info_bar.tmpl

+ 1 - 1
public/expansion/expansion.js

@@ -17,4 +17,4 @@ var nextWord = (function() {
         if (!copy || !copy.length) copy = wordArray.slice();
         return copy.splice(Math.random() * copy.length | 0, 1);
     }
-}());
+}());

+ 3 - 3
routes/api/v1/api.go

@@ -57,7 +57,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)
@@ -232,12 +232,12 @@ 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() {

+ 3 - 3
templates/base/info_bar.tmpl

@@ -14,9 +14,9 @@
                 {{end}}
                 <span class="infobar align">
                     <span class="infobar heart">❤</span>
-                    <span 
-                        id="expansion" 
-                        class="infobar expansion" 
+                    <span
+                        id="expansion"
+                        class="infobar expansion"
                         onclick="document.getElementById('expansion').innerHTML = nextWord();" >
                         Get It Together
                     </span>