Skip to content

Commit 1cc00d1

Browse files
committed
API should follow RequireSignInView (go-gitea#8654)
1 parent 14ebda6 commit 1cc00d1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

routers/api/v1/api.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ func RegisterRoutes(m *macaron.Macaron) {
860860
m.Group("/topics", func() {
861861
m.Get("/search", repo.TopicSearch)
862862
})
863-
}, securityHeaders(), context.APIContexter(), sudo())
863+
}, securityHeaders(), reqTokenBySetting(), context.APIContexter(), sudo())
864864
}
865865

866866
func securityHeaders() macaron.Handler {
@@ -872,3 +872,10 @@ func securityHeaders() macaron.Handler {
872872
})
873873
}
874874
}
875+
876+
func reqTokenBySetting() macaron.Handler {
877+
if setting.Service.RequireSignInView {
878+
return reqToken()
879+
}
880+
return func(ctx *macaron.Context) {}
881+
}

0 commit comments

Comments
 (0)