Skip to content

Commit ffff835

Browse files
authored
API should follow RequireSignInView (#8654) (#8661)
1 parent 63c54f7 commit ffff835

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

routers/api/v1/api.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ func RegisterRoutes(m *macaron.Macaron) {
845845
m.Group("/topics", func() {
846846
m.Get("/search", repo.TopicSearch)
847847
})
848-
}, securityHeaders(), context.APIContexter(), sudo())
848+
}, securityHeaders(), reqTokenBySetting(), context.APIContexter(), sudo())
849849
}
850850

851851
func securityHeaders() macaron.Handler {
@@ -857,3 +857,10 @@ func securityHeaders() macaron.Handler {
857857
})
858858
}
859859
}
860+
861+
func reqTokenBySetting() macaron.Handler {
862+
if setting.Service.RequireSignInView {
863+
return reqToken()
864+
}
865+
return func(ctx *macaron.Context) {}
866+
}

0 commit comments

Comments
 (0)