mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-03-22 04:00:16 +00:00
Compare commits
No commits in common. "master" and "0.98" have entirely different histories.
@ -1,6 +1,6 @@
|
|||||||
ARG SIGNAL_CLI_VERSION=0.14.1
|
ARG SIGNAL_CLI_VERSION=0.14.1
|
||||||
ARG LIBSIGNAL_CLIENT_VERSION=0.87.4
|
ARG LIBSIGNAL_CLIENT_VERSION=0.87.4
|
||||||
ARG SIGNAL_CLI_NATIVE_PACKAGE_VERSION=0.14.1+morph027+2
|
ARG SIGNAL_CLI_NATIVE_PACKAGE_VERSION=0.14.1+morph027+1
|
||||||
|
|
||||||
ARG SWAG_VERSION=1.16.4
|
ARG SWAG_VERSION=1.16.4
|
||||||
ARG GRAALVM_VERSION=25.0.2
|
ARG GRAALVM_VERSION=25.0.2
|
||||||
|
|||||||
@ -58,14 +58,13 @@ The `signal-cli-rest-api` supports three different modes of execution, which can
|
|||||||
* **`normal` Mode: (Default)** The `signal-cli` executable is invoked for every REST API request. Being a Java application, each REST call requires a new startup of the JVM (Java Virtual Machine), increasing the latency and hence leading to the slowest mode of operation.
|
* **`normal` Mode: (Default)** The `signal-cli` executable is invoked for every REST API request. Being a Java application, each REST call requires a new startup of the JVM (Java Virtual Machine), increasing the latency and hence leading to the slowest mode of operation.
|
||||||
* **`native` Mode:** A precompiled binary `signal-cli-native` (using GraalVM) is used for every REST API request. This results in a much lower latency & memory usage on each call. On the `armv7` platform this mode is not available and falls back to `normal`. The native mode may also be less stable, due to the experimental state of GraalVM compiler.
|
* **`native` Mode:** A precompiled binary `signal-cli-native` (using GraalVM) is used for every REST API request. This results in a much lower latency & memory usage on each call. On the `armv7` platform this mode is not available and falls back to `normal`. The native mode may also be less stable, due to the experimental state of GraalVM compiler.
|
||||||
* `json-rpc` Mode: A single, JVM-based `signal-cli` instance is spawned as daemon process. This mode is usually the fastest, but requires more memory as the JVM keeps running.
|
* `json-rpc` Mode: A single, JVM-based `signal-cli` instance is spawned as daemon process. This mode is usually the fastest, but requires more memory as the JVM keeps running.
|
||||||
* `json-rpc-native` Mode: Uses the `signal-cli-native` binary and starts it in daemon mode (this mode basically combines the advantages of the `native` mode and the `json-rpc` mode).
|
|
||||||
|
|
||||||
| mode | speed | resident memory usage |
|
| mode | speed | resident memory usage |
|
||||||
| ---------: | :------------------------------------------------------- | :-------------------- |
|
| ---------: | :------------------------------------------------------- | :-------------------- |
|
||||||
| `normal` | :heavy_check_mark: | normal |
|
| `normal` | :heavy_check_mark: | normal |
|
||||||
| `native` | :heavy_check_mark: :heavy_check_mark: | normal |
|
| `native` | :heavy_check_mark: :heavy_check_mark: | normal |
|
||||||
| `json-rpc` | :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: | increased |
|
| `json-rpc` | :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: | increased |
|
||||||
| `json-rpc-native` | :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: | normal |
|
|
||||||
|
|
||||||
|
|
||||||
**Example of running `signal-cli-rest` in `native` mode**
|
**Example of running `signal-cli-rest` in `native` mode**
|
||||||
|
|||||||
@ -27,7 +27,7 @@ cap_prefix="-cap_"
|
|||||||
caps="$cap_prefix$(seq -s ",$cap_prefix" 0 $(cat /proc/sys/kernel/cap_last_cap))"
|
caps="$cap_prefix$(seq -s ",$cap_prefix" 0 $(cat /proc/sys/kernel/cap_last_cap))"
|
||||||
|
|
||||||
# TODO: check mode
|
# TODO: check mode
|
||||||
if [ "$MODE" = "json-rpc" ] || [ "$MODE" = "json-rpc-native" ]
|
if [ "$MODE" = "json-rpc" ]
|
||||||
then
|
then
|
||||||
/usr/bin/jsonrpc2-helper
|
/usr/bin/jsonrpc2-helper
|
||||||
if [ -n "$JAVA_OPTS" ] ; then
|
if [ -n "$JAVA_OPTS" ] ; then
|
||||||
|
|||||||
@ -1024,7 +1024,6 @@ func (a *Api) RemoveAdminsFromGroup(c *gin.Context) {
|
|||||||
// @Success 200 {object} []client.GroupEntry
|
// @Success 200 {object} []client.GroupEntry
|
||||||
// @Failure 400 {object} Error
|
// @Failure 400 {object} Error
|
||||||
// @Param number path string true "Registered Phone Number"
|
// @Param number path string true "Registered Phone Number"
|
||||||
// @Param expand query bool false "Expand the response to show more details (default: false)"
|
|
||||||
// @Router /v1/groups/{number} [get]
|
// @Router /v1/groups/{number} [get]
|
||||||
func (a *Api) GetGroups(c *gin.Context) {
|
func (a *Api) GetGroups(c *gin.Context) {
|
||||||
number, err := url.PathUnescape(c.Param("number"))
|
number, err := url.PathUnescape(c.Param("number"))
|
||||||
@ -1033,26 +1032,12 @@ func (a *Api) GetGroups(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
expand := c.DefaultQuery("expand", "false")
|
groups, err := a.signalClient.GetGroups(number)
|
||||||
if expand != "true" && expand != "false" {
|
if err != nil {
|
||||||
c.JSON(400, Error{Msg: "Couldn't process request - expand parameter needs to be either 'true' or 'false'"})
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var groups any
|
|
||||||
if StringToBool(expand) {
|
|
||||||
groups, err = a.signalClient.GetGroupsExpanded(number)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(400, Error{Msg: err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
groups, err = a.signalClient.GetGroups(number)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(400, Error{Msg: err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c.JSON(200, groups)
|
c.JSON(200, groups)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,7 +1050,6 @@ func (a *Api) GetGroups(c *gin.Context) {
|
|||||||
// @Failure 400 {object} Error
|
// @Failure 400 {object} Error
|
||||||
// @Param number path string true "Registered Phone Number"
|
// @Param number path string true "Registered Phone Number"
|
||||||
// @Param groupid path string true "Group ID"
|
// @Param groupid path string true "Group ID"
|
||||||
// @Param expand query bool false "Expand the response to show more details (default: false)"
|
|
||||||
// @Router /v1/groups/{number}/{groupid} [get]
|
// @Router /v1/groups/{number}/{groupid} [get]
|
||||||
func (a *Api) GetGroup(c *gin.Context) {
|
func (a *Api) GetGroup(c *gin.Context) {
|
||||||
number, err := url.PathUnescape(c.Param("number"))
|
number, err := url.PathUnescape(c.Param("number"))
|
||||||
@ -1075,27 +1059,12 @@ func (a *Api) GetGroup(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
groupId := c.Param("groupid")
|
groupId := c.Param("groupid")
|
||||||
|
|
||||||
expand := c.DefaultQuery("expand", "false")
|
groupEntry, err := a.signalClient.GetGroup(number, groupId)
|
||||||
if expand != "true" && expand != "false" {
|
if err != nil {
|
||||||
c.JSON(400, Error{Msg: "Couldn't process request - expand parameter needs to be either 'true' or 'false'"})
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var groupEntry any
|
|
||||||
if StringToBool(expand) {
|
|
||||||
groupEntry, err = a.signalClient.GetGroupExpanded(number, groupId)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(400, Error{Msg: err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
groupEntry, err = a.signalClient.GetGroup(number, groupId)
|
|
||||||
if err != nil {
|
|
||||||
c.JSON(400, Error{Msg: err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if groupEntry != nil {
|
if groupEntry != nil {
|
||||||
c.JSON(200, groupEntry)
|
c.JSON(200, groupEntry)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -126,30 +126,6 @@ type GroupEntry struct {
|
|||||||
Permissions ds.GroupPermissions `json:"permissions"`
|
Permissions ds.GroupPermissions `json:"permissions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupMember struct {
|
|
||||||
Number string `json:"number"`
|
|
||||||
Uuid string `json:"uuid"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupAdmin struct {
|
|
||||||
Number string `json:"number"`
|
|
||||||
Uuid string `json:"uuid"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExpandedGroupEntry struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Id string `json:"id"`
|
|
||||||
InternalId string `json:"internal_id"`
|
|
||||||
Members []GroupMember `json:"members"`
|
|
||||||
Blocked bool `json:"blocked"`
|
|
||||||
PendingInvites []GroupMember `json:"pending_invites"`
|
|
||||||
PendingRequests []GroupMember `json:"pending_requests"`
|
|
||||||
InviteLink string `json:"invite_link"`
|
|
||||||
Admins []GroupAdmin `json:"admins"`
|
|
||||||
Permissions ds.GroupPermissions `json:"permissions"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type IdentityEntry struct {
|
type IdentityEntry struct {
|
||||||
Number string `json:"number"`
|
Number string `json:"number"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
@ -159,21 +135,31 @@ type IdentityEntry struct {
|
|||||||
Uuid string `json:"uuid"`
|
Uuid string `json:"uuid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SignalCliGroupMember struct {
|
||||||
|
Number string `json:"number"`
|
||||||
|
Uuid string `json:"uuid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SignalCliGroupAdmin struct {
|
||||||
|
Number string `json:"number"`
|
||||||
|
Uuid string `json:"uuid"`
|
||||||
|
}
|
||||||
|
|
||||||
type SignalCliGroupEntry struct {
|
type SignalCliGroupEntry struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
IsMember bool `json:"isMember"`
|
IsMember bool `json:"isMember"`
|
||||||
IsBlocked bool `json:"isBlocked"`
|
IsBlocked bool `json:"isBlocked"`
|
||||||
Members []GroupMember `json:"members"`
|
Members []SignalCliGroupMember `json:"members"`
|
||||||
PendingMembers []GroupMember `json:"pendingMembers"`
|
PendingMembers []SignalCliGroupMember `json:"pendingMembers"`
|
||||||
RequestingMembers []GroupMember `json:"requestingMembers"`
|
RequestingMembers []SignalCliGroupMember `json:"requestingMembers"`
|
||||||
GroupInviteLink string `json:"groupInviteLink"`
|
GroupInviteLink string `json:"groupInviteLink"`
|
||||||
Admins []GroupAdmin `json:"admins"`
|
Admins []SignalCliGroupAdmin `json:"admins"`
|
||||||
Uuid string `json:"uuid"`
|
Uuid string `json:"uuid"`
|
||||||
PermissionEditDetails string `json:"permissionEditDetails"`
|
PermissionEditDetails string `json:"permissionEditDetails"`
|
||||||
PermissionAddMember string `json:"permissionAddMember"`
|
PermissionAddMember string `json:"permissionAddMember"`
|
||||||
PermissionSendMessage string `json:"permissionSendMessage"`
|
PermissionSendMessage string `json:"permissionSendMessage"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignalCliIdentityEntry struct {
|
type SignalCliIdentityEntry struct {
|
||||||
@ -1314,8 +1300,8 @@ func (s *SignalClient) RemoveAdminsFromGroup(number string, groupId string, admi
|
|||||||
return s.updateGroupAdmins(number, groupId, admins, false)
|
return s.updateGroupAdmins(number, groupId, admins, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignalClient) GetGroupsExpanded(number string) ([]ExpandedGroupEntry, error) {
|
func (s *SignalClient) GetGroups(number string) ([]GroupEntry, error) {
|
||||||
groupEntries := []ExpandedGroupEntry{}
|
groupEntries := []GroupEntry{}
|
||||||
|
|
||||||
var signalCliGroupEntries []SignalCliGroupEntry
|
var signalCliGroupEntries []SignalCliGroupEntry
|
||||||
var err error
|
var err error
|
||||||
@ -1343,7 +1329,7 @@ func (s *SignalClient) GetGroupsExpanded(number string) ([]ExpandedGroupEntry, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, signalCliGroupEntry := range signalCliGroupEntries {
|
for _, signalCliGroupEntry := range signalCliGroupEntries {
|
||||||
var groupEntry ExpandedGroupEntry
|
var groupEntry GroupEntry
|
||||||
groupEntry.InternalId = signalCliGroupEntry.Id
|
groupEntry.InternalId = signalCliGroupEntry.Id
|
||||||
groupEntry.Name = signalCliGroupEntry.Name
|
groupEntry.Name = signalCliGroupEntry.Name
|
||||||
groupEntry.Id = convertInternalGroupIdToGroupId(signalCliGroupEntry.Id)
|
groupEntry.Id = convertInternalGroupIdToGroupId(signalCliGroupEntry.Id)
|
||||||
@ -1352,32 +1338,9 @@ func (s *SignalClient) GetGroupsExpanded(number string) ([]ExpandedGroupEntry, e
|
|||||||
groupEntry.Permissions.SendMessages = signalCliGroupPermissionToRestApiGroupPermission(signalCliGroupEntry.PermissionSendMessage)
|
groupEntry.Permissions.SendMessages = signalCliGroupPermissionToRestApiGroupPermission(signalCliGroupEntry.PermissionSendMessage)
|
||||||
groupEntry.Permissions.EditGroup = signalCliGroupPermissionToRestApiGroupPermission(signalCliGroupEntry.PermissionSendMessage)
|
groupEntry.Permissions.EditGroup = signalCliGroupPermissionToRestApiGroupPermission(signalCliGroupEntry.PermissionSendMessage)
|
||||||
groupEntry.Permissions.AddMembers = signalCliGroupPermissionToRestApiGroupPermission(signalCliGroupEntry.PermissionAddMember)
|
groupEntry.Permissions.AddMembers = signalCliGroupPermissionToRestApiGroupPermission(signalCliGroupEntry.PermissionAddMember)
|
||||||
groupEntry.Members = signalCliGroupEntry.Members
|
|
||||||
groupEntry.PendingInvites = signalCliGroupEntry.PendingMembers
|
|
||||||
groupEntry.PendingRequests = signalCliGroupEntry.RequestingMembers
|
|
||||||
groupEntry.Admins = signalCliGroupEntry.Admins
|
|
||||||
groupEntry.InviteLink = signalCliGroupEntry.GroupInviteLink
|
|
||||||
|
|
||||||
groupEntries = append(groupEntries, groupEntry)
|
|
||||||
}
|
|
||||||
|
|
||||||
return groupEntries, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SignalClient) GetGroups(number string) ([]GroupEntry, error) {
|
|
||||||
expandedGroupEntries, err := s.GetGroupsExpanded(number)
|
|
||||||
if err != nil {
|
|
||||||
return []GroupEntry{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
groupEntries := []GroupEntry{}
|
|
||||||
for _, expandedGroupEntry := range expandedGroupEntries {
|
|
||||||
groupEntry := GroupEntry{InternalId: expandedGroupEntry.InternalId, Name: expandedGroupEntry.Name,
|
|
||||||
Id: expandedGroupEntry.Id, Blocked: expandedGroupEntry.Blocked, Description: expandedGroupEntry.Description,
|
|
||||||
Permissions: expandedGroupEntry.Permissions, InviteLink: expandedGroupEntry.InviteLink}
|
|
||||||
|
|
||||||
members := []string{}
|
members := []string{}
|
||||||
for _, val := range expandedGroupEntry.Members {
|
for _, val := range signalCliGroupEntry.Members {
|
||||||
identifier := val.Number
|
identifier := val.Number
|
||||||
if identifier == "" {
|
if identifier == "" {
|
||||||
identifier = val.Uuid
|
identifier = val.Uuid
|
||||||
@ -1386,28 +1349,28 @@ func (s *SignalClient) GetGroups(number string) ([]GroupEntry, error) {
|
|||||||
}
|
}
|
||||||
groupEntry.Members = members
|
groupEntry.Members = members
|
||||||
|
|
||||||
pendingInvites := []string{}
|
pendingMembers := []string{}
|
||||||
for _, val := range expandedGroupEntry.PendingInvites {
|
for _, val := range signalCliGroupEntry.PendingMembers {
|
||||||
identifier := val.Number
|
identifier := val.Number
|
||||||
if identifier == "" {
|
if identifier == "" {
|
||||||
identifier = val.Uuid
|
identifier = val.Uuid
|
||||||
}
|
}
|
||||||
pendingInvites = append(pendingInvites, identifier)
|
pendingMembers = append(pendingMembers, identifier)
|
||||||
}
|
}
|
||||||
groupEntry.PendingInvites = pendingInvites
|
groupEntry.PendingInvites = pendingMembers
|
||||||
|
|
||||||
pendingRequests := []string{}
|
requestingMembers := []string{}
|
||||||
for _, val := range expandedGroupEntry.PendingRequests {
|
for _, val := range signalCliGroupEntry.RequestingMembers {
|
||||||
identifier := val.Number
|
identifier := val.Number
|
||||||
if identifier == "" {
|
if identifier == "" {
|
||||||
identifier = val.Uuid
|
identifier = val.Uuid
|
||||||
}
|
}
|
||||||
pendingRequests = append(pendingRequests, identifier)
|
requestingMembers = append(requestingMembers, identifier)
|
||||||
}
|
}
|
||||||
groupEntry.PendingRequests = pendingRequests
|
groupEntry.PendingRequests = requestingMembers
|
||||||
|
|
||||||
admins := []string{}
|
admins := []string{}
|
||||||
for _, val := range expandedGroupEntry.Admins {
|
for _, val := range signalCliGroupEntry.Admins {
|
||||||
identifier := val.Number
|
identifier := val.Number
|
||||||
if identifier == "" {
|
if identifier == "" {
|
||||||
identifier = val.Uuid
|
identifier = val.Uuid
|
||||||
@ -1416,6 +1379,8 @@ func (s *SignalClient) GetGroups(number string) ([]GroupEntry, error) {
|
|||||||
}
|
}
|
||||||
groupEntry.Admins = admins
|
groupEntry.Admins = admins
|
||||||
|
|
||||||
|
groupEntry.InviteLink = signalCliGroupEntry.GroupInviteLink
|
||||||
|
|
||||||
groupEntries = append(groupEntries, groupEntry)
|
groupEntries = append(groupEntries, groupEntry)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1439,23 +1404,6 @@ func (s *SignalClient) GetGroup(number string, groupId string) (*GroupEntry, err
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignalClient) GetGroupExpanded(number string, groupId string) (*ExpandedGroupEntry, error) {
|
|
||||||
groupEntry := ExpandedGroupEntry{}
|
|
||||||
groups, err := s.GetGroupsExpanded(number)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, group := range groups {
|
|
||||||
if group.Id == groupId {
|
|
||||||
groupEntry = group
|
|
||||||
return &groupEntry, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SignalClient) GetAvatar(number string, id string, avatarType AvatarType) ([]byte, error) {
|
func (s *SignalClient) GetAvatar(number string, id string, avatarType AvatarType) ([]byte, error) {
|
||||||
var err error
|
var err error
|
||||||
var rawData string
|
var rawData string
|
||||||
|
|||||||
@ -233,6 +233,13 @@ func (r *JsonRpc2Client) ReceiveData(number string, receiveWebhookUrl string) {
|
|||||||
}
|
}
|
||||||
log.Debug("json-rpc received data: ", str)
|
log.Debug("json-rpc received data: ", str)
|
||||||
|
|
||||||
|
if receiveWebhookUrl != "" {
|
||||||
|
err = postMessageToWebhook(receiveWebhookUrl, []byte(str))
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Couldn't post data to webhook: ", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var resp1 JsonRpc2ReceivedMessage
|
var resp1 JsonRpc2ReceivedMessage
|
||||||
json.Unmarshal([]byte(str), &resp1)
|
json.Unmarshal([]byte(str), &resp1)
|
||||||
if resp1.Method == "receive" {
|
if resp1.Method == "receive" {
|
||||||
@ -247,13 +254,6 @@ func (r *JsonRpc2Client) ReceiveData(number string, receiveWebhookUrl string) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
r.receivedMessagesMutex.Unlock()
|
r.receivedMessagesMutex.Unlock()
|
||||||
|
|
||||||
if receiveWebhookUrl != "" {
|
|
||||||
err = postMessageToWebhook(receiveWebhookUrl, []byte(str))
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Couldn't post data to webhook: ", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp2 JsonRpc2MessageResponse
|
var resp2 JsonRpc2MessageResponse
|
||||||
|
|||||||
@ -917,12 +917,6 @@ const docTemplate = `{
|
|||||||
"name": "number",
|
"name": "number",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Expand the response to show more details (default: false)",
|
|
||||||
"name": "expand",
|
|
||||||
"in": "query"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -1016,12 +1010,6 @@ const docTemplate = `{
|
|||||||
"name": "groupid",
|
"name": "groupid",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Expand the response to show more details (default: false)",
|
|
||||||
"name": "expand",
|
|
||||||
"in": "query"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
|
|||||||
@ -914,12 +914,6 @@
|
|||||||
"name": "number",
|
"name": "number",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Expand the response to show more details (default: false)",
|
|
||||||
"name": "expand",
|
|
||||||
"in": "query"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -1013,12 +1007,6 @@
|
|||||||
"name": "groupid",
|
"name": "groupid",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Expand the response to show more details (default: false)",
|
|
||||||
"name": "expand",
|
|
||||||
"in": "query"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
|
|||||||
@ -1163,10 +1163,6 @@ paths:
|
|||||||
name: number
|
name: number
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
- description: 'Expand the response to show more details (default: false)'
|
|
||||||
in: query
|
|
||||||
name: expand
|
|
||||||
type: boolean
|
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
@ -1258,10 +1254,6 @@ paths:
|
|||||||
name: groupid
|
name: groupid
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
- description: 'Expand the response to show more details (default: false)'
|
|
||||||
in: query
|
|
||||||
name: expand
|
|
||||||
type: boolean
|
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
|
|||||||
@ -123,7 +123,7 @@ func main() {
|
|||||||
mode := utils.GetEnv("MODE", "normal")
|
mode := utils.GetEnv("MODE", "normal")
|
||||||
if mode == "normal" {
|
if mode == "normal" {
|
||||||
signalCliMode = client.Normal
|
signalCliMode = client.Normal
|
||||||
} else if mode == "json-rpc" || mode == "json-rpc-native" {
|
} else if mode == "json-rpc" {
|
||||||
signalCliMode = client.JsonRpc
|
signalCliMode = client.JsonRpc
|
||||||
} else if mode == "native" {
|
} else if mode == "native" {
|
||||||
signalCliMode = client.Native
|
signalCliMode = client.Native
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import (
|
|||||||
const supervisorctlConfigTemplate = `
|
const supervisorctlConfigTemplate = `
|
||||||
[program:%s]
|
[program:%s]
|
||||||
process_name=%s
|
process_name=%s
|
||||||
command=%s --output=json --config %s%s daemon %s%s%s%s --tcp 127.0.0.1:%d
|
command=signal-cli --output=json --config %s%s daemon %s%s%s%s --tcp 127.0.0.1:%d
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
startretries=10
|
startretries=10
|
||||||
@ -43,12 +43,6 @@ func main() {
|
|||||||
|
|
||||||
jsonRpc2ClientConfig.AddEntry(utils.MULTI_ACCOUNT_NUMBER, utils.JsonRpc2ClientConfigEntry{TcpPort: tcpPort})
|
jsonRpc2ClientConfig.AddEntry(utils.MULTI_ACCOUNT_NUMBER, utils.JsonRpc2ClientConfigEntry{TcpPort: tcpPort})
|
||||||
|
|
||||||
signalCliBinary := "signal-cli"
|
|
||||||
signalMode := utils.GetEnv("MODE", "json-rpc")
|
|
||||||
if signalMode == "json-rpc-native" {
|
|
||||||
signalCliBinary = "signal-cli-native"
|
|
||||||
}
|
|
||||||
|
|
||||||
signalCliIgnoreAttachments := ""
|
signalCliIgnoreAttachments := ""
|
||||||
ignoreAttachments := utils.GetEnv("JSON_RPC_IGNORE_ATTACHMENTS", "")
|
ignoreAttachments := utils.GetEnv("JSON_RPC_IGNORE_ATTACHMENTS", "")
|
||||||
if ignoreAttachments == "true" {
|
if ignoreAttachments == "true" {
|
||||||
@ -97,7 +91,7 @@ func main() {
|
|||||||
//write supervisorctl config
|
//write supervisorctl config
|
||||||
supervisorctlConfigFilename := "/etc/supervisor/conf.d/" + "signal-cli-json-rpc-1.conf"
|
supervisorctlConfigFilename := "/etc/supervisor/conf.d/" + "signal-cli-json-rpc-1.conf"
|
||||||
|
|
||||||
supervisorctlConfig := fmt.Sprintf(supervisorctlConfigTemplate, supervisorctlProgramName, supervisorctlProgramName, signalCliBinary,
|
supervisorctlConfig := fmt.Sprintf(supervisorctlConfigTemplate, supervisorctlProgramName, supervisorctlProgramName,
|
||||||
signalCliConfigDir, trustNewIdentities, signalCliIgnoreAttachments, signalCliIgnoreStories,
|
signalCliConfigDir, trustNewIdentities, signalCliIgnoreAttachments, signalCliIgnoreStories,
|
||||||
signalCliIgnoreAvatars, signalCliIgnoreStickers, tcpPort,
|
signalCliIgnoreAvatars, signalCliIgnoreStickers, tcpPort,
|
||||||
supervisorctlProgramName, supervisorctlProgramName)
|
supervisorctlProgramName, supervisorctlProgramName)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user