mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 23:54:22 +01:00
added DEFAULT_SIGNAL_TEXT_MODE env variable
* allows to set the default text mode globally. The setting is only used when the 'text_mode' is not explicitly set in the payload. see #671
This commit is contained in:
@@ -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.
|
* `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.
|
* `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.
|
||||||
|
|||||||
@@ -437,10 +437,19 @@ func (a *Api) SendV2(c *gin.Context) {
|
|||||||
return
|
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(
|
data, err := a.signalClient.SendV2(
|
||||||
req.Number, req.Message, req.Recipients, req.Base64Attachments, req.Sticker,
|
req.Number, req.Message, req.Recipients, req.Base64Attachments, req.Sticker,
|
||||||
req.Mentions, req.QuoteTimestamp, req.QuoteAuthor, req.QuoteMessage, req.QuoteMentions,
|
req.Mentions, req.QuoteTimestamp, req.QuoteAuthor, req.QuoteMessage, req.QuoteMentions,
|
||||||
req.TextMode, req.EditTimestamp, req.NotifySelf)
|
textMode, req.EditTimestamp, req.NotifySelf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.(type) {
|
switch err.(type) {
|
||||||
case *client.RateLimitErrorType:
|
case *client.RateLimitErrorType:
|
||||||
|
|||||||
Reference in New Issue
Block a user