@wvdsh/api 0.1.114 → 0.1.115
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,15 @@ 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
|
+
}) => string;
|
|
414
|
+
};
|
|
406
415
|
export declare const PAID_CONTENT_PICOMATCH_OPTIONS: {
|
|
407
416
|
readonly dot: true;
|
|
408
417
|
};
|
|
@@ -267,6 +267,28 @@ 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)}`
|
|
284
|
+
build(args) {
|
|
285
|
+
const subdomain = `${args.gameCloudId}-${GameplaySubdomain.hashPart(args.userId)}-${GameplaySubdomain.hashPart(args.gameBuildId)}`;
|
|
286
|
+
if (subdomain.length > GameplaySubdomain.MAX_LENGTH) {
|
|
287
|
+
throw new Error(`Gameplay subdomain exceeds ${GameplaySubdomain.MAX_LENGTH} characters`);
|
|
288
|
+
}
|
|
289
|
+
return subdomain;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
270
292
|
// ========== PAID CONTENT ==========
|
|
271
293
|
export const PAID_CONTENT_PICOMATCH_OPTIONS = { dot: true };
|
|
272
294
|
// ========== HEARTBEAT (client-side constants) ==========
|