diff --git a/core/Process/Mcserver.js b/core/Process/Mcserver.js index eb4e974..8aaa523 100644 --- a/core/Process/Mcserver.js +++ b/core/Process/Mcserver.js @@ -75,6 +75,10 @@ class MinecraftServer extends ServerProcess { //关服命令 this.dataModel.stopCommand = args.stopCommand || ""; + this.dataModel.dockerConfig = args.dockerConfig || this.dataModel.dockerConfig; + + this.dataModel.mcpingConfig = args.mcpingConfig || this.dataModel.mcpingConfig; + this.propertiesLoad(); } diff --git a/route/api.js b/route/api.js index e62c825..a7ea5b1 100644 --- a/route/api.js +++ b/route/api.js @@ -279,5 +279,26 @@ router.post("/execute/", function (req, res) { } }); + +// 创建服务器实例(JSON) | API +router.post("/advanced_create_server", function (req, res) { + // 仅仅准许管理员使用 + if (!keyManager.isMaster(apiResponse.key(req))) { + apiResponse.forbidden(res); + return; + } + // 解析请求参数 + try { + const params = req.body; + const config = JSON.parse(params.config); + // 创建 + const result = serverModel.createServer(params.serverName, config); + // 返回状态码 + result ? apiResponse.ok(res) : apiResponse.error(res); + } catch (err) { + apiResponse.error(res, err); + } +}); + //模块导出 module.exports = router;