Merge 513f3556e7 into 09be5d45d5
This commit is contained in:
5 files changed
+61
-28
No files matched your search
@@ -398,7 +398,17 @@ export const googlechatPlugin: ChannelPlugin<ResolvedGoogleChatAccount> = {
|
||||
),
|
||||
};
|
||||
}
|
||||
return { ok: true, to: normalized };
|
||||
const hasWildcard = allowListRaw.includes("*");
|
||||
if (hasWildcard || allowList.length === 0 || allowList.includes(normalized)) {
|
||||
return { ok: true, to: normalized };
|
||||
}
|
||||
if (mode === "implicit" || mode === "heartbeat") {
|
||||
return { ok: true, to: allowList[0] };
|
||||
}
|
||||
return {
|
||||
ok: false,
|
||||
error: new Error(`Google Chat target ${trimmed} is not in the allowFrom list.`),
|
||||
};
|
||||
}
|
||||
|
||||
if (allowList.length > 0) {
|
||||
|
||||
@@ -51,25 +51,19 @@ export const twitchOutbound: ChannelOutboundAdapter = {
|
||||
.map((entry: string) => normalizeTwitchChannel(entry))
|
||||
.filter((entry): entry is string => entry.length > 0);
|
||||
|
||||
// If target is provided, normalize and validate it
|
||||
if (trimmed) {
|
||||
const normalizedTo = normalizeTwitchChannel(trimmed);
|
||||
|
||||
// For implicit/heartbeat modes with allowList, check against allowlist
|
||||
if (hasWildcard || allowList.length === 0 || allowList.includes(normalizedTo)) {
|
||||
return { ok: true, to: normalizedTo };
|
||||
}
|
||||
if (mode === "implicit" || mode === "heartbeat") {
|
||||
if (hasWildcard || allowList.length === 0) {
|
||||
return { ok: true, to: normalizedTo };
|
||||
}
|
||||
if (allowList.includes(normalizedTo)) {
|
||||
return { ok: true, to: normalizedTo };
|
||||
}
|
||||
// Fallback to first allowFrom entry
|
||||
// biome-ignore lint/style/noNonNullAssertion: length > 0 check ensures element exists
|
||||
return { ok: true, to: allowList[0]! };
|
||||
}
|
||||
|
||||
// For explicit mode, accept any valid channel name
|
||||
return { ok: true, to: normalizedTo };
|
||||
return {
|
||||
ok: false,
|
||||
error: new Error(`Twitch target ${trimmed} is not in the allowFrom list.`),
|
||||
};
|
||||
}
|
||||
|
||||
// No target provided, use allowFrom fallback
|
||||
|
||||
@@ -303,18 +303,24 @@ export const whatsappPlugin: ChannelPlugin<ResolvedWhatsAppAccount> = {
|
||||
};
|
||||
}
|
||||
if (isWhatsAppGroupJid(normalizedTo)) {
|
||||
if (hasWildcard || allowList.length === 0 || allowList.includes(normalizedTo)) {
|
||||
return { ok: true, to: normalizedTo };
|
||||
}
|
||||
return {
|
||||
ok: false,
|
||||
error: new Error(`WhatsApp group ${trimmed} is not in the allowFrom list.`),
|
||||
};
|
||||
}
|
||||
if (hasWildcard || allowList.length === 0 || allowList.includes(normalizedTo)) {
|
||||
return { ok: true, to: normalizedTo };
|
||||
}
|
||||
if (mode === "implicit" || mode === "heartbeat") {
|
||||
if (hasWildcard || allowList.length === 0) {
|
||||
return { ok: true, to: normalizedTo };
|
||||
}
|
||||
if (allowList.includes(normalizedTo)) {
|
||||
return { ok: true, to: normalizedTo };
|
||||
}
|
||||
return { ok: true, to: allowList[0] };
|
||||
}
|
||||
return { ok: true, to: normalizedTo };
|
||||
return {
|
||||
ok: false,
|
||||
error: new Error(`WhatsApp target ${trimmed} is not in the allowFrom list.`),
|
||||
};
|
||||
}
|
||||
|
||||
if (allowList.length > 0) {
|
||||
|
||||
Reference in new issue
Block a user