termify-agent 1.0.34 → 1.0.35
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a unique machine identifier
|
|
3
|
-
* Uses hostname + username + platform hash as a stable machine ID
|
|
3
|
+
* Uses hostname + username + platform hash as a stable machine ID.
|
|
4
|
+
* When running under sudo, uses SUDO_USER so the ID stays the same.
|
|
4
5
|
*/
|
|
5
6
|
export declare function getMachineId(): string;
|
|
6
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine-id.d.ts","sourceRoot":"","sources":["../../src/utils/machine-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"machine-id.d.ts","sourceRoot":"","sources":["../../src/utils/machine-id.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAQA"}
|
package/dist/utils/machine-id.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import crypto from 'crypto';
|
|
3
|
+
/**
|
|
4
|
+
* Get the real (non-root) username, even when running under sudo.
|
|
5
|
+
*/
|
|
6
|
+
function getRealUsername() {
|
|
7
|
+
return process.env.SUDO_USER || os.userInfo().username;
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* Get a unique machine identifier
|
|
5
|
-
* Uses hostname + username + platform hash as a stable machine ID
|
|
11
|
+
* Uses hostname + username + platform hash as a stable machine ID.
|
|
12
|
+
* When running under sudo, uses SUDO_USER so the ID stays the same.
|
|
6
13
|
*/
|
|
7
14
|
export function getMachineId() {
|
|
8
|
-
|
|
9
|
-
const fallbackData = `${os.hostname()}-${os.userInfo().username}-${os.platform()}`;
|
|
15
|
+
const fallbackData = `${os.hostname()}-${getRealUsername()}-${os.platform()}`;
|
|
10
16
|
return crypto.createHash('sha256').update(fallbackData).digest('hex').substring(0, 32);
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
@@ -18,7 +24,7 @@ export function getSystemInfo() {
|
|
|
18
24
|
hostname: os.hostname(),
|
|
19
25
|
arch: os.arch(),
|
|
20
26
|
platform: `${os.platform()} ${os.release()}`,
|
|
21
|
-
username:
|
|
27
|
+
username: getRealUsername(),
|
|
22
28
|
};
|
|
23
29
|
}
|
|
24
30
|
//# sourceMappingURL=machine-id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine-id.js","sourceRoot":"","sources":["../../src/utils/machine-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B
|
|
1
|
+
{"version":3,"file":"machine-id.js","sourceRoot":"","sources":["../../src/utils/machine-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,SAAS,eAAe;IACtB,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,eAAe,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC9E,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACzF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAO3B,OAAO;QACL,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE;QACjB,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE;QACvB,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;QACf,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE;QAC5C,QAAQ,EAAE,eAAe,EAAE;KAC5B,CAAC;AACJ,CAAC"}
|