feat(server): handle matching login and decorative content manifests
Add matching frame and message handling, per-connection session encryption, and loopback traffic dispatch. Serve the decorative content manifest and empty indices to remove startup download waits. Resolve character requests to their explicit account ID, include the nickname in profile replies, and redact matching traffic logs.
This commit is contained in:
1 parent
7f482ae530
commit
27754122fc
24 files changed
+857
-37
No files matched your search
@@ -1,15 +1,18 @@
|
||||
/** Char action names mapped to their handlers (full list of names: research-data/char_actions_37.json). */
|
||||
import type { AccountStore } from '../../accounts/account-store.ts';
|
||||
import type { PlayerProfiles } from '../../profile/player-profiles.ts';
|
||||
import type { CharActionHandler } from '../char-action.ts';
|
||||
import { initialMeta, legacyUserData } from './online-init-actions.ts';
|
||||
import { entitlementsFull, initialMeta, legacyUserData } from './online-init-actions.ts';
|
||||
|
||||
export interface ActionDependencies {
|
||||
readonly profiles: PlayerProfiles;
|
||||
readonly accounts: AccountStore;
|
||||
}
|
||||
|
||||
export function actionTable(deps: ActionDependencies): ReadonlyMap<string, CharActionHandler> {
|
||||
return new Map<string, CharActionHandler>([
|
||||
['cln_get_initial_meta', initialMeta()],
|
||||
['cln_legacy_get_userdata', legacyUserData(deps.profiles)],
|
||||
['cln_upd_entitlements_full', entitlementsFull(deps.profiles, deps.accounts)],
|
||||
['cln_legacy_get_userdata', legacyUserData(deps.profiles, deps.accounts)],
|
||||
]);
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
*.
|
||||
*/
|
||||
import { emptyBlock } from '@wto/blk';
|
||||
import type { Account, AccountStore } from '../../accounts/account-store.ts';
|
||||
import { clientProfile } from '../../profile/client-profile.ts';
|
||||
import type { PlayerProfiles } from '../../profile/player-profiles.ts';
|
||||
import type { CharAnswer } from '../char-answers.ts';
|
||||
import type { CharActionContext, CharActionHandler } from '../char-action.ts';
|
||||
@@ -21,11 +23,31 @@ export function initialMeta(): CharActionHandler {
|
||||
};
|
||||
}
|
||||
|
||||
/** cln_legacy_get_userdata: the whole profile (ClientEconomicState::loadOnline, aces.exe 0x2a23b0). */
|
||||
export function legacyUserData(profiles: PlayerProfiles): CharActionHandler {
|
||||
return (context) => withUser(context, (userId) => ({ kind: 'data', blk: profiles.profileOf(userId) }));
|
||||
/**
|
||||
* cln_upd_entitlements_full: the profile request of the online initialisation stage
|
||||
* CHAR_PROFILE_RECEIVED (sent at aces.exe 0x29f920 with headers onLogin and resetToken; the
|
||||
* request body is the client's machine description). The answer is the whole profile: the
|
||||
* job (EconomicSerializeJob, type 4) loads it as a BLK, and EconomicSerializeAction::
|
||||
* performAction (0x295ef0) reads it into the client's profile with the profile serializer
|
||||
* (0x917740) when it is not empty.
|
||||
*/
|
||||
export function entitlementsFull(profiles: PlayerProfiles, accounts: AccountStore): CharActionHandler {
|
||||
return profileAnswer(profiles, accounts);
|
||||
}
|
||||
|
||||
function withUser(context: CharActionContext, run: (userId: string) => CharAnswer): CharAnswer {
|
||||
return context.userId ? run(context.userId) : { kind: 'error', code: 'AUTH_REQ_ERROR' };
|
||||
/** cln_legacy_get_userdata: the whole profile (ClientEconomicState::loadOnline, aces.exe 0x2a23b0). */
|
||||
export function legacyUserData(profiles: PlayerProfiles, accounts: AccountStore): CharActionHandler {
|
||||
return profileAnswer(profiles, accounts);
|
||||
}
|
||||
|
||||
function profileAnswer(profiles: PlayerProfiles, accounts: AccountStore): CharActionHandler {
|
||||
return (context) => withAccount(context, accounts, (account) => ({
|
||||
kind: 'data',
|
||||
blk: clientProfile(profiles.profileOf(account.userId), account),
|
||||
}));
|
||||
}
|
||||
|
||||
function withAccount(context: CharActionContext, accounts: AccountStore, run: (account: Account) => CharAnswer): CharAnswer {
|
||||
const account = context.userId === undefined ? undefined : accounts.byUserId(context.userId);
|
||||
return account ? run(account) : { kind: 'error', code: 'AUTH_REQ_ERROR' };
|
||||
}
|
||||
Reference in new issue
Block a user