Skip to content

Commit

Permalink
return mode (normal,native,json-rpc) in "about" endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard B committed Oct 20, 2021
1 parent 6679a14 commit 6c28b78
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ type SendResponse struct {
type About struct {
SupportedApiVersions []string `json:"versions"`
BuildNr int `json:"build"`
Mode string `json:"mode"`
}

func cleanupTmpFiles(paths []string) {
Expand Down Expand Up @@ -275,6 +276,17 @@ func ConvertGroupIdToInternalGroupId(id string) (string, error) {
return string(internalGroupId), err
}

func getSignalCliModeString(signalCliMode SignalCliMode) string {
if signalCliMode == Normal {
return "normal"
} else if signalCliMode == Native {
return "native"
} else if signalCliMode == JsonRpc {
return "json-rpc"
}
return "unknown"
}

type SignalClient struct {
signalCliConfig string
attachmentTmpDir string
Expand Down Expand Up @@ -450,7 +462,7 @@ func (s *SignalClient) send(number string, message string,
}

func (s *SignalClient) About() About {
about := About{SupportedApiVersions: []string{"v1", "v2"}, BuildNr: 2}
about := About{SupportedApiVersions: []string{"v1", "v2"}, BuildNr: 2, Mode: getSignalCliModeString(s.signalCliMode)}
return about
}

Expand Down

0 comments on commit 6c28b78

Please sign in to comment.