diff --git a/FastGithub.Browser/BrowserHostedService.cs b/FastGithub.Browser/BrowserHostedService.cs
new file mode 100644
index 0000000..1639e0b
--- /dev/null
+++ b/FastGithub.Browser/BrowserHostedService.cs
@@ -0,0 +1,25 @@
+using Microsoft.Extensions.Hosting;
+using System;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace FastGithub.Browser
+{
+ ///
+ /// 启动浏览器加载readme
+ ///
+ sealed class BrowserHostedService : IHostedService
+ {
+ public Task StartAsync(CancellationToken cancellationToken)
+ {
+
+ return Task.CompletedTask;
+ }
+
+ public Task StopAsync(CancellationToken cancellationToken)
+ {
+ return Task.CompletedTask;
+ }
+ }
+}
diff --git a/FastGithub.Browser/BrowserServiceCollectionExtensions.cs b/FastGithub.Browser/BrowserServiceCollectionExtensions.cs
new file mode 100644
index 0000000..0cb1fb9
--- /dev/null
+++ b/FastGithub.Browser/BrowserServiceCollectionExtensions.cs
@@ -0,0 +1,21 @@
+using FastGithub.Browser;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace FastGithub
+{
+ ///
+ /// 浏览器服务注册扩展
+ ///
+ public static class BrowserServiceCollectionExtensions
+ {
+ ///
+ /// 注册浏览器服务注册
+ ///
+ ///
+ ///
+ public static IServiceCollection AddBrowser(this IServiceCollection services)
+ {
+ return services.AddHostedService();
+ }
+ }
+}
diff --git a/FastGithub.Browser/FastGithub.Browser.csproj b/FastGithub.Browser/FastGithub.Browser.csproj
new file mode 100644
index 0000000..02a814b
--- /dev/null
+++ b/FastGithub.Browser/FastGithub.Browser.csproj
@@ -0,0 +1,10 @@
+
+
+
+ net5.0
+
+
+
+
+
+
diff --git a/FastGithub.Upgrade/UpgradeHostedService.cs b/FastGithub.Upgrade/UpgradeHostedService.cs
index 35fa681..7c8588b 100644
--- a/FastGithub.Upgrade/UpgradeHostedService.cs
+++ b/FastGithub.Upgrade/UpgradeHostedService.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
+using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
@@ -41,6 +42,16 @@ namespace FastGithub.Upgrade
{
this.logger.LogWarning($"升级失败:{ex.Message}");
}
+
+ if (OperatingSystem.IsWindows() && Process.GetCurrentProcess().SessionId > 0)
+ {
+ await Task.Delay(TimeSpan.FromSeconds(2d), stoppingToken);
+ Process.Start(new ProcessStartInfo
+ {
+ UseShellExecute = true,
+ FileName = "https://localhost"
+ });
+ }
}
}
}
diff --git a/FastGithub/Program.cs b/FastGithub/Program.cs
index 12ffe2a..61ac886 100644
--- a/FastGithub/Program.cs
+++ b/FastGithub/Program.cs
@@ -44,8 +44,8 @@ namespace FastGithub
services.AddDnsServer();
services.AddDomainResolve();
services.AddHttpClient();
- services.AddAppUpgrade();
services.AddReverseProxy();
+ services.AddAppUpgrade();
services.AddSingleton();
services.Configure(ctx.Configuration.GetSection(nameof(FastGithub)));
})
diff --git a/FastGithub/README.MD b/FastGithub/README.MD
index bb57d01..3d7b188 100644
--- a/FastGithub/README.MD
+++ b/FastGithub/README.MD
@@ -6,8 +6,8 @@ github加速神器
* 双击运行FastGithub.exe程序
* 程序自动设置网络适配器的主DNS为127.0.0.1
* 程序自动安装CA证书到`将所有的证书都放入下载存储\受信任的根证书颁发机构`
-* FastGithub.exe start // 安装并启动服务
-* FastGithub.exe stop // 卸载并删除服务
+* FastGithub.exe start // 作为windows服务安装并启动
+* FastGithub.exe stop // 作为windows服务卸载并删除
#### linux本机
* 执行./FastGithub运行程序
diff --git a/FastGithub/README.html b/FastGithub/README.html
index 3e738c9..8e75f7d 100644
--- a/FastGithub/README.html
+++ b/FastGithub/README.html
@@ -23,8 +23,8 @@
双击运行FastGithub.exe程序
程序自动设置网络适配器的主DNS为127.0.0.1
程序自动安装CA证书到将所有的证书都放入下载存储\受信任的根证书颁发机构
- FastGithub.exe start // 安装并启动服务
- FastGithub.exe stop // 卸载并删除服务
+ FastGithub.exe start // 作为windows服务安装并启动
+ FastGithub.exe stop // 作为windows服务卸载并删除
linux本机