fix(web): allow group replies past allowFrom

This commit is contained in:
Peter Steinberger
2025-12-03 13:08:54 +00:00
parent 4c3635a7c0
commit 8204351d67
6 changed files with 73 additions and 9 deletions

View File

@@ -348,6 +348,9 @@ export async function getReplyFromConfig(
const from = (ctx.From ?? "").replace(/^whatsapp:/, "");
const to = (ctx.To ?? "").replace(/^whatsapp:/, "");
const isSamePhone = from && to && from === to;
const isGroup =
typeof ctx.From === "string" &&
(ctx.From.includes("@g.us") || ctx.From.startsWith("group:"));
const abortKey = sessionKey ?? (from || undefined) ?? (to || undefined);
const rawBodyNormalized = (
sessionCtx.BodyStripped ?? sessionCtx.Body ?? ""
@@ -362,7 +365,7 @@ export async function getReplyFromConfig(
// Same-phone mode (self-messaging) is always allowed
if (isSamePhone) {
logVerbose(`Allowing same-phone mode: from === to (${from})`);
} else if (Array.isArray(allowFrom) && allowFrom.length > 0) {
} else if (!isGroup && Array.isArray(allowFrom) && allowFrom.length > 0) {
// Support "*" as wildcard to allow all senders
if (!allowFrom.includes("*") && !allowFrom.includes(from)) {
logVerbose(