Dragonfly Download Bin #198
20485
package-lock.json
generated
20485
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -44,9 +44,14 @@
|
||||
},
|
||||
"homepage": "https://docs.bdsmaneger.com/Bds Maneger core",
|
||||
"engines": {
|
||||
"node": ">=15.6.0",
|
||||
"npm": ">=7"
|
||||
"node": ">=15.6.0"
|
||||
},
|
||||
"os": [
|
||||
"linux",
|
||||
"darwin",
|
||||
"win32",
|
||||
"android"
|
||||
],
|
||||
"dependencies": {
|
||||
"@azure/storage-blob": "^12.6.0",
|
||||
"adm-zip": "^0.5.1",
|
||||
|
@ -1,6 +1,4 @@
|
||||
const child_process = require("child_process");
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
const { writeFileSync, existsSync, readFileSync, readdirSync, rmSync } = fs;
|
||||
const { join, resolve } = path;
|
||||
@ -328,24 +326,16 @@ module.exports.v2 = async (version = true) => {
|
||||
if (valid_platform.dragonfly) {
|
||||
if (LocalServersVersions.dragonfly !== version) {
|
||||
// Add info to ReturnObject
|
||||
ReturnObject.url = "https://github.com/df-mc/dragonfly/tree/master";
|
||||
ReturnObject.data = "";
|
||||
ReturnObject.url = ServerDownloadJSON.dragonfly[version][process.platform][bds.arch]
|
||||
ReturnObject.data = ServerDownloadJSON.dragonfly[version].data;
|
||||
|
||||
// Build Dragonfly
|
||||
const TmpDragonflyDir = path.join(os.tmpdir(), `dragonfly_${Math.random().toString(36).substring(7)}`);
|
||||
child_process.execFileSync("git", ["clone", "https://github.com/df-mc/dragonfly", "--depth", "1", TmpDragonflyDir]);
|
||||
let DragonflyPackageOut = path.join(ServersPaths.dragonfly, "DragonFly");
|
||||
if (process.platform === "win32") DragonflyPackageOut += ".exe";
|
||||
child_process.execFileSync("go", ["build", "-o", DragonflyPackageOut], {cwd: TmpDragonflyDir});
|
||||
|
||||
// move Dragonfly to ServersPaths
|
||||
fs.renameSync(DragonflyPackageOut, path.join(ServersPaths.dragonfly, path.basename(DragonflyPackageOut)));
|
||||
|
||||
// Remove Build Dir
|
||||
fs.rmSync(TmpDragonflyDir, {recursive: true, force: true});
|
||||
// Download
|
||||
let DgBin = path.join(ServersPaths.dragonfly, "Dragonfly");
|
||||
if (process.platform === "win32") DgBin += ".exe";
|
||||
fs.writeFileSync(DgBin, await Request.buffer(ReturnObject.url), "binary");
|
||||
|
||||
// Update Server Version
|
||||
bds.BdsSettigs.UpdateServerVersion(Math.random().toString(), CurrentPlatform);
|
||||
bds.BdsSettigs.UpdateServerVersion(version, CurrentPlatform);
|
||||
} else {
|
||||
ReturnObject.skip = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user