Compare commits

..

10 Commits

Author SHA1 Message Date
Hugo
e9e912d4a7
Merge 8ea7456812d6f8b53d11c2aa26f6a2645b83322f into 57141615675e7000c700ba1e5eb38ecb5c7d6486 2025-12-13 11:21:08 +01:00
Bernhard B
5714161567 fixed bug in json-rpc mode
* handle 'trust-new-identities' setting in json-rpc mode

see #771
2025-12-08 22:40:03 +01:00
Bernhard B.
57ebd2acb8
Merge pull request #769 from bbernhard/dependabot/go_modules/src/github.com/sirupsen/logrus-1.9.1
Bump github.com/sirupsen/logrus from 1.9.0 to 1.9.1 in /src
2025-12-05 23:00:51 +01:00
Bernhard B.
0c081ec7cf
Merge pull request #770 from jtrumpio/improve-captcha-documentation
Improve captcha documentation
2025-12-05 22:59:23 +01:00
Jason Trumpio
8a75633ca9
Improve captcha documentation to provide example captcha string format
Signed-off-by: Jason Trumpio <jason@trumpio.com>
2025-12-04 23:28:08 -05:00
Jason Trumpio
c45b9059b5
Improve captcha documentation to provide example captcha string format
Signed-off-by: Jason Trumpio <jason@trumpio.com>
2025-12-04 23:27:11 -05:00
Jason Trumpio
a7f531d17f
Improve captcha documentation to provide example captcha string format
Signed-off-by: Jason Trumpio <jason@trumpio.com>
2025-12-04 23:25:42 -05:00
Jason Trumpio
9ea4407ac2
Improve captcha documentation to provide example captcha string format
Signed-off-by: Jason Trumpio <jason@trumpio.com>
2025-12-04 23:23:29 -05:00
Jason Trumpio
d102da4ba2
Improve captcha documentation to provide example captcha string format
Signed-off-by: Jason Trumpio <jason@trumpio.com>
2025-12-04 23:14:49 -05:00
dependabot[bot]
4a2bf9182d
Bump github.com/sirupsen/logrus from 1.9.0 to 1.9.1 in /src
Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/sirupsen/logrus/releases)
- [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sirupsen/logrus/compare/v1.9.0...v1.9.1)

---
updated-dependencies:
- dependency-name: github.com/sirupsen/logrus
  dependency-version: 1.9.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-05 02:36:43 +00:00
6 changed files with 28 additions and 12 deletions

View File

@ -156,3 +156,4 @@ There are a bunch of environmental variables that can be set inside the docker c
* `JSON_RPC_IGNORE_ATTACHMENTS`: When set to `true`, attachments are not automatically downloaded in json-rpc mode (default: `false`)
* `JSON_RPC_IGNORE_STORIES`: When set to `true`, stories are not automatically downloaded in json-rpc mode (default: `false`)
* `JSON_RPC_TRUST_NEW_IDENTITIES`: Choose how to trust new identities in json-rpc mode. Supported values: `on-first-use`, `always`, `never`. (default: `on-first-use`)

View File

@ -23,7 +23,7 @@ e.g:
When you try to register a number, if you receive a response like `{"error":"Captcha required for verification (null)\n"}` then Signal is requiring a captcha. To register the number you must do the following:
1. Go to [https://signalcaptchas.org/registration/generate.html](https://signalcaptchas.org/registration/generate.html)
2. Open the developer console
3. Find the line that looks like this: `Prevented navigation to “signalcaptcha://{captcha value}” due to an unknown protocol.` Copy the captcha value
3. Find the line that looks like this: `Prevented navigation to “signalcaptcha://{captcha value}” due to an unknown protocol.` Copy the captcha value (e.g. `signal-hcaptcha-short.xxxxx.registration.yyyyyy`). Note: do not include `signalcaptcha://`.
4. Use it to make the registration call like this:
`curl -X POST -H "Content-Type: application/json" -d '{"captcha":"captcha value"}' 'http://127.0.0.1:8080/v1/register/<number>'`

View File

@ -2296,8 +2296,12 @@ func (s *SignalClient) ListDevices(number string) ([]ListDevicesResponse, error)
}
func (s *SignalClient) SetTrustMode(number string, trustMode utils.SignalCliTrustMode) error {
s.signalCliApiConfig.SetTrustModeForNumber(number, trustMode)
return s.signalCliApiConfig.Persist()
if s.signalCliMode == JsonRpc {
return errors.New("Not supported in json-rpc mode, use the environment variable JSON_RPC_TRUST_NEW_IDENTITIES instead!")
} else {
s.signalCliApiConfig.SetTrustModeForNumber(number, trustMode)
return s.signalCliApiConfig.Persist()
}
}
func (s *SignalClient) GetTrustMode(number string) utils.SignalCliTrustMode {

View File

@ -11,7 +11,7 @@ require (
github.com/gorilla/websocket v1.5.0
github.com/h2non/filetype v1.1.3
github.com/robfig/cron/v3 v3.0.1
github.com/sirupsen/logrus v1.9.0
github.com/sirupsen/logrus v1.9.1
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0

View File

@ -84,8 +84,8 @@ github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.1 h1:Ou41VVR3nMWWmTiEUnj0OlsgOSCUFgsPAOl6jRIcVtQ=
github.com/sirupsen/logrus v1.9.1/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

View File

@ -2,18 +2,19 @@ package main
import (
"fmt"
"github.com/bbernhard/signal-cli-rest-api/utils"
log "github.com/sirupsen/logrus"
"io/ioutil"
"os"
"os/exec"
"strings"
"github.com/bbernhard/signal-cli-rest-api/utils"
log "github.com/sirupsen/logrus"
)
const supervisorctlConfigTemplate = `
[program:%s]
process_name=%s
command=bash -c "nc -l -p %d <%s | signal-cli --output=json --config %s jsonRpc%s%s >%s"
command=bash -c "nc -l -p %d <%s | signal-cli --output=json --config %s%s jsonRpc%s%s >%s"
autostart=true
autorestart=true
startretries=10
@ -77,16 +78,26 @@ func main() {
log.Fatal("Couldn't create log folder ", supervisorctlLogFolder, ": ", err.Error())
}
trustNewIdentities := ""
trustNewIdentitiesEnv := utils.GetEnv("JSON_RPC_TRUST_NEW_IDENTITIES", "")
if trustNewIdentitiesEnv == "on-first-use" {
trustNewIdentities = " --trust-new-identities on-first-use"
} else if trustNewIdentitiesEnv == "always" {
trustNewIdentities = " --trust-new-identities always"
} else if trustNewIdentitiesEnv == "never" {
trustNewIdentities = " --trust-new-identities never"
} else if trustNewIdentitiesEnv != "" {
log.Fatal("Invalid JSON_RPC_TRUST_NEW_IDENTITIES environment variable set!")
}
log.Info("Updated jsonrpc2.yml")
//write supervisorctl config
supervisorctlConfigFilename := "/etc/supervisor/conf.d/" + "signal-cli-json-rpc-1.conf"
supervisorctlConfig := fmt.Sprintf(supervisorctlConfigTemplate, supervisorctlProgramName, supervisorctlProgramName,
tcpPort, fifoPathname, signalCliConfigDir, signalCliIgnoreAttachments, signalCliIgnoreStories, fifoPathname,
tcpPort, fifoPathname, signalCliConfigDir, trustNewIdentities, signalCliIgnoreAttachments, signalCliIgnoreStories, fifoPathname,
supervisorctlProgramName, supervisorctlProgramName)
err = ioutil.WriteFile(supervisorctlConfigFilename, []byte(supervisorctlConfig), 0644)
if err != nil {