feat: migrate platform login scenes and native login flows

This commit is contained in:
2026-09-06 09:06:00 +08:00
parent f2a948f059
commit 695d3be25c
140 changed files with 7599 additions and 4397 deletions
@@ -1,11 +1,13 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
STARTUP_CONFIG,
STARTUP_CONFIG as EDITABLE_STARTUP_CONFIG,
validateStartupConfig,
decodeGameConfig,
resolveGameServer,
} from '../../YouleNexus/assets/framework/config/profiles.ts';
// 固定测试来源,允许开发者独立切换项目的 local/remote 开关。
const STARTUP_CONFIG = Object.freeze({...EDITABLE_STARTUP_CONFIG, configSource:'remote' as const});
test('decodeGameConfig:按旧协议把 -/# 解码为远程 txt URL', () => {
assert.equal(decodeGameConfig('host-path#8080-config'), 'http://host/path:8080/config.txt');
@@ -23,7 +25,7 @@ test('resolveGameServer:空 gameconfig 使用配置源,非空值使用解码
});
test('one frozen source defines the complete default startup configuration', () => {
assert.deepEqual(STARTUP_CONFIG, { mode: 'debug', gameserver: 'https://tsgames.daoqi88.cn/config/update_jsonv2.txt', useLocalServer: true, localServers: ['ws://127.0.0.1:3088'] });
assert.deepEqual(STARTUP_CONFIG, { mode: 'debug', configSource: 'remote', localConfigResource: 'dev-config/update_jsonv2', gameserver: 'https://tsgames.daoqi88.cn/config_test/update_jsonv2.txt', useLocalServer: true, localServers: ['ws://127.0.0.1:3088'] });
assert.ok(Object.isFrozen(STARTUP_CONFIG)); assert.ok(Object.isFrozen(STARTUP_CONFIG.localServers));
});
test('source validation rejects malformed configuration without defaults', () => {
@@ -32,3 +34,11 @@ test('source validation rejects malformed configuration without defaults', () =>
}
for (const url of ['ws://127.4.3.2:3088','wss://localhost:3088','ws://[::1]:3088']) assert.deepEqual(validateStartupConfig({...STARTUP_CONFIG,localServers:[url]}).localServers,[url]);
});
test('config source and local resource paths are explicit and local is debug only', () => {
for (const patch of [{configSource:undefined},{configSource:'other'},{configSource:'local',mode:'release'},
{localConfigResource:''},{localConfigResource:'../outside'},{localConfigResource:'dev-config/a.txt'},{localConfigResource:'/absolute'}]) {
assert.throws(()=>validateStartupConfig({...STARTUP_CONFIG,...patch} as any), /startup config/);
}
assert.equal(validateStartupConfig({...STARTUP_CONFIG,configSource:'local'}).configSource,'local');
});