Publish Zonghengjia Windows 0.4.0 client source
This commit is contained in:
@@ -60,7 +60,7 @@ internal sealed partial class MainForm
|
||||
ConfigureLabel(_welcomeLabel, "", Brand.Font(11, FontStyle.Bold), Brand.Navy);
|
||||
ConfigureLabel(_accountLabel, "", Brand.Font(9.5f), Brand.Muted);
|
||||
ConfigureLabel(_identityBadge, "", Brand.Font(8.5f), Brand.RoyalBlue);
|
||||
ConfigureLabel(_scheduleBadge, "AI 自动调度", Brand.Font(8, FontStyle.Bold), Brand.RoyalBlue);
|
||||
ConfigureLabel(_scheduleBadge, "默认线路", Brand.Font(8, FontStyle.Bold), Brand.RoyalBlue);
|
||||
foreach (var badge in new[] { _identityBadge, _scheduleBadge })
|
||||
{
|
||||
badge.BackColor = Color.FromArgb(226, 239, 255);
|
||||
@@ -72,7 +72,7 @@ internal sealed partial class MainForm
|
||||
_dashboardBody.Controls.AddRange([_welcomeLabel, _accountLabel, _identityBadge, _logoutButton]);
|
||||
|
||||
ConfigureLabel(_statusTitle, "未连接", Brand.Font(17, FontStyle.Bold), Brand.Text);
|
||||
ConfigureLabel(_statusDetail, "点击连接,自动选择工作节点", Brand.Font(11), Brand.Muted);
|
||||
ConfigureLabel(_statusDetail, "点击连接,使用默认安全线路", Brand.Font(11), Brand.Muted);
|
||||
_statusDot.ForeColor = Brand.Muted;
|
||||
_statusCard.ScenicStatus = true;
|
||||
_nodeCard.AccentBar = _modeCard.AccentBar = false;
|
||||
@@ -86,10 +86,10 @@ internal sealed partial class MainForm
|
||||
await ToggleConnectionAsync();
|
||||
};
|
||||
_statusCard.Controls.AddRange([_statusDot, _statusTitle, _statusDetail, _connectButton]);
|
||||
ConfigureLabel(_nodeHeading, "当前工作节点", Brand.Font(10.5f, FontStyle.Bold), Brand.Text);
|
||||
ConfigureLabel(_nodeHeading, "默认线路", Brand.Font(10.5f, FontStyle.Bold), Brand.Text);
|
||||
ConfigureLabel(_routeHeading, "代理模式", Brand.Font(10.5f, FontStyle.Bold), Brand.Text);
|
||||
ConfigureLabel(_currentNodeLabel, "未连接", Brand.Font(11, FontStyle.Bold), Brand.RoyalBlue);
|
||||
ConfigureLabel(_selectionHeading, "调度", Brand.Font(10.5f, FontStyle.Bold), Brand.Text);
|
||||
ConfigureLabel(_selectionHeading, "", Brand.Font(10.5f, FontStyle.Bold), Brand.Text);
|
||||
ConfigureLabel(_actualModeHeading, "模式", Brand.Font(10.5f, FontStyle.Bold), Brand.Text);
|
||||
_modeCard.Controls.AddRange([_nodeHeading, _currentNodeLabel, _actualModeHeading, _routeReadOnly]);
|
||||
_nodeCard.Controls.AddRange([_selectionHeading, _routeHeading, _modeCard]);
|
||||
@@ -102,14 +102,15 @@ internal sealed partial class MainForm
|
||||
BuildConnectionSelection();
|
||||
ConfigureCombo(_routeCombo, Point.Empty, new(220, 30));
|
||||
_routeCombo.BackColor = Color.Transparent;
|
||||
_routeCombo.AccessibleName = "代理模式(连接时不可更改)";
|
||||
_routeCombo.AccessibleName = "代理模式(运行中可切换)";
|
||||
_routeReadOnly.Font = Brand.Font(10.5f, FontStyle.Bold);
|
||||
_routeReadOnly.Visible = true;
|
||||
_routeReadOnly.ForeColor = Brand.DeepBlue;
|
||||
_nodeCard.Controls.Add(_routeCombo);
|
||||
InitializeLiveProxyModeSwitch();
|
||||
|
||||
ConfigureLabel(_trafficHeading, "代理实时速度", Brand.Font(9.5f, FontStyle.Bold), Brand.Text);
|
||||
_trafficCard.AccessibleDescription = "纵横家当前全部代理速度,包含当前 Tailscale 传输;非整机流量。";
|
||||
_trafficCard.AccessibleDescription = "纵横家当前本机代理速度;非整机流量。";
|
||||
ConfigureLabel(_dailyHeading, "累计流量", Brand.Font(12, FontStyle.Bold), Brand.Text);
|
||||
ConfigureLabel(_sampleLabel, "仅代理流量 · 近 5 分钟", Brand.Font(7.5f), Brand.Muted);
|
||||
_sampleLabel.TextAlign = ContentAlignment.MiddleRight;
|
||||
@@ -244,8 +245,9 @@ internal sealed partial class MainForm
|
||||
{
|
||||
DisplayName="示例用户",Email="demo@example.com",IdentityType="employee",
|
||||
Subscription=new SubscriptionInfo {Plan="员工福利",UsedBytes=276L*1024*1024*1024,DeviceLimit=10},
|
||||
Nodes=[new NodeInfo {Name="VPN002",Slug="aliyun-tokyo-002",Status="online"}],
|
||||
RouteModes=[new RouteModeInfo {Id="smart",Name="AI 智能代理"}]
|
||||
Nodes=[new NodeInfo {Name="默认线路",Slug=SingleNodeClientPolicy.FixedNodeSlug,Status="online"}],
|
||||
RouteModes=[new RouteModeInfo {Id="smart",Name="AI 智能代理"},
|
||||
new RouteModeInfo {Id="global",Name="全局代理"}]
|
||||
});
|
||||
form._refreshTimer.Stop();
|
||||
var now=DateTimeOffset.UtcNow;
|
||||
@@ -275,9 +277,9 @@ internal sealed partial class MainForm
|
||||
&& form.CompactPresentation && form.DashboardControlsFit();
|
||||
|
||||
form.ClientSize=new Size(form.ScaleLogical(480),form.ScaleLogical(360));
|
||||
form._currentNodeBaseName="VPN002";
|
||||
form.UpdateConnectedTransportPresentation(true);
|
||||
form.SetConnectionState(true,"已安全连接","VPN002 + Tailscale · AI 智能代理");
|
||||
form._currentNodeBaseName="默认线路";
|
||||
form.UpdateConnectedTransportPresentation(false);
|
||||
form.SetConnectionState(true,"已安全连接","AI 智能代理");
|
||||
form.DisplayTraffic(1_153_433,64_614,"演示样本 · 近 5 分钟");
|
||||
form._sessionMetric.SetBytes(1_883_750_912,hint:"本次连接累计");
|
||||
for(var i=0;i<61;i++) form._trafficChart.Add((1500+Math.Sin(i*.8)*500)*1024,
|
||||
@@ -290,74 +292,37 @@ internal sealed partial class MainForm
|
||||
["dashboard_after_login_retains_initial_window_bounds"] = loginBounds == dashboardBounds && loginClientSize == dashboardClientSize,
|
||||
["dashboard_after_login_fits_initial_compact_window"] = initialDashboardFits,
|
||||
["fixed_half_size_window"]=form.ClientSize==new Size(form.ScaleLogical(480),form.ScaleLogical(360)),
|
||||
["repeated_proxy_and_tailnet_rows_hidden"]=!form._trafficCard.Visible&&!form._tailnetTrafficCard.Visible,
|
||||
["local_graph_caption_identifies_tailnet"]=form._trendHeading.Text.Contains("Tailscale"),
|
||||
["legacy_transport_rows_hidden"]=!form._trafficCard.Visible&&!form._tailnetTrafficCard.Visible,
|
||||
["local_graph_has_generic_proxy_caption"]=form._trendHeading.Text.Contains("本机代理")
|
||||
&&!form._trendHeading.Text.Contains("Tailscale",StringComparison.OrdinalIgnoreCase),
|
||||
["local_graph_has_actual_upload_download_values"]=form._uploadLegend.Visible&&form._downloadLegend.Visible
|
||||
&&form._uploadLegend.Text.Contains("MB/s")&&form._downloadLegend.Text.Contains("KB/s"),
|
||||
["totals_numeric_only"]=!form._dailyCard.Controls.OfType<TrafficChart>().Any(),
|
||||
["configuration_actual_state_aligned"]=form._connectionModeCombo.PointToScreen(Point.Empty).Y==form._currentNodeLabel.PointToScreen(Point.Empty).Y,
|
||||
["only_proxy_mode_selector_visible"]=!form._connectionModeCombo.Visible&&!form._manualNodeCombo.Visible
|
||||
&&form._routeCombo.Visible&&!form._currentNodeLabel.Visible,
|
||||
["no_dashboard_scroll"]=!form._dashboardScrollBar.Visible&&form._dashboardBody.Location==Point.Empty,
|
||||
["controls_fit"]=form.DashboardControlsFit(),
|
||||
["half_transparent_surfaces"]=CardPanel.SurfaceAlpha==128
|
||||
};
|
||||
Capture("local-trend-tailnet");
|
||||
Capture("single-node-proxy-trend");
|
||||
var originalBounds=(form._speedTrendCard.Bounds,form._dailyCard.Bounds,form._footer.Bounds);
|
||||
form.UpdateConnectedTransportPresentation(false);
|
||||
checks["public_ingress_caption_changes_without_resizing"]=form._trendHeading.Text.Contains("公网入口")
|
||||
checks["transport_metadata_does_not_resize_or_relabel_dashboard"]=form._trendHeading.Text.Contains("本机代理")
|
||||
&&originalBounds==(form._speedTrendCard.Bounds,form._dailyCard.Bounds,form._footer.Bounds);
|
||||
Capture("local-trend-domain");
|
||||
form.UpdateConnectedTransportPresentation(true);
|
||||
Capture("single-node-global-ready");
|
||||
form.UpdateConnectedTransportPresentation(false);
|
||||
form.SetNodeTrafficPermission(true);
|
||||
showServerFixture=true;
|
||||
NodeTrafficSnapshot? lastServerFixture=null;
|
||||
for(var i=0;i<301;i++)
|
||||
{
|
||||
var sampled=now.AddSeconds(i-300);
|
||||
serverClock=sampled;
|
||||
lastServerFixture=new NodeTrafficSnapshot
|
||||
{
|
||||
Contract=1,Scope="server_host_interface",Source="linux_host_interface",Direction="interface_perspective",
|
||||
CounterSince="boot_or_interface_reset",SamplePeriodSeconds=1,GeneratedAt=sampled,
|
||||
Nodes=new[]{("VPN002 东京","aliyun-tokyo-002"),("VPN003 美国","aliyun-siliconvalley-003"),
|
||||
("济南 博翠明湖","jinan-phone"),("VPN004 纽约","racknerd-newyork-004")}.Select((node,index)=>new NodeTrafficReading
|
||||
{
|
||||
Name=node.Item1,Slug=node.Item2,SampledAt=sampled,IntervalSeconds=1,CounterEpoch="synthetic-preview",
|
||||
UploadRate=(long)((20+(index+1)*12+Math.Sin(i*.035+index)*15)*1024),
|
||||
DownloadRate=(long)((150+(index+1)*45+Math.Sin(i*.07+index)*120)*1024)
|
||||
}).ToList()
|
||||
};
|
||||
previewServers.SetSnapshot(lastServerFixture);
|
||||
}
|
||||
form.LayoutDashboard();Capture("local-and-four-server-trends");
|
||||
checks["four_server_rows_received"]=previewServers.ServerCount==4;
|
||||
checks["graphs_order_local_then_servers_then_totals"]=form._speedTrendCard.Bottom<form._nodeTrafficPanel.Top
|
||||
&&form._nodeTrafficPanel.Bottom<form._dailyCard.Top&&form._dailyCard.Bottom<form._footer.Top;
|
||||
checks["four_servers_have_distinct_samples"]=previewServers.History("racknerd-newyork-004").Last().Up
|
||||
!=previewServers.History("aliyun-tokyo-002").Last().Up;
|
||||
checks["no_personal_accounting_changes_from_server_samples"]=form._sessionUp==0&&form._sessionDown==0;
|
||||
checks["server_graphs_keep_window_and_controls_fitted"]=form.DashboardControlsFit()&&!form._dashboardScrollBar.Visible;
|
||||
form.SetTailnetTrafficVisibility(true);
|
||||
checks["server_sampling_cannot_be_enabled"]=!form._canViewNodeTraffic&&!form._nodeTrafficPanel.Visible&&!form._nodeTrafficTimer.Enabled;
|
||||
checks["tailnet_presentation_cannot_be_enabled"]=!form._tailnetTrafficVisible&&!form._tailnetTrafficCard.Visible;
|
||||
foreach(var period in SpeedHistoryPeriod.All)
|
||||
{
|
||||
form._historyRangeCombo.SelectedItem=period;
|
||||
previewServers.SetPeriodMinutes(period.Minutes);
|
||||
checks["local_and_server_range_"+period.Minutes]=form._trafficChart.PeriodMinutes==period.Minutes
|
||||
&&previewServers.HistoryCount("racknerd-newyork-004")==301;
|
||||
checks["local_range_"+period.Minutes]=form._trafficChart.PeriodMinutes==period.Minutes;
|
||||
}
|
||||
form._historyRangeCombo.SelectedItem=SpeedHistoryPeriod.All[1];
|
||||
previewServers.SetPeriodMinutes(5);
|
||||
previewServers.SetSnapshot(new NodeTrafficSnapshot
|
||||
{
|
||||
Contract=1,Scope="server_host_interface",Source="linux_host_interface",Direction="interface_perspective",
|
||||
CounterSince="boot_or_interface_reset",SamplePeriodSeconds=1,GeneratedAt=now,
|
||||
Nodes=lastServerFixture!.Nodes.Where(row=>row.Slug!="jinan-phone").ToList()
|
||||
});
|
||||
Capture("local-and-three-server-trends");
|
||||
checks["three_live_server_fixture_fits_without_height_change"]=previewServers.ServerCount==3
|
||||
&&form.DashboardControlsFit()&&!form._dashboardScrollBar.Visible;
|
||||
previewServers.Unavailable("后台尚未提供服务器监控",clear:true);
|
||||
Capture("server-monitor-unavailable");
|
||||
checks["missing_server_data_does_not_invent_rows"]=previewServers.ServerCount==0;
|
||||
form.SetNodeTrafficPermission(false);
|
||||
Capture("single-node-no-server-monitor");
|
||||
checks["single_node_dashboard_fits_without_server_rows"]=form.DashboardControlsFit()&&!form._dashboardScrollBar.Visible;
|
||||
form.SetConnectionState(false,"未连接","连接后显示代理速度趋势");
|
||||
form._trafficChart.Reset();Capture("disconnected");
|
||||
checks["disconnected_values_not_stale"]=form._uploadLegend.Text.Contains("—")&&form._downloadLegend.Text.Contains("—");
|
||||
|
||||
Reference in New Issue
Block a user