-
Notifications
You must be signed in to change notification settings - Fork 46.7k
fix(bluebubbles): add group chat filters #33541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3991,6 +3991,7 @@ async def start(self) -> bool: | |
| "WECOM_CALLBACK_ALLOWED_USERS", | ||
| "WEIXIN_ALLOWED_USERS", | ||
| "BLUEBUBBLES_ALLOWED_USERS", | ||
| "BLUEBUBBLES_ALLOWED_CHATS", | ||
| "QQ_ALLOWED_USERS", | ||
| "YUANBAO_ALLOWED_USERS", | ||
| "GATEWAY_ALLOWED_USERS", | ||
|
|
@@ -6469,6 +6470,7 @@ def _is_user_authorized(self, source: SessionSource) -> bool: | |
| if source.chat_type in {"group", "forum", "channel"} and source.chat_id: | ||
| chat_allowlist_env = { | ||
| Platform.TELEGRAM: "TELEGRAM_GROUP_ALLOWED_CHATS", | ||
| Platform.BLUEBUBBLES: "BLUEBUBBLES_ALLOWED_CHATS", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Current main extracted this authorization path into |
||
| Platform.QQBOT: "QQ_GROUP_ALLOWED_USERS", | ||
| }.get(source.platform, "") | ||
| if chat_allowlist_env: | ||
|
|
@@ -6509,6 +6511,7 @@ def _is_user_authorized(self, source: SessionSource) -> bool: | |
| } | ||
| platform_group_chat_env_map = { | ||
| Platform.TELEGRAM: "TELEGRAM_GROUP_ALLOWED_CHATS", | ||
| Platform.BLUEBUBBLES: "BLUEBUBBLES_ALLOWED_CHATS", | ||
| Platform.QQBOT: "QQ_GROUP_ALLOWED_USERS", | ||
| } | ||
| platform_allow_all_map = { | ||
|
|
@@ -6708,6 +6711,7 @@ def _get_unauthorized_dm_behavior(self, platform: Optional[Platform]) -> str: | |
| "TELEGRAM_GROUP_ALLOWED_USERS", | ||
| "TELEGRAM_GROUP_ALLOWED_CHATS", | ||
| ), | ||
| Platform.BLUEBUBBLES: ("BLUEBUBBLES_ALLOWED_CHATS",), | ||
| Platform.QQBOT: ("QQ_GROUP_ALLOWED_USERS",), | ||
| } | ||
| if os.getenv(platform_env_map.get(platform, ""), "").strip(): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gate runs after the attachment loop above, so an ignored group message can still download and cache inbound attachments. Resolve the chat identity and apply the filter before attachment retrieval, with a test asserting the downloader is not called for an ignored group payload.