Async functions #172
@@ -89,120 +89,123 @@ async function StartServer(){
 | 
			
		||||
        process.exit(2)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Bds Maneger CLI Help
 | 
			
		||||
if (help) {
 | 
			
		||||
    let help = [
 | 
			
		||||
        "usage: bds_maneger [options]",
 | 
			
		||||
        "",
 | 
			
		||||
        "options:",
 | 
			
		||||
        "  -s  --start            Start Server",
 | 
			
		||||
        "  -k  --kill             Detect and kill bds servers",
 | 
			
		||||
        "  -p  --platform         Select server platform",
 | 
			
		||||
        "  -d  --download         server version to install, default \"latest\"",
 | 
			
		||||
        "       --interactive       Install the server interactively",
 | 
			
		||||
        "  -S  --system_info      System info and test",
 | 
			
		||||
        "  -h  --help             Print this list and exit.",
 | 
			
		||||
        "  -v  --version          Print the version and exit."
 | 
			
		||||
    ]
 | 
			
		||||
    console.log(cli_color.yellow(help.join("\n")));
 | 
			
		||||
    process.exit();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Get Bds Core Version
 | 
			
		||||
if (version) {
 | 
			
		||||
    const Info = [
 | 
			
		||||
        `Bds Maneger Core version: ${bds.package_json.version}`,
 | 
			
		||||
        "",
 | 
			
		||||
        "****************** Bds Maneger Core contributors ******************",
 | 
			
		||||
        "",
 | 
			
		||||
    ]
 | 
			
		||||
    for (let contri of bds.extra_json.contributors) {
 | 
			
		||||
        Info.push(`********* ${contri.name} *********`)
 | 
			
		||||
        if (contri.email) Info.push(`* ${contri.email}`)
 | 
			
		||||
        if (contri.url) Info.push(`* ${contri.url}`)
 | 
			
		||||
        Info.push("*")
 | 
			
		||||
        Info.push("*********")
 | 
			
		||||
(async () => {
 | 
			
		||||
    // Bds Maneger CLI Help
 | 
			
		||||
    if (help) {
 | 
			
		||||
        let help = [
 | 
			
		||||
            "usage: bds_maneger [options]",
 | 
			
		||||
            "",
 | 
			
		||||
            "options:",
 | 
			
		||||
            "  -s  --start            Start Server",
 | 
			
		||||
            "  -k  --kill             Detect and kill bds servers",
 | 
			
		||||
            "  -p  --platform         Select server platform",
 | 
			
		||||
            "  -d  --download         server version to install, default \"latest\"",
 | 
			
		||||
            "       --interactive       Install the server interactively",
 | 
			
		||||
            "  -S  --system_info      System info and test",
 | 
			
		||||
            "  -h  --help             Print this list and exit.",
 | 
			
		||||
            "  -v  --version          Print the version and exit."
 | 
			
		||||
        ]
 | 
			
		||||
        console.log(cli_color.yellow(help.join("\n")));
 | 
			
		||||
        process.exit();
 | 
			
		||||
    }
 | 
			
		||||
    console.log(Info.join("\n"));
 | 
			
		||||
    process.exit();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (SystemCheck) {
 | 
			
		||||
    var checkothearch = "";
 | 
			
		||||
    if (process.platform === "linux" && bds.arch !== "x64"){checkothearch = `qemu-x86_64-static is installed to emulate an x64 system: ${commandExits("qemu-x86_64-static")}\n`}
 | 
			
		||||
    if (process.platform === "android" && bds.arch !== "x64"){checkothearch = `qemu-x86_64 is installed to emulate an x64 system: ${commandExits("qemu-x86_64")}\n`}
 | 
			
		||||
    const help = [
 | 
			
		||||
        `Bds Maneger Core And Bds Maneger CLI version: ${cli_color.magentaBright(bds.package_json.version)}`,
 | 
			
		||||
        `System: ${cli_color.yellow(process.platform)}, architecture: ${cli_color.blue(bds.arch)}`,
 | 
			
		||||
        checkothearch,
 | 
			
		||||
        "**************************************************************",
 | 
			
		||||
        "* Bds Maneger dirs:",
 | 
			
		||||
        `*   - Config:                ${cli_color.yellowBright(bds_dir)}`,
 | 
			
		||||
        `*   - Players File:          ${cli_color.yellowBright(GetPaths("player"))}`,
 | 
			
		||||
        "*",
 | 
			
		||||
        "* Bds Servers dirs:",
 | 
			
		||||
        `*   - Bedrock Server:        ${cli_color.yellowBright(GetServerPaths("bedrock"))}`,
 | 
			
		||||
        `*   - Pocketmine-MP Server:  ${cli_color.yellowBright(GetServerPaths("pocketmine"))}`,
 | 
			
		||||
        `*   - Dragonfly:             ${cli_color.yellowBright(GetServerPaths("dragonfly"))}`,
 | 
			
		||||
        `*   - Java Server:           ${cli_color.yellowBright(GetServerPaths("java"))}`,
 | 
			
		||||
        `*   - Spigot Server:         ${cli_color.yellowBright(GetServerPaths("spigot"))}`,
 | 
			
		||||
        "*",
 | 
			
		||||
        "**************************************************************",
 | 
			
		||||
        "* Servers currently available:",
 | 
			
		||||
        `*   - Bedrock:          ${SystemInfo.valid_platform.bedrock}`,
 | 
			
		||||
        `*   - Pocketmine-MP:    ${SystemInfo.valid_platform.pocketmine}`,
 | 
			
		||||
        `*   - Dragonfly:        ${SystemInfo.valid_platform.dragonfly}`,
 | 
			
		||||
        `*   - Java:             ${SystemInfo.valid_platform.java}`,
 | 
			
		||||
        `*   - Spigot:           ${SystemInfo.valid_platform.java}`,
 | 
			
		||||
        "*",
 | 
			
		||||
        "**************************************************************"
 | 
			
		||||
    ];
 | 
			
		||||
    console.log(
 | 
			
		||||
        cli_color.whiteBright(help.join("\n")
 | 
			
		||||
            .replace(/true/gi, cli_color.greenBright("true"))
 | 
			
		||||
            .replace(/false/gi, cli_color.redBright("false"))
 | 
			
		||||
            .replace(/undefined/gi, cli_color.red("undefined"))
 | 
			
		||||
        ));
 | 
			
		||||
    process.exit(0)
 | 
			
		||||
}
 | 
			
		||||
    // Get Bds Core Version
 | 
			
		||||
    if (version) {
 | 
			
		||||
        const Info = [
 | 
			
		||||
            `Bds Maneger Core version: ${bds.package_json.version}`,
 | 
			
		||||
            "",
 | 
			
		||||
            "****************** Bds Maneger Core contributors ******************",
 | 
			
		||||
            "",
 | 
			
		||||
        ]
 | 
			
		||||
        for (let contri of bds.extra_json.contributors) {
 | 
			
		||||
            Info.push(`********* ${contri.name} *********`)
 | 
			
		||||
            if (contri.email) Info.push(`* ${contri.email}`)
 | 
			
		||||
            if (contri.url) Info.push(`* ${contri.url}`)
 | 
			
		||||
            Info.push("*")
 | 
			
		||||
            Info.push("*********")
 | 
			
		||||
        }
 | 
			
		||||
        console.log(Info.join("\n"));
 | 
			
		||||
        process.exit();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
// Download server
 | 
			
		||||
if (bds_version){
 | 
			
		||||
    (async () => {
 | 
			
		||||
        try {
 | 
			
		||||
            if (argv.interactive) {
 | 
			
		||||
                const LoadVersion = (await (await fetch(BdsConfigAndInfo.Fetchs.servers)).json())[GetPlatform()]
 | 
			
		||||
                const Version = Object.getOwnPropertyNames(LoadVersion)
 | 
			
		||||
                
 | 
			
		||||
                const StartQuestion = (Readline) => {
 | 
			
		||||
                    Readline.question("Select a version to download: ", input => {
 | 
			
		||||
                        if (Version[parseInt(input) - 1]) {
 | 
			
		||||
                            Readline.close();
 | 
			
		||||
                            download(Version[parseInt(input) - 1], true, function(){
 | 
			
		||||
                                if (start) return StartServer();
 | 
			
		||||
                                console.log("Installation was successful, so start the server with the -s option");
 | 
			
		||||
                                process.exit(0);
 | 
			
		||||
                            })
 | 
			
		||||
                        } else {
 | 
			
		||||
                            console.log("Invalid Option");
 | 
			
		||||
                            StartQuestion(Readline);
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
    if (SystemCheck) {
 | 
			
		||||
        const { valid_platform } = await SystemInfo();
 | 
			
		||||
        var checkothearch = "";
 | 
			
		||||
        if (process.platform === "linux" && bds.arch !== "x64"){checkothearch = `qemu-x86_64-static is installed to emulate an x64 system: ${commandExits("qemu-x86_64-static")}\n`}
 | 
			
		||||
        if (process.platform === "android" && bds.arch !== "x64"){checkothearch = `qemu-x86_64 is installed to emulate an x64 system: ${commandExits("qemu-x86_64")}\n`}
 | 
			
		||||
        const help = [
 | 
			
		||||
            `Bds Maneger Core And Bds Maneger CLI version: ${cli_color.magentaBright(bds.package_json.version)}`,
 | 
			
		||||
            `System: ${cli_color.yellow(process.platform)}, architecture: ${cli_color.blue(bds.arch)}`,
 | 
			
		||||
            checkothearch,
 | 
			
		||||
            "**************************************************************",
 | 
			
		||||
            "* Bds Maneger dirs:",
 | 
			
		||||
            `*   - Config:                ${cli_color.yellowBright(bds_dir)}`,
 | 
			
		||||
            `*   - Players File:          ${cli_color.yellowBright(GetPaths("player"))}`,
 | 
			
		||||
            "*",
 | 
			
		||||
            "* Bds Servers dirs:",
 | 
			
		||||
            `*   - Bedrock Server:        ${cli_color.yellowBright(GetServerPaths("bedrock"))}`,
 | 
			
		||||
            `*   - Pocketmine-MP Server:  ${cli_color.yellowBright(GetServerPaths("pocketmine"))}`,
 | 
			
		||||
            `*   - Dragonfly:             ${cli_color.yellowBright(GetServerPaths("dragonfly"))}`,
 | 
			
		||||
            `*   - Java Server:           ${cli_color.yellowBright(GetServerPaths("java"))}`,
 | 
			
		||||
            `*   - Spigot Server:         ${cli_color.yellowBright(GetServerPaths("spigot"))}`,
 | 
			
		||||
            "*",
 | 
			
		||||
            "**************************************************************",
 | 
			
		||||
            "* Servers currently available:",
 | 
			
		||||
            `*   - Bedrock:          ${valid_platform.bedrock}`,
 | 
			
		||||
            `*   - Pocketmine-MP:    ${valid_platform.pocketmine}`,
 | 
			
		||||
            `*   - Dragonfly:        ${valid_platform.dragonfly}`,
 | 
			
		||||
            `*   - Java:             ${valid_platform.java}`,
 | 
			
		||||
            `*   - Spigot:           ${valid_platform.java}`,
 | 
			
		||||
            "*",
 | 
			
		||||
            "**************************************************************"
 | 
			
		||||
        ];
 | 
			
		||||
        console.log(
 | 
			
		||||
            cli_color.whiteBright(help.join("\n")
 | 
			
		||||
                .replace(/true/gi, cli_color.greenBright("true"))
 | 
			
		||||
                .replace(/false/gi, cli_color.redBright("false"))
 | 
			
		||||
                .replace(/undefined/gi, cli_color.red("undefined"))
 | 
			
		||||
            ));
 | 
			
		||||
        process.exit(0)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Download server
 | 
			
		||||
    if (bds_version){
 | 
			
		||||
        (async () => {
 | 
			
		||||
            try {
 | 
			
		||||
                if (argv.interactive) {
 | 
			
		||||
                    const LoadVersion = (await (await fetch(BdsConfigAndInfo.Fetchs.servers)).json())[GetPlatform()]
 | 
			
		||||
                    const Version = Object.getOwnPropertyNames(LoadVersion)
 | 
			
		||||
                    
 | 
			
		||||
                    const StartQuestion = (Readline) => {
 | 
			
		||||
                        Readline.question("Select a version to download: ", input => {
 | 
			
		||||
                            if (Version[parseInt(input) - 1]) {
 | 
			
		||||
                                Readline.close();
 | 
			
		||||
                                download(Version[parseInt(input) - 1], true, function(){
 | 
			
		||||
                                    if (start) return StartServer();
 | 
			
		||||
                                    console.log("Installation was successful, so start the server with the -s option");
 | 
			
		||||
                                    process.exit(0);
 | 
			
		||||
                                })
 | 
			
		||||
                            } else {
 | 
			
		||||
                                console.log("Invalid Option");
 | 
			
		||||
                                StartQuestion(Readline);
 | 
			
		||||
                            }
 | 
			
		||||
                        });
 | 
			
		||||
                    }
 | 
			
		||||
        
 | 
			
		||||
                    console.log(`Selected platform: ${GetPlatform()}, Total available versions: ${Version.length}`);
 | 
			
		||||
                    console.log(`${cli_color.red("Option")}     ${cli_color.green("Version")}`);
 | 
			
		||||
        
 | 
			
		||||
                    for (let option in Version) console.log(`${cli_color.red(parseInt(option) + 1)}:   ${cli_color.green(Version[option])}`);
 | 
			
		||||
                    StartQuestion(readline.createInterface({input: process.stdin,output: process.stdout}));
 | 
			
		||||
                }
 | 
			
		||||
    
 | 
			
		||||
                console.log(`Selected platform: ${GetPlatform()}, Total available versions: ${Version.length}`);
 | 
			
		||||
                console.log(`${cli_color.red("Option")}     ${cli_color.green("Version")}`);
 | 
			
		||||
    
 | 
			
		||||
                for (let option in Version) console.log(`${cli_color.red(parseInt(option) + 1)}:   ${cli_color.green(Version[option])}`);
 | 
			
		||||
                StartQuestion(readline.createInterface({input: process.stdin,output: process.stdout}));
 | 
			
		||||
            }
 | 
			
		||||
            else bds.download(bds_version, true, function(){
 | 
			
		||||
                if (start) StartServer();
 | 
			
		||||
            })
 | 
			
		||||
        } catch (error) {console.error(error);process.exit(165);}
 | 
			
		||||
    })();
 | 
			
		||||
}
 | 
			
		||||
                else bds.download(bds_version, true, function(){
 | 
			
		||||
                    if (start) StartServer();
 | 
			
		||||
                })
 | 
			
		||||
            } catch (error) {console.error(error);process.exit(165);}
 | 
			
		||||
        })();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
// Start server
 | 
			
		||||
if (start && !(server || version || SystemCheck || bds_version || help)) StartServer();
 | 
			
		||||
    // Start server
 | 
			
		||||
    if (start && !(server || version || SystemCheck || bds_version || help)) StartServer();
 | 
			
		||||
 | 
			
		||||
})()
 | 
			
		||||
							
								
								
									
										2
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								index.js
									
									
									
									
									
								
							@@ -47,7 +47,7 @@ module.exports.telegram_token_save = UpdateTelegramToken
 | 
			
		||||
 * 
 | 
			
		||||
 * @param {function} callback - The callback function after start API
 | 
			
		||||
 */
 | 
			
		||||
module.exports.api = require("./src/rest/api");
 | 
			
		||||
module.exports.api = require("./src/api/api");
 | 
			
		||||
 | 
			
		||||
function token_register(Admin_Scoper = ["web_admin", "admin"]) {
 | 
			
		||||
    Admin_Scoper = Array.from(Admin_Scoper).filter(scoper => /admin/.test(scoper));
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
const { join, resolve, basename } = require("path");
 | 
			
		||||
const { existsSync, writeFileSync, mkdirSync, readFileSync } = require("fs");
 | 
			
		||||
const { homedir } = require("os");
 | 
			
		||||
const { valid_platform } = require("./BdsSystemInfo");
 | 
			
		||||
const BdsInfo = require("./BdsSystemInfo");
 | 
			
		||||
const yaml = require("js-yaml");
 | 
			
		||||
 | 
			
		||||
// PATHs
 | 
			
		||||
@@ -9,12 +9,19 @@ const home = homedir();
 | 
			
		||||
const bds_dir = join(home, "bds_core");
 | 
			
		||||
if (!(existsSync(bds_dir))) mkdirSync(bds_dir, {recursive: true})
 | 
			
		||||
 | 
			
		||||
// Set default platform for bds maneger
 | 
			
		||||
var default_platformConfig;
 | 
			
		||||
if (valid_platform["bedrock"]) default_platformConfig = "bedrock";
 | 
			
		||||
else if (valid_platform["java"]) default_platformConfig = "java";
 | 
			
		||||
else if (valid_platform["pocketmine"]) default_platformConfig = "pocketmine";
 | 
			
		||||
else throw new Error("We cannot run any platforms on this system/device");
 | 
			
		||||
BdsInfo().then(validation => {
 | 
			
		||||
    const { valid_platform } = validation;
 | 
			
		||||
    // Set default platform for bds maneger
 | 
			
		||||
    var default_platformConfig;
 | 
			
		||||
    if (valid_platform["bedrock"]) default_platformConfig = "bedrock";
 | 
			
		||||
    else if (valid_platform["java"]) default_platformConfig = "java";
 | 
			
		||||
    else if (valid_platform["pocketmine"]) default_platformConfig = "pocketmine";
 | 
			
		||||
    else throw new Error("We cannot run any platforms on this system/device");
 | 
			
		||||
    UpdatePlatform(default_platformConfig);
 | 
			
		||||
}).catch(err => {
 | 
			
		||||
    console.log(err);
 | 
			
		||||
    process.exit(1);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// Config Base to Bds Maneger Core and others Projects
 | 
			
		||||
var Config = {
 | 
			
		||||
@@ -28,7 +35,7 @@ var Config = {
 | 
			
		||||
        enable_tmp_host: false
 | 
			
		||||
    },
 | 
			
		||||
    server: {
 | 
			
		||||
        platform: default_platformConfig,
 | 
			
		||||
        platform: "bedrock",
 | 
			
		||||
        BackupCron: [
 | 
			
		||||
            {
 | 
			
		||||
                enabled: false,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,62 +1,73 @@
 | 
			
		||||
const { execSync } = require("child_process");
 | 
			
		||||
const { release } = require("os");
 | 
			
		||||
const { readdirSync } = require("fs");
 | 
			
		||||
const { execSync } = require("child_process");
 | 
			
		||||
const commadExist = require("./commandExist");
 | 
			
		||||
const fetchSync = require("@the-bds-maneger/fetchsync");
 | 
			
		||||
const Request = require("./Requests");
 | 
			
		||||
 | 
			
		||||
// Load JSON for Server and PHP Zip files
 | 
			
		||||
const PHPBin = fetchSync("https://raw.githubusercontent.com/The-Bds-Maneger/Php_Static_Binary/main/binarys.json").json(),
 | 
			
		||||
    Servers = fetchSync("https://raw.githubusercontent.com/The-Bds-Maneger/external_files/main/Server.json").json();
 | 
			
		||||
 | 
			
		||||
// System Architect (x64, aarch64 and others)
 | 
			
		||||
var arch;
 | 
			
		||||
if (process.arch === "arm64") arch = "aarch64";
 | 
			
		||||
else arch = process.arch
 | 
			
		||||
module.exports.arch = arch
 | 
			
		||||
 | 
			
		||||
var system,
 | 
			
		||||
    require_qemu = false,
 | 
			
		||||
    valid_platform = {
 | 
			
		||||
async function CheckSystemAsync() {
 | 
			
		||||
    const
 | 
			
		||||
        PHPBin = await Request.JSON("https://raw.githubusercontent.com/The-Bds-Maneger/Php_Static_Binary/main/binarys.json"),
 | 
			
		||||
        Servers = await Request.JSON("https://raw.githubusercontent.com/The-Bds-Maneger/external_files/main/Server.json");
 | 
			
		||||
    
 | 
			
		||||
    let system, require_qemu = false;
 | 
			
		||||
    const valid_platform = {
 | 
			
		||||
        bedrock: true,
 | 
			
		||||
        pocketmine: true,
 | 
			
		||||
        java: commadExist("java"),
 | 
			
		||||
        dragonfly: commadExist("go"),
 | 
			
		||||
    }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
// check php bin
 | 
			
		||||
if ((PHPBin[process.platform] || {})[arch]) valid_platform["pocketmine"] = true;
 | 
			
		||||
    else valid_platform["pocketmine"] = false;
 | 
			
		||||
    // check php bin
 | 
			
		||||
    if ((PHPBin[process.platform] || {})[arch]) valid_platform["pocketmine"] = true;
 | 
			
		||||
        else valid_platform["pocketmine"] = false;
 | 
			
		||||
 | 
			
		||||
// SoSystem X
 | 
			
		||||
if (process.platform == "win32") {
 | 
			
		||||
    system = "Windows";
 | 
			
		||||
} else if (process.platform == "linux") {
 | 
			
		||||
    system = "Linux";
 | 
			
		||||
    
 | 
			
		||||
    // Bedrock Check
 | 
			
		||||
    if (Servers.bedrock[Servers.latest.bedrock][arch]) {
 | 
			
		||||
        if (Servers.bedrock[Servers.latest.bedrock][arch][process.platform]) valid_platform["bedrock"] = true;
 | 
			
		||||
        else valid_platform["bedrock"] = false;
 | 
			
		||||
    } else valid_platform["bedrock"] = false;
 | 
			
		||||
    // SoSystem X
 | 
			
		||||
    if (process.platform == "win32") {
 | 
			
		||||
        system = "Windows";
 | 
			
		||||
    } else if (process.platform == "linux") {
 | 
			
		||||
        system = "Linux";
 | 
			
		||||
        
 | 
			
		||||
        // Bedrock Check
 | 
			
		||||
        if (Servers.bedrock[Servers.latest.bedrock][arch]) {
 | 
			
		||||
            if (Servers.bedrock[Servers.latest.bedrock][arch][process.platform]) valid_platform["bedrock"] = true;
 | 
			
		||||
            else valid_platform["bedrock"] = false;
 | 
			
		||||
        } else valid_platform["bedrock"] = false;
 | 
			
		||||
 | 
			
		||||
    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'");
 | 
			
		||||
            valid_platform["bedrock"] = true
 | 
			
		||||
            require_qemu = true
 | 
			
		||||
        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'");
 | 
			
		||||
                valid_platform["bedrock"] = true
 | 
			
		||||
                require_qemu = true
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else if (process.platform == "darwin") {
 | 
			
		||||
        system = "MacOS";
 | 
			
		||||
        valid_platform["bedrock"] = false
 | 
			
		||||
    } else if (process.platform === "android") {
 | 
			
		||||
        system = "Android";
 | 
			
		||||
        valid_platform["bedrock"] = false
 | 
			
		||||
    } else {
 | 
			
		||||
        throw new Error(`The Bds Maneger Core does not support ${process.platform} systems, as no tests have been done.`);
 | 
			
		||||
    }
 | 
			
		||||
} else if (process.platform == "darwin") {
 | 
			
		||||
    system = "MacOS";
 | 
			
		||||
    valid_platform["bedrock"] = false
 | 
			
		||||
} else if (process.platform === "android") {
 | 
			
		||||
    system = "Android";
 | 
			
		||||
    valid_platform["bedrock"] = false
 | 
			
		||||
} else {
 | 
			
		||||
    console.log(`The Bds Maneger Core does not support ${process.platform} systems, as no tests have been done.`);
 | 
			
		||||
    process.exit(127);
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
        system,
 | 
			
		||||
        require_qemu,
 | 
			
		||||
        valid_platform,
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = CheckSystemAsync;
 | 
			
		||||
 | 
			
		||||
// System Architect (x64, aarch64 and others)
 | 
			
		||||
let arch;
 | 
			
		||||
if (process.arch === "arm64") arch = "aarch64";
 | 
			
		||||
else arch = process.arch
 | 
			
		||||
module.exports.arch = arch
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Platforms valid from deferents systems
 | 
			
		||||
 */
 | 
			
		||||
function GetKernel() {
 | 
			
		||||
    if (process.platform === "win32") {
 | 
			
		||||
        const kernelVersion = parseFloat(release());
 | 
			
		||||
@@ -93,11 +104,4 @@ function GetKernel() {
 | 
			
		||||
        else return str.replace(/\n|\t|\r/gi, "");
 | 
			
		||||
    } else return "Not identified";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Platforms valid from deferents systems
 | 
			
		||||
 */
 | 
			
		||||
module.exports.valid_platform = valid_platform
 | 
			
		||||
module.exports.require_qemu = require_qemu
 | 
			
		||||
module.exports.system = system
 | 
			
		||||
module.exports.GetKernel = GetKernel;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								lib/Requests.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								lib/Requests.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
if (typeof fetch === "undefined") global.fetch = require("node-fetch");
 | 
			
		||||
module.exports = {
 | 
			
		||||
    JSON: async (url = "", options) => await (await fetch(url, options)).json(),
 | 
			
		||||
    TEXT: async (url = "", options) => await (await fetch(url, options)).text(),
 | 
			
		||||
    BUFFER: async (url = "", options) => Buffer.from(await (await fetch(url, options)).arrayBuffer()),
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
const express = require("express");
 | 
			
		||||
const app = express.Router();
 | 
			
		||||
const { GetPlatform, GetPaths } = require("../../../lib/BdsSettings")
 | 
			
		||||
const bds = require("../../../index");
 | 
			
		||||
const { token_verify, CheckPlayer } = require("../../UsersAndtokenChecks");
 | 
			
		||||
const { readFileSync } = require("fs");
 | 
			
		||||
const docs = require("../../../BdsManegerInfo.json").docs;
 | 
			
		||||
		Reference in New Issue
	
	Block a user