mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-04 10:14:47 +08:00
fix(signal-auth): read 'number' field from signal-cli 0.13+ listAccounts
signal-cli >= 0.13 emits the account identifier as `number` in JSON output, not `account`. The skip-if-already-linked path in signal-auth always returned an empty list, so re-runs of setup unconditionally tried `signal-cli link`, which fails when the data directory already exists. Read `number` first, fall back to `account` for older signal-cli.
This commit is contained in:
@@ -36,6 +36,7 @@ const LINK_TIMEOUT_MS = 180_000;
|
||||
const DEFAULT_DEVICE_NAME = 'NanoClaw';
|
||||
|
||||
interface SignalAccount {
|
||||
number?: string;
|
||||
account?: string;
|
||||
registered?: boolean;
|
||||
}
|
||||
@@ -59,7 +60,7 @@ function listAccounts(): string[] {
|
||||
const parsed = JSON.parse(res.stdout || '[]') as SignalAccount[];
|
||||
return parsed
|
||||
.filter((a) => a.registered !== false)
|
||||
.map((a) => a.account ?? '')
|
||||
.map((a) => a.number ?? a.account ?? '')
|
||||
.filter(Boolean);
|
||||
} catch {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user