auto-save 2026-05-09 18:03 (~6)
This commit is contained in:
@@ -366,6 +366,25 @@ def split_text(text: str, limit: int = 3800) -> list[str]:
|
||||
return chunks
|
||||
|
||||
|
||||
def handle_apps() -> tuple[int, dict[str, Any]]:
|
||||
apps = []
|
||||
for app_id, app in Config.feishu_apps.items():
|
||||
apps.append({
|
||||
"app_id": app_id,
|
||||
"callback_url": f"https://hermes.kang-kang.com/feishu/events/{app_id}",
|
||||
"default_receive_id_type": app.get("default_receive_id_type", "chat_id"),
|
||||
"has_default_receive_id": bool(app.get("default_receive_id")),
|
||||
"allowed_chat_ids_count": len(app.get("allowed_chat_ids", set())),
|
||||
"verification_tokens_count": len(app.get("verification_tokens", [])),
|
||||
})
|
||||
return 200, {
|
||||
"code": 0,
|
||||
"service": "hermes-feishu-bridge",
|
||||
"default_app_id": Config.default_feishu_app_id,
|
||||
"apps": apps,
|
||||
}
|
||||
|
||||
|
||||
def handle_notify(path: str, headers: dict[str, str], body: dict[str, Any]) -> tuple[int, dict[str, Any]]:
|
||||
expected = Config.notify_token
|
||||
if not expected:
|
||||
@@ -404,6 +423,10 @@ class Handler(BaseHTTPRequestHandler):
|
||||
if self.path == "/health":
|
||||
self.send_json(200, {"ok": True, "service": "feishu-bridge"})
|
||||
return
|
||||
if self.path == "/feishu/apps":
|
||||
status, payload = handle_apps()
|
||||
self.send_json(status, payload)
|
||||
return
|
||||
self.send_json(404, {"code": 404, "msg": "not found"})
|
||||
|
||||
def do_POST(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user