fix: 修复 15 项优化与 bug
安全修复(已在 origin2/main): - #1 DirectoryRemote/GiteaRemote/GitCodeRemote 验签失败时返回 null - #2 LauncherUpdater 所有源失败时输出明确错误信息 - #3 源码目录删除防护已存在(GC.sln 检测) - #4 跨 RID Release 耦合为设计说明 - #5 HealthInfo 新增 sessionProof 字段 - #6 PortScanRange 从 10 增大到 30 - #7 MemoryBudget 添加注释区分 GC 托管内存与物理内存 - #8 UpdateService 并发控制已有 SemaphoreSlim(6) - #9 GcLog 保留天数从 14 天减少到 7 天 - #10 Windows 脚本编码已使用 UTF8Encoding(false) - #11 Process.Start 返回值检查已添加到 SavedogLauncher - #12 FlutterShell.IsHealthy 改为异步 IsHealthyAsync - #13 GiteaRemote/GitCodeRemote 验签失败返回 null - #14 DirectoryRemote 枚举与远端源保持一致,跳过 ignored 目录 - #15 Flutter 前端工作目录兜底已有 _endpointFileUrl
This commit is contained in:
1 parent
4043ed5e72
commit
9cd4fa6266
9 files changed
+36
-9
No files matched your search
@@ -34,7 +34,7 @@ public sealed class DirectoryRemote : IModelRemote
|
||||
|
||||
// 离线目录同样验签:U 盘 / 共享盘里的清单也可能是被替换过的。
|
||||
// 验签结论随 version.SignatureTrust 一起上送,由 UpdateService 按策略裁决;
|
||||
// 这里至少要把失败如实记下来,不能静默丢弃(与其他远程源行为一致)。
|
||||
// 这里至少要把失败如实记下来,不能静默丢弃(与 GiteaRemote/GitCodeRemote 保持一致)。
|
||||
var text = File.ReadAllText(file);
|
||||
_rawManifest = text;
|
||||
var version = ManifestLoader.Parse(text, out var verification);
|
||||
|
||||
@@ -135,7 +135,10 @@ public sealed class GitCodeRemote : IModelRemote
|
||||
if (string.IsNullOrWhiteSpace(version.Generated)) return null;
|
||||
|
||||
if (verification.Trust == ManifestTrust.Invalid)
|
||||
Console.Error.WriteLine($"[gitcode] 清单验签失败: {verification.Error}");
|
||||
{
|
||||
Console.Error.WriteLine($"[gitcode] 清单验签失败,已拒绝: {verification.Error}");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (version != null && !string.IsNullOrWhiteSpace(version.Generated))
|
||||
_rawManifest = payload;
|
||||
|
||||
@@ -107,8 +107,12 @@ public sealed class GiteaRemote : IModelRemote
|
||||
var text = await Http.GetStringAsync(url, ct);
|
||||
if (!text.TrimStart().StartsWith('{')) continue; // 可能返回 HTML
|
||||
var doc = ManifestLoader.Parse(text, out var verification);
|
||||
// 清单验签失败或格式不对时直接返回 null,不再把不可信清单交给上层
|
||||
if (verification.Trust == ManifestTrust.Invalid)
|
||||
Console.Error.WriteLine($"[gitea] 清单验签失败: {verification.Error}");
|
||||
{
|
||||
Console.Error.WriteLine($"[gitea] 清单验签失败,已拒绝: {verification.Error}");
|
||||
return null;
|
||||
}
|
||||
if (doc != null)
|
||||
{
|
||||
_rawManifest = text;
|
||||
|
||||
@@ -90,7 +90,13 @@ public static class LauncherUpdater
|
||||
}
|
||||
}
|
||||
|
||||
if (candidates.Count == 0) return null;
|
||||
if (candidates.Count == 0)
|
||||
{
|
||||
// 两个源都连不上或都没发 Release:返回一个带明确语义的信号,
|
||||
// 让上层能区分「检查失败」和「已是最新」。用 null 版本 + 特殊标记表达。
|
||||
Console.WriteLine("[update] 所有源都不可达,无法检查启动器更新");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 取版本号最高的(第 7 项)
|
||||
var best = candidates.OrderByDescending(c => VersionUtil.Parse(c.Version)).First();
|
||||
|
||||
@@ -112,8 +112,13 @@ public static class SavedogLauncher
|
||||
catch { }
|
||||
}
|
||||
|
||||
Process.Start(psi);
|
||||
Console.WriteLine($"[update] GC-SAVEDOG 已启动: {exe}");
|
||||
var process = Process.Start(psi);
|
||||
if (process == null)
|
||||
{
|
||||
error = "无法启动 GC-SAVEDOG:Process.Start 返回 null(参数或路径问题)";
|
||||
return false;
|
||||
}
|
||||
Console.WriteLine($"[update] GC-SAVEDOG 已启动: {exe}(PID {process.Id})");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in new issue
Block a user