版本提示

This commit is contained in:
老九 2021-09-08 10:38:40 +08:00
parent 37bfc3db83
commit eb0fcf5cac
4 changed files with 33 additions and 21 deletions

View File

@ -1,5 +1,7 @@
using FastGithub.Models; using FastGithub.Configuration;
using FastGithub.Models;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
namespace FastGithub.Controllers namespace FastGithub.Controllers
{ {
@ -14,7 +16,11 @@ namespace FastGithub.Controllers
/// <returns></returns> /// <returns></returns>
public IActionResult Index() public IActionResult Index()
{ {
var model = new Home { Host = Request.Host.ToString() }; var model = new Home
{
Version = ProductionVersion.Current?.ToString(),
ProjectUri = "https://github.com/dotnetcore/FastGithub"
};
return View(model); return View(model);
} }
} }

View File

@ -8,11 +8,11 @@
/// <summary> /// <summary>
/// 获取版本号 /// 获取版本号
/// </summary> /// </summary>
public string? Version { get; } = ProductionVersion.Current?.ToString(); public string? Version { get; set; }
/// <summary> /// <summary>
/// 请求域名或ip /// 请求域名或ip
/// </summary> /// </summary>
public string? Host { get; set; } public string? ProjectUri { get; set; }
} }
} }

View File

@ -17,7 +17,7 @@ namespace FastGithub
public Task StartAsync(CancellationToken cancellationToken) public Task StartAsync(CancellationToken cancellationToken)
{ {
var version = ProductionVersion.Current; var version = ProductionVersion.Current;
this.logger.LogInformation($"{nameof(FastGithub)}启动完成当前版本为v{version}"); this.logger.LogInformation($"{nameof(FastGithub)}启动完成当前版本为v{version}访问https://github.com/dotnetcore/FastGithub关注新版本");
return Task.CompletedTask; return Task.CompletedTask;
} }

View File

@ -16,23 +16,29 @@
<body> <body>
<div class="container"> <div class="container">
<h1>FastGithub</h1> <div class="row">
<p>github加速神器解决github打不开、用户头像无法加载、releases无法上传下载、git-clone、git-pull、git-push失败等问题</p> <div class="col-md-12">
<h3>软件信息</h3>
<p>
<span>软件版本:</span>
<span>v@(Model?.Version)</span>
</p>
<p>
<span>项目地址:</span>
<a target="_blank" href="https://github.com/dotnetcore/FastGithub">https://github.com/dotnetcore/FastGithub</a>
</p>
<h3>CA证书</h3> <h1>FastGithub</h1>
<p> <p>github加速神器解决github打不开、用户头像无法加载、releases无法上传下载、git-clone、git-pull、git-push失败等问题</p>
你可能需要在客户端设备下载FastGithub自颁发的CA证书<a target="_blank" href="/cert">FastGithub.cer</a>,导入到受信任的根证书颁发机构或浏览器
</p> <h3>软件信息</h3>
<p>
<span>安装版本:</span>
<span>v@(Model?.Version)</span>
</p>
<p>
<span>项目地址:</span>
<a target="_blank" href="@(Model?.ProjectUri)">@(Model?.ProjectUri)</a>
</p>
<h3>CA证书</h3>
<p>
你可能需要在客户端设备下载FastGithub自颁发的CA证书<a target="_blank" href="/cert">FastGithub.cer</a>,导入到受信任的根证书颁发机构或浏览器
</p>
</div>
</div>
</div> </div>
</body> </body>
</html> </html>