@wvdsh/api 0.1.114 → 0.1.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -403,6 +403,16 @@ export declare const UgcStorage: {
|
|
|
403
403
|
readonly encodeKeyPath: (objectKey: string) => string;
|
|
404
404
|
readonly decodeKeyPath: (pathname: string) => string;
|
|
405
405
|
};
|
|
406
|
+
export declare const GameplaySubdomain: {
|
|
407
|
+
readonly MAX_LENGTH: 63;
|
|
408
|
+
readonly hashPart: (value: string) => string;
|
|
409
|
+
readonly build: (args: {
|
|
410
|
+
gameCloudId: string;
|
|
411
|
+
userId: string;
|
|
412
|
+
gameBuildId: string;
|
|
413
|
+
isAnonymous: boolean;
|
|
414
|
+
}) => string;
|
|
415
|
+
};
|
|
406
416
|
export declare const PAID_CONTENT_PICOMATCH_OPTIONS: {
|
|
407
417
|
readonly dot: true;
|
|
408
418
|
};
|
|
@@ -267,6 +267,29 @@ export const UgcStorage = {
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
|
+
// ========== GAMEPLAY SUBDOMAIN ==========
|
|
271
|
+
export const GameplaySubdomain = {
|
|
272
|
+
// One DNS label under `builds.{playsiteHost}`
|
|
273
|
+
MAX_LENGTH: 63,
|
|
274
|
+
// FNV-1a 32-bit -> 8 hex chars
|
|
275
|
+
hashPart(value) {
|
|
276
|
+
let h = 0x811c9dc5;
|
|
277
|
+
for (let i = 0; i < value.length; i++) {
|
|
278
|
+
h ^= value.charCodeAt(i);
|
|
279
|
+
h = Math.imul(h, 0x01000193);
|
|
280
|
+
}
|
|
281
|
+
return (h >>> 0).toString(16).padStart(8, '0');
|
|
282
|
+
},
|
|
283
|
+
// `{gameCloudId}-{hashPart(userId)}-{hashPart(gameBuildId)}`, with `guest` in place of the user hash for anonymous users
|
|
284
|
+
build(args) {
|
|
285
|
+
const userPart = args.isAnonymous ? 'guest' : GameplaySubdomain.hashPart(args.userId);
|
|
286
|
+
const subdomain = `${args.gameCloudId}-${userPart}-${GameplaySubdomain.hashPart(args.gameBuildId)}`;
|
|
287
|
+
if (subdomain.length > GameplaySubdomain.MAX_LENGTH) {
|
|
288
|
+
throw new Error(`Gameplay subdomain exceeds ${GameplaySubdomain.MAX_LENGTH} characters`);
|
|
289
|
+
}
|
|
290
|
+
return subdomain;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
270
293
|
// ========== PAID CONTENT ==========
|
|
271
294
|
export const PAID_CONTENT_PICOMATCH_OPTIONS = { dot: true };
|
|
272
295
|
// ========== HEARTBEAT (client-side constants) ==========
|