Merge 7a5732b098 into 4583f88626
This commit is contained in:
commit
f41dd867ea
23
src/utils.ts
23
src/utils.ts
@ -89,7 +89,28 @@ function resolveLidMappingDirs(opts?: JidToE164Options): string[] {
|
||||
addDir(opts?.authDir);
|
||||
for (const dir of opts?.lidMappingDirs ?? []) addDir(dir);
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user