mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	API should follow RequireSignInView (#8654)
This commit is contained in:
		@@ -862,7 +862,7 @@ func RegisterRoutes(m *macaron.Macaron) {
 | 
			
		||||
		m.Group("/topics", func() {
 | 
			
		||||
			m.Get("/search", repo.TopicSearch)
 | 
			
		||||
		})
 | 
			
		||||
	}, securityHeaders(), context.APIContexter(), sudo())
 | 
			
		||||
	}, securityHeaders(), reqTokenBySetting(), context.APIContexter(), sudo())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func securityHeaders() macaron.Handler {
 | 
			
		||||
@@ -874,3 +874,10 @@ func securityHeaders() macaron.Handler {
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func reqTokenBySetting() macaron.Handler {
 | 
			
		||||
	if setting.Service.RequireSignInView {
 | 
			
		||||
		return reqToken()
 | 
			
		||||
	}
 | 
			
		||||
	return func(ctx *macaron.Context) {}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user