增加web功能
This commit is contained in:
@@ -596,9 +596,15 @@ func (s *Server) handleTopDomains(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *Server) handleShield(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
// 返回屏蔽规则的基本配置信息和统计数据,不返回完整规则列表
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
// 检查是否需要返回完整规则列表
|
||||
if r.URL.Query().Get("all") == "true" {
|
||||
// 返回完整规则数据
|
||||
rules := s.shieldManager.GetRules()
|
||||
json.NewEncoder(w).Encode(rules)
|
||||
return
|
||||
}
|
||||
// 获取规则统计信息
|
||||
stats := s.shieldManager.GetStats()
|
||||
shieldInfo := map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user