web重做

This commit is contained in:
Alex Yang
2025-11-24 01:53:26 +08:00
parent f499a4a84a
commit 85320611cb
17 changed files with 4936 additions and 2346 deletions

View File

@@ -339,22 +339,14 @@ func (s *Server) handleQuery(w http.ResponseWriter, r *http.Request) {
return
}
// 检查域名是否被屏蔽
blocked := s.shieldManager.IsBlocked(domain)
// 检查hosts文件是否有匹配
hostsIP, hasHosts := s.shieldManager.GetHostsIP(domain)
result := map[string]interface{}{
"domain": domain,
"blocked": blocked,
"hasHosts": hasHosts,
"hostsIP": hostsIP,
"timestamp": time.Now(),
}
// 获取域名屏蔽的详细信息
blockDetails := s.shieldManager.CheckDomainBlockDetails(domain)
// 添加时间戳
blockDetails["timestamp"] = time.Now()
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(result)
json.NewEncoder(w).Encode(blockDetails)
}
// handleStatus 处理系统状态请求