forked from mirror/MCSManager
优化 使用 Prettier 格式
This commit is contained in:
parent
bdb9a89437
commit
80629936bd
53
.eslintrc.js
53
.eslintrc.js
@ -1,37 +1,36 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"es6": true
|
||||
env: {
|
||||
browser: true,
|
||||
commonjs: true,
|
||||
es6: true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly",
|
||||
"MCSERVER": "writeable",
|
||||
"__dirname": "writeable",
|
||||
"Buffer": "writeable",
|
||||
"Vue": "readonly",
|
||||
"MI": "writeable",
|
||||
"MS": "writeable",
|
||||
"TOOLS": "writeable",
|
||||
"VIEW_MODEL": "writeable",
|
||||
"RES": "readonly",
|
||||
"PAGE": "writeable",
|
||||
"$": "writeable",
|
||||
"WS": "readonly",
|
||||
"hex_md5": "readonly",
|
||||
"process": "readonly"
|
||||
|
||||
extends: "eslint:recommended",
|
||||
globals: {
|
||||
Atomics: "readonly",
|
||||
SharedArrayBuffer: "readonly",
|
||||
MCSERVER: "writeable",
|
||||
__dirname: "writeable",
|
||||
Buffer: "writeable",
|
||||
Vue: "readonly",
|
||||
MI: "writeable",
|
||||
MS: "writeable",
|
||||
TOOLS: "writeable",
|
||||
VIEW_MODEL: "writeable",
|
||||
RES: "readonly",
|
||||
PAGE: "writeable",
|
||||
$: "writeable",
|
||||
WS: "readonly",
|
||||
hex_md5: "readonly",
|
||||
process: "readonly"
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018
|
||||
},
|
||||
"rules": {
|
||||
rules: {
|
||||
"no-unused-vars": "warn",
|
||||
"no-use-before-define": "warn",
|
||||
"no-undef": "warn",
|
||||
"no-use-before-define": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-prototype-builtins": "off"
|
||||
}
|
||||
};
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
# mineself files
|
||||
# myself files
|
||||
server/
|
||||
users/
|
||||
.vscode/
|
||||
@ -6,7 +6,7 @@ testServer/
|
||||
*.exe
|
||||
*.zip
|
||||
docker_temp/
|
||||
|
||||
toprettier.bat
|
||||
|
||||
# config files
|
||||
users/*.json
|
||||
|
@ -9,7 +9,6 @@ const path = require("path");
|
||||
const fs = require("fs");
|
||||
const Docker = require("dockerode");
|
||||
|
||||
|
||||
class ServerProcess extends EventEmitter {
|
||||
constructor(args) {
|
||||
super(args);
|
||||
|
@ -5,7 +5,6 @@ const mcPingProtocol = require("../../helper/MCPingProtocol");
|
||||
|
||||
const BASE_SERVER_DIR = "./server/";
|
||||
|
||||
|
||||
class ServerManager extends EventEmitter {
|
||||
constructor(args) {
|
||||
super(args);
|
||||
|
@ -31,7 +31,7 @@ class RecordCommand {
|
||||
else fs.writeFileSync(this.path, new Buffer(HISTORY_SIZE_LINE * 2).toString() + data);
|
||||
}
|
||||
|
||||
readRecord(pstart = 0, length = 32, callback = () => { }) {
|
||||
readRecord(pstart = 0, length = 32, callback = () => {}) {
|
||||
if (!fs.existsSync(this.path)) return;
|
||||
|
||||
const fsstat = fs.statSync(this.path);
|
||||
@ -54,7 +54,7 @@ class RecordCommand {
|
||||
callback(resStr);
|
||||
|
||||
// 关闭文件
|
||||
fs.close(fd, () => { });
|
||||
fs.close(fd, () => {});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
function send(res, info, value) {
|
||||
let str = JSON.stringify({
|
||||
ResponseKey: info,
|
||||
|
@ -171,7 +171,7 @@ router.post("/upload", (req, res) => {
|
||||
let readStream = fs.createReadStream(uploadedPath);
|
||||
let writeStream = fs.createWriteStream(dstPath);
|
||||
readStream.pipe(writeStream);
|
||||
fs.unlink(uploadedPath, () => { });
|
||||
fs.unlink(uploadedPath, () => {});
|
||||
res.send("Done");
|
||||
} catch (err) {
|
||||
res.status(500).send("上传虽然成功,但是处理文件出错: " + err);
|
||||
@ -200,7 +200,7 @@ router.get("/download/:name", (req, res) => {
|
||||
filename: encodeURIComponent(req.params.name.trim())
|
||||
}
|
||||
},
|
||||
() => { }
|
||||
() => {}
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
||||
};
|
||||
|
||||
//设置头上显示什么 已舍弃
|
||||
TOOLS.setHeaderTitle = function () { };
|
||||
TOOLS.setHeaderTitle = function () {};
|
||||
|
||||
//Minecraft 服务器输出删除双S
|
||||
TOOLS.deletDoubleS = function (text) {
|
||||
@ -282,7 +282,7 @@
|
||||
var _popWindCallback = null;
|
||||
TOOLS.popWind = function (config) {
|
||||
var popWinContext = $("#PopWinContext");
|
||||
_popWindCallback = config.callback || function () { }; //全局的callback变量
|
||||
_popWindCallback = config.callback || function () {}; //全局的callback变量
|
||||
var css = config.style || {
|
||||
display: "block"
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
@ -26,8 +25,8 @@
|
||||
<b>无法访问! 您的浏览器版本过低或是兼容模式,请使用最新/更高版本的浏览器: IE10+ chrome FireFox 等,如果是国内浏览器请打开极速浏览模式(webkit内核)。</b>
|
||||
</div>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<!--
|
||||
</head>
|
||||
<!--
|
||||
__ ___ __ ___
|
||||
/ |/ /____________ ______ _____ _____ / |/ /___ _____ ____ _____ ____ _____
|
||||
/ /|_/ / ___/ ___/ _ \/ ___/ | / / _ \/ ___/ / /|_/ / __ `/ __ \/ __ `/ __ `/ _ \/ ___/
|
||||
@ -36,7 +35,7 @@
|
||||
/____/
|
||||
-->
|
||||
|
||||
<body>
|
||||
<body>
|
||||
<div id="MainContainer">
|
||||
<div id="SideCol">
|
||||
<div id="SideColMenu">
|
||||
@ -53,8 +52,7 @@
|
||||
</div>
|
||||
<div id="SideColFor">
|
||||
<!--如果您想更改菜单名或功能,请查看 common/js/meum.js 文件-->
|
||||
<a href="javascript:void(0);" v-for="item of items" :class="{ MeumSelect: item.select }"
|
||||
v-on:click="onRedirect(item.link,item.api,item)">
|
||||
<a href="javascript:void(0);" v-for="item of items" :class="{ MeumSelect: item.select }" v-on:click="onRedirect(item.link,item.api,item)">
|
||||
<span class="glyphicon" :class="item.class" aria-hidden="true"></span>
|
||||
<span v-text="item.name"></span>
|
||||
</a>
|
||||
@ -94,8 +92,7 @@
|
||||
<!--页面加载进度条-->
|
||||
<div class="Toolscon" id="ToolsPageLoading">
|
||||
<div class="progress" style="height: 4px; line-height: 4px; background-color: inherit; border: 0px">
|
||||
<div id="ToolsLoading" class="progress-bar progress-bar-success progress-bar-striped active"
|
||||
style="width: 0%; height: 4px"></div>
|
||||
<div id="ToolsLoading" class="progress-bar progress-bar-success progress-bar-striped active" style="width: 0%; height: 4px"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -119,11 +116,12 @@
|
||||
<div id="SidebarButton" v-on:click="operate()">
|
||||
<div class="SidebarButtonWapper">
|
||||
<!-- <span class="glyphicon " :class="!isExpand?'glyphicon-th-list':'glyphicon-list'" aria-hidden="true"></span> -->
|
||||
<svg t="1583817080960" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
p-id="941" width="24" height="46">
|
||||
<svg t="1583817080960" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="941" width="24" height="46">
|
||||
<path
|
||||
d="M393 475.7H176.5c-44.9 0-81.5-36.6-81.5-81.5V182.5c0-44.9 36.6-81.5 81.5-81.5H393c44.9 0 81.5 36.6 81.5 81.5v211.7c0 45-36.5 81.5-81.5 81.5zM176.5 155.4c-15 0-27.2 12.2-27.2 27.2v211.7c0 15 12.2 27.2 27.2 27.2H393c15 0 27.2-12.2 27.2-27.2V182.5c0-15-12.2-27.2-27.2-27.2l-216.5 0.1zM846.5 469.9H629.9c-44.9 0-81.5-36.6-81.5-81.5V176.7c0-44.9 36.6-81.5 81.5-81.5h216.6c44.9 0 81.5 36.6 81.5 81.5v211.7c0 44.9-36.6 81.5-81.5 81.5zM629.9 149.5c-15 0-27.2 12.2-27.2 27.2v211.7c0 15 12.2 27.2 27.2 27.2h216.6c15 0 27.2-12.2 27.2-27.2V176.7c0-15-12.2-27.2-27.2-27.2H629.9zM393 928.2H176.5c-44.9 0-81.5-36.6-81.5-81.5V635c0-44.9 36.6-81.5 81.5-81.5H393c44.9 0 81.5 36.6 81.5 81.5v211.7c0 45-36.5 81.5-81.5 81.5zM176.5 607.9c-15 0-27.2 12.2-27.2 27.2v211.7c0 15 12.2 27.2 27.2 27.2H393c15 0 27.2-12.2 27.2-27.2V635c0-15-12.2-27.2-27.2-27.2H176.5v0.1zM846.5 922.4H629.9c-44.9 0-81.5-36.6-81.5-81.5V629.2c0-44.9 36.6-81.5 81.5-81.5h216.6c44.9 0 81.5 36.6 81.5 81.5v211.7c0 44.9-36.6 81.5-81.5 81.5zM629.9 602c-15 0-27.2 12.2-27.2 27.2v211.7c0 15 12.2 27.2 27.2 27.2h216.6c15 0 27.2-12.2 27.2-27.2V629.2c0-15-12.2-27.2-27.2-27.2H629.9z"
|
||||
fill="#ffffff" p-id="942"></path>
|
||||
fill="#ffffff"
|
||||
p-id="942"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
@ -138,8 +136,17 @@
|
||||
<div id="WebTerminalControl">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon">/</span>
|
||||
<input type="text" id="" class="form-control" @keyup.enter="toCommand" v-model="command" type="text"
|
||||
autocomplete="off" placeholder="[命令输入框] 请输入您要执行的命令..." aria-describedby="sizing-addon3" />
|
||||
<input
|
||||
type="text"
|
||||
id=""
|
||||
class="form-control"
|
||||
@keyup.enter="toCommand"
|
||||
v-model="command"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
placeholder="[命令输入框] 请输入您要执行的命令..."
|
||||
aria-describedby="sizing-addon3"
|
||||
/>
|
||||
</div>
|
||||
<div class="PanelItemF" style="text-align: right">
|
||||
<div class="PanelItem mb0" v-on:click="toCommand">
|
||||
@ -299,6 +306,5 @@
|
||||
VIEW_MODEL.COMMON = {};
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -7,8 +7,6 @@ const keyManager = require("../helper/KeyManager");
|
||||
const requestLimit = require("../helper/RequestLimit");
|
||||
const tools = require("../core/tools");
|
||||
|
||||
|
||||
|
||||
// 服务端实例状态获取 | 公共性 API 接口
|
||||
// 无需任何权限判定
|
||||
router.all("/status/:name", function (req, res) {
|
||||
|
@ -8,7 +8,6 @@ const userModel = require("../../model/UserModel");
|
||||
const os = require("os");
|
||||
const mversion = require("../../helper/version");
|
||||
|
||||
|
||||
const MB_SIZE = 1024 * 1024;
|
||||
let serverM = serverModel.ServerManager();
|
||||
let userM = userModel.userCenter();
|
||||
|
@ -4,7 +4,6 @@ const serverModel = require("../../model/ServerModel");
|
||||
const response = require("../../helper/Response");
|
||||
const permssion = require("../../helper/Permission");
|
||||
|
||||
|
||||
WebSocketObserver().listener("genuser/home", (data) => {
|
||||
try {
|
||||
let username = data.WsSession.username.trim();
|
||||
|
@ -4,7 +4,6 @@ const response = require("../../helper/Response");
|
||||
const permssion = require("../../helper/Permission");
|
||||
const tools = require("../../core/tools");
|
||||
|
||||
|
||||
WebSocketObserver().listener("userset/update", (data) => {
|
||||
if (!permssion.isMaster(data.WsSession)) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user