fix(cron/whatsapp): route implicit delivery to allowlisted recipients (openclaw#21533) thanks @Takhoffman

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
Tak Hoffman
2026-02-19 20:33:37 -06:00
committed by GitHub
parent a87b5fb009
commit d9e46028f5
6 changed files with 194 additions and 2 deletions

View File

@@ -269,6 +269,16 @@ async function readAllowFromStateForPath(
return normalizeAllowFromList(channel, value);
}
function readAllowFromStateForPathSync(channel: PairingChannel, filePath: string): string[] {
try {
const raw = fs.readFileSync(filePath, "utf8");
const parsed = JSON.parse(raw) as AllowFromStore;
return normalizeAllowFromList(channel, parsed);
} catch {
return [];
}
}
async function readAllowFromState(params: {
channel: PairingChannel;
entry: string | number;
@@ -341,6 +351,24 @@ export async function readChannelAllowFromStore(
return dedupePreserveOrder([...scopedEntries, ...legacyEntries]);
}
export function readChannelAllowFromStoreSync(
channel: PairingChannel,
env: NodeJS.ProcessEnv = process.env,
accountId?: string,
): string[] {
const normalizedAccountId = accountId?.trim().toLowerCase() ?? "";
if (!normalizedAccountId) {
const filePath = resolveAllowFromPath(channel, env);
return readAllowFromStateForPathSync(channel, filePath);
}
const scopedPath = resolveAllowFromPath(channel, env, accountId);
const scopedEntries = readAllowFromStateForPathSync(channel, scopedPath);
const legacyPath = resolveAllowFromPath(channel, env);
const legacyEntries = readAllowFromStateForPathSync(channel, legacyPath);
return dedupePreserveOrder([...scopedEntries, ...legacyEntries]);
}
type AllowFromStoreEntryUpdateParams = {
channel: PairingChannel;
entry: string | number;