This commit is contained in:
impozzible 2026-01-29 21:53:34 -05:00 committed by GitHub
commit f41dd867ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,7 +89,28 @@ function resolveLidMappingDirs(opts?: JidToE164Options): string[] {
addDir(opts?.authDir); addDir(opts?.authDir);
for (const dir of opts?.lidMappingDirs ?? []) addDir(dir); for (const dir of opts?.lidMappingDirs ?? []) addDir(dir);
addDir(resolveOAuthDir()); addDir(resolveOAuthDir());
addDir(path.join(CONFIG_DIR, "credentials")); const credentialsDir = path.join(CONFIG_DIR, "credentials");
addDir(credentialsDir);
// Also search WhatsApp account subdirectories for LID mappings
const waDir = path.join(credentialsDir, "whatsapp");
try {
if (fs.existsSync(waDir) && fs.statSync(waDir).isDirectory()) {
for (const account of fs.readdirSync(waDir)) {
const accountDir = path.join(waDir, account);
try {
if (fs.statSync(accountDir).isDirectory()) {
dirs.add(accountDir);
}
} catch {
// Skip if can't stat
}
}
}
} catch {
// Skip if whatsapp dir doesn't exist or can't be read
}
return [...dirs]; return [...dirs];
} }