client: Windows 客户端(WinUI3 壳 + agent-core;调试用 Electron 壳存档);localserver token 改为常数时间比较

This commit is contained in:
Qiufeng
2026-08-20 20:38:21 +08:00
parent 33b7d57498
commit 9abf7f8213
60 changed files with 10025 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
# EveryPublish 客户端打包脚本(Windows 上执行)
# 产出 dist/EveryPublish-Client-<版本>-win-x64.zip:WinUI 壳 + agent-core.exe 同目录。
param(
[string]$Version = "0.2.0"
)
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot # client/ui
$dist = Join-Path $root "..\dist"
New-Item -ItemType Directory -Force -Path $dist | Out-Null
Write-Host "[1/5] 生成图标 app.ico ..."
Add-Type -AssemblyName System.Drawing
$assets = Join-Path $root "Assets"
New-Item -ItemType Directory -Force -Path $assets | Out-Null
$bmp = New-Object System.Drawing.Bitmap 32, 32
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.Clear([System.Drawing.Color]::FromArgb(0, 110, 255))
$font = New-Object System.Drawing.Font("Arial", 16, [System.Drawing.FontStyle]::Bold)
$g.DrawString("E", $font, [System.Drawing.Brushes]::White, 7, 5)
$g.Dispose()
$icon = [System.Drawing.Icon]::FromHandle($bmp.GetHicon())
$fs = [System.IO.File]::Create((Join-Path $assets "app.ico"))
$icon.Save($fs)
$fs.Close()
Write-Host "[2/5] 交叉编译 agent-core.exe (Go) ..."
Push-Location (Join-Path $root "..\core")
$env:GOOS = "windows"
$env:GOARCH = "amd64"
go build -o (Join-Path $dist "agent-core.exe") .
Pop-Location
Write-Host "[3/5] dotnet publish WinUI 壳 ..."
$publishDir = Join-Path $dist "publish"
Push-Location $root
dotnet publish EveryPublish.Client.csproj -c Release -r win-x64 -p:Platform=x64 -o $publishDir
Pop-Location
Write-Host "[4/5] 组装产物 ..."
Copy-Item (Join-Path $dist "agent-core.exe") $publishDir -Force
Copy-Item -Recurse -Force $assets (Join-Path $publishDir "Assets")
Write-Host "[5/5] 压缩 ..."
$zip = Join-Path $dist "EveryPublish-Client-$Version-win-x64.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path (Join-Path $publishDir "*") -DestinationPath $zip -Force
Write-Host "OK: $zip" -ForegroundColor Green
+31
View File
@@ -0,0 +1,31 @@
# EveryPublish Windows 构建前环境自检(PowerShell)
Write-Host "=== EveryPublish Windows 构建自检 ===" -ForegroundColor Cyan
function Check($name, $cmd) {
try {
$out = Invoke-Expression $cmd 2>&1 | Out-String
$first = ($out.Trim() -split "`n")[0]
Write-Host "[OK] $name : $first" -ForegroundColor Green
return $true
} catch {
Write-Host "[FAIL] $name 未安装或不可用" -ForegroundColor Red
return $false
}
}
$ok = $true
$ok = (Check "dotnet SDK" "dotnet --version") -and $ok
$ok = (Check "Go 工具链" "go version") -and $ok
# 版本校验:.NET 需 8.x,Go 需 1.23+
$dotnetVer = (dotnet --version 2>$null)
if ($dotnetVer -and -not $dotnetVer.StartsWith("8.")) {
Write-Host "[WARN] dotnet 版本 $dotnetVer,建议 .NET 8 SDK" -ForegroundColor Yellow
}
if (-not $ok) {
Write-Host "请先安装依赖(见 client/ui/README.md)后重试" -ForegroundColor Red
exit 1
}
Write-Host "环境就绪:可运行 Packaging\build-installer.ps1 打包" -ForegroundColor Green