|
|
|
@ -74,7 +74,6 @@ import (
|
|
|
|
|
"code.gitea.io/gitea/routers/api/v1/user"
|
|
|
|
|
|
|
|
|
|
"github.com/go-macaron/binding"
|
|
|
|
|
"github.com/go-macaron/cors"
|
|
|
|
|
macaron "gopkg.in/macaron.v1"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -501,12 +500,6 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|
|
|
|
m.Get("/swagger", misc.Swagger) //Render V1 by default
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var handlers []macaron.Handler
|
|
|
|
|
if setting.EnableCORS {
|
|
|
|
|
handlers = append(handlers, cors.CORS(setting.CORSConfig))
|
|
|
|
|
}
|
|
|
|
|
handlers = append(handlers, securityHeaders(), context.APIContexter(), sudo())
|
|
|
|
|
|
|
|
|
|
m.Group("/v1", func() {
|
|
|
|
|
// Miscellaneous
|
|
|
|
|
if setting.API.EnableSwagger {
|
|
|
|
@ -852,7 +845,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
|
|
|
|
m.Group("/topics", func() {
|
|
|
|
|
m.Get("/search", repo.TopicSearch)
|
|
|
|
|
})
|
|
|
|
|
}, handlers...)
|
|
|
|
|
}, securityHeaders(), context.APIContexter(), sudo())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func securityHeaders() macaron.Handler {
|
|
|
|
|