mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(notifications): add support for custom Telegram api url (#1508)
feat(notifications): Add support for reverse proxyed telegram api
This commit is contained in:
parent
72ca7a8a4f
commit
c43e2c76d6
2 changed files with 15 additions and 1 deletions
|
@ -73,7 +73,15 @@ func (s *telegramSender) Send(event domain.NotificationEvent, payload domain.Not
|
||||||
return errors.Wrap(err, "could not marshal data: %+v", m)
|
return errors.Wrap(err, "could not marshal data: %+v", m)
|
||||||
}
|
}
|
||||||
|
|
||||||
url := fmt.Sprintf("https://api.telegram.org/bot%v/sendMessage", s.Settings.Token)
|
var host string
|
||||||
|
|
||||||
|
if s.Settings.Host == "" {
|
||||||
|
host = "https://api.telegram.org"
|
||||||
|
} else {
|
||||||
|
host = s.Settings.Host
|
||||||
|
}
|
||||||
|
|
||||||
|
url := fmt.Sprintf("%v/bot%v/sendMessage", host, s.Settings.Token)
|
||||||
|
|
||||||
req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
|
req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(jsonData))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -132,6 +132,12 @@ function FormFieldsTelegram() {
|
||||||
label="Message Thread ID"
|
label="Message Thread ID"
|
||||||
help="Message Thread (topic) of a Supergroup"
|
help="Message Thread (topic) of a Supergroup"
|
||||||
/>
|
/>
|
||||||
|
<TextFieldWide
|
||||||
|
name="host"
|
||||||
|
label="Telegram Api Proxy"
|
||||||
|
help="Reverse proxy domain for api.telegram.org, only needs to be specified if the network you are using has blocked the Telegram API."
|
||||||
|
placeholder="http(s)://ip:port"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue