isamert / scli

a simple terminal user interface for signal messenger (using signal-cli)
GNU General Public License v3.0
448 stars 39 forks source link

Handle `$SIGNALCLI_DATA_FOLDER/accounts.json` #180

Closed maximbaz closed 2 years ago

maximbaz commented 2 years ago

It seems a recent update to signal-cli started creating $SIGNALCLI_DATA_FOLDER/accounts.json file, which is an array with (one in my case) object describing my account.

scli needs to support this file (maybe ignore it, maybe parse it?). Right now it crashes:

$ scli
ERROR: Multiple accounts found. Run one of:
    scli --username=+xxx
    scli --username=accounts.json

Removing accounts.json seems to be a decent workaround 😜

exquo commented 2 years ago

Thanks! Should be fixed now

maximbaz commented 2 years ago

I would have sent the same patch but it turns out to be faulty 😅

Newly linked accounts look like this:

$ ll ~/.local/share/signal-cli/data/
.rw------- xxxxx xxxxx 1.0 KB Tue Mar 15 19:40:15 2022 740685
drwx------ xxxxx xxxxx 182 B  Tue Mar 15 19:47:51 2022 740685.d
.rw------- xxxxx xxxxx 134 B  Tue Mar 15 19:40:15 2022 accounts.json

$ cat data/accounts.json
{
  accounts : [ {
    path : 740685,
    number : +1234567890,
    uuid : ac548414-c47e-433e-ac8f-97b323b8e750
  } ]
}

It seems like that number is a random value, so we have to parse accounts.json, or simply ignore *.json files?

exquo commented 2 years ago

Thanks for the clarification, and sorry about the delayed response!

I have added a fix in 70074a93c59eda1337b55fae0de0bd016a4bc0c2. Will merge it with master shortly.