refactor: 拆分主页与公共组件,扫码登录改走 WinHTTP
- 抽出 lib/core 的日期/JSON 工具,收敛各页重复解析 - 主页与音乐风险页拆成组件,风险功能共用一套运行框架 - 修复设置页作为主页页签保存时弹掉根路由导致的黑屏 - 登录对齐 Astral aimedb 协议:84 位二维码校验、签名与请求头修正, 补 GlobalSign 中间证书;Windows 改用 WinHTTP 绕过服务端对 BoringSSL 的 TLS 指纹拦截(证书校验保持开启) - 补开发预览数据与测试
This commit is contained in:
1 parent
0cb5320290
commit
e9357f5969
55 files changed
+4387
-3392
No files matched your search
@@ -0,0 +1,114 @@
|
||||
import '../models/session_model.dart';
|
||||
import '../models/user_data.dart';
|
||||
import '../models/user_preview.dart';
|
||||
import '../services/title_api_service.dart';
|
||||
|
||||
/// 开发期 UI 预览用的假数据,不连 aimedb / title server。
|
||||
///
|
||||
/// 改这里就能调主页各卡片展示的数值;头像 `iconId: 0` 显示占位图标,
|
||||
/// 改成非 0 会去 assets2.lxns.net 拉真实头像。
|
||||
const int uiPreviewUserId = 12345678901234;
|
||||
const String uiPreviewToken = 'ui-preview-token';
|
||||
const int uiPreviewLoginId = 987654;
|
||||
|
||||
const UserDataBean uiPreviewUserData = UserDataBean(
|
||||
userId: uiPreviewUserId,
|
||||
userName: 'Ichino',
|
||||
friendCode: '123456789012345',
|
||||
isNetMember: true,
|
||||
point: 234567,
|
||||
totalPoint: 9876543,
|
||||
playerRating: 15234,
|
||||
playerOldRating: 8200,
|
||||
playerNewRating: 7034,
|
||||
highestRating: 15456,
|
||||
musicRating: 13800,
|
||||
gradeRank: 12,
|
||||
courseRank: 34,
|
||||
classRank: 56,
|
||||
nameplateId: 101,
|
||||
frameId: 202,
|
||||
iconId: 0,
|
||||
trophyId: 303,
|
||||
plateId: 404,
|
||||
titleId: 505,
|
||||
partnerId: 606,
|
||||
playCount: 2345,
|
||||
currentPlayCount: 123,
|
||||
totalSync: 45678,
|
||||
totalAchievement: 123456,
|
||||
totalDeluxscore: 98765,
|
||||
totalAwake: 5678,
|
||||
lastGameId: 'SDEZ',
|
||||
lastRomVersion: '1.60.00',
|
||||
lastDataVersion: '1.60.00',
|
||||
lastLoginDate: '2026-10-25 12:34:56',
|
||||
lastPlayDate: '2026-10-25 12:00:00',
|
||||
firstGameId: 'SDEZ',
|
||||
firstRomVersion: '1.00.00',
|
||||
firstDataVersion: '1.00.00',
|
||||
firstPlayDate: '2021-07-01 10:00:00',
|
||||
lastRegionName: '上海',
|
||||
lastRegionId: 1007,
|
||||
dailyBonusDate: '2026-10-25 12:00:00',
|
||||
banState: 0,
|
||||
);
|
||||
|
||||
const UserPreviewDataBean uiPreviewPreview = UserPreviewDataBean(
|
||||
userId: uiPreviewUserId,
|
||||
userName: 'Ichino',
|
||||
isLogin: true,
|
||||
loginId: uiPreviewLoginId,
|
||||
lastGameId: 'SDEZ',
|
||||
lastRomVersion: '1.60.00',
|
||||
lastDataVersion: '1.60.00',
|
||||
lastLoginDate: '2026-10-25 12:34:56',
|
||||
lastPlayDate: '2026-10-25 12:00:00',
|
||||
playerRating: 15234,
|
||||
nameplateId: 101,
|
||||
iconId: 0,
|
||||
trophyId: 303,
|
||||
isNetMember: true,
|
||||
isInherit: false,
|
||||
totalAwake: 5678,
|
||||
dispRate: 1,
|
||||
dailyBonusDate: '2026-10-25 12:00:00',
|
||||
headPhoneVolume: 80,
|
||||
banState: 0,
|
||||
errorId: 0,
|
||||
);
|
||||
|
||||
const String uiPreviewRawResponse = '''
|
||||
{
|
||||
"userId": $uiPreviewUserId,
|
||||
"userName": "Ichino",
|
||||
"isLogin": true,
|
||||
"playerRating": 15234,
|
||||
"banState": 0,
|
||||
"errorId": 0
|
||||
}''';
|
||||
|
||||
/// 预置登录态与主页种子数据;风险/票据页会按「已登录」渲染。
|
||||
SessionRestoreResult createUiPreviewSession() {
|
||||
final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
|
||||
SessionModel.instance
|
||||
..setGameLogin(
|
||||
UserLoginResult(
|
||||
token: uiPreviewToken,
|
||||
loginId: uiPreviewLoginId,
|
||||
lastLoginDate: uiPreviewUserData.lastLoginDate,
|
||||
// 提前两分钟,避免页面一进来就卡在 60 秒登录冷却里。
|
||||
loginDateTime: now - 120,
|
||||
),
|
||||
)
|
||||
..updateCookies('JSESSIONID=UI-PREVIEW');
|
||||
|
||||
return const SessionRestoreResult(
|
||||
reusedCookie: true,
|
||||
userData: uiPreviewUserData,
|
||||
preview: uiPreviewPreview,
|
||||
rawPreviewResponse: uiPreviewRawResponse,
|
||||
loggedIn: true,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../pages/home_page.dart';
|
||||
import 'ui_preview_data.dart';
|
||||
|
||||
/// 开发期 UI 预览入口:跳过二维码登录,直接用假数据进主页。
|
||||
///
|
||||
/// flutter run -d windows -t lib/dev/ui_preview_main.dart --no-pub
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final restored = createUiPreviewSession();
|
||||
runApp(
|
||||
MyApp(
|
||||
home: HomePage(
|
||||
userId: uiPreviewUserId,
|
||||
token: uiPreviewToken,
|
||||
restored: restored,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user