Async functions #172
19
package-lock.json
generated
19
package-lock.json
generated
@ -10,7 +10,6 @@
|
|||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/storage-blob": "^12.6.0",
|
"@azure/storage-blob": "^12.6.0",
|
||||||
"@the-bds-maneger/fetchsync": "github:The-Bds-Maneger/fetchSync",
|
|
||||||
"adm-zip": "^0.5.1",
|
"adm-zip": "^0.5.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"cli-color": "^2.0.0",
|
"cli-color": "^2.0.0",
|
||||||
@ -451,17 +450,6 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@the-bds-maneger/fetchsync": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "git+ssh://git@github.com/The-Bds-Maneger/fetchSync.git#c4af0cae45f434250dd7d2b0617395b5001371df",
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"dependencies": {
|
|
||||||
"node-fetch": "^2.6.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/cacheable-request": {
|
"node_modules/@types/cacheable-request": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz",
|
||||||
@ -7489,13 +7477,6 @@
|
|||||||
"defer-to-connect": "^2.0.0"
|
"defer-to-connect": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@the-bds-maneger/fetchsync": {
|
|
||||||
"version": "git+ssh://git@github.com/The-Bds-Maneger/fetchSync.git#c4af0cae45f434250dd7d2b0617395b5001371df",
|
|
||||||
"from": "@the-bds-maneger/fetchsync@github:The-Bds-Maneger/fetchSync",
|
|
||||||
"requires": {
|
|
||||||
"node-fetch": "^2.6.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@types/cacheable-request": {
|
"@types/cacheable-request": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.2.tgz",
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@azure/storage-blob": "^12.6.0",
|
"@azure/storage-blob": "^12.6.0",
|
||||||
"@the-bds-maneger/fetchsync": "github:The-Bds-Maneger/fetchSync",
|
|
||||||
"adm-zip": "^0.5.1",
|
"adm-zip": "^0.5.1",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"cli-color": "^2.0.0",
|
"cli-color": "^2.0.0",
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
// External User ip
|
// External User ip
|
||||||
const fetchSync = require("@the-bds-maneger/fetchsync");
|
const Request = require("../lib/Requests");
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
const { GetTempHost } = require("../lib/BdsSettings");
|
const { GetTempHost } = require("../lib/BdsSettings");
|
||||||
|
|
||||||
const externalIP = {
|
Request.TEXT("https://api.ipify.org").then(external_ipv4 => {
|
||||||
ipv4: fetchSync("https://api.ipify.org/").text().replace("\n", ""),
|
Request.TEXT("https://api64.ipify.org/").then(external_ipv6 => {
|
||||||
ipv6: fetchSync("https://api64.ipify.org/").text().replace("\n", "")
|
const externalIP = {
|
||||||
}
|
ipv4: external_ipv4.replace("\n", ""),
|
||||||
|
ipv6: external_ipv6.replace("\n", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.externalIP = externalIP;
|
||||||
|
module.exports.ip = externalIP;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Internal ip user
|
// Internal ip user
|
||||||
const interfaces = os.networkInterfaces();
|
const interfaces = os.networkInterfaces();
|
||||||
@ -48,7 +55,7 @@ var host = null,
|
|||||||
|
|
||||||
if (GetTempHost()){
|
if (GetTempHost()){
|
||||||
// Get HOST
|
// Get HOST
|
||||||
HostResponse = fetchSync("https://bds-core-back-end.vercel.app/Gethost", {
|
Request.JSON("https://bds-core-back-end.vercel.app/Gethost", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
mode: "cors",
|
mode: "cors",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
@ -58,30 +65,28 @@ if (GetTempHost()){
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
}).json();
|
}).then(HostResponse => {
|
||||||
global.BdsTempHost = HostResponse.user.host.host
|
global.BdsTempHost = HostResponse.user.host.host
|
||||||
host = HostResponse.user.host.host
|
host = HostResponse.user.host.host
|
||||||
|
console.log(`Bds Maneger Core Temp Host ID: ${HostResponse.user.ID}`)
|
||||||
console.log(`Bds Maneger Core Temp Host ID: ${HostResponse.user.ID}`)
|
// Delete Host
|
||||||
|
process.on("exit", function () {
|
||||||
// Delete Host
|
Request.JSON("https://bds-core-back-end.vercel.app/DeleteHost", {
|
||||||
process.on("exit", function () {
|
method: "post",
|
||||||
const deleted_host = fetchSync("https://bds-core-back-end.vercel.app/DeleteHost", {
|
body: JSON.stringify({
|
||||||
method: "post",
|
"ID": HostResponse.user.ID
|
||||||
body: JSON.stringify({
|
}),
|
||||||
"ID": HostResponse.user.ID
|
headers: {
|
||||||
}),
|
"Content-Type": "application/json"
|
||||||
headers: {
|
}
|
||||||
"Content-Type": "application/json"
|
}).then(deleted_host => {
|
||||||
}
|
if (deleted_host.error) console.log(deleted_host.error)
|
||||||
}).json()
|
});
|
||||||
if (deleted_host.error) console.log(deleted_host.error)
|
});
|
||||||
})
|
});
|
||||||
} else module.exports.host = null
|
} else module.exports.host = null
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
externalIP,
|
|
||||||
ip: externalIP,
|
|
||||||
internal_ip,
|
internal_ip,
|
||||||
Interfaces,
|
Interfaces,
|
||||||
HostResponse,
|
HostResponse,
|
||||||
|
Reference in New Issue
Block a user