diff --git a/Inotify/Controllers/SettingController.cs b/Inotify/Controllers/SettingController.cs index 71b8b5b..f3d4d7c 100644 --- a/Inotify/Controllers/SettingController.cs +++ b/Inotify/Controllers/SettingController.cs @@ -49,7 +49,9 @@ namespace Inotify.Controllers sendTemplate.IsActive = sendAuthInfo.Active; sendTemplate.AuthToTemplate(sendAuthInfo.AuthData); userSendTemplates.Add(sendTemplate); - sendTemplate.Values.FirstOrDefault(e => e.Name == nameof(BarkSendTemplate.Auth.SendUrl)).Value = ""; + + var bark = sendTemplate.Values.FirstOrDefault(e => e.Name == nameof(BarkSendTemplate.Auth.SendUrl)); + if(bark!=null) bark .Value = ""; } } diff --git a/Inotify/Inotify.csproj b/Inotify/Inotify.csproj index 011eb2c..d265959 100644 --- a/Inotify/Inotify.csproj +++ b/Inotify/Inotify.csproj @@ -27,7 +27,7 @@ - + diff --git a/Inotify/Sends/Products/TelegramBotSendTemplate.cs b/Inotify/Sends/Products/TelegramBotSendTemplate.cs index 79a5c5f..a0cdb2e 100644 --- a/Inotify/Sends/Products/TelegramBotSendTemplate.cs +++ b/Inotify/Sends/Products/TelegramBotSendTemplate.cs @@ -1,5 +1,6 @@  using System; +using System.Net.Http; using Telegram.Bot; using Telegram.Bot.Types.InputFiles; @@ -26,7 +27,13 @@ namespace Inotify.Sends.Products { var proxy = GetProxy(); - var client = proxy == null ? new TelegramBotClient(Auth.BotToken) : new TelegramBotClient(Auth.BotToken, proxy); + var proxyHttpClientHandler = new HttpClientHandler + { + Proxy = proxy, + UseProxy = true, + }; + var httpClient = new HttpClient(proxyHttpClientHandler); + var client = proxy == null ? new TelegramBotClient(Auth.BotToken) : new TelegramBotClient(Auth.BotToken, httpClient); var content = string.IsNullOrEmpty(message.Title) ? message.Title : message.Title + "\n" + message.Data; var isIMG = !string.IsNullOrEmpty(message.Title) && IsUrl(message.Title) && IsImage(message.Title) && string.IsNullOrEmpty(message.Data); if (isIMG) diff --git a/Inotify/Sends/SendTemplate.cs b/Inotify/Sends/SendTemplate.cs index c7b0217..4960c07 100644 --- a/Inotify/Sends/SendTemplate.cs +++ b/Inotify/Sends/SendTemplate.cs @@ -203,7 +203,7 @@ namespace Inotify.Sends if (proxyurl != null) { - WebProxy proxy = new WebProxy + WebProxy proxy = new WebProxy() { Address = new Uri(proxyurl) };