Update Get Temp Host #229
@@ -11,6 +11,7 @@ const ProcessArgs = require("minimist")(process.argv.slice(2));
|
||||
|
||||
// Import Bds Core
|
||||
const BdsCore = require("../index");
|
||||
const BdsNetwork = require("../src/BdsNetwork");
|
||||
const commandExits = require("../lib/commandExist");
|
||||
const readline = require("readline");
|
||||
// const BdsMenus = require("./bds_maneger/menus");
|
||||
@@ -71,6 +72,7 @@ async function help() {
|
||||
"* -i, --info Print info about Bds Maneger Core and Platforms",
|
||||
"* -d, --download Download a server",
|
||||
"* -s, --start Start a server",
|
||||
"* --get_domain Get temporary public domain to connect in to server or API",
|
||||
"* -p, --platform Change the platform",
|
||||
"* -n, --no-api Don't start the Bds Maneger API Rest",
|
||||
"*",
|
||||
@@ -107,7 +109,7 @@ async function Runner() {
|
||||
await info();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Help
|
||||
if (ProcessArgs.help || ProcessArgs.h) {
|
||||
await help();
|
||||
@@ -116,9 +118,24 @@ async function Runner() {
|
||||
|
||||
// Download
|
||||
if (ProcessArgs.download || ProcessArgs.d) await DownloadServer();
|
||||
|
||||
// Start Server
|
||||
if (!(ProcessArgs.start || ProcessArgs.s)) return;
|
||||
|
||||
// Start
|
||||
// Get Temporary External Domain
|
||||
if (ProcessArgs.get_domain) {
|
||||
try {
|
||||
const HostInfo = await BdsNetwork.GetHost();
|
||||
console.log("Domain:", HostInfo.host);
|
||||
process.on("exit", async () => {
|
||||
await HostInfo.delete_host();
|
||||
console.log("Sucess remove host");
|
||||
});
|
||||
} catch (err) {
|
||||
console.log("Cannot get domain");
|
||||
}
|
||||
}
|
||||
|
||||
const BdsCoreStart = BdsCore.start();
|
||||
BdsCoreStart.log(data => console.log(cli_color.blueBright(data.replace(/\n$/gi, ""))));
|
||||
BdsCoreStart.exit(code => {
|
||||
|
@@ -14,7 +14,7 @@ async function CheckSystemAsync() {
|
||||
spigot: await PlatformVersionsV2("spigot"),
|
||||
dragonfly: await PlatformVersionsV2("dragonfly"),
|
||||
}
|
||||
|
||||
|
||||
let system, require_qemu = false;
|
||||
const valid_platform = {
|
||||
bedrock: true,
|
||||
@@ -27,7 +27,7 @@ async function CheckSystemAsync() {
|
||||
if ((PHPBin[process.platform] || {})[arch]) valid_platform["pocketmine"] = true;
|
||||
else valid_platform["pocketmine"] = false;
|
||||
|
||||
//
|
||||
// Check for Dragonfly
|
||||
if (!(Servers.dragonfly.versions[Servers.dragonfly.latest][process.platform][bds.arch])) valid_platform["dragonfly"] = false;
|
||||
|
||||
// SoSystem X
|
||||
@@ -35,7 +35,7 @@ async function CheckSystemAsync() {
|
||||
system = "Windows";
|
||||
} else if (process.platform == "linux") {
|
||||
system = "Linux";
|
||||
|
||||
|
||||
// Bedrock Check
|
||||
if (Servers.bedrock.versions[Servers.bedrock.latest][process.platform]) {
|
||||
if (Servers.bedrock.versions[Servers.bedrock.latest][process.platform][arch]) valid_platform["bedrock"] = true;
|
||||
@@ -44,15 +44,16 @@ async function CheckSystemAsync() {
|
||||
|
||||
if (valid_platform["bedrock"] === false) {
|
||||
if (commadExist("qemu-x86_64-static")) {
|
||||
// console.warn("The Minecraft Bedrock Server is only being validated because you can use 'qemu-x86_64-static'");
|
||||
// console.warn("The Minecraft Bedrock Server is only being validated because you can use 'qemu-x86_64-static'");;
|
||||
valid_platform["bedrock"] = true
|
||||
require_qemu = true
|
||||
require_qemu = true;
|
||||
}
|
||||
}
|
||||
} else if (process.platform == "darwin") {
|
||||
system = "MacOS";
|
||||
} else if (process.platform === "android") {
|
||||
system = "Android";
|
||||
if (valid_platform["bedrock"]) valid_platform["bedrock"] = false;
|
||||
} else {
|
||||
throw new Error(`The Bds Maneger Core does not support ${process.platform} systems, as no tests have been done.`);
|
||||
}
|
||||
@@ -121,4 +122,4 @@ function GetCpuCoreCount() {
|
||||
else if (process.platform === "darwin") return require("os").cpus().length;
|
||||
else return 1;
|
||||
}
|
||||
module.exports.GetCpuCoreCount = GetCpuCoreCount;
|
||||
module.exports.GetCpuCoreCount = GetCpuCoreCount;
|
||||
|
Reference in New Issue
Block a user