不弹出浏览器
This commit is contained in:
parent
6891fc06bd
commit
586383cb26
@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.1.1</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<Description>github加速神器</Description>
|
||||
<Copyright>https://github.com/xljiulang/FastGithub</Copyright>
|
||||
|
||||
@ -7,7 +7,7 @@ namespace FastGithub.Upgrade
|
||||
/// <summary>
|
||||
/// 表示产品版本
|
||||
/// </summary>
|
||||
sealed class ProductionVersion : IComparable<ProductionVersion>
|
||||
public class ProductionVersion : IComparable<ProductionVersion>
|
||||
{
|
||||
/// <summary>
|
||||
/// 版本
|
||||
@ -94,14 +94,14 @@ namespace FastGithub.Upgrade
|
||||
/// 获取当前应用程序的产品版本
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ProductionVersion? GetApplicationVersion()
|
||||
public static ProductionVersion? GetAppVersion()
|
||||
{
|
||||
var version = Assembly
|
||||
.GetEntryAssembly()?
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
||||
.InformationalVersion;
|
||||
|
||||
return version == null ? null : ProductionVersion.Parse(version);
|
||||
return version == null ? null : Parse(version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -42,16 +41,6 @@ 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"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ namespace FastGithub.Upgrade
|
||||
/// <returns></returns>
|
||||
public async Task UpgradeAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var currentVersion = ProductionVersion.GetApplicationVersion();
|
||||
var currentVersion = ProductionVersion.GetAppVersion();
|
||||
if (currentVersion == null)
|
||||
{
|
||||
return;
|
||||
|
||||
46
FastGithub/HostedService.cs
Normal file
46
FastGithub/HostedService.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FastGithub
|
||||
{
|
||||
/// <summary>
|
||||
/// Host服务
|
||||
/// </summary>
|
||||
sealed class HostedService : IHostedService
|
||||
{
|
||||
private readonly ILogger<HostedService> logger;
|
||||
|
||||
/// <summary>
|
||||
/// Host服务
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
public HostedService(ILogger<HostedService> logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启动服务
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var localhost = "https://127.0.0.1";
|
||||
this.logger.LogInformation($"{nameof(FastGithub)}启动完成,访问{localhost}或本机任意ip可查看使用说明");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停止服务
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,7 @@ namespace FastGithub
|
||||
services.AddAppUpgrade();
|
||||
services.AddSingleton<FastGithubConfig>();
|
||||
services.Configure<FastGithubOptions>(this.Configuration.GetSection(nameof(FastGithub)));
|
||||
services.AddHostedService<HostedService>();
|
||||
|
||||
services.AddControllersWithViews();
|
||||
services.AddRouting(c => c.LowercaseUrls = true);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@using FastGithub.Upgrade
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
@ -10,7 +11,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href=" https://cdn.jsdelivr.net/npm/@@bootcss/v3.bootcss.com@@1.0.10/dist/css/bootstrap.min.css">
|
||||
<title>FastGithub--github加速神器</title>
|
||||
<title>FastGithub</title>
|
||||
|
||||
<style type="text/css">
|
||||
.os {
|
||||
@ -28,14 +29,23 @@
|
||||
|
||||
<h1>FastGithub</h1>
|
||||
<p>github加速神器</p>
|
||||
<a href="https://github.com/xljiulang/FastGithub">https://github.com/xljiulang/FastGithub</a>
|
||||
<p>
|
||||
<span>软件版本:</span>
|
||||
<span>v@(ProductionVersion.GetAppVersion())</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>平台地址:</span>
|
||||
<a target="_blank" href="https://github.com/xljiulang/FastGithub">https://github.com/xljiulang/FastGithub</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h3>CA证书</h3>
|
||||
<p>
|
||||
你可能需要<a target="_blank" href="/cert">下载FastGithub自颁发的CA证书</a>,根据设备所使用的平台要求,导入到受信任的根证书颁发机构或浏览器
|
||||
</p>
|
||||
|
||||
<h3>运行方式</h3>
|
||||
<h3>部署方式</h3>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-4">
|
||||
<div class="thumbnail">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user