feat: 全面迁移到 Flutter + 新增 GitHub 源与 CI 流水线

前端
- 移除全部 Avalonia 依赖,模型渲染与界面统一改用 Flutter
- 新增用户页:登录/注册(SHA-512 + 盐)、签到积分(30 天一循环)、
  主题色积分购买、二选一随机、今日人品
- 新增百宝箱页、模型内嵌渲染页、自绘标题栏(最小化/最大化/关闭)
- 下载页显示模型下载进度条,下载源读取加速
- 关于页新增「重新下载启动器」并在下载后做 sha256 完整性校验
- 修复浅色主题下标题栏不跟随主题色、无法连接后端等问题

后端
- 新增 UserService:.GC/user/<用户名>.yaml 存用户名/积分/SHA-512 口令,
  登录返回 session token,本地 .GC/user/user.yaml 保存登录态
- 新增 /api/user/{register,login,me,signin,theme} 接口
- 去掉 Avalonia 窗口宿主,后端只提供 HTTP API

下载源
- 新增 GitHub 镜像源(Morris-morris-cloud/GC),与 Xhmcl 并发测速
- 单源探测超时收紧到 2 秒,取最快且可用的源;GitHub 复用 GiteaRemote
  (contents 带 ref、releases 带 per_page=100)

构建与 CI
- macOS 上默认只出 macOS 包,Windows 交给原生 Windows 构建
- 修复 Windows 交叉编译中 flutter-cpp-client-wrapper 双层目录嵌套
- 新增 GitHub Actions:
  · nightly-prerelease:每天 21:00 编译三平台,发布 nightly 预发布
  · build-bot:Issue/PR 评论 @build-bot build <mac|win-amd|win-arm|all>,
    发布 ip-prerelease 预发布
  · pr-review:检查能否编译、静态分析、合并冲突、是否落后 main
- 忽略 79MB 课件产物等高线.html 与工具链临时备份
This commit is contained in:
Morris committed 2026-11-21 19:18:58 +08:00
1 parent b9cb56cb8b
commit ea1fa6b6d1
134 files changed
+4309 -16614

No files matched your search

+18 -11
View File
@@ -42,9 +42,8 @@ public sealed class GitCodeRemote : IModelRemote
_displayName = string.IsNullOrWhiteSpace(repository)
? DefaultRepository : repository!.TrimEnd('/');
_http = new HttpClient { Timeout = TimeSpan.FromMinutes(2) };
_http.DefaultRequestHeaders.UserAgent.ParseAdd("GC-Updater/1.0");
_http.DefaultRequestHeaders.Accept.ParseAdd("application/json");
// 使用共享 HttpClient,统一连接池管理
_http = SharedHttpClientFactory.GetDefault();
if (string.IsNullOrWhiteSpace(manifestUrl))
{
@@ -136,7 +135,8 @@ public sealed class GitCodeRemote : IModelRemote
if (verification.Trust == ManifestTrust.Invalid)
{
Console.Error.WriteLine($"[gitcode] 清单验签失败,已拒绝: {verification.Error}");
GcLog.Warn($"清单验签失败,已拒绝: {verification.Error}",
$"Manifest signature check failed: {verification.Error}");
return null;
}
@@ -146,7 +146,8 @@ public sealed class GitCodeRemote : IModelRemote
}
catch (Exception ex)
{
Console.Error.WriteLine($"版本清单解析失败 {url}: {ex.Message}");
GcLog.Warn($"版本清单解析失败 {url}: {ex.Message}",
$"Failed to parse version manifest {url}: {ex.Message}");
return null;
}
}
@@ -179,7 +180,8 @@ public sealed class GitCodeRemote : IModelRemote
try { text = await GetWithRetryAsync(url, ct); }
catch (Exception ex)
{
Console.Error.WriteLine($"列目录失败 {repoPath}: {ex.Message}");
GcLog.Warn($"列目录失败 {repoPath}: {ex.Message}",
$"Failed to list directory {repoPath}: {ex.Message}");
return;
}
if (!text.TrimStart().StartsWith("[", StringComparison.Ordinal)) return;
@@ -338,7 +340,8 @@ public sealed class GitCodeRemote : IModelRemote
if (bytes != null) return bytes;
}
Console.Error.WriteLine("[gitcode] 找不到可用的启动器包(Release 附件与 dist 目录都没对上)");
GcLog.Warn("找不到可用的启动器包(Release 附件与 dist 目录都没对上)",
"Could not find a usable launcher package");
return null;
}
@@ -351,7 +354,8 @@ public sealed class GitCodeRemote : IModelRemote
try { bytes = await _http.GetByteArrayAsync(url!, ct); }
catch (Exception ex)
{
Console.Error.WriteLine($"[gitcode] 下载失败 {Short(url!)}: {ex.Message}");
GcLog.Warn($"下载失败 {Short(url!)}: {ex.Message}",
$"Download failed {Short(url!)}: {ex.Message}");
return null;
}
if (bytes.Length == 0) return null;
@@ -361,12 +365,14 @@ public sealed class GitCodeRemote : IModelRemote
var actual = Convert.ToHexString(SHA256.HashData(bytes)).ToLowerInvariant();
if (!string.Equals(actual, sha256.Trim(), StringComparison.OrdinalIgnoreCase))
{
Console.Error.WriteLine($"[gitcode] 包校验不符,换下一个来源: {Short(url!)}");
GcLog.Warn($"包校验不符,换下一个来源: {Short(url!)}",
$"Package hash mismatch, trying next source: {Short(url!)}");
return null;
}
}
Console.WriteLine($"[gitcode] 启动器包来源: {Short(url!)}");
GcLog.Info($"启动器包来源: {Short(url!)}",
$"Launcher package source: {Short(url!)}");
return bytes;
}
@@ -431,7 +437,8 @@ public sealed class GitCodeRemote : IModelRemote
match = 0;
}
Console.WriteLine($"[gitcode] 在 {dir} 找到编译产物: {zips[match].Name}");
GcLog.Info($"在 {dir} 找到编译产物: {zips[match].Name}",
$"Found build artifact in {dir}: {zips[match].Name}");
return await ResolveFileUrlAsync(zips[match].Path, ct);
}
catch (Exception)