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

+25
View File
@@ -0,0 +1,25 @@
import 'base.dart';
import 'contour_flutter.dart';
import 'geography_flutter.dart';
import 'revolution_flutter.dart';
import 'rotation_flutter.dart';
import 'scale_flutter.dart';
/// 后端模型 id → Flutter 实现。
///
/// 后端(`/api/models`)用的是模型包目录名(contour-map、earth-rotation…),
/// Flutter 实现自己的 id 带 `-flutter` 后缀,这里做一次映射。
/// Avalonia 版模型窗口已移除,所有模型统一在客户端内用 Flutter 渲染。
final Map<String, GcModel Function()> _factories = <String, GcModel Function()>{
'contour-map': () => ContourModelFlutter(),
'earth-geography': () => GeographyModelFlutter(),
'earth-rotation': () => RotationModelFlutter(),
'earth-revolution': () => RevolutionModelFlutter(),
'scale-calculator': () => ScaleCalculatorModelFlutter(),
};
/// 按模型 id 取 Flutter 实现;没有对应实现时返回 null。
GcModel? flutterModelFor(String id) {
final factory = _factories[id] ?? _factories[id.replaceAll('-flutter', '')];
return factory?.call();
}
+62
View File
@@ -0,0 +1,62 @@
/// 用户记录
class UserRecord {
const UserRecord({
required this.username,
required this.points,
required this.consecutiveDays,
this.lastSignIn,
this.themeColor,
});
final String username;
final int points;
final int consecutiveDays;
final String? lastSignIn;
final String? themeColor;
factory UserRecord.fromJson(Map<String, dynamic> json) {
return UserRecord(
username: json['username'] as String? ?? '',
points: json['points'] as int? ?? 0,
consecutiveDays: json['consecutive_days'] as int? ?? 0,
lastSignIn: json['last_sign_in'] as String?,
themeColor: json['theme_color'] as String?,
);
}
}
/// 签到奖励配置(30天周期)
class SignInRewards {
static const List<int> rewards = [
10, 10, 10, 10, 10, 10, 10, // 第1-7天:每天+10
20, 20, 20, 20, 20, 20, 20, // 第8-15天:每天+20
30, 30, 30, 30, 30, 30, 30, // 第16-23天:每天+30
30, 30, 30, 30, 30, 30, 30, // 第24-30天:每天+30
];
static int getReward(int day) {
if (day < 1) day = 1;
if (day > 30) day = ((day - 1) % 30) + 1;
return rewards[day - 1];
}
}
/// 主题颜色
class ThemeColor {
const ThemeColor({required this.name, required this.hex, required this.cost});
final String name;
final String hex;
final int cost;
static const List<ThemeColor> predefined = [
ThemeColor(name: '蓝色', hex: '4A90D9', cost: 0),
ThemeColor(name: '红色', hex: 'E74C3C', cost: 50),
ThemeColor(name: '绿色', hex: '27AE60', cost: 50),
ThemeColor(name: '紫色', hex: '9B59B6', cost: 50),
ThemeColor(name: '橙色', hex: 'F39C12', cost: 50),
ThemeColor(name: '青色', hex: '1ABC9C', cost: 50),
ThemeColor(name: '粉色', hex: 'E91E63', cost: 50),
ThemeColor(name: '深蓝', hex: '2C3E50', cost: 50),
];
}