fix: stabilize feishu login setup

maintainer edit: fix the lint failure, report the active config path, fail fast when the registration response lacks a login URL, and cover the new Feishu login writeback path.
This commit is contained in:
chengyongru
2026-06-18 22:38:06 +08:00
committed by Xubin Ren
parent 593ab4a788
commit 3d386f7b7e
2 changed files with 64 additions and 2 deletions
+4 -2
View File
@@ -371,6 +371,8 @@ def _begin_registration(domain: str = "feishu") -> dict:
if not device_code:
raise RuntimeError("Feishu / Lark registration did not return a device_code")
qr_url = res.get("verification_uri_complete", "")
if not qr_url:
raise RuntimeError("Feishu / Lark registration did not return a login URL")
if "?" in qr_url:
qr_url += "&from=nanobot&tp=nanobot"
else:
@@ -715,7 +717,7 @@ class FeishuChannel(BaseChannel):
print(f"Domain: {self.config.domain}")
# Write credentials back to config.json
from nanobot.config.loader import load_config, save_config
from nanobot.config.loader import get_config_path, load_config, save_config
full_config = load_config()
feishu_cfg = getattr(full_config.channels, "feishu", None) or {}
@@ -727,7 +729,7 @@ class FeishuChannel(BaseChannel):
setattr(full_config.channels, "feishu", feishu_cfg)
save_config(full_config)
print(f"\nCredentials saved to ~/.nanobot/config.json (feishu enabled)")
print(f"\nCredentials saved to {get_config_path()} (feishu enabled)")
print("Login successful!")
return True