forked from mirror/MCSManager
commit
add64b8d44
16
app.js
16
app.js
@ -282,6 +282,22 @@ app.use("/fs", require("./onlinefs/controller/function"));
|
|||||||
|
|
||||||
if (MCSERVER.allError <= 0) {
|
if (MCSERVER.allError <= 0) {
|
||||||
MCSERVER.infoLog("INFO", "控制面板已经启动");
|
MCSERVER.infoLog("INFO", "控制面板已经启动");
|
||||||
|
// 异步等待3秒,打开已配置打开 MCSM 时自启的服务器
|
||||||
|
setTimeout(() => {
|
||||||
|
var serverModel = require("./model/ServerModel");
|
||||||
|
let servers = serverModel.ServerManager().getServerObjects();
|
||||||
|
for (let k in servers) {
|
||||||
|
try {
|
||||||
|
let server = servers[k];
|
||||||
|
if (server.dataModel.autoStart) {
|
||||||
|
server.start();
|
||||||
|
}
|
||||||
|
} catch (serverErr) {
|
||||||
|
MCSERVER.error("自动开启某服务器失败:", serverErr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
} else {
|
} else {
|
||||||
MCSERVER.infoLog("INFO", "控制面板启动异常");
|
MCSERVER.infoLog("INFO", "控制面板启动异常");
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ class MinecraftServer extends ServerProcess {
|
|||||||
this.dataModel.oe = SYSTEM_CODE;
|
this.dataModel.oe = SYSTEM_CODE;
|
||||||
|
|
||||||
this.dataModel.autoRestart = false; //是否自动重启
|
this.dataModel.autoRestart = false; //是否自动重启
|
||||||
|
this.dataModel.autoStart = false; //是否自动启动
|
||||||
this.dataModel.schedule = []; //计划任务配置项目
|
this.dataModel.schedule = []; //计划任务配置项目
|
||||||
|
|
||||||
this.properties = undefined; //服务端配置表
|
this.properties = undefined; //服务端配置表
|
||||||
|
@ -78,6 +78,25 @@
|
|||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="Panel" :class="serverData.autoStart?'PanelGreen':'PanelGray'">
|
||||||
|
<div class="PanelTitle">启动设置</div>
|
||||||
|
<div class="PanelBody">
|
||||||
|
<transition name="slide-fade">
|
||||||
|
<div class="PanelItem" v-on:click="toAutoStart(false)" v-show="serverData.autoStart">
|
||||||
|
<span class="glyphicon glyphicon-retweet" aria-hidden="true"> </span>
|
||||||
|
服务器自启:
|
||||||
|
<span style="color: #29b90c">打开</span>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
<transition name="slide-fade">
|
||||||
|
<div class="PanelItem" v-on:click="toAutoStart(true)" v-show="!serverData.autoStart">
|
||||||
|
<span class="glyphicon glyphicon-retweet" aria-hidden="true"> </span>
|
||||||
|
服务器自启:
|
||||||
|
<span style="color: #818181">关闭</span>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="Panel PanelGray" v-if="isFtpOpen">
|
<div class="Panel PanelGray" v-if="isFtpOpen">
|
||||||
<div class="PanelTitle">FTP 链接信息</div>
|
<div class="PanelTitle">FTP 链接信息</div>
|
||||||
<div class="PanelBody">
|
<div class="PanelBody">
|
||||||
@ -117,7 +136,8 @@
|
|||||||
<div class="PanelTitle">服务端控制组</div>
|
<div class="PanelTitle">服务端控制组</div>
|
||||||
<div class="PanelBody">
|
<div class="PanelBody">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3 col-sm-6" v-on:click="RES.redirectPage('./template/component/terminal.html', null, '')">
|
<div class="col-md-3 col-sm-6"
|
||||||
|
v-on:click="RES.redirectPage('./template/component/terminal.html', null, '')">
|
||||||
<div class="PanelItemBlock">
|
<div class="PanelItemBlock">
|
||||||
<div class="LogV">
|
<div class="LogV">
|
||||||
<span class="glyphicon glyphicon-console" aria-hidden="true"> </span>
|
<span class="glyphicon glyphicon-console" aria-hidden="true"> </span>
|
||||||
@ -199,6 +219,9 @@
|
|||||||
toAutoRestart: function () {
|
toAutoRestart: function () {
|
||||||
WS.sendMsg("server/console/autorestart", serverName);
|
WS.sendMsg("server/console/autorestart", serverName);
|
||||||
},
|
},
|
||||||
|
toAutoStart: function () {
|
||||||
|
WS.sendMsg("server/console/autostart", serverName);
|
||||||
|
},
|
||||||
toOnlineFs: function () {
|
toOnlineFs: function () {
|
||||||
var path = MCSERVER.URL("fs_auth/auth/" + encodeURIComponent(serverName));
|
var path = MCSERVER.URL("fs_auth/auth/" + encodeURIComponent(serverName));
|
||||||
window.open(path);
|
window.open(path);
|
||||||
@ -256,7 +279,7 @@
|
|||||||
username: MCSERVER.listenServername
|
username: MCSERVER.listenServername
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
run: function (cur, old) {}
|
run: function (cur, old) { }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -324,4 +347,4 @@
|
|||||||
MI.onDestroy("resize", PAGE.chartResizeFunc);
|
MI.onDestroy("resize", PAGE.chartResizeFunc);
|
||||||
PAGE.ChartLogIs = false;
|
PAGE.ChartLogIs = false;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
@ -20,3 +20,20 @@ WebSocketObserver().listener("server/console/autorestart", (data) => {
|
|||||||
}
|
}
|
||||||
response.wsMsgWindow(data.ws, "权限不足!您并不拥有此服务器.");
|
response.wsMsgWindow(data.ws, "权限不足!您并不拥有此服务器.");
|
||||||
});
|
});
|
||||||
|
//自动启动设定
|
||||||
|
WebSocketObserver().listener("server/console/autostart", (data) => {
|
||||||
|
let serverName = data.body.trim();
|
||||||
|
let userName = data.WsSession.username;
|
||||||
|
if (permssion.isCanServer(userName, serverName)) {
|
||||||
|
let server = serverModel.ServerManager().getServer(serverName);
|
||||||
|
server.dataModel.autoStart = !server.dataModel.autoStart; //同上
|
||||||
|
try {
|
||||||
|
server.save();
|
||||||
|
response.wsMsgWindow(data.ws, "更改设置成功!");
|
||||||
|
} catch (err) {
|
||||||
|
response.wsMsgWindow(data.ws, "更改设置失败!不正常,请刷新网页重新设置!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
response.wsMsgWindow(data.ws, "权限不足!您并不拥有此服务器.");
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user