diff --git a/README.md b/README.md index 8f9e4a9..8a5e460 100644 --- a/README.md +++ b/README.md @@ -145,3 +145,5 @@ There are a bunch of environmental variables that can be set inside the docker c * `SWAGGER_USE_HTTPS_AS_PREFERRED_SCHEME`: Use the HTTPS Scheme as preferred scheme in the Swagger UI. * `PORT`: Defaults to port `8080` unless this env var is set to tell it otherwise. + +* `DEFAULT_SIGNAL_TEXT_MODE`: Allows to set the default text mode that should be used when sending a message (supported values: `normal`, `styled`). The setting is only used in case the `text_mode` is not explicitly set in the payload of the `send` method. diff --git a/src/api/api.go b/src/api/api.go index 779c3fc..72c8661 100644 --- a/src/api/api.go +++ b/src/api/api.go @@ -437,10 +437,19 @@ func (a *Api) SendV2(c *gin.Context) { return } + textMode := req.TextMode + if textMode == nil { + defaultSignalTextMode := utils.GetEnv("DEFAULT_SIGNAL_TEXT_MODE", "normal") + if defaultSignalTextMode == "styled" { + styledStr := "styled" + textMode = &styledStr + } + } + data, err := a.signalClient.SendV2( req.Number, req.Message, req.Recipients, req.Base64Attachments, req.Sticker, req.Mentions, req.QuoteTimestamp, req.QuoteAuthor, req.QuoteMessage, req.QuoteMentions, - req.TextMode, req.EditTimestamp, req.NotifySelf) + textMode, req.EditTimestamp, req.NotifySelf) if err != nil { switch err.(type) { case *client.RateLimitErrorType: