tokenmax-collector 0.3.0 → 0.3.1
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.
- package/package.json +1 -1
- package/src/machine.ts +3 -2
package/package.json
CHANGED
package/src/machine.ts
CHANGED
|
@@ -11,12 +11,13 @@ const disallowed = /[^A-Za-z0-9._-]/g;
|
|
|
11
11
|
|
|
12
12
|
const platformUuidPattern = /"IOPlatformUUID"\s*=\s*"([^"]+)"/;
|
|
13
13
|
|
|
14
|
+
/** The hostname changes with the network, and every spelling of it used to open
|
|
15
|
+
* a new machine on the server, so the platform identifier travels alone. */
|
|
14
16
|
export function machineId(
|
|
15
17
|
hostnameValue: string,
|
|
16
18
|
platformUuid: string | null,
|
|
17
19
|
): string {
|
|
18
|
-
const raw =
|
|
19
|
-
platformUuid === null ? hostnameValue : `${hostnameValue}-${platformUuid}`;
|
|
20
|
+
const raw = platformUuid ?? hostnameValue;
|
|
20
21
|
return raw.replace(disallowed, "-").slice(0, 64);
|
|
21
22
|
}
|
|
22
23
|
|