feat(pairing): allow omitted allowFrom — pairing-only mode by default

Previously _validate_allow_from raised SystemExit when allowFrom was
missing, forcing every channel to declare an explicit allowlist.
With the pairing feature this is no longer necessary: a channel with
no allowFrom simply operates in pairing-only mode, letting users
approve senders via /pairing approve <code> from the WebUI or CLI.

- Replace SystemExit with an info log in _validate_allow_from
- Add test_validate_allow_from_allows_missing_allow_from
This commit is contained in:
chengyongru
2026-05-15 15:46:44 +08:00
committed by Xubin Ren
parent 199a1bb8fa
commit 88ff64be48
2 changed files with 35 additions and 3 deletions
+5 -3
View File
@@ -144,9 +144,11 @@ class ChannelManager:
else:
allow = getattr(cfg, "allow_from", None)
if allow is None:
raise SystemExit(
f'Error: "{name}" is missing or null allowFrom. '
f'Set ["*"] to allow everyone, or add specific user IDs.'
# allowFrom omitted → pairing-only mode. Unapproved senders
# receive a pairing code instead of being silently ignored.
logger.info(
'"{}" has no allowFrom; unapproved users will receive a pairing code',
name,
)
def _should_send_progress(self, channel_name: str, *, tool_hint: bool = False) -> bool: