Skip to content

Commit 3c63c3a

Browse files
authored
API should follow RequireSignInView (#8654)
1 parent bd7709a commit 3c63c3a

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
@@ -862,7 +862,7 @@ func RegisterRoutes(m *macaron.Macaron) {
862862
m.Group("/topics", func() {
863863
m.Get("/search", repo.TopicSearch)
864864
})
865-
}, securityHeaders(), context.APIContexter(), sudo())
865+
}, securityHeaders(), reqTokenBySetting(), context.APIContexter(), sudo())
866866
}
867867

868868
func securityHeaders() macaron.Handler {
@@ -874,3 +874,10 @@ func securityHeaders() macaron.Handler {
874874
})
875875
}
876876
}
877+
878+
func reqTokenBySetting() macaron.Handler {
879+
if setting.Service.RequireSignInView {
880+
return reqToken()
881+
}
882+
return func(ctx *macaron.Context) {}
883+
}

0 commit comments

Comments
 (0)