clarify telegram notification flow

This commit is contained in:
Dmitry Verkhoturov
2021-11-04 15:42:04 -05:00
committed by Umputun
parent 6449b7d92b
commit e1a2374a2d
+7 -8
View File
@@ -472,28 +472,27 @@ func (s *ServerCommand) newServerApp(ctx context.Context) (*serverApp, error) {
KeyStore: adminStore,
}
var telegramService *notify.Telegram
var telegramBotUsername string
notifyDestinations, err := s.makeNotifyDestinations(authenticator)
if err != nil {
log.Printf("[WARN] failed to prepare notify destinations, %s", err)
}
var telegramService *notify.Telegram
if contains("telegram", s.Notify.Users) || contains("telegram", s.Notify.Admins) {
telegramService, err = s.makeTelegramNotify()
if err != nil {
log.Printf("[WARN] failed to make telegram notify service, %s", err)
} else {
notifyDestinations = append(notifyDestinations, telegramService)
}
}
notifyService := s.makeNotifyService(dataService, notifyDestinations)
var telegramBotUsername string
if telegramService != nil {
notifyDestinations = append(notifyDestinations, telegramService)
telegramBotUsername = telegramService.GetBotUsername()
}
notifyService := s.makeNotifyService(dataService, notifyDestinations)
imgProxy := &proxy.Image{
HTTP2HTTPS: s.ImageProxy.HTTP2HTTPS,
CacheExternal: s.ImageProxy.CacheExternal,
@@ -813,8 +812,8 @@ func (s *ServerCommand) addAuthProviders(ctx context.Context, authenticator *aut
if s.Auth.Telegram {
telegram := &provider.TelegramHandler{
ProviderName: "telegram",
ErrorMsg: "❌ Invalid auth request. Please try clicking link again.",
SuccessMsg: "✅ You have successfully authenticated!",
ErrorMsg: "❌ Invalid auth request. Please try requesting the link again.",
SuccessMsg: "✅ You have successfully authenticated, check the web!",
Telegram: provider.NewTelegramAPI(s.Telegram.Token, &http.Client{Timeout: s.Telegram.Timeout}),
L: log.Default(),
TokenService: authenticator.TokenService(),