mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-21 00:24:32 +01:00
switched implementation to multi-account mode
* instead of starting signal-cli in json-rpc mode with the '-u', we start signal-cli without the '-u' parameter (also known as multi-account mode). This makes it possible to register a number in json-rpc mode.
This commit is contained in:
@@ -59,7 +59,7 @@ func (r *JsonRpc2Client) Dial(address string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *JsonRpc2Client) getRaw(command string, args interface{}) (string, error) {
|
||||
func (r *JsonRpc2Client) getRaw(command string, account *string, args interface{}) (string, error) {
|
||||
type Request struct {
|
||||
JsonRpc string `json:"jsonrpc"`
|
||||
Method string `json:"method"`
|
||||
@@ -99,6 +99,13 @@ func (r *JsonRpc2Client) getRaw(command string, args interface{}) (string, error
|
||||
}
|
||||
}
|
||||
|
||||
if account != nil {
|
||||
fullCommandBytes, err = sjson.SetBytes(fullCommandBytes, "params.account", account)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug("full command: ", string(fullCommandBytes))
|
||||
|
||||
_, err = r.conn.Write([]byte(string(fullCommandBytes) + "\n"))
|
||||
|
||||
Reference in New Issue
Block a user