Update Platforms #390

Merged
Sirherobrine23 merged 10 commits from StashCode into main 2022-06-09 20:22:38 +00:00
53 changed files with 1103 additions and 1170 deletions
Showing only changes of commit 2c8da3e68e - Show all commits

View File

@ -1,8 +1,14 @@
# Hello little programmers!
# Contributing to Core Core for server management and events
Bds Manager Core accepts contributions provided that
- Be a fork of the repository
- have the latest repository modifications applied to the repository in the `main` branch
- to add a platform to the project, maintaining scripts
Read Code of Conduct fist!
[Bds Manager Core code of conduct](CODE_OF_CONDUCT.md)
[Bds Manager Core code of conduct](CODE_OF_CONDUCT.md)
## TL;DR
[Add Platform](https://github.com/The-Bds-Maneger/Bds-Maneger-Core/wiki/Add-new-Platform-to-Core)
Bds Manager Core accepts contributions provided that:
* Be a fork of the repository.
* have the latest repository modifications applied to the repository in the `main` branch.
* to add a platform to the project, maintaining scripts.

314
package-lock.json generated
View File

@ -19,15 +19,13 @@
"adm-zip": "^0.5.9",
"axios": "^0.27.0",
"cron": "^2.0.0",
"dir-compare": "^4.0.0",
"fs-extra": "^10.0.1",
"mongoose": "^6.3.6",
"prismarine-nbt": "^2.2.1",
"simple-git": "^3.6.0",
"tar": "^6.1.11"
},
"devDependencies": {
"@types/adm-zip": "^0.5.0",
"@types/cli-color": "^2.0.2",
"@types/cron": "^2.0.0",
"@types/fs-extra": "^9.0.13",
"@types/node": "^17.0.22",
@ -94,40 +92,6 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"node_modules/@kwsites/file-exists": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz",
"integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==",
"dependencies": {
"debug": "^4.1.1"
}
},
"node_modules/@kwsites/file-exists/node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/@kwsites/file-exists/node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/@kwsites/promise-deferred": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz",
"integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="
},
"node_modules/@sindresorhus/is": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
@ -205,12 +169,6 @@
"@types/node": "*"
}
},
"node_modules/@types/cli-color": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/cli-color/-/cli-color-2.0.2.tgz",
"integrity": "sha512-1ErQIcmNHtNViGKTtB/TIKqMkC2RkKI2nBneCr9hSCPo9H05g9VzjlaXPW3H0vaI8zFGjJZvSav+VKDKCtKgKA==",
"dev": true
},
"node_modules/@types/cron": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/cron/-/cron-2.0.0.tgz",
@ -463,7 +421,8 @@
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
},
"node_modules/base64-js": {
"version": "1.5.1",
@ -542,6 +501,7 @@
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -565,9 +525,9 @@
"integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow=="
},
"node_modules/bson": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/bson/-/bson-4.6.2.tgz",
"integrity": "sha512-VeJKHShcu1b/ugl0QiujlVuBepab714X9nNyBdA1kfekuDGecxgpTA2Z6nYbagrWFeiIyzSWIOzju3lhj+RNyQ==",
"version": "4.6.4",
"resolved": "https://registry.npmjs.org/bson/-/bson-4.6.4.tgz",
"integrity": "sha512-TdQ3FzguAu5HKPPlr0kYQCyrYUYh8tFM+CMTpxjNzVzxeiJY00Rtuj3LXLHSgiGvmaWlZ8PE+4KyM2thqE38pQ==",
"dependencies": {
"buffer": "^5.6.0"
},
@ -811,7 +771,8 @@
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"node_modules/configstore": {
"version": "5.0.1",
@ -1030,15 +991,6 @@
"node": ">=0.3.1"
}
},
"node_modules/dir-compare": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-4.0.0.tgz",
"integrity": "sha512-wC7thVKL3V656tO61rbEDE4LTeeYrUC2pAUL00AaXYghBhjjVNRyBlpH6POzb44ZuK23OSrqF6TbSC/QYeqfAg==",
"dependencies": {
"minimatch": "^3.0.4",
"p-limit": "^3.1.0 "
}
},
"node_modules/domexception": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz",
@ -1774,9 +1726,9 @@
}
},
"node_modules/ip": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
"integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg=="
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
@ -2367,6 +2319,7 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
@ -2415,14 +2368,14 @@
}
},
"node_modules/mongodb": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.3.1.tgz",
"integrity": "sha512-sNa8APSIk+r4x31ZwctKjuPSaeKuvUeNb/fu/3B6dRM02HpEgig7hTHM8A/PJQTlxuC/KFWlDlQjhsk/S43tBg==",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.5.0.tgz",
"integrity": "sha512-A2l8MjEpKojnhbCM0MK3+UOGUSGvTNNSv7AkP1fsT7tkambrkkqN/5F2y+PhzsV0Nbv58u04TETpkaSEdI2zKA==",
"dependencies": {
"bson": "^4.6.1",
"bson": "^4.6.2",
"denque": "^2.0.1",
"mongodb-connection-string-url": "^2.4.1",
"socks": "^2.6.1"
"mongodb-connection-string-url": "^2.5.2",
"socks": "^2.6.2"
},
"engines": {
"node": ">=12.9.0"
@ -2453,15 +2406,15 @@
}
},
"node_modules/mongoose": {
"version": "6.2.10",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.10.tgz",
"integrity": "sha512-Yp+6UH5M0AlxAVGdC2/Deq0St+2qW73oKCnhJDr83bOZ12eflTLTT5uQF0p6KzvtFj86XWbq/7ApvO4yW6h1sA==",
"version": "6.3.6",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.3.6.tgz",
"integrity": "sha512-/Cixfo+bA32EHQ5Y7sxMj5ZOXFiAFlvA3X4mFruUET9OsbJZfstg4n2FzxovX8Q7EcoQ7Ry1bnOp9AeXtodF7w==",
"dependencies": {
"bson": "^4.2.2",
"bson": "^4.6.2",
"kareem": "2.3.5",
"mongodb": "4.3.1",
"mpath": "0.8.4",
"mquery": "4.0.2",
"mongodb": "4.5.0",
"mpath": "0.9.0",
"mquery": "4.0.3",
"ms": "2.1.3",
"sift": "16.0.0"
},
@ -2479,17 +2432,17 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/mpath": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz",
"integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
"integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/mquery": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.2.tgz",
"integrity": "sha512-oAVF0Nil1mT3rxty6Zln4YiD6x6QsUWYz927jZzjMxOK2aqmhEz5JQ7xmrKK7xRFA2dwV+YaOpKU/S+vfNqKxA==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.3.tgz",
"integrity": "sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==",
"dependencies": {
"debug": "4.x"
},
@ -2843,20 +2796,6 @@
"node": ">=6"
}
},
"node_modules/p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"dependencies": {
"yocto-queue": "^0.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/package-json": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz",
@ -3374,41 +3313,6 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
"node_modules/simple-git": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.7.1.tgz",
"integrity": "sha512-+Osjtsumbtew2y9to0pOYjNzSIr4NkKGBg7Po5SUtjQhaJf2QBmiTX/9E9cv9rmc7oUiSGFIB9e7ys5ibnT9+A==",
"dependencies": {
"@kwsites/file-exists": "^1.1.1",
"@kwsites/promise-deferred": "^1.1.1",
"debug": "^4.3.3"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/steveukx/"
}
},
"node_modules/simple-git/node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/simple-git/node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
@ -3443,7 +3347,7 @@
"node_modules/sparse-bitfield": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
"optional": true,
"dependencies": {
"memory-pager": "^1.0.2"
@ -4192,17 +4096,6 @@
"engines": {
"node": ">=6"
}
},
"node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
}
},
"dependencies": {
@ -4253,34 +4146,6 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"@kwsites/file-exists": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz",
"integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==",
"requires": {
"debug": "^4.1.1"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"@kwsites/promise-deferred": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz",
"integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="
},
"@sindresorhus/is": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
@ -4349,12 +4214,6 @@
"@types/node": "*"
}
},
"@types/cli-color": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@types/cli-color/-/cli-color-2.0.2.tgz",
"integrity": "sha512-1ErQIcmNHtNViGKTtB/TIKqMkC2RkKI2nBneCr9hSCPo9H05g9VzjlaXPW3H0vaI8zFGjJZvSav+VKDKCtKgKA==",
"dev": true
},
"@types/cron": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/cron/-/cron-2.0.0.tgz",
@ -4563,7 +4422,8 @@
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
},
"base64-js": {
"version": "1.5.1",
@ -4615,6 +4475,7 @@
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -4635,9 +4496,9 @@
"integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow=="
},
"bson": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/bson/-/bson-4.6.2.tgz",
"integrity": "sha512-VeJKHShcu1b/ugl0QiujlVuBepab714X9nNyBdA1kfekuDGecxgpTA2Z6nYbagrWFeiIyzSWIOzju3lhj+RNyQ==",
"version": "4.6.4",
"resolved": "https://registry.npmjs.org/bson/-/bson-4.6.4.tgz",
"integrity": "sha512-TdQ3FzguAu5HKPPlr0kYQCyrYUYh8tFM+CMTpxjNzVzxeiJY00Rtuj3LXLHSgiGvmaWlZ8PE+4KyM2thqE38pQ==",
"requires": {
"buffer": "^5.6.0"
}
@ -4806,7 +4667,8 @@
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"configstore": {
"version": "5.0.1",
@ -4978,15 +4840,6 @@
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
},
"dir-compare": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-4.0.0.tgz",
"integrity": "sha512-wC7thVKL3V656tO61rbEDE4LTeeYrUC2pAUL00AaXYghBhjjVNRyBlpH6POzb44ZuK23OSrqF6TbSC/QYeqfAg==",
"requires": {
"minimatch": "^3.0.4",
"p-limit": "^3.1.0 "
}
},
"domexception": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz",
@ -5518,9 +5371,9 @@
}
},
"ip": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
"integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
"integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg=="
},
"ipaddr.js": {
"version": "1.9.1",
@ -5949,6 +5802,7 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -5982,15 +5836,15 @@
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
"mongodb": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.3.1.tgz",
"integrity": "sha512-sNa8APSIk+r4x31ZwctKjuPSaeKuvUeNb/fu/3B6dRM02HpEgig7hTHM8A/PJQTlxuC/KFWlDlQjhsk/S43tBg==",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.5.0.tgz",
"integrity": "sha512-A2l8MjEpKojnhbCM0MK3+UOGUSGvTNNSv7AkP1fsT7tkambrkkqN/5F2y+PhzsV0Nbv58u04TETpkaSEdI2zKA==",
"requires": {
"bson": "^4.6.1",
"bson": "^4.6.2",
"denque": "^2.0.1",
"mongodb-connection-string-url": "^2.4.1",
"mongodb-connection-string-url": "^2.5.2",
"saslprep": "^1.0.3",
"socks": "^2.6.1"
"socks": "^2.6.2"
}
},
"mongodb-connection-string-url": {
@ -6014,15 +5868,15 @@
}
},
"mongoose": {
"version": "6.2.10",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.2.10.tgz",
"integrity": "sha512-Yp+6UH5M0AlxAVGdC2/Deq0St+2qW73oKCnhJDr83bOZ12eflTLTT5uQF0p6KzvtFj86XWbq/7ApvO4yW6h1sA==",
"version": "6.3.6",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.3.6.tgz",
"integrity": "sha512-/Cixfo+bA32EHQ5Y7sxMj5ZOXFiAFlvA3X4mFruUET9OsbJZfstg4n2FzxovX8Q7EcoQ7Ry1bnOp9AeXtodF7w==",
"requires": {
"bson": "^4.2.2",
"bson": "^4.6.2",
"kareem": "2.3.5",
"mongodb": "4.3.1",
"mpath": "0.8.4",
"mquery": "4.0.2",
"mongodb": "4.5.0",
"mpath": "0.9.0",
"mquery": "4.0.3",
"ms": "2.1.3",
"sift": "16.0.0"
},
@ -6035,14 +5889,14 @@
}
},
"mpath": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz",
"integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g=="
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
"integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew=="
},
"mquery": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.2.tgz",
"integrity": "sha512-oAVF0Nil1mT3rxty6Zln4YiD6x6QsUWYz927jZzjMxOK2aqmhEz5JQ7xmrKK7xRFA2dwV+YaOpKU/S+vfNqKxA==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-4.0.3.tgz",
"integrity": "sha512-J5heI+P08I6VJ2Ky3+33IpCdAvlYGTSUjwTPxkAr8i8EoduPMBX2OY/wa3IKZIQl7MU4SbFk8ndgSKyB/cl1zA==",
"requires": {
"debug": "4.x"
},
@ -6312,14 +6166,6 @@
"integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==",
"dev": true
},
"p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"requires": {
"yocto-queue": "^0.1.0"
}
},
"package-json": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz",
@ -6719,31 +6565,6 @@
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
"dev": true
},
"simple-git": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.7.1.tgz",
"integrity": "sha512-+Osjtsumbtew2y9to0pOYjNzSIr4NkKGBg7Po5SUtjQhaJf2QBmiTX/9E9cv9rmc7oUiSGFIB9e7ys5ibnT9+A==",
"requires": {
"@kwsites/file-exists": "^1.1.1",
"@kwsites/promise-deferred": "^1.1.1",
"debug": "^4.3.3"
},
"dependencies": {
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
}
}
},
"smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
@ -6767,7 +6588,7 @@
"sparse-bitfield": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
"optional": true,
"requires": {
"memory-pager": "^1.0.2"
@ -7321,11 +7142,6 @@
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
"dev": true
},
"yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="
}
}
}

View File

@ -1,11 +1,21 @@
{
"name": "@the-bds-maneger/core",
"version": "3.0.2",
"description": "A very simple way to manage Minecraft servers",
"author": "Sirherobrine23",
"license": "AGPL-3.0-or-later",
"homepage": "https://sirherobrine23.org/Bds_Maneger_Project",
"private": false,
"publishConfig": {
"access": "public"
},
"version": "3.0.2",
"description": "A very simple way to manage Minecraft servers",
"maintainers": [
{
"name": "Matheus Sampaio Queiroga",
"email": "srherobrine20@gmail.com",
"url": "https://sirherobrine23.org"
}
],
"types": "./dist/dts/index.d.ts",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.mjs",
@ -20,37 +30,26 @@
"build:cjs": "tsc --outDir dist/cjs --module commonjs",
"build:esm": "tsc --outDir dist/esm --module es6 && node -e 'const fs = require(\"fs\");const path = require(\"path\");const read = (pathRe) => {for (const fileFolde of fs.readdirSync(pathRe)) {const filePath = path.join(pathRe, fileFolde);if (fs.statSync(filePath).isDirectory()) read(filePath);else {console.log(filePath, \"-->\", filePath.replace(/\\.js$/, \".mjs\"));fs.renameSync(filePath, filePath.replace(/\\.js$/, \".mjs\"));}}};read(\"dist/esm\");'"
},
"nodemonConfig": {
"delay": 2500,
"exec": "npm run test",
"ext": "json,ts",
"watch": [
"src/**/*",
"package.json",
"package-lock.json"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/The-Bds-Maneger/Bds-Maneger-Core.git"
},
"keywords": [
"minecraft",
"typescript",
"bds",
"bds-server",
"bds_maneger",
"bds-maneger",
"bds_project",
"minecraft",
"bedrock",
"java",
"pocketmine",
"server_mode",
"rest",
"typescript"
"spigot"
],
"author": "Sirherobrine23",
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/The-Bds-Maneger/Bds-Maneger-Core/issues/new"
"url": "https://github.com/The-Bds-Maneger/Bds-Maneger-Core/issues/new",
"email": "support_bds@sirherobrine23.org"
},
"homepage": "https://docs.bdsmaneger.com/Bds Maneger core",
"engines": {
"node": ">=16.0.0"
},
@ -65,15 +64,13 @@
"adm-zip": "^0.5.9",
"axios": "^0.27.0",
"cron": "^2.0.0",
"dir-compare": "^4.0.0",
"fs-extra": "^10.0.1",
"mongoose": "^6.3.6",
"prismarine-nbt": "^2.2.1",
"simple-git": "^3.6.0",
"tar": "^6.1.11"
},
"devDependencies": {
"@types/adm-zip": "^0.5.0",
"@types/cli-color": "^2.0.2",
"@types/cron": "^2.0.0",
"@types/fs-extra": "^9.0.13",
"@types/node": "^17.0.22",
@ -82,5 +79,15 @@
"npm-run-all": "^4.1.5",
"ts-node": "^10.7.0",
"typescript": "^4.6.4"
},
"nodemonConfig": {
"delay": 2500,
"exec": "npm run test",
"ext": "json,ts",
"watch": [
"src/**/*",
"package.json",
"package-lock.json"
]
}
}
}

View File

@ -1,4 +0,0 @@
import * as bedrock from "./bedrock/install";
export default {bedrock};
export {bedrock};

View File

@ -1,107 +0,0 @@
import path from "node:path";
import fs, { promises as fsPromise } from "node:fs";
import simpleGit from "simple-git";
import { compare as compareDir } from "dir-compare";
import { backupRoot as backupFolderPath } from "../pathControl";
import { genericAddFiles } from "./root";
export type gitBackupOption = {
repoUrl?: string;
branch?: string;
Auth?: {
Username?: string;
PasswordToken: string
}
};
async function initGitRepo(RepoPath: string, options?: gitBackupOption): Promise<void> {
if (fs.existsSync(RepoPath)) {
if (fs.existsSync(path.join(RepoPath, ".git"))) {
if (!(!!options?.Auth?.Username || !!options?.Auth?.PasswordToken)) return;
// remove old origin
const gitRe = simpleGit(RepoPath);
const urlParsed = new URL(options?.repoUrl);
const remotes = await gitRe.getRemotes(true);
let gitUrl = options.repoUrl;
if (options?.Auth?.Username || options?.Auth?.PasswordToken) {
if (options.Auth?.Username && options.Auth?.PasswordToken) {
if (options.Auth?.PasswordToken.startsWith("ghp_")) options.Auth.Username = "oauth2";
const urlParse = new URL(gitUrl);
gitUrl = `${urlParse.protocol}//${options.Auth.Username}:${options.Auth.PasswordToken}@${urlParse.host}${urlParse.pathname}`;
}
}
for (const remote of remotes) {
if (remote.refs.fetch.includes(urlParsed.hostname) && remote.refs.push.includes(urlParsed.hostname)) {
await gitRe.removeRemote(remote.name);
await gitRe.addRemote(remote.name, gitUrl);
}
}
}
}
await fsPromise.mkdir(RepoPath, {recursive: true});
if (options) {
if (options.repoUrl) {
let gitUrl = options.repoUrl;
if (options?.Auth?.Username || options?.Auth?.PasswordToken) {
if (options.Auth?.Username && options.Auth?.PasswordToken) {
if (options.Auth?.PasswordToken.startsWith("ghp_")) options.Auth.Username = "oauth2";
const urlParse = new URL(gitUrl);
gitUrl = `${urlParse.protocol}//${options.Auth.Username}:${options.Auth.PasswordToken}@${urlParse.host}${urlParse.pathname}`;
}
}
const gitClone = simpleGit(RepoPath);
await gitClone.clone(gitUrl, RepoPath);
if (options.branch) await gitClone.checkout(options.branch);
} else {
console.log("No Repo Url, creating empty repo");
await initGitRepo(RepoPath);
return;
}
} else {
// Create empty git repo and create main branch
const gitInit = simpleGit(RepoPath);
await gitInit.init()
// Create main branch
await gitInit.checkoutBranch("main", "master");
}
const git = simpleGit(RepoPath);
if (!!(await git.getConfig("user.email"))) await git.addConfig("user.email", "support_bds@sirherobrine23.org");
if (!!(await git.getConfig("user.name"))) await git.addConfig("user.name", "BDS-Backup");
return;
}
/**
* Create a backup in the git repository and push it to the remote if is authenticated (in each commit all existing files will be deleted).
*
* @param options - Config git repository
*/
export async function gitBackup(options?: gitBackupOption): Promise<void>{
const gitFolder = path.join(backupFolderPath, "gitBackup");
await initGitRepo(gitFolder, options);
const TempFiles = await genericAddFiles();
const git = simpleGit(gitFolder, {baseDir: gitFolder});
await git.stash();
await git.pull();
const Difff = (await compareDir(TempFiles.tempFolderPath, gitFolder, {excludeFilter: ".git"})).diffSet.filter(a => a.type1 === "missing"||a.type2 === "missing").filter(a => a.type1 === "file"||a.type2 === "file");
await Promise.all(Difff.map(async file => {
// Delete files
const FileDelete = path.join(file.path2, file.name2);
await fsPromise.rm(FileDelete, {force: true});
}));
await Promise.all((await TempFiles.listFiles()).map(async file => {
const gitPath = path.join(gitFolder, file);
const tempFolderPath = path.join(TempFiles.tempFolderPath, file);
if (!(fs.existsSync(path.join(gitFolder, path.parse(file).dir)))) await fsPromise.mkdir(path.join(gitFolder, path.parse(file).dir), {recursive: true}).catch(() => {});
await fsPromise.copyFile(tempFolderPath, gitPath);
}))
await TempFiles.cleanFolder();
await git.add(gitFolder).then(() => git.commit(`BDS Backup - ${new Date()}`).catch(console.error));
if (!!((options||{}).Auth||{}).Username) {
console.log("Pushing to remote");
await git.push([
"--force",
"--set-upstream"
]);
}
return;
}

View File

@ -1,4 +1,3 @@
import * as gitA from "./git";
import * as zipA from "./zip";
export const git = gitA;
export const zip = zipA;
import * as zip from "./zip";
export default {zip}
export {zip}

View File

@ -2,35 +2,10 @@ import * as bdsTypes from "./globalType";
import platform from "./platform/index";
export default DownloadServer;
export async function DownloadServer(Platform: bdsTypes.Platform, Version: string|boolean): Promise<{Version: string, Date: Date, url: string}> {
if (Platform === "bedrock") {
const bedrockInfo = await platform.bedrock.DownloadServer(Version);
return {
Version: bedrockInfo.version,
Date: bedrockInfo.publishDate,
url: bedrockInfo.url
};
} else if (Platform === "java") {
const javaInfo = await platform.java.DownloadServer(Version);
return {
Version: javaInfo.version,
Date: javaInfo.publishDate,
url: javaInfo.url
};
} else if (Platform === "spigot") {
const spigotInfo = await platform.spigot.DownloadServer(Version);
return {
Version: spigotInfo.version,
Date: spigotInfo.publishDate,
url: spigotInfo.url
};
} else if (Platform === "pocketmine") {
const pocketmineInfo = await platform.pocketmine.DownloadServer(Version);
return {
Version: pocketmineInfo.version,
Date: pocketmineInfo.publishDate,
url: pocketmineInfo.url
};
}
throw new Error("No file found for this Platform and Arch");
export async function DownloadServer(Platform: bdsTypes.Platform, Version: string|boolean): Promise<{version: string, url: string; publishDate: Date}> {
if (Platform === "bedrock") return platform.bedrock.DownloadServer(Version);
else if (Platform === "java") return platform.java.DownloadServer(Version);
else if (Platform === "spigot") return platform.spigot.DownloadServer(Version);
else if (Platform === "pocketmine") return platform.pocketmine.DownloadServer(Version);
throw new Error("Invalid Platform");
}

View File

@ -1,6 +1,4 @@
import { CronJob } from "cron";
import { gitBackupOption } from "./backup/git";
export type Platform = "bedrock"|"java"|"pocketmine"|"spigot";
export const PlatformArray = ["bedrock", "java", "pocketmine", "spigot"];
@ -20,12 +18,13 @@ export type bdsSessionCommands = {
export type startServerOptions = {
/** Save only worlds/maps without server software - (Beta) */
storageOnlyWorlds?: boolean;
gitBackup?: gitBackupOption;
};
export type playerAction1 = {player: string, Date: Date; xuid?: string|undefined}
export type playerAction2 = playerAction1 & {action: "connect"|"disconnect"|"unknown"}
// Server events
export type serverListen = {port: number; protocol?: "TCP"|"UDP"; version?: "IPv4"|"IPv6"|"IPv4/IPv6"};
export type playerObject = {[player: string]: {action: "connect"|"disconnect"|"unknown"; date: Date; history: Array<{action: "connect"|"disconnect"|"unknown"; date: Date}>}};
export interface serverOn {
(act: "started", fn: (data: Date) => void);
(act: "err", fn: (data: Error|number) => void);
@ -40,32 +39,31 @@ export interface serverOn {
(act: "log_stdout", fn: (data: string) => void);
(act: "log_stderr", fn: (data: string) => void);
}
export type serverListen = {port: number; protocol?: "TCP"|"UDP"; version?: "IPv4"|"IPv6"|"IPv4/IPv6"};
export type playerObject = {[player: string]: {action: "connect"|"disconnect"|"unknown"; date: Date; history: Array<{action: "connect"|"disconnect"|"unknown"; date: Date}>}};
// Type to Bds Session (All Platforms)
export type BdsSession = {
/** Server Session ID */
id: string;
logFile?: string;
/** register cron job to create backups */
creteBackup: (crontime: string|Date, option?: {type: "git"; config: gitBackupOption}|{type: "zip", pathStorage?: string}) => CronJob;
creteBackup: (crontime: string|Date, option?: {type: "zip", pathStorage?: string}) => CronJob;
/** Get server players historic connections */
Player: playerObject;
/** Get Server ports. listening. */
ports: Array<serverListen>;
/** if exists server map get world seed, fist map not get seed */
seed?: string|number;
/** Basic server functions. */
commands: bdsSessionCommands;
/** Server actions, example on avaible to connect or banned¹ */
server: {
/** Server actions, example on avaible to connect or banned¹ */
/** Server actions */
on: serverOn;
/** Server actions, example on avaible to connect or banned¹ */
/** Server actions */
once: serverOn;
/** Server Started date */
startDate: Date;
/** Server Started */
started: boolean;
};
/** Basic server functions. */
commands: bdsSessionCommands;
};

View File

@ -1,8 +1,22 @@
// import
import * as Server from "./server";
// import All platforms and old functions
// New Methods
import * as platform from "./platform/index";
// Old functions
import * as downloadServer from "./download_server";
import * as worldManeger from "./worldManeger";
import * as serverConfig from "./serverConfig";
import * as bdsTypes from "./globalType";
import * as platform from "./platform/index";
import * as backup from "./backup/index";
export default {Server, downloadServer, serverConfig, bdsTypes, platform, backup};
import * as Server from "./server";
// Export all modules
export default {
bdsTypes,
platform,
downloadServer,
worldManeger,
serverConfig,
backup,
Server,
};

View File

@ -0,0 +1,52 @@
import mongoose from "mongoose";
import { Platform } from '../globalType';
export type PlayerSchema = {
Player: string,
Ban: boolean,
Platform: Platform,
FistDate: Date,
LastUpdateDate: Date,
ConnectionHistoric: Array<{
ConnectionType: "connect" | "disconnect" | "unknown",
Date: Date
}>
};
export const schema = new mongoose.Schema<PlayerSchema>({
Player: {
type: String,
required: true
},
Ban: {
type: Boolean,
required: true
},
Platform: {
type: String,
enum: ["bedrock", "java", "pocketmine", "spigot"],
required: true
},
FistDate: {
type: Date,
required: true
},
LastUpdateDate: {
type: Date,
required: true
},
ConnectionHistoric: [
{
ConnectionType: {
type: String,
enum: ["connect", "disconnect", "unknown"],
required: true
},
Date: {
type: Date,
required: true
}
}
]
});
export default schema;

View File

@ -4,7 +4,7 @@ import fs, { promises as fsPromise } from "node:fs";
import AdmZip from "adm-zip";
import * as Proprieties from "../../lib/Proprieties"
import { parse as nbtParse, NBT, Metadata as nbtData, NBTFormat } from "prismarine-nbt";
import { getBuffer } from "../../HttpRequests";
import { getBuffer } from "../../lib/HttpRequests";
import { serverRoot } from "../../pathControl";
const serverPath = path.join(serverRoot, "bedrock");

View File

@ -2,8 +2,8 @@ import path from "node:path";
import fs from "node:fs";
import adm_zip from "adm-zip";
import * as versionManeger from "@the-bds-maneger/server_versions";
import * as httpRequests from "../../HttpRequests";
import { runCommandAsync } from "../../childProcess"
import * as httpRequests from "../../lib/HttpRequests";
import { runCommandAsync } from "../../lib/childProcess"
import { serverRoot } from "../../pathControl";
export default async function download(version: string|boolean) {

View File

@ -1,5 +1,14 @@
import DownloadServer from "./download";
import * as config from "./config";
import * as server from "./server";
import DownloadServer from "./download";
import * as backup from "./backup";
export {DownloadServer, config, server, backup};
import * as addon from "./addon";
// export
export {
DownloadServer,
config,
server,
backup,
addon
};

View File

@ -2,11 +2,10 @@ import path from "node:path";
import fs from "node:fs";
import crypto from "crypto";
import node_cron from "cron";
import * as child_process from "../../childProcess";
import * as child_process from "../../lib/childProcess";
import { backupRoot, serverRoot } from "../../pathControl";
import { BdsSession, bdsSessionCommands, playerAction2 } from '../../globalType';
import { getConfig } from "./config";
import { gitBackup, gitBackupOption } from "../../backup/git";
import { createZipBackup } from "../../backup/zip";
import events from "../../lib/customEvents";
import portislisten from "../../lib/portIsAllocated";
@ -111,12 +110,10 @@ export async function startServer(): Promise<BdsSession> {
}
}
const backupCron = (crontime: string|Date, option?: {type: "git"; config: gitBackupOption}|{type: "zip", config?: {pathZip?: string}}): node_cron.CronJob => {
const backupCron = (crontime: string|Date, option?: {type: "zip", config?: {pathZip?: string}}): node_cron.CronJob => {
// Validate Config
if (option) {
if (option.type === "git") {
if (!option.config) throw new Error("Config is required");
} else if (option.type === "zip") {}
if (option.type === "zip") {}
else option = {type: "zip"};
}
async function lockServerBackup() {
@ -131,10 +128,7 @@ export async function startServer(): Promise<BdsSession> {
}
if (!option) option = {type: "zip"};
const CrontimeBackup = new node_cron.CronJob(crontime, async () => {
if (option.type === "git") {
await lockServerBackup();
await gitBackup(option.config).catch(() => undefined).then(() => unLockServerBackup());
} else if (option.type === "zip") {
if (option.type === "zip") {
await lockServerBackup();
if (!!option?.config?.pathZip) await createZipBackup({path: path.resolve(backupRoot, option?.config?.pathZip)}).catch(() => undefined);
else await createZipBackup(true).catch(() => undefined);

View File

@ -2,6 +2,7 @@ import * as bedrock from "./bedrock/index";
import * as pocketmine from "./pocketmine/index";
import * as java from "./java/index";
import * as spigot from "./spigot/index";
//
// import { BdsSession } from "../globalType";
//
// type globalPlatform = {
@ -26,5 +27,5 @@ import * as spigot from "./spigot/index";
// },
// }
// };
export default {bedrock, java, pocketmine, spigot}
// export default {bedrock, java, pocketmine, spigot} as globalPlatform;
export default {bedrock, java, pocketmine, spigot};

View File

@ -1,7 +1,7 @@
import path from "node:path";
import fs from "node:fs";
import * as versionManeger from "@the-bds-maneger/server_versions";
import * as httpRequests from "../../HttpRequests";
import * as httpRequests from "../../lib/HttpRequests";
import { serverRoot } from "../../pathControl";
export default async function download(version: string|boolean) {

View File

@ -1,4 +1,10 @@
import DownloadServer from "./download";
import * as server from "./server";
import * as backup from "./backup";
import DownloadServer from "./download";
export {server, DownloadServer, backup};
// Export
export {
DownloadServer,
server,
backup
};

View File

@ -2,10 +2,9 @@ import path from "node:path";
import fs from "node:fs";
import crypto from "crypto";
import node_cron from "cron";
import * as child_process from "../../childProcess";
import * as child_process from "../../lib/childProcess";
import { backupRoot, serverRoot } from "../../pathControl";
import { BdsSession, bdsSessionCommands } from '../../globalType';
import { gitBackup, gitBackupOption } from "../../backup/git";
import { createZipBackup } from "../../backup/zip";
import events from "../../lib/customEvents";
@ -70,12 +69,10 @@ export async function startServer(): Promise<BdsSession> {
}
}
const backupCron = (crontime: string|Date, option?: {type: "git"; config: gitBackupOption}|{type: "zip", config?: {pathZip?: string}}): node_cron.CronJob => {
const backupCron = (crontime: string|Date, option?: {type: "zip", config?: {pathZip?: string}}): node_cron.CronJob => {
// Validate Config
if (option) {
if (option.type === "git") {
if (!option.config) throw new Error("Config is required");
} else if (option.type === "zip") {}
if (option.type === "zip") {}
else option = {type: "zip"};
}
async function lockServerBackup() {
@ -90,10 +87,7 @@ export async function startServer(): Promise<BdsSession> {
}
if (!option) option = {type: "zip"};
const CrontimeBackup = new node_cron.CronJob(crontime, async () => {
if (option.type === "git") {
await lockServerBackup();
await gitBackup(option.config).catch(() => undefined).then(() => unLockServerBackup());
} else if (option.type === "zip") {
if (option.type === "zip") {
await lockServerBackup();
if (!!option?.config?.pathZip) await createZipBackup({path: path.resolve(backupRoot, option?.config?.pathZip)}).catch(() => undefined);
else await createZipBackup(true).catch(() => undefined);

View File

@ -1,4 +1,4 @@
import * as httpRequest from "../../HttpRequests";
import * as httpRequest from "../../lib/HttpRequests";
export async function getPlugins(): Promise<Array<{
id: number,

View File

@ -4,8 +4,8 @@ import os from "os";
import adm_zip from "adm-zip";
import tar from "tar";
import * as versionManeger from "@the-bds-maneger/server_versions";
import * as httpRequests from "../../HttpRequests";
import * as childProcess from "../../childProcess";
import * as httpRequests from "../../lib/HttpRequests";
import * as childProcess from "../../lib/childProcess";
import Readdirrec from "../../lib/listRecursive";
import { serverRoot } from "../../pathControl";

View File

@ -1,6 +1,14 @@
import DownloadServer from "./download";
import * as addons from "./addons";
import * as config from "./config";
import * as server from "./server";
import * as backup from "./backup";
import DownloadServer from "./download";
export {addons, config, server, DownloadServer, backup};
// Export
export {
DownloadServer,
addons,
config,
server,
backup
};

View File

@ -2,10 +2,9 @@ import path from "node:path";
import fs from "node:fs";
import crypto from "crypto";
import node_cron from "cron";
import * as child_process from "../../childProcess";
import * as child_process from "../../lib/childProcess";
import { backupRoot, serverRoot } from "../../pathControl";
import { BdsSession, bdsSessionCommands, serverListen, playerAction2 } from '../../globalType';
import { gitBackup, gitBackupOption } from "../../backup/git";
import { createZipBackup } from "../../backup/zip";
import events from "../../lib/customEvents";
@ -109,12 +108,10 @@ export async function startServer(): Promise<BdsSession> {
}
}
const backupCron = (crontime: string|Date, option?: {type: "git"; config: gitBackupOption}|{type: "zip", config?: {pathZip?: string}}): node_cron.CronJob => {
const backupCron = (crontime: string|Date, option?: {type: "zip", config?: {pathZip?: string}}): node_cron.CronJob => {
// Validate Config
if (option) {
if (option.type === "git") {
if (!option.config) throw new Error("Config is required");
} else if (option.type === "zip") {}
if (option.type === "zip") {}
else option = {type: "zip"};
}
async function lockServerBackup() {
@ -129,10 +126,7 @@ export async function startServer(): Promise<BdsSession> {
}
if (!option) option = {type: "zip"};
const CrontimeBackup = new node_cron.CronJob(crontime, async () => {
if (option.type === "git") {
await lockServerBackup();
await gitBackup(option.config).catch(() => undefined).then(() => unLockServerBackup());
} else if (option.type === "zip") {
if (option.type === "zip") {
await lockServerBackup();
if (!!option?.config?.pathZip) await createZipBackup({path: path.resolve(backupRoot, option?.config?.pathZip)}).catch(() => undefined);
else await createZipBackup(true).catch(() => undefined);

View File

@ -1,7 +1,7 @@
import path from "node:path";
import fs from "node:fs";
import * as versionManeger from "@the-bds-maneger/server_versions";
import * as httpRequests from "../../HttpRequests";
import * as httpRequests from "../../lib/HttpRequests";
import { serverRoot } from "../../pathControl";
export default async function download(version: string|boolean) {

View File

@ -1,4 +1,10 @@
import DownloadServer from "./download";
import * as server from "./server";
import * as backup from "./backup";
import DownloadServer from "./download";
export {server, backup, DownloadServer};
// Export
export {
DownloadServer,
server,
backup
};

View File

@ -2,10 +2,9 @@ import path from "node:path";
import fs from "node:fs";
import crypto from "node:crypto";
import node_cron from "cron";
import * as child_process from "../../childProcess";
import * as child_process from "../../lib/childProcess";
import { backupRoot, serverRoot } from "../../pathControl";
import { BdsSession, bdsSessionCommands } from '../../globalType';
import { gitBackup, gitBackupOption } from "../../backup/git";
import { createZipBackup } from "../../backup/zip";
import events from "../../lib/customEvents";
@ -69,12 +68,10 @@ export async function startServer(): Promise<BdsSession> {
}
}
const backupCron = (crontime: string|Date, option?: {type: "git"; config: gitBackupOption}|{type: "zip", config?: {pathZip?: string}}): node_cron.CronJob => {
const backupCron = (crontime: string|Date, option?: {type: "zip", config?: {pathZip?: string}}): node_cron.CronJob => {
// Validate Config
if (option) {
if (option.type === "git") {
if (!option.config) throw new Error("Config is required");
} else if (option.type === "zip") {}
if (option.type === "zip") {}
else option = {type: "zip"};
}
async function lockServerBackup() {
@ -89,10 +86,7 @@ export async function startServer(): Promise<BdsSession> {
}
if (!option) option = {type: "zip"};
const CrontimeBackup = new node_cron.CronJob(crontime, async () => {
if (option.type === "git") {
await lockServerBackup();
await gitBackup(option.config).catch(() => undefined).then(() => unLockServerBackup());
} else if (option.type === "zip") {
if (option.type === "zip") {
await lockServerBackup();
if (!!option?.config?.pathZip) await createZipBackup({path: path.resolve(backupRoot, option?.config?.pathZip)}).catch(() => undefined);
else await createZipBackup(true).catch(() => undefined);

View File

@ -1,17 +1,19 @@
import platformManeger from "./platform";
import * as bdsTypes from "./globalType";
import { BdsSession, Platform } from "./globalType";
// Server Sessions
const Sessions: {[Session: string]: bdsTypes.BdsSession} = {};
export function getSessions(): {[SessionID: string]: bdsTypes.BdsSession} {return {
const Sessions: {[Session: string]: BdsSession} = {};
export function getSessions(): {[SessionID: string]: BdsSession} {return {
...Sessions,
...(platformManeger.bedrock.server.getSessions()),
...(platformManeger.pocketmine.server.getSessions()),
...(platformManeger.java.server.getSessions()),
...(platformManeger.spigot.server.getSessions()),
};}
// Start Server
export default Start;
export async function Start(Platform: bdsTypes.Platform, options?: bdsTypes.startServerOptions): Promise<bdsTypes.BdsSession> {
export default StartServer;
export async function StartServer(Platform: Platform): Promise<BdsSession> {
if (Platform === "bedrock") return platformManeger.bedrock.server.startServer();
else if (Platform === "java") return platformManeger.java.server.startServer();
else if (Platform === "pocketmine") return platformManeger.pocketmine.server.startServer();