Skip to content

Commit d7a7571

Browse files
committed
feat: update
1 parent 06d6c14 commit d7a7571

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,5 @@
109109
- Feature #473 : let user input when there is no target task in configs
110110
## 1.0.2
111111
- Fix #484 : fix read dic config error
112+
- Merge PR #472 : add reverse proxy host for telegram notification
113+
- Merge PR #483 : update login field for entrypoint

src/Ray.BiliBiliTool.Console/Program.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ internal static IHostBuilder CreateHostBuilder(string[] args)
8181
//用户机密:
8282
if (env.IsDevelopment() && env.ApplicationName?.Length > 0)
8383
{
84-
var appAssembly = Assembly.Load(new AssemblyName(env.ApplicationName));
84+
//var appAssembly = Assembly.Load(new AssemblyName(env.ApplicationName));
85+
var appAssembly = Assembly.GetAssembly(typeof(Program));
8586
configurationBuilder.AddUserSecrets(appAssembly, optional: true, reloadOnChange: true);
8687
}
8788

src/Ray.BiliBiliTool.Console/appsettings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"chatId": "",
115115
"restrictedToMinimumLevel": "Information",
116116
"proxy": "", //代理,user:password@host:port
117-
"apiHost": ""
117+
"apiHost": "https://api.telegram.org" //可以替换成自己搭建的反代host(https://hostloc.com/thread-805441-1-1.html)
118118
}
119119
},
120120
//4.企业微信机器人(https://work.weixin.qq.com/api/doc/90000/90136/91770)

src/Ray.Serilog.Sinks/Ray.Serilog.Sinks.TelegramBatched/TelegramApiClient.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class TelegramApiClient : PushService
1414

1515
private readonly string _chatId;
1616
private readonly string _proxy;
17-
private const string TelegramBotApiUrl = "https://api.telegram.org/bot";
17+
private const string DefaultTelegramBotApiHost = "https://api.telegram.org";
1818

1919
/// <summary>
2020
/// The API URL.
@@ -42,12 +42,9 @@ public TelegramApiClient(string botToken, string chatId, string proxy = "", stri
4242

4343
_chatId = chatId;
4444
_proxy = proxy;
45-
var botApiUrl = TelegramBotApiUrl;
46-
if (!string.IsNullOrWhiteSpace(apiHost))
47-
{
48-
botApiUrl = apiHost;
49-
}
50-
this._apiUrl = new Uri($"{botApiUrl}{botToken}/sendMessage");
45+
46+
var botApiHost = string.IsNullOrWhiteSpace(apiHost)? DefaultTelegramBotApiHost:apiHost;
47+
this._apiUrl = new Uri($"{botApiHost}/bot{botToken}/sendMessage");
5148

5249
if (proxy.IsNotNullOrEmpty())
5350
{

test/LogTest/TestTelegram.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public class TestTelegram
1818

1919
public TestTelegram()
2020
{
21-
Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
22-
Program.CreateHost(new string[] { });
21+
Environment.SetEnvironmentVariable("DOTNET_ENVIRONMENT", "Development");
22+
Program.CreateHost(new string[] { "ENVIRONMENT=Development" });
2323

2424
_botToken = Global.ConfigurationRoot["Serilog:WriteTo:3:Args:botToken"];
2525
_chatId = Global.ConfigurationRoot["Serilog:WriteTo:3:Args:chatId"];

0 commit comments

Comments
 (0)