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
@@ -7,7 +7,9 @@ import {
resolveLocalStartup,
type LocalStartupContext,
} from '../../YouleNexus/assets/framework/config/local-startup.ts';
import { STARTUP_CONFIG } from '../../YouleNexus/assets/framework/config/profiles.ts';
import { STARTUP_CONFIG as EDITABLE_STARTUP_CONFIG } from '../../YouleNexus/assets/framework/config/profiles.ts';
// 固定测试来源,允许开发者独立切换项目的 local/remote 开关。
const STARTUP_CONFIG = Object.freeze({...EDITABLE_STARTUP_CONFIG, configSource:'remote' as const});
import type { ResolveRuntimeConfigOptions, RuntimeConfig } from '../../YouleNexus/assets/framework/config/runtime-config.ts';
import type { ConfigFetcher } from '../../YouleNexus/assets/framework/config/remote-config.ts';
import { BUILD_IDENTITY } from '../../YouleNexus/assets/framework/config/sources/defaults.ts';
@@ -22,7 +24,7 @@ function options(search = ''): ResolveRuntimeConfigOptions & {
return { player_server_tcp: 'remote.example:3088' };
},
};
return { hostKind: 'h5', win: {}, search, fetcher };
return { startupConfig:STARTUP_CONFIG, hostKind: 'h5', win: {}, search, fetcher };
}
test('local debug fetches remote config before choosing authoritative local servers', async () => {
@@ -174,3 +176,12 @@ test('local consumers validate the injected source snapshot and its exact target
assert.throws(()=>assertLocalStartupContext({...context,config:{...context.config,startupConfig:{...context.config.startupConfig,...patch}}} as any),/mode|useLocalServer|localServers|gameserver/);
}
});
test('local startup validates the selected project txt source', async () => {
const localFetcher={async fetch(){return {showVisitor:1};}};
const context=await resolveLocalStartup({startupConfig:{...STARTUP_CONFIG,configSource:'local'},hostKind:'h5',win:{},search:'',
fetcher:{async fetch(){throw Error('remote forbidden');}},localFetcher});
assert.equal(context.config.source,'local');
assert.equal(context.config.gameserver,STARTUP_CONFIG.localConfigResource);
assert.doesNotThrow(()=>assertLocalStartupContext(context));
});