fix: suppress whatsapp pairing in self-phone mode

This commit is contained in:
Peter Steinberger
2026-01-07 20:40:24 +01:00
parent 8c48220a60
commit ef644b8369
9 changed files with 187 additions and 32 deletions

View File

@@ -202,6 +202,9 @@ export async function monitorWebInbox(options: {
: undefined);
const isSamePhone = from === selfE164;
const isSelfChat = isSelfChatMode(selfE164, configuredAllowFrom);
const isFromMe = Boolean(msg.key?.fromMe);
const selfChatMode = account.selfChatMode ?? false;
const selfPhoneMode = selfChatMode || isSelfChat;
// Pre-compute normalized allowlists for filtering
const dmHasWildcard = allowFrom?.includes("*") ?? false;
@@ -246,6 +249,12 @@ export async function monitorWebInbox(options: {
// DM access control (secure defaults): "pairing" (default) / "allowlist" / "open" / "disabled"
if (!group) {
if (isFromMe && !isSamePhone && selfPhoneMode) {
logVerbose(
"Skipping outbound self-phone DM (fromMe); no pairing reply needed.",
);
continue;
}
if (dmPolicy === "disabled") {
logVerbose("Blocked dm (dmPolicy: disabled)");
continue;