移除Pages
This commit is contained in:
parent
986dec2da7
commit
ea4277c93d
@ -2,6 +2,8 @@
|
||||
using LiveCharts.Wpf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FastGithub.UI
|
||||
@ -14,7 +16,7 @@ namespace FastGithub.UI
|
||||
private readonly LineSeries readSeries = new LineSeries
|
||||
{
|
||||
Title = "上行速率",
|
||||
PointGeometry = null,
|
||||
PointGeometry = null,
|
||||
Values = new ChartValues<double>()
|
||||
};
|
||||
|
||||
@ -39,10 +41,35 @@ namespace FastGithub.UI
|
||||
this.Series.Add(this.writeSeries);
|
||||
|
||||
DataContext = this;
|
||||
this.InitFlowChart();
|
||||
}
|
||||
|
||||
public void Add(FlowRate flowRate)
|
||||
|
||||
private async void InitFlowChart()
|
||||
{
|
||||
var httpClient = new HttpClient();
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
await this.GetFlowRateAsync(httpClient);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(1d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task GetFlowRateAsync(HttpClient httpClient)
|
||||
{
|
||||
var response = await httpClient.GetAsync("http://127.0.0.1/flowRates");
|
||||
var json = await response.EnsureSuccessStatusCode().Content.ReadAsStringAsync();
|
||||
var flowRate = Newtonsoft.Json.JsonConvert.DeserializeObject<FlowRate>(json);
|
||||
|
||||
this.readSeries.Values.Add(flowRate.ReadRate / 1024);
|
||||
this.writeSeries.Values.Add(flowRate.WriteRate / 1024);
|
||||
this.Labels.Add(DateTime.Now.ToString("HH:mm:ss"));
|
||||
@ -54,6 +81,5 @@ namespace FastGithub.UI
|
||||
this.Labels.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,32 +51,8 @@ namespace FastGithub.UI
|
||||
{
|
||||
var version = FileVersionInfo.GetVersionInfo(fileName);
|
||||
this.Title = $"{FAST_GITHUB} v{version.ProductVersion}";
|
||||
}
|
||||
|
||||
this.InitFlowChart();
|
||||
}
|
||||
|
||||
private async void InitFlowChart()
|
||||
{
|
||||
var httpClient = new HttpClient();
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await httpClient.GetAsync("http://127.0.0.1/flowRates");
|
||||
var json = await response.EnsureSuccessStatusCode().Content.ReadAsStringAsync();
|
||||
var flowRate = Newtonsoft.Json.JsonConvert.DeserializeObject<FlowRate>(json);
|
||||
this.flowChart.Add(flowRate);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(1d));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
@ -97,7 +73,6 @@ namespace FastGithub.UI
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,10 +44,4 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
@page
|
||||
@model FastGithub.Pages.CertModel
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link href="bootstrap.min.css" rel="stylesheet" />
|
||||
<title>证书验证</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div>
|
||||
<h3>Firefox</h3>
|
||||
<blockquote>
|
||||
<h4>建立安全连接失败</h4>
|
||||
<p><small>连接到 github.com 时发生错误。对等端的证书有一个无效的签名。</small> </p>
|
||||
<p><small> 错误代码:SEC_ERROR_BAD_SIGNATURE</small> </p>
|
||||
</blockquote>
|
||||
|
||||
<h4>解决办法</h4>
|
||||
<p>
|
||||
<span class="badge">1</span>
|
||||
<span>地址栏输入:</span><code>about:config</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="badge">2</span>
|
||||
<span>输入首选项名称:</span><code>security.enterprise_roots.enabled</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="badge">3</span>
|
||||
<span>修改值为:</span><code>true</code>
|
||||
</p>
|
||||
</div>
|
||||
<hr />
|
||||
<div>
|
||||
<h3>git.exe</h3>
|
||||
<blockquote>
|
||||
<h4>clone、pull或push等异常 </h4>
|
||||
<p><small>fatal: unable to access 'https://github.com/xxx.git/'</small> </p>
|
||||
<p><small>SSL certificate problem: unable to get local issuer certificate</small> </p>
|
||||
</blockquote>
|
||||
|
||||
<h4>解决办法</h4>
|
||||
<p>
|
||||
<span class="badge">1</span>
|
||||
<span>管理员身份运行:</span><code>cmd</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="badge">2</span>
|
||||
<span>在cmd输入:</span><code>git config --global http.sslverify false</code>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,12 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace FastGithub.Pages
|
||||
{
|
||||
public class CertModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,94 +0,0 @@
|
||||
@page
|
||||
@model FastGithub.Pages.FlowModel
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<script src="echarts.min.js"></script>
|
||||
<script src="jquery.min.js"></script>
|
||||
<title>流量监控</title>
|
||||
|
||||
<style type="text/css">
|
||||
html, body, #chart {
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body onContextMenu="return false">
|
||||
<div id="chart"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var timeCategory = [];
|
||||
var readCategory = [];
|
||||
var wirteCategory = [];
|
||||
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['上行速率(KB/s)', '下行速率(KB/s)']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: timeCategory
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '上行速率(KB/s)',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
smooth: true,
|
||||
data: readCategory
|
||||
},
|
||||
{
|
||||
name: '下行速率(KB/s)',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
smooth: true,
|
||||
data: wirteCategory
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var flowChart = echarts.init(document.getElementById('chart'));
|
||||
flowChart.setOption(option);
|
||||
window.onresize = function () {
|
||||
flowChart.resize();
|
||||
}
|
||||
|
||||
setInterval(function () {
|
||||
$.getJSON('/flowRates?r=' + Math.random(), function (data) {
|
||||
var time = new Date().toLocaleTimeString().replace(/^\D*/, '');
|
||||
timeCategory.push(time);
|
||||
readCategory.push((data.readRate / 1024).toFixed(2));
|
||||
wirteCategory.push((data.writeRate / 1024).toFixed(2));
|
||||
|
||||
if (timeCategory.length > 60) {
|
||||
timeCategory.shift();
|
||||
readCategory.shift();
|
||||
wirteCategory.shift();
|
||||
}
|
||||
|
||||
flowChart.setOption(option);
|
||||
});
|
||||
}, 1000);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,12 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace FastGithub.Pages
|
||||
{
|
||||
public class FlowModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -1,12 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace FastGithub.Pages
|
||||
{
|
||||
public class RewardModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
@using FastGithub
|
||||
@namespace FastGithub.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@ -1,3 +0,0 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@ -39,7 +39,6 @@ namespace FastGithub
|
||||
services.AddHttpClient();
|
||||
services.AddReverseProxy();
|
||||
services.AddFlowAnalyze();
|
||||
services.AddRazorPages();
|
||||
services.AddHostedService<AppHostedService>();
|
||||
|
||||
if (OperatingSystem.IsWindows())
|
||||
@ -69,7 +68,6 @@ namespace FastGithub
|
||||
appBuilder.UseRouting();
|
||||
appBuilder.UseEndpoints(endpoint =>
|
||||
{
|
||||
endpoint.MapRazorPages();
|
||||
endpoint.MapGet("/flowRates", context =>
|
||||
{
|
||||
var loggingFeature = context.Features.Get<IRequestLoggingFeature>();
|
||||
|
||||
6
FastGithub/wwwroot/bootstrap.min.css
vendored
6
FastGithub/wwwroot/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
12
FastGithub/wwwroot/echarts.min.js
vendored
12
FastGithub/wwwroot/echarts.min.js
vendored
File diff suppressed because one or more lines are too long
5
FastGithub/wwwroot/jquery.min.js
vendored
5
FastGithub/wwwroot/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user