增加浏览器显示readme.html
This commit is contained in:
parent
bb48f6b760
commit
923839db18
25
FastGithub.Browser/BrowserHostedService.cs
Normal file
25
FastGithub.Browser/BrowserHostedService.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FastGithub.Browser
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 启动浏览器加载readme
|
||||||
|
/// </summary>
|
||||||
|
sealed class BrowserHostedService : IHostedService
|
||||||
|
{
|
||||||
|
public Task StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
FastGithub.Browser/BrowserServiceCollectionExtensions.cs
Normal file
21
FastGithub.Browser/BrowserServiceCollectionExtensions.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using FastGithub.Browser;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace FastGithub
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 浏览器服务注册扩展
|
||||||
|
/// </summary>
|
||||||
|
public static class BrowserServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 注册浏览器服务注册
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IServiceCollection AddBrowser(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
return services.AddHostedService<BrowserHostedService>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
FastGithub.Browser/FastGithub.Browser.csproj
Normal file
10
FastGithub.Browser/FastGithub.Browser.csproj
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@ -1,6 +1,7 @@
|
|||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -41,6 +42,16 @@ namespace FastGithub.Upgrade
|
|||||||
{
|
{
|
||||||
this.logger.LogWarning($"升级失败:{ex.Message}");
|
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"
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,8 +44,8 @@ namespace FastGithub
|
|||||||
services.AddDnsServer();
|
services.AddDnsServer();
|
||||||
services.AddDomainResolve();
|
services.AddDomainResolve();
|
||||||
services.AddHttpClient();
|
services.AddHttpClient();
|
||||||
services.AddAppUpgrade();
|
|
||||||
services.AddReverseProxy();
|
services.AddReverseProxy();
|
||||||
|
services.AddAppUpgrade();
|
||||||
services.AddSingleton<FastGithubConfig>();
|
services.AddSingleton<FastGithubConfig>();
|
||||||
services.Configure<FastGithubOptions>(ctx.Configuration.GetSection(nameof(FastGithub)));
|
services.Configure<FastGithubOptions>(ctx.Configuration.GetSection(nameof(FastGithub)));
|
||||||
})
|
})
|
||||||
|
|||||||
@ -6,8 +6,8 @@ github加速神器
|
|||||||
* 双击运行FastGithub.exe程序
|
* 双击运行FastGithub.exe程序
|
||||||
* 程序自动设置网络适配器的主DNS为127.0.0.1
|
* 程序自动设置网络适配器的主DNS为127.0.0.1
|
||||||
* 程序自动安装CA证书到`将所有的证书都放入下载存储\受信任的根证书颁发机构`
|
* 程序自动安装CA证书到`将所有的证书都放入下载存储\受信任的根证书颁发机构`
|
||||||
* FastGithub.exe start // 安装并启动服务
|
* FastGithub.exe start // 作为windows服务安装并启动
|
||||||
* FastGithub.exe stop // 卸载并删除服务
|
* FastGithub.exe stop // 作为windows服务卸载并删除
|
||||||
|
|
||||||
#### linux本机
|
#### linux本机
|
||||||
* 执行./FastGithub运行程序
|
* 执行./FastGithub运行程序
|
||||||
|
|||||||
@ -23,8 +23,8 @@
|
|||||||
<li>双击运行FastGithub.exe程序</li>
|
<li>双击运行FastGithub.exe程序</li>
|
||||||
<li>程序自动设置网络适配器的主DNS为127.0.0.1</li>
|
<li>程序自动设置网络适配器的主DNS为127.0.0.1</li>
|
||||||
<li>程序自动安装CA证书到<code>将所有的证书都放入下载存储\受信任的根证书颁发机构</code> </li>
|
<li>程序自动安装CA证书到<code>将所有的证书都放入下载存储\受信任的根证书颁发机构</code> </li>
|
||||||
<li>FastGithub.exe start // 安装并启动服务</li>
|
<li>FastGithub.exe start // 作为windows服务安装并启动</li>
|
||||||
<li>FastGithub.exe stop // 卸载并删除服务</li>
|
<li>FastGithub.exe stop // 作为windows服务卸载并删除</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h4>linux本机</h4>
|
<h4>linux本机</h4>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user