This commit is contained in:
suwings 2019-01-25 16:20:49 +08:00
commit 63b260f4a3
4 changed files with 25 additions and 5 deletions

View File

@ -98,12 +98,16 @@ class ServerProcess extends EventEmitter {
dockerCommand = dockerCommand.replace(/\$\{commande\}/igm, this.dataModel.highCommande);
else
dockerCommand = dockerCommand.replace(/\$\{commande\}/igm, this.templateStart(true));
//加入镜像名
dockerCommand = dockerCommand.replace(/\$\{imagename\}/igm,
this.dataModel.dockerConfig.dockerImageName);
//加入端口限制
dockerCommand = dockerCommand.replace(/\$\{ports\}/igm,
this.dataModel.dockerConfig.dockerPorts ? "-p " + this.dataModel.dockerConfig.dockerPorts : "");
//加入服务端绝对路径
dockerCommand = dockerCommand.replace(/\$\{serverpath\}/igm,
stdCwd);
tools.CharReplaceTemp(stdCwd, " "));
//加入最大内存限制
dockerCommand = dockerCommand.replace(/\$\{xmx\}/igm,
this.dataModel.dockerConfig.dockerXmx ? "-m " + this.dataModel.dockerConfig.dockerXmx : "");
@ -115,7 +119,7 @@ class ServerProcess extends EventEmitter {
let execDockerCommande = [];
for (let i = 1; i < dockerCommandPart.length; i++) {
if (dockerCommandPart[i].trim() != "") execDockerCommande.push(dockerCommandPart[i]);
if (dockerCommandPart[i].trim() != "") execDockerCommande.push(tools.TempReplaceChar(dockerCommandPart[i], " "));
}
//暂时使用 MCSMERVER.log 目前已弃用,下版本 log4js

View File

@ -80,4 +80,17 @@ module.exports.getFullTime = () => {
var date = new Date();
return date.getFullYear() + '/' + date.getMonth() + '/' + date.getDay() + ' ' +
date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
}
const REPALCE_STR = '__MCSMANAGER_REPLACE_STR__';
module.exports.CharReplaceTemp = (text = "", replaceStr = "") => {
let re = new RegExp(replaceStr, "gim"); //注意,反斜杠需要转义
text = text.replace(re, REPALCE_STR);
return text;
}
module.exports.TempReplaceChar = (text = "", replaceStr = "") => {
let re = new RegExp(REPALCE_STR, "gim"); //注意,反斜杠需要转义
text = text.replace(re, replaceStr);
return text;
}

View File

@ -204,6 +204,7 @@
}
#TerminalMinecraft {
font-family: 'Consolas', 'Courier New', Courier, monospace;
overflow: auto;
width: 100%;
resize: none;
@ -231,6 +232,7 @@
}
#TerminalCommand {
font-family: 'Consolas', 'Courier New', Courier, monospace;
font-size: 12px;
color: white;
width: 100%;
@ -250,6 +252,7 @@
/* 控制台的手机设定 */
@media (max-width:760px) {
#Terminal div,
#Terminal input,
#Terminal a {

View File

@ -116,10 +116,10 @@
//Minecraft 服务器输出基本颜色
TOOLS.encodeConsoleColor = function (text) {
text = text.replace(/([A-Za-z _&;-\\.]{1,}:)/igm, "<span style='color:#ffa700;'>$1</span>");
text = text.replace(/\[/igm, "<span style='color:#10e616;'><b>[&nbsp;</b></span>");
text = text.replace(/\]/igm, "<span style='color:#10e616;'><b>&nbsp;]</b></span>");
text = text.replace(/\[/igm, "<span style='color:#10e616;'>[</span>");
text = text.replace(/\]/igm, "<span style='color:#10e616;'>]</span>");
text = text.replace(/INFO/gm, "<span style='color:#03ea0a;'>INFO</span>");
text = text.replace(/(\d{2,}:\d{2,}:\d{2,})/gm, "<span style='color:#017EBC;'> $1 </span>");
text = text.replace(/(\d{2,}:\d{2,}:\d{2,})/gm, "<span style='color:#017EBC;'>$1</span>");
RegExpStringArr = [
//蓝色