feat: 全面迁移到 Flutter + 新增 GitHub 源与 CI 流水线
PR 审核 / 后端编译 (pull_request) Waiting to run
PR 审核 / 前端检查(Flutter) (pull_request) Waiting to run
PR 审核 / 安全扫描 (pull_request) Waiting to run

前端
- 移除全部 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

@@ -1,96 +0,0 @@
using System;
using System.Collections.Generic;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
using GC.ModelSdk;
namespace GC.ContourMap;
/// <summary>等高线模型入口(清单里的 type 指向这里)。</summary>
public sealed class ContourMapFactory : IModelFactory
{
public int ApiVersion => 1;
public IModelRuntime Create() => new ContourMapRuntime();
}
/// <summary>
/// 等高线模型运行时。
/// 依据人教版七年级上册「地形图的判读」:海拔与相对高度、等高线与等高距、
/// 山峰/山脊/山谷/鞍部/陡崖的判读、坡度陡缓与等高线疏密的关系。
/// </summary>
public sealed class ContourMapRuntime : IModelRuntime
{
private TerrainField? _field;
private Dictionary<string, string>? _texts;
private ContourPage? _page;
public void Prepare(IModelContext context)
{
context.ReportProgress(0.15, "生成地形高度场");
_field = new TerrainField(TerrainKind.Mountain, 192);
context.ReportProgress(0.70, "提取等高线");
_texts = LoadTexts(context.DataDirectory, context.Language);
context.ReportProgress(0.92, "准备界面");
context.Log($"[contour-map] 地形 {_field.Size}×{_field.Size}," +
$"海拔 {_field.MinHeight:0}~{_field.MaxHeight:0} m,等高距 {_field.EffectiveInterval:0} m");
}
public Control CreateView(IModelContext context)
{
_texts ??= LoadTexts(context.DataDirectory, context.Language);
// 实验地形 + 五大地貌都在界面里现场生成(切换很快,不必预先生成全部)
_page = new ContourPage(_texts);
return _page.Build();
}
public void Dispose()
{
_page?.Dispose();
_page = null;
_field = null;
_texts = null;
System.GC.SuppressFinalize(this);
}
/// <summary>
/// 文案 = 内置默认(保证任何语言都有词)+ dataDir/i18n/&lt;lang&gt;.json 覆盖。
/// 语言包缺失或某条没翻译时自动退回内置默认,不会露出裸 key。
/// </summary>
private static Dictionary<string, string> LoadTexts(string dataDir, string language)
{
var isEn = language.StartsWith("en", StringComparison.OrdinalIgnoreCase);
var map = new Dictionary<string, string>(DefaultTexts.Zh);
if (isEn) foreach (var kv in DefaultTexts.En) map[kv.Key] = kv.Value;
var candidates = new List<string>();
if (!string.IsNullOrWhiteSpace(language)) candidates.Add(language);
candidates.Add(isEn ? "en" : "zh-CN");
foreach (var lang in candidates)
{
var path = System.IO.Path.Combine(dataDir, "i18n", lang + ".json");
if (!System.IO.File.Exists(path)) continue;
try
{
using var doc = System.Text.Json.JsonDocument.Parse(System.IO.File.ReadAllText(path));
if (doc.RootElement.ValueKind != System.Text.Json.JsonValueKind.Object) continue;
foreach (var p in doc.RootElement.EnumerateObject())
{
if (p.Value.ValueKind != System.Text.Json.JsonValueKind.String) continue;
var v = p.Value.GetString();
if (!string.IsNullOrWhiteSpace(v)) map[p.Name] = v!;
}
break;
}
catch
{
// 语言包损坏不影响开课,继续用内置默认
}
}
return map;
}
}