feat: prepare Zhinian desktop client for pilot release
This commit is contained in:
@@ -334,6 +334,27 @@ export async function saveWeChatAccountState(rawAccountId: string, payload: {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
export async function listWeChatAccountAliases(): Promise<Array<{ accountId: string; userId: string }>> {
|
||||
const accountIds = await readAccountIndex();
|
||||
const aliases: Array<{ accountId: string; userId: string }> = [];
|
||||
|
||||
for (const accountId of accountIds) {
|
||||
try {
|
||||
const filePath = join(WECHAT_ACCOUNTS_DIR, `${normalizeOpenClawAccountId(accountId)}.json`);
|
||||
const raw = await readFile(filePath, 'utf-8');
|
||||
const parsed = JSON.parse(raw) as { userId?: unknown };
|
||||
const userId = typeof parsed.userId === 'string' ? parsed.userId.trim() : '';
|
||||
if (userId) {
|
||||
aliases.push({ accountId: normalizeOpenClawAccountId(accountId), userId });
|
||||
}
|
||||
} catch {
|
||||
// Ignore malformed or removed account state files.
|
||||
}
|
||||
}
|
||||
|
||||
return aliases;
|
||||
}
|
||||
|
||||
export async function startWeChatLoginSession(options: {
|
||||
sessionKey?: string;
|
||||
accountId?: string;
|
||||
|
||||
Reference in New Issue
Block a user