feat(accounts)!: require explicit local account registration
Open the local signup page in the game's embedded browser before sign-in. Return the existing login error for unknown accounts or invalid passwords. BREAKING CHANGE: First-time players must register in the game's signup window or create a save in the launcher before signing in. Existing accounts can sign in with their saved credentials.
This commit is contained in:
1 parent
d20b7f4249
commit
d043a8f0f8
23 files changed
+134
-32
No files matched your search
@@ -84,10 +84,16 @@ export function buildGameCopy(inputs: GameCopyInputs): GameCopyBuild {
|
||||
const executable = patchExecutable(inputs.stock.executable, folders.exe);
|
||||
const stockImage = new PeImage(inputs.stock.executable);
|
||||
const native = resolveNativeModules(stockImage, loadNativeModules(folders.native));
|
||||
const { pack: charPack, ...charReport } = rebuildCharPack(inputs.stock.charPack, endpoint, { placeholderDecals: inputs.placeholderDecals });
|
||||
const guiPack = rebuildGuiPack(inputs.stock.guiPack, endpoint, folders.gui);
|
||||
const appliedGuiPatches = guiPack.applied.map((item) => item.patch.id);
|
||||
const localRegistration = appliedGuiPatches.includes('registration/open-local-page') &&
|
||||
appliedGuiPatches.includes('registration/keep-local-page-embedded');
|
||||
const { pack: charPack, ...charReport } = rebuildCharPack(inputs.stock.charPack, endpoint, {
|
||||
placeholderDecals: inputs.placeholderDecals,
|
||||
localRegistration,
|
||||
});
|
||||
const bundles = offlinePackBundleGuids(inputs.stock.charPack, inputs.multiVehiclePackIds);
|
||||
const mainPack = rebuildMainPack(inputs.stock.mainPack, endpoint, bundles);
|
||||
const guiPack = rebuildGuiPack(inputs.stock.guiPack, endpoint, folders.gui);
|
||||
|
||||
const executableFolder = dirname(GAME_FILES.executable);
|
||||
const hookSettings = networkHookSettings(endpoint, stockImage, native.values);
|
||||
@@ -105,7 +111,7 @@ export function buildGameCopy(inputs: GameCopyInputs): GameCopyBuild {
|
||||
files,
|
||||
endpoint,
|
||||
exePatches: { applied: executable.plan.writes.map((write) => ({ patchId: write.patchId, rva: write.rva })), failures: executable.plan.failures },
|
||||
guiPatches: { applied: guiPack.applied.map((item) => item.patch.id), failures: guiPack.failures },
|
||||
guiPatches: { applied: appliedGuiPatches, failures: guiPack.failures },
|
||||
nativeModules: { available: [...native.available.keys()], failures: native.failures },
|
||||
blocking: blockingFailures(failures),
|
||||
charPack: charReport,
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface CharPackResult {
|
||||
export interface CharPackOptions {
|
||||
/** Store the placeholder decal index (false when the player's own web cache is copied). */
|
||||
readonly placeholderDecals: boolean;
|
||||
readonly localRegistration: boolean;
|
||||
}
|
||||
|
||||
export function rebuildCharPack(stockPack: Uint8Array, endpoint: LocalEndpoint, options: CharPackOptions): CharPackResult {
|
||||
@@ -35,7 +36,7 @@ export function rebuildCharPack(stockPack: Uint8Array, endpoint: LocalEndpoint,
|
||||
let revealedVehicles = 0;
|
||||
const decals = options.placeholderDecals ? offlineDecalIndex(readPackBlk(stockPack, DECALS_CONFIG_PATH)) : undefined;
|
||||
const pack = editPackBlks(stockPack, [
|
||||
{ path: NETWORK_CONFIG_PATH, edit: (root) => { network = redirectNetworkConfig(root, endpoint); } },
|
||||
{ path: NETWORK_CONFIG_PATH, edit: (root) => { network = redirectNetworkConfig(root, endpoint, options.localRegistration); } },
|
||||
{ path: GAME_SETTINGS_PATH, edit: (root) => { features = enableFeaturesForEveryone(root, OFFLINE_FEATURES); } },
|
||||
{ path: SHOP_PATH, edit: (root) => { revealedVehicles = revealHiddenVehicles(root); } },
|
||||
], decals?.files ?? []);
|
||||
|
||||
@@ -18,19 +18,22 @@ export interface NetworkRedirectReport {
|
||||
readonly addresses: readonly AddressChange[];
|
||||
}
|
||||
|
||||
export function redirectNetworkConfig(root: BlkBlock, endpoint: LocalEndpoint): NetworkRedirectReport {
|
||||
export function redirectNetworkConfig(root: BlkBlock, endpoint: LocalEndpoint, localRegistration: boolean): NetworkRedirectReport {
|
||||
const addresses = redirectAddresses(root, endpoint);
|
||||
const environments = root.blocks.filter((block) => findParam(block, 'charServer'));
|
||||
for (const environment of environments) configureEnvironment(environment, endpoint);
|
||||
for (const environment of environments) configureEnvironment(environment, endpoint, localRegistration);
|
||||
return { environments: environments.map((block) => block.name), addresses };
|
||||
}
|
||||
|
||||
function configureEnvironment(environment: BlkBlock, endpoint: LocalEndpoint): void {
|
||||
function configureEnvironment(environment: BlkBlock, endpoint: LocalEndpoint, localRegistration: boolean): void {
|
||||
setParam(environment, 'enableSslCertCheck', { type: 'bool', value: false });
|
||||
// The local store page. The stock value carries URL tags; here only
|
||||
// auto_local, so scripts/onlineShop/url.nut adds ?skin_lang=<game language> and opens it in
|
||||
// the built-in browser. No auto_login: that goes through Gaijin's login.gaijin.net.
|
||||
setParam(environment, 'webstoreURL', { type: 'string', value: `auto_local http://${endpoint.host}:${endpoint.port}/store` });
|
||||
if (localRegistration) {
|
||||
setParam(environment, 'signUpURL', { type: 'string', value: `auto_local http://${endpoint.host}:${endpoint.port}/register` });
|
||||
}
|
||||
const login = ensureBlock(environment, 'yuplay');
|
||||
for (const [key, value] of loginOverrides(endpoint)) setParam(login, key, { type: 'string', value });
|
||||
}
|
||||
Reference in new issue
Block a user