fix(agent): 修复 webhook 路由 Python 严格缩进错误导致的进程崩溃问题

This commit is contained in:
hotyue
2026-04-23 13:40:12 +00:00
parent d2b575fe85
commit a24a533165

View File

@@ -242,18 +242,18 @@ class AgentHandler(http.server.BaseHTTPRequestHandler):
except Exception as e:
print(f"Log transmission failed: {e}")
# ================== [v4.0.0 新增: 触发深海声呐] ==================
elif req_path == '/trigger_quality':
self.send_response(200)
self.send_header("Content-type", "text/plain")
self.end_headers()
self.wfile.write(b"Action Accepted: trigger_quality\n")
script_path = '/opt/ip_sentinel/core/mod_quality.sh'
if os.path.exists(script_path):
# 使用 Popen 且丢弃输入输出,实现绝对的异步脱离,不阻塞 Webhook 主线程
subprocess.Popen(['bash', script_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
# =================================================================
# ================== [v4.0.0 新增: 触发深海声呐] ==================
elif req_path == '/trigger_quality':
self.send_response(200)
self.send_header("Content-type", "text/plain")
self.end_headers()
self.wfile.write(b"Action Accepted: trigger_quality\n")
script_path = '/opt/ip_sentinel/core/mod_quality.sh'
if os.path.exists(script_path):
# 使用 Popen 且丢弃输入输出,实现绝对的异步脱离,不阻塞 Webhook 主线程
subprocess.Popen(['bash', script_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
# =================================================================
# 路由 5: 节点重命名展示别名同步接口 (Base64 终极防御版)