优化 删除数组末尾逗号

This commit is contained in:
Suwings 2020-10-08 12:14:30 +08:00
parent 841ae19644
commit f0ee4c998d
73 changed files with 266 additions and 266 deletions

View File

@ -1,4 +1,4 @@
{
"printWidth": 200,
"trailingComma":"none"
"trailingComma": "none"
}

12
app.js
View File

@ -79,7 +79,7 @@ colors.setTheme({
help: "cyan",
warn: "yellow",
debug: "magenta",
error: "red",
error: "red"
});
//logo输出
@ -117,7 +117,7 @@ MCSERVER.logCenter.pushLogData = (objStr, k, v) => {
MCSERVER.logCenter[objStr] = MCSERVER.logCenter[objStr].slice(1);
MCSERVER.logCenter[objStr].push({
key: k,
val: v,
val: v
});
};
@ -130,7 +130,7 @@ var expressWs = require("express-ws")(app);
app.use(cookieParser());
app.use(
bodyParser.urlencoded({
extended: false,
extended: false
})
);
app.use(bodyParser.json());
@ -141,10 +141,10 @@ app.use(
secret: UUID.v4(),
name: "MCSM_SESSION_ID",
cookie: {
maxAge: MCSERVER.localProperty.session_max_age * 1000 * 60,
maxAge: MCSERVER.localProperty.session_max_age * 1000 * 60
},
resave: false,
saveUninitialized: false,
saveUninitialized: false
})
);
@ -268,7 +268,7 @@ app.use("/fs", require("./onlinefs/controller/function"));
ftpServerInterface.initFTPdServerOptions({
host: MCSERVER.localProperty.ftp_ip || "127.0.0.1",
port: MCSERVER.localProperty.ftp_port,
tls: null,
tls: null
});
if (MCSERVER.localProperty.ftp_is_allow) require("./ftpd/index"); //执行ftp逻辑

View File

@ -114,8 +114,8 @@ class ServerProcess extends EventEmitter {
ExposedPortsObj[portmap[0] + "/" + protocol] = {};
PortBindingsObj[portmap[0] + "/" + protocol] = [
{
HostPort: portmap[1] + "",
},
HostPort: portmap[1] + ""
}
];
}
// 输出启动消息
@ -148,8 +148,8 @@ class ServerProcess extends EventEmitter {
HostConfig: {
Binds: [stdCwd + ":/mcsd/"],
Memory: this.dataModel.dockerConfig.dockerXmx * 1024 * 1024 * 1024,
PortBindings: PortBindingsObj,
},
PortBindings: PortBindingsObj
}
});
try {
// 尝试启动容器
@ -164,7 +164,7 @@ class ServerProcess extends EventEmitter {
{
stream: true,
stdin: true,
stdout: true,
stdout: true
},
(err, stream) => {
if (err) throw err;
@ -268,7 +268,7 @@ class ServerProcess extends EventEmitter {
this.ProcessConfig = {
cwd: this.dataModel.cwd,
stdio: "pipe",
stdio: "pipe"
};
try {

View File

@ -38,7 +38,7 @@ class MinecraftServer extends ServerProcess {
dockerImageName: "mcsd",
dockerXmx: "",
dockerPorts: "",
isDocker: false,
isDocker: false
};
// Minecraft Ping 查询配置项目
@ -46,7 +46,7 @@ class MinecraftServer extends ServerProcess {
mcpingName: "",
mcpingHost: "",
mcpingPort: "",
mcpingMotd: "",
mcpingMotd: ""
};
}
@ -91,7 +91,7 @@ class MinecraftServer extends ServerProcess {
properties.parse(
this.dataModel.cwd + "/server.properties",
{
path: true,
path: true
},
(err, obj) => {
//Note: 这里callback似乎会执行两次
@ -105,7 +105,7 @@ class MinecraftServer extends ServerProcess {
propertiesSave(newProperties, callback) {
//解析
let text = properties.stringify(newProperties, {
separator: "=",
separator: "="
});
//properties 库自动给等于两边加入了空格,现在去除
text = text.replace(/ = /gim, "=");

View File

@ -130,7 +130,7 @@ class ServerManager extends EventEmitter {
this.emit("console", {
serverName: name,
command: "CONSOLE",
msg: data,
msg: data
});
});
//监听退出
@ -138,21 +138,21 @@ class ServerManager extends EventEmitter {
this.emit("exit", {
serverName: name,
command: "EXIT",
msg: code,
msg: code
});
});
server.on("open", (server) => {
this.emit("open", {
serverName: name,
command: "OPEN",
msg: server,
msg: server
});
});
server.on("error", (err) => {
this.emit("open", {
serverName: name,
command: "ERROR",
msg: err,
msg: err
});
});
}
@ -195,7 +195,7 @@ class ServerManager extends EventEmitter {
// 准备发送给前端的服务端集合数据
list.push({
serverName: k,
data: returnData,
data: returnData
});
}
return list;

View File

@ -10,7 +10,7 @@ function createPassword(_password, _salt) {
PasswordMD5 = md5(PasswordMD5);
return {
password: PasswordMD5,
salt: _salt,
salt: _salt
};
}

View File

@ -81,5 +81,5 @@ class User {
module.exports = {
User,
USER_SAVE_PATH,
USER_SAVE_PATH
};

View File

@ -136,7 +136,7 @@ class UserCenter {
data.createDate = tmp.createDate;
list.push({
username: this.userList[k].dataModel.username,
data: data,
data: data
});
}
return list;

View File

@ -17,24 +17,24 @@ log4js.configure({
type: "stdout",
layout: {
type: "pattern",
pattern: "[%d{MM/dd hh:mm:ss}] [%[%p%]] %m",
},
pattern: "[%d{MM/dd hh:mm:ss}] [%[%p%]] %m"
}
},
app: {
type: "file",
filename: LOG_FILE_PATH,
layout: {
type: "pattern",
pattern: "%d %p %m",
},
},
pattern: "%d %p %m"
}
}
},
categories: {
default: {
appenders: ["out", "app"],
level: "info",
},
},
level: "info"
}
}
});
const logger = log4js.getLogger("default");

View File

@ -56,10 +56,10 @@ module.exports.autoLoadModule = (proPath, minePath, callback) => {
module.exports.mCopyFileSync = (oldpath, newpath) => {
let resetData = fs.readFileSync(oldpath, {
encoding: "UTF-8",
encoding: "UTF-8"
});
fs.writeFileSync(newpath, resetData, {
encoding: "UTF-8",
encoding: "UTF-8"
});
return true;
};

View File

@ -33,7 +33,7 @@ ftpServerInterface.createFTPServer({
allowUnauthorizedTls: false,
useWriteFile: false, //true 则客户端上传的文件将缓冲在内存中然后使用写入磁盘writeFile。
useReadFile: false,
maxStatsAtOnce: 10,
maxStatsAtOnce: 10
// uploadMaxSlurpSize: uploadMaxSlurpSize // N/A unless 'useWriteFile' is true.
});
@ -54,7 +54,7 @@ ftpServerInterface.initFTPServerListener({
},
error: () => {
return false;
},
}
});
//run

View File

@ -22,7 +22,7 @@ module.exports.send = (res, data = "", statusCode = 200) => {
res.send(
JSON.stringify({
status: statusCode,
data: data,
data: data
})
);
res.end();
@ -31,7 +31,7 @@ module.exports.send = (res, data = "", statusCode = 200) => {
module.exports.ok = (res, statusCode = 200) => {
res.send(
JSON.stringify({
status: statusCode,
status: statusCode
})
);
res.end();
@ -41,7 +41,7 @@ module.exports.error = (res, error = new NullError(), statusCode = 500) => {
res.send(
JSON.stringify({
status: statusCode,
error: error.message,
error: error.message
})
);
res.end();
@ -51,7 +51,7 @@ module.exports.forbidden = (res, error = new ForbiddenError(), statusCode = 403)
res.send(
JSON.stringify({
status: statusCode,
error: error.message,
error: error.message
})
);
res.end();
@ -61,7 +61,7 @@ module.exports.unavailable = (res, error = new UnavailableError(), statusCode =
res.send(
JSON.stringify({
status: statusCode,
error: error.message,
error: error.message
})
);
res.end();

View File

@ -136,5 +136,5 @@ class LogHistory {
}
module.exports = {
LogHistory,
LogHistory
};

View File

@ -15,7 +15,7 @@ class MCServStatus {
motd: null,
current_players: null,
max_players: null,
latency: null,
latency: null
};
}
@ -43,7 +43,7 @@ class MCServStatus {
motd: server_info[3].replace(/\u0000/g, ""),
current_players: server_info[4].replace(/\u0000/g, ""),
max_players: server_info[5].replace(/\u0000/g, ""),
latency: this.status.latency,
latency: this.status.latency
};
formatMotd(server_info[3]);
// Request an end to the connection after the data has been received.
@ -101,7 +101,7 @@ function CreateMCPingTask(id, ip, port) {
}
// 任务参数对象,用于记录错误次数和其他数据
TASK_OBJECT_DATABASE[id] = {
errorCount: 0,
errorCount: 0
};
// 每隔 6 秒ping 查询一次服务器状态,并且缓存结果
const taskInterval = setInterval(() => {
@ -140,7 +140,7 @@ module.exports = {
PingMCServer,
CreateMCPingTask,
DestroyMCPingTask,
QueryMCPingTask,
QueryMCPingTask
};
// PROMISE VERSION

View File

@ -15,7 +15,7 @@ function defaultFalseCallBack(req, res, ResponseKey, ResponseValue, notAjaxRedir
if (req.xhr) {
res.send({
ResponseKey: ResponseKey,
ResponseValue: ResponseValue,
ResponseValue: ResponseValue
});
} else {
res.redirect(notAjaxRedirect || "./error/notlogin");

View File

@ -3,7 +3,7 @@ var querystring = require("querystring");
function send(res, info, value) {
let str = JSON.stringify({
ResponseKey: info,
ResponseValue: value,
ResponseValue: value
});
try {
@ -18,7 +18,7 @@ function send(res, info, value) {
function wsSend(ws, info, value, body = "") {
let str = JSON.stringify({
ResponseKey: info,
ResponseValue: value,
ResponseValue: value
});
try {
if (ws.readyState == ws.OPEN) {

View File

@ -67,7 +67,7 @@ function createScheduleJobCount(id, time, count, commande, servername, callback,
count: count,
time: time,
commande: commande,
servername: servername,
servername: servername
});
}
if (_save) MCSERVER.Schedule.dataModel.save();

View File

@ -15,5 +15,5 @@ module.exports = {
system: info,
root: process.cwd(),
verisonA: verisonA,
verisonB: verisonB,
verisonB: verisonB
};

View File

@ -43,5 +43,5 @@ function requestNews() {
}
module.exports = {
requestNews,
requestNews
};

View File

@ -8,7 +8,7 @@ var bodyParser = require("body-parser");
app.use(cookieParser());
app.use(
bodyParser.urlencoded({
extended: false,
extended: false
})
);
app.use(bodyParser.json());
@ -20,10 +20,10 @@ app.use(
name: "IFM_session",
// Cookie 默认时间:一小时
cookie: {
maxAge: 1000 * 60 * 60,
maxAge: 1000 * 60 * 60
},
resave: true,
saveUninitialized: true,
saveUninitialized: true
})
);

View File

@ -139,7 +139,7 @@ router.get("/eac_quque", (req, res) => {
const nowTask = fsoperate.FileOperate.getNowEacTaskCounter();
sendHandle(req, res, {
quque: quque.length,
now: nowTask,
now: nowTask
});
});
@ -156,7 +156,7 @@ router.post("/upload", (req, res) => {
//生成multiparty对象并配置上传目标路径
var form = new multiparty.Form({
uploadDir: os.tmpdir(),
uploadDir: os.tmpdir()
});
} catch (err) {
res.status(500).send("服务器上传初始化错误!请重试!");
@ -202,8 +202,8 @@ router.get("/download/:name", (req, res) => {
dotfiles: "deny",
headers: {
"Content-Disposition": "attachmnet",
filename: encodeURIComponent(req.params.name.trim()),
},
filename: encodeURIComponent(req.params.name.trim())
}
},
(err) => {}
);

View File

@ -38,7 +38,7 @@ if (realArgv.length >= 1) {
// 进行解压操作
compressing.zip
.uncompress(absPath, zipExtractDir, {
zipFileNameEncoding: SYSTEM_CODE,
zipFileNameEncoding: SYSTEM_CODE
})
.then(() => {
// BUG note: 此处无法使用 MCSM 全局变量,此为额外任务子进程。感谢 @ColorfulGhost
@ -63,7 +63,7 @@ if (realArgv.length >= 1) {
// 进行压缩操作
compressing.zip
.compressDir(absPath, compressZipPath, {
zipFileNameEncoding: SYSTEM_CODE,
zipFileNameEncoding: SYSTEM_CODE
})
.then(() => {
console.log("压缩任务", absPath, "成功.");

View File

@ -49,7 +49,7 @@ class FileOperate extends BaseFileOperate {
isFile: !info.isDirectory(),
time: info.mtime,
// info: other,
checkbox: false, //唯一前端数据
checkbox: false //唯一前端数据
};
});
}
@ -171,7 +171,7 @@ class FileOperate extends BaseFileOperate {
// 加入到解压缩队列
EAC_QUQUE.push({
category: "extract",
path: absPath,
path: absPath
});
});
}
@ -182,7 +182,7 @@ class FileOperate extends BaseFileOperate {
// 加入到解压缩队列
EAC_QUQUE.push({
category: "compress",
path: absPath,
path: absPath
});
});
}

View File

@ -48,7 +48,7 @@ TOOLS.charts.bulider = function (dom, len, config, callback, chartOption) {
option.series[0].data = viewData;
option.xAxis[0].data = keyData;
},
end: function () {},
end: function () {}
});
});
};
@ -73,31 +73,31 @@ TOOLS.charts.DefOption = {
"#ff00ff",
"#3cb371",
"#b8860b",
"#30e0e0",
"#30e0e0"
],
tooltip: {
trigger: "axis",
trigger: "axis"
},
legend: {
data: ["百分比"],
data: ["百分比"]
},
toolbox: {
show: false,
show: false
},
calculable: true,
xAxis: [
{
type: "category",
boundaryGap: false,
data: [],
},
data: []
}
],
yAxis: [
{
type: "value",
max: 100,
min: 0,
},
min: 0
}
],
series: [
{
@ -107,11 +107,11 @@ TOOLS.charts.DefOption = {
itemStyle: {
normal: {
areaStyle: {
type: "default",
},
},
type: "default"
}
}
},
data: [],
},
],
data: []
}
]
};

View File

@ -113,7 +113,7 @@
MI.listener("ws/response", function (obj) {
MI.routeOn(obj["ResponseKey"], {
obj: obj["ResponseValue"],
body: obj.body,
body: obj.body
});
});
})();
@ -134,10 +134,10 @@
MI.on("colmchange", null); //触发事件
if (!booleans) {
$SideCol.css({
opacity: "0",
opacity: "0"
});
$SideCol.css({
display: "none",
display: "none"
});
// $Container.css({
// 'left': '0px'
@ -152,7 +152,7 @@
// });
$SideCol.css({
display: "block",
opacity: "1",
opacity: "1"
});
MI.on("colmchangeEnd", null); //触发事件
// $Container.removeAttr('style')

View File

@ -6,7 +6,7 @@ MCSERVER.login = function (username, password, rand, loginSuccess, loginError, e
//import
data: {
username: username,
_rand: Math.random(), //增加缓存拒绝随机数
_rand: Math.random() //增加缓存拒绝随机数
},
success: function (data, textStatus) {
var obj = JSON.parse(data);
@ -16,7 +16,7 @@ MCSERVER.login = function (username, password, rand, loginSuccess, loginError, e
},
error: function () {
error && error();
},
}
});
function logging() {
@ -26,7 +26,7 @@ MCSERVER.login = function (username, password, rand, loginSuccess, loginError, e
url: MCSERVER.URL("./user/login"),
data: {
username: username,
password: md5Passworded,
password: md5Passworded
},
success: function (data, textStatus) {
var obj = JSON.parse(data);
@ -54,7 +54,7 @@ MCSERVER.login = function (username, password, rand, loginSuccess, loginError, e
},
error: function () {
error && error();
},
}
});
}
};

View File

@ -9,22 +9,22 @@
name: "用户中心", //菜单名
link: "./template/gen_home.html", //单击时跳转目的
api: "genuser/home", //通过 Webscoket 后端请求的API,null为不请求,
select: true,
select: true
},
{
class: "glyphicon-th-list", //html元素 类
name: "文件管理", //菜单名
link: "./template/filemanager.html", //单击时跳转目的
api: "genuser/home", //通过 Webscoket 后端请求的API,null为不请求,
select: false,
select: false
},
{
class: "glyphicon-equalizer",
name: "技术支持",
link: "./template/gen_about.html",
api: null,
select: false,
},
select: false
}
];
//管理员的
@ -35,35 +35,35 @@
name: "监控数据中心",
link: "./template/center.html",
api: "center/show",
select: false,
select: false
},
{
class: "glyphicon-tasks",
name: "服务端管理",
link: "./template/server.html",
api: "server/view",
select: false,
select: false
},
{
class: "glyphicon-th-large",
name: "用户管理",
link: "./template/userset.html",
api: "userset/update",
select: false,
select: false
},
{
class: "glyphicon-th-list",
name: "文件管理",
link: "./template/filemanager.html",
api: "genuser/home",
select: false,
select: false
},
{
class: "glyphicon-floppy-open",
name: "服务",
link: "./template/feelback.html",
api: null,
select: false,
},
select: false
}
];
})();

View File

@ -47,7 +47,7 @@
"broadcast-rcon-to-ops": "向OP广播RCON信息",
"broadcast-console-to-ops": "向OP广播服务器控制台信息",
"enforce-whitelist": "在服务器上强制使用白名单",
"spawn-protection": "通过将该值进行 2x+1 的运算来决定出生点的保护半径设置为0将只保护出生点下方那一个方块。",
"spawn-protection": "通过将该值进行 2x+1 的运算来决定出生点的保护半径设置为0将只保护出生点下方那一个方块。"
};
if (SuwingsLoveYou.hasOwnProperty(key)) {

View File

@ -63,7 +63,7 @@
},
processData: parameter["processData"] == false || true,
traditional: parameter["traditional"] == false || true,
cache: parameter["cache"] || false,
cache: parameter["cache"] || false
});
};
@ -129,7 +129,7 @@
ToolsPageLoading.css("display", "block");
PageMain.stop(true, true).animate(
{
opacity: "0",
opacity: "0"
},
150,
callback
@ -145,7 +145,7 @@
PageMain.stop(true, true).animate(
{
opacity: "1",
opacity: "1"
},
150,
function () {

View File

@ -18,7 +18,7 @@
TOOLS.pushMsgWindow = function (value) {
_queue.push({
msg: value,
msg: value
});
if (_run == true) return;
@ -199,12 +199,12 @@
"\\}",
"<",
">",
"Preparing start region for level",
"Preparing start region for level"
],
//红色
["WARN", "EULA", "Error", "Invalid", "Stopping the server", "Caused by", "Stopping"],
//黄色
["Starting Minecraft server on", "world_the_end", "world_nether", "Done", "MCSMANAGER"],
["Starting Minecraft server on", "world_the_end", "world_nether", "Done", "MCSMANAGER"]
];
for (var k in RegExpStringArr) {
for (var y in RegExpStringArr[k]) {
@ -257,12 +257,12 @@
"\\}",
"<",
">",
"Preparing start region for level",
"Preparing start region for level"
],
//红色
["WARN", "EULA", "Error", "Invalid", "Stopping the server", "Caused by", "Stopping"],
//黄色
["Starting Minecraft server on", "world_the_end", "world_nether", "Usage", "Server thread", "Done", "MCSMANAGER"],
["Starting Minecraft server on", "world_the_end", "world_nether", "Usage", "Server thread", "Done", "MCSMANAGER"]
];
for (var k in RegExpStringArr) {
for (var y in RegExpStringArr[k]) {
@ -290,16 +290,16 @@
var popWinContext = $("#PopWinContext");
_popWindCallback = config.callback || function () {}; //全局的callback变量
var css = config.style || {
display: "block",
display: "block"
};
popWinContext.html("<p>正在加载信息框,请稍等...</p>");
$("#PopWinTitle").html(config.title || "信息对话框");
$(".PopWin").css(css).css({
display: "block",
display: "block"
});
$("#balckWarp").css({
display: "block",
display: "block"
});
popWinContext.load(config.template, function (response, status, xhr) {
if (status != "success") {
@ -320,7 +320,7 @@
TOOLS.blackJumbotron = function (boolean) {
if (boolean) {
$("#balckWarp").css({
display: "block",
display: "block"
});
} else {
$("#balckWarp").removeAttr("style");

View File

@ -12,14 +12,14 @@
webscoketStatus["is"] = true;
webscoketStatus["tcolor"] = "#ffffff";
VIEW_MODEL.newVue("websocketStatus", {
el: "#websocket",
el: "#websocket"
});
VIEW_MODEL.newVue("websocketStatus", {
el: "#websocket2",
el: "#websocket2"
});
//左上角用户显示
VIEW_MODEL.newVue("websocketStatus", {
el: "#TitleUser",
el: "#TitleUser"
});
});
@ -66,7 +66,7 @@
VIEW_MODEL.newVueOnce("col-muem", {
el: "#SideColFor",
data: {
isOnMouse: false,
isOnMouse: false
},
methods: {
onRedirect: function (link, api, item) {
@ -81,8 +81,8 @@
MI.on("SideMeumClick", null);
// 跳转
RES.redirectPage(link, api, "update_page");
},
},
}
}
});
});
@ -190,7 +190,7 @@
rows: 30,
cols: 100,
fontSize: fontSize,
convertEol: true,
convertEol: true
}));
// 终端基本颜色代码
term.TERM_TEXT_RED = "\x1B[31m";
@ -219,7 +219,7 @@
WS.sendMsg(
"server/console/history",
JSON.stringify({
serverName: PAGE.serverName,
serverName: PAGE.serverName
})
);
};
@ -231,7 +231,7 @@
var WebTerminalScreenWapper = new Vue({
el: "#WebTerminalControl",
data: {
command: "",
command: ""
},
methods: {
toOpenServer: function () {
@ -243,7 +243,7 @@
console.log("发送命令:", this.command);
var data = {
command: this.command,
serverName: PAGE.serverName,
serverName: PAGE.serverName
};
if (this.command.length >= 1 || typeof parCommand == "string") {
//压入命令栈 并 发送
@ -277,11 +277,11 @@
WS.sendMsg(
"server/console/history",
JSON.stringify({
serverName: PAGE.serverName,
serverName: PAGE.serverName
})
);
},
},
}
}
});
$("#WebTerminalScreenWapper").removeAttr("style");

View File

@ -57,7 +57,7 @@
WS.sendMsg = function (value, body, callback) {
var obj = {
RequestKey: "req",
RequestValue: value,
RequestValue: value
};
if (DEBUG) {
console.log("=== Websocket 发送触发 ===");

View File

@ -221,8 +221,8 @@
// echart 路径配置
window.require.config({
paths: {
echarts: "./common/echarts-dist",
},
echarts: "./common/echarts-dist"
}
});
//抗CSRF攻击
@ -273,10 +273,10 @@
},
error: function () {
TOOLS.pushMsgWindow("退出失败,您网络正常且是否登陆?");
},
}
});
},
},
}
}
});
//工具信息栏
@ -284,23 +284,23 @@
el: "#ToolsInfo",
data: {
show: false,
msg: "",
},
msg: ""
}
});
// 手机端导航球
var SidebarButton = new Vue({
el: "#SidebarButton",
data: {
isExpand: false,
isExpand: false
},
methods: {
operate: function () {
MCSERVER.colmSet(!MCSERVER.getColmStatus());
// TOOLS.blackJumbotron(!this.isExpand)
this.isExpand = !MCSERVER.getColmStatus();
},
},
}
}
});
VIEW_MODEL.COMMON = {};

View File

@ -210,8 +210,8 @@
VIEW_MODEL.newVue("centerShow", {
el: "#CenterShow",
methods: {
time: PAGE.time(),
},
time: PAGE.time()
}
});
PAGE.time = setInterval(function () {

View File

@ -211,7 +211,7 @@
if (parCommand && typeof parCommand == "string") this.command = parCommand;
var data = {
command: this.command,
serverName: serverName,
serverName: serverName
};
if (this.command.length >= 1 || typeof parCommand == "string") {
WS.sendMsg("server/console/command", JSON.stringify(data));
@ -238,26 +238,26 @@
TOOLS.popWind({
style: {
maxWidth: "500px",
top: "15%",
top: "15%"
},
title: "监控协议配置",
template: "template/dialog/pingmc_config.html",
template: "template/dialog/pingmc_config.html"
});
},
toTerminal: function () {
// 打开弹窗型终端
TOOLS.listenTerminal(serverName);
},
}
},
data: {
command: "",
allowedStart: true,
runStatusClass: "",
username: MCSERVER.listenServername,
username: MCSERVER.listenServername
},
watch: {
run: function (cur, old) {},
},
run: function (cur, old) {}
}
});
// 服务器状态请求

View File

@ -72,7 +72,7 @@
data: {
oldPassword: "",
newPassword1: "",
newPassword2: "",
newPassword2: ""
},
methods: {
toBack: function () {
@ -86,11 +86,11 @@
var obj = {
//username : '保留使用',
oldPassword: this.oldPassword,
newPassword: this.newPassword2,
newPassword: this.newPassword2
};
WS.sendMsg("genuser/re_password", JSON.stringify(obj));
},
},
}
}
});
});

View File

@ -52,13 +52,13 @@
data: {
dockerFileText: 'FROM java:latest\nRUN mkdir -p /mcsd\nRUN echo "Asia/Shanghai" > /etc/timezone;dpkg-reconfigure -f noninteractive tzdata\nWORKDIR /mcsd',
dockerImageName: "",
createDockerDis: false,
createDockerDis: false
},
methods: {
createDocker: function () {
var obj = {
dockerImageName: this.dockerImageName || "mcsd",
dockerfile: TOOLS.decode(this.dockerFileText),
dockerfile: TOOLS.decode(this.dockerFileText)
};
if (!confirm("DockerFile 文件:\n" + obj.dockerfile + "\n镜像名:" + obj.dockerImageName + "\n确认无误单击【确定】得以继续")) return;
if (!TOOLS.isStdText(obj.dockerImageName)) {
@ -72,14 +72,14 @@
TOOLS.popWind({
style: {
maxWidth: "400px",
top: "0px",
top: "0px"
},
title: "Docker 构建结果",
template: "template/dialog/docker_res.html",
callback: function () {},
callback: function () {}
});
},
},
}
}
});
});

View File

@ -103,7 +103,7 @@
time: obj.time || "* * * * * *",
count: obj.count || 0,
commande: obj.commande || "",
servername: servername,
servername: servername
},
methods: {
toBack: function () {
@ -116,7 +116,7 @@
"schedule/delete",
JSON.stringify({
id: this.id,
servername: this.servername,
servername: this.servername
})
);
}
@ -127,7 +127,7 @@
time: this.time || "",
count: this.count || 0,
commande: this.commande || "",
servername: this.servername,
servername: this.servername
})
);
this.toBack();
@ -137,7 +137,7 @@
//弹出简单模式窗口
TOOLS.popWind({
style: {
maxWidth: "400px",
maxWidth: "400px"
},
title: "计划任务简单模式",
template: "template/dialog/time_bulider.html",
@ -146,10 +146,10 @@
that.time = result.time || "* * * * * *";
that.count = result.count || "0";
that.commande = result.command || "";
},
}
});
},
},
}
}
});
});

View File

@ -107,7 +107,7 @@
Xms: "",
addCmd: "",
java: "java",
readServerName: "",
readServerName: ""
},
methods: {
toCreateServer: function () {
@ -123,7 +123,7 @@
cwd: this.cwd,
Xmx: this.Xmx,
Xms: this.Xms,
java: this.Java,
java: this.Java
};
WS.sendMsg("server/create", JSON.stringify(obj));
RES.redirectPage("./template/server.html", "server/view");
@ -131,7 +131,7 @@
toCreaterDir: function () {
var obj = {
serverName: this.name,
cwd: this.cwd,
cwd: this.cwd
};
WS.sendMsg("server/create_dir", JSON.stringify(obj));
},
@ -152,14 +152,14 @@
that.addCmd = serverData.addCmd.join(" ").trim();
// that.cwd = serverData.cwd;
});
},
}
},
computed: {
serverCwd: function () {
if (this.cwd == "") return "./server/server_core/" + this.name;
return this.cwd;
},
},
}
}
});
});

View File

@ -225,7 +225,7 @@
addCmd: "",
java: "",
highCommande: "",
uploadPercentComplete: 0,
uploadPercentComplete: 0
},
methods: {
toCreateServer: function () {
@ -242,7 +242,7 @@
Xmx: this.Xmx,
Xms: this.Xms,
java: this.Java || "java",
highCommande: this.highCommande,
highCommande: this.highCommande
};
WS.sendMsg("server/create", JSON.stringify(obj));
RES.redirectPage("./template/server.html", "server/view");
@ -250,7 +250,7 @@
toCreaterDir: function () {
var obj = {
serverName: this.name,
cwd: this.cwd,
cwd: this.cwd
};
WS.sendMsg("server/create_dir", JSON.stringify(obj));
},
@ -284,7 +284,7 @@
file,
"/fileupload",
{
cwd: this.cwd,
cwd: this.cwd
},
function (percentComplete) {
console.log("上传进度:", percentComplete);
@ -303,14 +303,14 @@
}
);
}
},
}
},
computed: {
serverCwd: function () {
if (this.cwd == "") return "<面板所在目录>/server/server_core/" + this.name + "/";
return this.cwd;
},
},
}
}
});
});

View File

@ -90,7 +90,7 @@
if (!this.properties) return;
var obj = {
serverName: this.serverName,
properties: this.properties,
properties: this.properties
};
WS.sendMsg("server/properties_update", JSON.stringify(obj));
},
@ -105,8 +105,8 @@
},
findProperties: function (key) {
return MCSERVER.findPropertiesShow(key);
},
},
}
}
});
});

View File

@ -75,14 +75,14 @@
"schedule/delete",
JSON.stringify({
id: obj.id,
servername: this.servername,
servername: this.servername
}),
function () {
PAGE.refresh();
}
);
},
},
}
}
});
});

View File

@ -144,16 +144,16 @@
el: "#ServerPanel",
data: {
oldServerName: "",
isHighCommande: false,
isHighCommande: false
},
methods: {
toOpenCommmandInfo: function () {
TOOLS.popWind({
style: {
maxWidth: "700px",
maxWidth: "700px"
},
title: "自定义参数说明",
template: "template/dialog/usercommand.html",
template: "template/dialog/usercommand.html"
});
},
toDocker: function () {
@ -162,10 +162,10 @@
TOOLS.popWind({
style: {
maxWidth: "600px",
top: "15%",
top: "15%"
},
title: "Minecraft Docker 配置",
template: "template/dialog/docker_config.html",
template: "template/dialog/docker_config.html"
});
},
toConsole: function (serverName) {
@ -195,13 +195,13 @@
oe: this.oe,
highCommande: this.highCommande,
oldServerName: this.oldServerName,
timeLimitDate: this.timeLimitDate,
timeLimitDate: this.timeLimitDate
};
WS.sendMsg("server/rebulider", JSON.stringify(obj));
setTimeout(function () {
RES.redirectPage("./template/server.html", "server/view");
}, 100);
},
}
},
watch: {
highCommande: function (newQuestion) {
@ -210,8 +210,8 @@
} else {
this.isHighCommande = false;
}
},
},
}
}
});
VIEW_MODEL["ServerPanel"].addCmd = VIEW_MODEL["ServerPanel"].addCmd.toString().replace(/,/gim, " ");
VIEW_MODEL["ServerPanel"].oldServerName = VIEW_MODEL["ServerPanel"].name + "";

View File

@ -77,7 +77,7 @@
WS.sendMsg(
"server/console/history",
JSON.stringify({
serverName: PAGE.serverName,
serverName: PAGE.serverName
})
);
@ -92,7 +92,7 @@
WS.sendMsg(
"server/console/history",
JSON.stringify({
serverName: PAGE.serverName,
serverName: PAGE.serverName
})
);
},
@ -103,7 +103,7 @@
if (parCommand && typeof parCommand == "string") this.command = parCommand;
var data = {
command: this.command,
serverName: PAGE.serverName,
serverName: PAGE.serverName
};
if (this.command.length >= 1 || typeof parCommand == "string") {
//压入命令栈 并 发送
@ -139,20 +139,20 @@
"<span style='color:#03ea0a;'>",
"[ 控制面板 ]:",
"</span>",
"如果您在此页面遇到卡顿,内存高等现象,请使用此功能来优化。<br />",
"如果您在此页面遇到卡顿,内存高等现象,请使用此功能来优化。<br />"
].join(" ");
},
stopServer: function () {
this.toCommand("__stop__");
},
}
},
data: {
allowedStart: true,
command: "",
commandList: [],
commandListPrint: 0,
historyIf: false,
},
historyIf: false
}
});
PAGE.mainC = document.getElementById("TerminalMinecraft");

View File

@ -60,7 +60,7 @@
data: {
ServerLen: 0,
password: "",
oldUsername: "",
oldUsername: ""
},
methods: {
toUpdate: function () {
@ -77,7 +77,7 @@
newUsername: this.username,
newPassword: this.password,
allowedServer: allowedServers,
username: this.oldUsername,
username: this.oldUsername
};
WS.sendMsg("userset/upinfo", JSON.stringify(obj));
//返回到上层
@ -85,13 +85,13 @@
},
toDeleteUser: function (itemUsername) {
var obj = {
username: this.oldUsername,
username: this.oldUsername
};
WS.sendMsg("userset/delete", JSON.stringify(obj), function () {
RES.redirectPage("./template/userset.html", "userset/update");
});
},
},
}
}
});
var viewModel = VIEW_MODEL["OneUserView"];
viewModel.oldUsername = viewModel.username + " ";

View File

@ -30,7 +30,7 @@
new Vue({
el: "#ApiKeyContainer",
data: {
API_KEY: "",
API_KEY: ""
},
methods: {
updateKey: function () {
@ -46,7 +46,7 @@
var API_KEY = obj.ResponseValue;
that.API_KEY = API_KEY;
});
},
}
},
mounted: function () {
var that = this;
@ -54,6 +54,6 @@
var API_KEY = obj.ResponseValue;
that.API_KEY = API_KEY;
});
},
}
});
</script>

View File

@ -59,13 +59,13 @@
dockerImageName: this.dockerImageName.trim() || "mcsd",
dockerXmx: this.dockerXmx.trim(),
dockerPorts: this.dockerPorts.trim(),
isDocker: this.isDocker,
},
isDocker: this.isDocker
}
})
);
TOOLS.popWindClose();
},
},
}
}
});
});
</script>

View File

@ -39,13 +39,13 @@
new Vue({
el: "#DialogDockerRes ",
data: {
DockerRes: obj.ResponseValue,
DockerRes: obj.ResponseValue
},
methods: {
ok: function () {
TOOLS.popWindClose({});
},
},
}
}
});
});
</script>

View File

@ -46,7 +46,7 @@
mcpingName: remoteMCPingConfig.mcpingName || "",
mcpingHost: remoteMCPingConfig.mcpingHost || "",
mcpingPort: remoteMCPingConfig.mcpingPort || "",
mcpingMotd: remoteMCPingConfig.mcpingMotd || "",
mcpingMotd: remoteMCPingConfig.mcpingMotd || ""
},
methods: {
ok: function () {
@ -58,8 +58,8 @@
mcpingName: this.mcpingName.trim() || "Minecraft Server",
mcpingHost: this.mcpingHost.trim() || "localhost",
mcpingPort: this.mcpingPort.trim() || "",
mcpingMotd: this.mcpingMotd.trim() || "",
},
mcpingMotd: this.mcpingMotd.trim() || ""
}
})
);
TOOLS.popWindClose();
@ -69,8 +69,8 @@
},
toAPI_PAGE: function () {
window.open("/api/status/" + PAGE.listenServername);
},
},
}
}
});
});
</script>

View File

@ -25,7 +25,7 @@
data: {
sec: "",
count: "",
command: "",
command: ""
},
methods: {
ok: function () {
@ -55,12 +55,12 @@
TOOLS.popWindClose({
time: reg,
count: this.count,
command: this.command,
command: this.command
});
},
no: function () {
TOOLS.popWindClose(null);
},
},
}
}
});
</script>

View File

@ -79,13 +79,13 @@
success: function (data) {
VIEW_MODEL["News"] = data;
VIEW_MODEL.newVue("News", {
el: "#News",
el: "#News"
});
MI.routeCopy("News", data);
VIEW_MODEL.newVue("SystemUp", {
el: "#SystemUp",
el: "#SystemUp"
});
},
}
});
});

View File

@ -69,8 +69,8 @@
toServersDir: function () {
var path = MCSERVER.URL("fs_auth/auth_master/pwd");
window.open(path);
},
},
}
}
});
});

View File

@ -126,13 +126,13 @@
TOOLS.popWind({
style: {
maxWidth: "600px",
top: "24%",
top: "24%"
},
title: "用户 " + PAGE.username + " 的密匙设置",
template: "template/dialog/apikey.html",
template: "template/dialog/apikey.html"
});
},
},
}
}
});
});

View File

@ -245,8 +245,8 @@
},
newDocker: function () {
RES.redirectPage("./template/component/new_docker_image.html", null, "");
},
},
}
}
});
});

View File

@ -122,7 +122,7 @@
createUser: false,
username: "",
password: "",
allowedServer: "",
allowedServer: ""
},
methods: {
toRegisterUser: function () {
@ -138,7 +138,7 @@
var obj = {
username: this.username,
password: this.password,
allowedServer: allwoedServers,
allowedServer: allwoedServers
};
WS.sendMsg("userset/create", JSON.stringify(obj), function () {
PAGE.refresh();
@ -147,7 +147,7 @@
toDeleteUser: function (itemUsername) {
var obj = {
username: itemUsername,
username: itemUsername
};
var result = confirm("您真的打算删除这个这个用户吗?");
if (!result) return;
@ -176,13 +176,13 @@
TOOLS.popWind({
style: {
maxWidth: "600px",
top: "24%",
top: "24%"
},
title: "用户 " + PAGE.username + " 的密匙设置",
template: "template/dialog/apikey.html",
template: "template/dialog/apikey.html"
});
},
},
}
}
});
});

View File

@ -39,13 +39,13 @@ router.all("/status/:name", function (req, res) {
current_players: mcpingResult.current_players,
max_players: mcpingResult.max_players,
motd: mcserver.dataModel.mcpingConfig.mcpingMotd || mcpingResult.motd,
version: mcpingResult.version,
version: mcpingResult.version
};
} else {
sendStatus = {
id: serverName,
lastDate: mcserver.dataModel.lastDate,
status: mcserver.isRun(),
status: mcserver.isRun()
};
}

View File

@ -19,7 +19,7 @@ router.post("/", (req, res) => {
// 但此仅限于管理员使用
const form = new multiparty.Form({
uploadDir: os.tmpdir(),
uploadDir: os.tmpdir()
});
form.parse(req, function (err, fields, files) {
if (err) {

View File

@ -21,7 +21,7 @@ router.get("/", function (req, res) {
//用户未登录,返回一个随机的 token 给它,并且这个 token 与正常的 token 几乎一模一样
response.returnMsg(res, "token", {
token: getRandToken(),
username: username,
username: username
});
return;
}
@ -39,7 +39,7 @@ router.get("/", function (req, res) {
response.returnMsg(res, "token", {
token: req.session["token"],
username: username,
username: username
});
} else {
counter.plus("csrfCounter");

View File

@ -141,7 +141,7 @@ router.get("/login_key", function (req, res) {
//salt
enkey1: loggingUser.dataModel.salt,
//md5Key
enkey2: md5Key,
enkey2: md5Key
})
);
return;
@ -152,7 +152,7 @@ router.get("/login_key", function (req, res) {
res.send(
JSON.stringify({
enkey1: tools.randomString(6),
enkey2: tools.randomString(32),
enkey2: tools.randomString(32)
})
);
});

View File

@ -110,7 +110,7 @@ router.ws("/ws", function (ws, req) {
ws: ws,
username: username,
token: token,
console: null,
console: null
});
//Session 级别验证登录检查
@ -178,7 +178,7 @@ router.ws("/ws", function (ws, req) {
body: reqBody,
RequestValue: reqHeaderObj["RequestValue"],
token: token,
WsSession: WsSession,
WsSession: WsSession
});
} catch (err) {
MCSERVER.error("WebSocket 请求处理时异常:", err);

View File

@ -89,7 +89,7 @@ setInterval(function () {
root: mversion.root,
verisonA: mversion.verisonA,
verisonB: mversion.verisonB,
system: mversion.system,
system: mversion.system
};
let useMemBai = ((os.freemem() / os.totalmem()) * 100).toFixed(0);

View File

@ -55,7 +55,7 @@ serverModel.ServerManager().on("open", (data) => {
MCSERVER.log("[" + data.serverName + "] >>> 进程创建");
// 传递开启服务端事件
serverModel.ServerManager().emit("open_next", {
serverName: data.serverName,
serverName: data.serverName
});
// 为此服务端创建历史记录类
@ -125,7 +125,7 @@ setInterval(() => {
ws: socket.ws,
resK: "server/console/ws",
resV: {},
body: data,
body: data
});
});
// 释放内存并删除键

View File

@ -30,8 +30,8 @@ WebSocketObserver().listener("server/console", (data) => {
isFtpOpen: MCSERVER.localProperty.ftp_is_allow,
mcping: mcPingProtocol.QueryMCPingTask(serverName) || {
current_players: "--",
max_players: "--",
},
max_players: "--"
}
});
// MCSERVER.log('准许用户 [' + userName + '] 获取控制台实时数据');
}

View File

@ -20,7 +20,7 @@ WebSocketObserver().listener("server/console/open", (data) => {
response.wsSend(data.ws, "server/console/open", true);
// 传递开启服务端事件
serverModel.ServerManager().emit("open_next", {
serverName: serverName,
serverName: serverName
});
} catch (err) {
response.wsMsgWindow(data.ws, "" + err);

View File

@ -19,7 +19,7 @@ WebSocketObserver().listener("server/properties", (data) => {
response.wsSend(data.ws, "server/properties", {
run: serverModel.ServerManager().getServer(serverName).isRun(),
serverName: serverName,
properties: properties,
properties: properties
});
});
}
@ -63,7 +63,7 @@ WebSocketObserver().listener("server/properties_update_reload", (data) => {
response.wsSend(data.ws, "server/properties", {
run: serverModel.ServerManager().getServer(serverName).isRun(),
serverName: serverName,
properties: properties,
properties: properties
});
//信息框
response.wsMsgWindow(data.ws, "properties 配置重读刷新完毕");

View File

@ -25,7 +25,7 @@ WebSocketObserver().listener("docker/new", (data) => {
MCSERVER.PAGE.DockerRes.unshift({
time: tools.getFullTime(),
name: dockerImageName.trim(),
res: text,
res: text
});
}
//任务列表
@ -45,7 +45,7 @@ WebSocketObserver().listener("docker/new", (data) => {
let process = childProcess.spawn("docker", ["build", "-t", dockerImageName.trim(), "./docker_temp/"], {
cwd: ".",
stdio: "pipe",
stdio: "pipe"
});
process.on("exit", (code) => {
console.log("EXIT", code);

View File

@ -38,7 +38,7 @@ WebSocketObserver().listener("genuser/home", (data) => {
createDate: userHaveServer.dataModel.createDate,
run: userHaveServer.isRun(),
jarName: userHaveServer.dataModel.jarName,
timeLimitDate: userHaveServer.dataModel.timeLimitDate,
timeLimitDate: userHaveServer.dataModel.timeLimitDate
});
if (userHaveServer.isRun()) {
OnlineServerList.push(userHaveServer.dataModel.name);
@ -54,7 +54,7 @@ WebSocketObserver().listener("genuser/home", (data) => {
OnlineLen: OnlineServerList.length,
AllServerLen: userServerList.length,
userServerList: userServerList,
OnlineServerList: OnlineServerList,
OnlineServerList: OnlineServerList
});
} catch (err) {
MCSERVER.error("普通用户访问异常", err);

View File

@ -19,7 +19,7 @@ WebSocketObserver().listener("mcping/config_save", (data) => {
mcpingName: jsonObject.mcpingConfig.mcpingName || "",
mcpingHost: jsonObject.mcpingConfig.mcpingHost || "",
mcpingPort: jsonObject.mcpingConfig.mcpingPort || "",
mcpingMotd: jsonObject.mcpingConfig.mcpingMotd || "",
mcpingMotd: jsonObject.mcpingConfig.mcpingMotd || ""
};
// console.log('mcping mcserver.dataModel:', mcserver.dataModel)
mcserver.dataModel.save();

View File

@ -11,7 +11,7 @@ WebSocketObserver().listener("menu", (data) => {
return;
}
response.wsSend(data.ws, "ws/muem", {
username: data.WsSession.username,
username: data.WsSession.username
});
// response.wsMsgWindow(data.ws, '欢迎上线 ' + data.WsSession.username);
});

View File

@ -42,7 +42,7 @@ WebSocketObserver().listener("schedule/list", (data) => {
response.wsSend(data.ws, "schedule/list", {
username: data.WsSession.username,
servername: servername,
schedules: sendlist,
schedules: sendlist
});
}
});

View File

@ -8,7 +8,7 @@ WebSocketObserver().listener("server/view", (data) => {
if (!permssion.isMaster(data.WsSession)) return;
let value = serverModel.ServerManager().getServerList();
response.wsSend(data.ws, "server/view", {
items: value,
items: value
});
});

View File

@ -6,7 +6,7 @@ const response = require("../../helper/Response");
WebSocketObserver().listener("soft/view", (data) => {
if (!permssion.isMaster(data.WsSession)) return;
response.wsSend(data.ws, "soft/view", {
softConfig: MCSERVER.softConfig,
softConfig: MCSERVER.softConfig
});
});

View File

@ -17,7 +17,7 @@ WebSocketObserver().listener("userset/update", (data) => {
}
response.wsSend(data.ws, "userset/update", {
items: userNameList,
items: userNameList
});
});
@ -112,7 +112,7 @@ WebSocketObserver().listener("userset/view", (data) => {
username: user.dataModel.username,
lastDate: user.dataModel.lastDate,
createDate: user.dataModel.createDate,
allowedServer: user.dataModel.allowedServer || [],
allowedServer: user.dataModel.allowedServer || []
});
});