fix: 修复模型检测/自动下载与启动器更新
- ModelSourceClient: 自托管 Gitea 源(git.xhmcl.com)ArchiveCandidates 之前 直接 yield break,只能靠系统 git clone。没装 git 的机器「检测模型/下载/ 自动更新」全部失效。补上 archive/<branch>.zip 归档地址(已实测可用), 下载经 ResumableDownloader 完成,无需系统 git。fake-git 实测 5/5 模型可检测。 - LauncherUpdater.HashZipPayloadAsync: 只找 GC.dll/GC/GC*.dll,但产物自 1.0.10 起是 GCL-<版本>-<平台> 单文件,找不到主程序 -> sha256 无法比对 -> 不提示更新。 改为优先匹配 GCL- 主程序(排除 GC-UI/GC-SAVEDOG/.GC),兼容旧 GC 命名。 实测已从「无法比对 sha256」变为能算出远端包 sha256。 - version.json / model/version.json: 5 个模型的 manifestSha256 与仓库实际模型 json 不符(发布时 updatedAt 漂移导致),使模型自动更新每次因校验失败被丢弃 (「没有自动下载」)。按当前模型 json 实际 sha256 修正并重新签名(gc-2026-12), 两份清单保持一致;launcher 包 sha256/size 与版本号不动。
This commit is contained in:
1 parent
5e5d84856a
commit
023e9468db
4 files changed
+43
-19
No files matched your search
@@ -194,8 +194,26 @@ public static class LauncherUpdater
|
||||
{
|
||||
using var ms = new MemoryStream(zip);
|
||||
using var archive = new System.IO.Compression.ZipArchive(ms, System.IO.Compression.ZipArchiveMode.Read);
|
||||
// 找主程序:app 内的可执行文件 / GC.dll / 单文件 exe
|
||||
var entry = archive.Entries.FirstOrDefault(e =>
|
||||
|
||||
// 发布包从 1.0.10 起改为 GCL 命名 + 单文件 + 单顶层目录,主程序是
|
||||
// <顶层>/GCL-<版本>-<平台>.exe (Windows)
|
||||
// <顶层>/GCL-<版本>-<平台> (Linux,无扩展名)
|
||||
// <顶层>/GCL-<版本>-mac-arm64.app/... (macOS)
|
||||
// 旧布局则是 GC.dll / GC / GC*.dll。先找新名,再退回旧名,兼容老发布包。
|
||||
// 注意排除 GC-UI / GC-SAVEDOG / .GC/bin 里的附属程序,它们不是启动器本体。
|
||||
bool IsLauncher(System.IO.Compression.ZipArchiveEntry e)
|
||||
{
|
||||
var n = e.Name;
|
||||
if (n.Length == 0) return false; // 目录条目
|
||||
if (n.StartsWith("GC-UI", StringComparison.OrdinalIgnoreCase) ||
|
||||
n.StartsWith("GC-SAVEDOG", StringComparison.OrdinalIgnoreCase)) return false;
|
||||
if (e.FullName.Replace('\\', '/').Contains("/.GC/")) return false;
|
||||
if (n.StartsWith("GCL-", StringComparison.OrdinalIgnoreCase)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
var entry = archive.Entries.FirstOrDefault(IsLauncher)
|
||||
?? archive.Entries.FirstOrDefault(e =>
|
||||
e.Name.Equals("GC.dll", StringComparison.OrdinalIgnoreCase))
|
||||
?? archive.Entries.FirstOrDefault(e =>
|
||||
e.Name.Equals("GC", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -154,7 +154,13 @@ public sealed class ModelSourceClient : IModelSourceClient
|
||||
else if (host.Contains("gitee.com"))
|
||||
yield return $"https://gitee.com/{owner}/{repo}/repository/archive/{b}.zip";
|
||||
else
|
||||
yield break;
|
||||
{
|
||||
// 自托管 Gitea(如 git.xhmcl.com):用 archive/<branch>.zip 拉源码归档。
|
||||
// 关键:不能在这里 yield break —— 那样就只剩 git clone 一条路,
|
||||
// 用户机器没装 git 时「检测模型 / 下载 / 自动更新」会全部失效。
|
||||
// 归档下载走 ResumableDownloader,无需系统 git。
|
||||
yield return $"{uri.GetLeftPart(UriPartial.Authority)}/{owner}/{repo}/archive/{b}.zip";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user