Files
ykxmz/_build/push_now.ps1
T
xmz7891 60d1bdfe58 中转站加下载区 + 大文件流式发送
下载区
- 管理页加一张「下载最新版」卡片,就一个按钮
  自动指向 /v1/downloads 里最新的被控端整包,不用每次改页面
- GET /v1/downloads 列出成品
- GET /download/<文件> 直接给文件
  只允许白名单后缀(.apk/.zip/.txt/.exe/.idsig)
  文件名严格校验,挡目录穿越(../ 和 ..%2F 都试过)
- 卡片下面附一个 Gitee 历史版本入口

大文件
- 原来 read_bytes() 一次性读进内存再 write。
  19MB 在 460MB 的设备上勉强,更要命的是 Cloudflare
  有 100 秒的源站响应上限,数据越晚开始流动越容易被掐。
- 改成 64KB 分块流式发送,边读边发
  实测:19MB 公网下载 40 秒完成,字节数完全一致

版本
- 三端分开打包(原来是一个合并 zip)
    ykxmz-agent-1.5.0.zip   被控端
    ykxmz-server-1.5.0.zip  服务器端
    ykxmz-watch-1.5.0.apk   控制端(直接给 APK)
2026-10-06 23:08:06 +08:00

61 lines
2.4 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 提交并推送
$ErrorActionPreference = "Continue"
$git = "C:\Program Files\Git\bin\git.exe"
$root = "C:\Users\shu\Desktop\deepseekagent\LanRemote"
Set-Location $root
Write-Host "===== 1. 暂存 =====" -ForegroundColor Cyan
& $git add -A 2>&1 | Out-Null
$files = @(& $git -c core.quotepath=false diff --cached --name-only |
Where-Object { $_ -and $_.Trim() -ne "" })
Write-Host " 改动: $($files.Count) 个文件"
Write-Host ""
Write-Host "===== 2. 确认没有大文件 =====" -ForegroundColor Cyan
$big = foreach ($f in $files) {
$p = Join-Path $root ($f -replace '/','\')
if (Test-Path -LiteralPath $p -PathType Leaf) {
$len = (Get-Item -LiteralPath $p).Length
if ($len -gt 500KB) { [pscustomobject]@{ N = $f; MB = [math]::Round($len/1MB,2) } }
}
}
if ($big) { $big | ForEach-Object { Write-Host " ⚠ $($_.MB) MB $($_.N)" -ForegroundColor Yellow } }
else { Write-Host " ✓ 没有超过 500KB 的" -ForegroundColor Green }
Write-Host ""
Write-Host "===== 3. 提交 =====" -ForegroundColor Cyan
$msg = @"
中转站加下载区 + 大文件流式发送
下载区
- 管理页加一张「下载最新版」卡片,就一个按钮
自动指向 /v1/downloads 里最新的被控端整包,不用每次改页面
- GET /v1/downloads 列出成品
- GET /download/<文件> 直接给文件
只允许白名单后缀(.apk/.zip/.txt/.exe/.idsig)
文件名严格校验,挡目录穿越(../ 和 ..%2F 都试过)
- 卡片下面附一个 Gitee 历史版本入口
大文件
- 原来 read_bytes() 一次性读进内存再 write。
19MB 在 460MB 的设备上勉强,更要命的是 Cloudflare
有 100 秒的源站响应上限,数据越晚开始流动越容易被掐。
- 改成 64KB 分块流式发送,边读边发
实测:19MB 公网下载 40 秒完成,字节数完全一致
版本
- 三端分开打包(原来是一个合并 zip)
ykxmz-agent-1.5.0.zip 被控端
ykxmz-server-1.5.0.zip 服务器端
ykxmz-watch-1.5.0.apk 控制端(直接给 APK)
"@
& $git commit -q -m $msg 2>&1 | Out-Null
Write-Host " exit=$LASTEXITCODE"
& $git log --oneline 2>&1 | Select-Object -First 2 | ForEach-Object { Write-Host " $_" }
Write-Host ""
Write-Host "===== 4. 推送 =====" -ForegroundColor Cyan
$env:GIT_SSH_COMMAND = "`"C:\Program Files\Git\usr\bin\ssh.exe`""
& $git push origin main 2>&1 | Select-Object -Last 6 | ForEach-Object { Write-Host " $_" }
Write-Host " exit=$LASTEXITCODE"