mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-03-13 02:33:47 +00:00
updated golang buildcontainer
This commit is contained in:
parent
8d13f5f383
commit
a9c367a5b1
@ -7,7 +7,7 @@ ARG GRAALVM_VERSION=25.0.2
|
||||
|
||||
ARG BUILD_VERSION_ARG=unset
|
||||
|
||||
FROM golang:1.24-bookworm AS buildcontainer
|
||||
FROM golang:1.24 AS buildcontainer
|
||||
|
||||
ARG SIGNAL_CLI_VERSION
|
||||
ARG LIBSIGNAL_CLIENT_VERSION
|
||||
@ -31,7 +31,7 @@ RUN arch="$(uname -m)"; \
|
||||
RUN dpkg-reconfigure debconf --frontend=noninteractive \
|
||||
&& apt-get update \
|
||||
&& apt-get -y install --no-install-recommends \
|
||||
wget software-properties-common git locales zip unzip \
|
||||
wget git locales zip unzip \
|
||||
file build-essential libz-dev zlib1g-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
@ -1,11 +1,22 @@
|
||||
version: "3"
|
||||
services:
|
||||
signal-cli-rest-api:
|
||||
image: bbernhard/signal-cli-rest-api:latest
|
||||
#image: bbernhard/signal-cli-rest-api:latest-dev
|
||||
build: "."
|
||||
environment:
|
||||
- MODE=normal #supported modes: json-rpc, native, normal
|
||||
- MODE=normal #supported modes: json-rpc, json-rpc-native, native, normal
|
||||
- ENABLE_PLUGINS=true
|
||||
- DEFAULT_SIGNAL_TEXT_MODE=styled
|
||||
- SWAGGER_IP=127.0.0.1
|
||||
- PODMAN_USERNS=keep-id
|
||||
#- JSON_RPC_IGNORE_ATTACHMENTS=true
|
||||
#- JSON_RPC_IGNORE_STORIES=true
|
||||
#- RECEIVE_WEBHOOK_URL=http://127.0.0.1:8089/webhook
|
||||
#- JSON_RPC_TRUST_NEW_IDENTITIES=always
|
||||
#- RECEIVE_WEBHOOK_URL=http://127.0.0.1:8080/v1/plugins/abc
|
||||
#- AUTO_RECEIVE_SCHEDULE=0 22 * * * #enable this parameter on demand (see description below)
|
||||
#network_mode: host
|
||||
ports:
|
||||
- "8080:8080" #map docker port 8080 to host port 8080.
|
||||
volumes:
|
||||
- "./signal-cli-config:/home/.local/share/signal-cli" #map "signal-cli-config" folder on host system into docker container. the folder contains the password and cryptographic keys when a new number is registered
|
||||
- "./plugins:/plugins"
|
||||
|
||||
@ -215,7 +215,7 @@ type RemoteDeleteRequest struct {
|
||||
}
|
||||
|
||||
type DeleteLocalAccountDataRequest struct {
|
||||
IgnoreRegistered bool `json:"ignore_registered" example:"false"`
|
||||
IgnoreRegistered bool `json:"ignore_registered" example:"false"`
|
||||
}
|
||||
|
||||
type DeviceLinkUriResponse struct {
|
||||
@ -364,30 +364,30 @@ func (a *Api) UnregisterNumber(c *gin.Context) {
|
||||
// @Failure 400 {object} Error
|
||||
// @Router /v1/devices/{number}/local-data [delete]
|
||||
func (a *Api) DeleteLocalAccountData(c *gin.Context) {
|
||||
number, err := url.PathUnescape(c.Param("number"))
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - malformed number"})
|
||||
return
|
||||
}
|
||||
if number == "" {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - number missing"})
|
||||
return
|
||||
}
|
||||
number, err := url.PathUnescape(c.Param("number"))
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - malformed number"})
|
||||
return
|
||||
}
|
||||
if number == "" {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - number missing"})
|
||||
return
|
||||
}
|
||||
|
||||
req := DeleteLocalAccountDataRequest{}
|
||||
if c.Request.Body != nil && c.Request.ContentLength != 0 {
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - invalid request"})
|
||||
return
|
||||
}
|
||||
}
|
||||
req := DeleteLocalAccountDataRequest{}
|
||||
if c.Request.Body != nil && c.Request.ContentLength != 0 {
|
||||
if err := c.BindJSON(&req); err != nil {
|
||||
c.JSON(400, Error{Msg: "Couldn't process request - invalid request"})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err := a.signalClient.DeleteLocalAccountData(number, req.IgnoreRegistered); err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
if err := a.signalClient.DeleteLocalAccountData(number, req.IgnoreRegistered); err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.Status(http.StatusNoContent)
|
||||
c.Status(http.StatusNoContent)
|
||||
}
|
||||
|
||||
// @Summary Verify a registered phone number.
|
||||
@ -843,6 +843,7 @@ func (a *Api) AddMembersToGroup(c *gin.Context) {
|
||||
|
||||
err = a.signalClient.AddMembersToGroup(number, groupId, req.Members)
|
||||
if err != nil {
|
||||
log.Info("ERR NOT NULL")
|
||||
switch err.(type) {
|
||||
case *client.NotFoundError:
|
||||
c.JSON(404, Error{Msg: err.Error()})
|
||||
@ -1174,19 +1175,19 @@ func (a *Api) GetQrCodeLink(c *gin.Context) {
|
||||
// @Failure 400 {object} Error
|
||||
// @Router /v1/qrcodelink/raw [get]
|
||||
func (a *Api) GetQrCodeLinkUri(c *gin.Context) {
|
||||
deviceName := c.Query("device_name")
|
||||
if deviceName == "" {
|
||||
c.JSON(400, Error{Msg: "Please provide a name for the device"})
|
||||
return
|
||||
}
|
||||
deviceName := c.Query("device_name")
|
||||
if deviceName == "" {
|
||||
c.JSON(400, Error{Msg: "Please provide a name for the device"})
|
||||
return
|
||||
}
|
||||
|
||||
deviceLinkUri, err := a.signalClient.GetDeviceLinkUri(deviceName)
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
deviceLinkUri, err := a.signalClient.GetDeviceLinkUri(deviceName)
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(200, DeviceLinkUriResponse{DeviceLinkUri: deviceLinkUri})
|
||||
c.JSON(200, DeviceLinkUriResponse{DeviceLinkUri: deviceLinkUri})
|
||||
}
|
||||
|
||||
// @Summary List all accounts
|
||||
@ -2080,7 +2081,7 @@ func (a *Api) RemoveDevice(c *gin.Context) {
|
||||
}
|
||||
|
||||
deviceIdStr := c.Param("deviceId")
|
||||
deviceId, err := strconv.ParseInt(deviceIdStr, 10, 64)
|
||||
deviceId, err := strconv.ParseInt(deviceIdStr, 10, 64)
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: "deviceId must be numeric"})
|
||||
return
|
||||
|
||||
@ -2634,8 +2634,8 @@ func (s *SignalClient) ListContacts(number string, allRecipients bool, recipient
|
||||
|
||||
if s.signalCliMode == JsonRpc {
|
||||
type Request struct {
|
||||
AllRecipients bool `json:"allRecipients,omitempty"`
|
||||
Recipient string `json:"recipient,omitempty"`
|
||||
AllRecipients bool `json:"allRecipients,omitempty"`
|
||||
Recipient string `json:"recipient,omitempty"`
|
||||
}
|
||||
req := Request{}
|
||||
if allRecipients {
|
||||
@ -2705,7 +2705,6 @@ func (s *SignalClient) ListContacts(number string, allRecipients bool, recipient
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
||||
func (s *SignalClient) SetPin(number string, registrationLockPin string) error {
|
||||
if s.signalCliMode == JsonRpc {
|
||||
type Request struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user