优化 使用 prettier 格式化

This commit is contained in:
Suwings 2021-01-25 16:43:17 +08:00
parent 5fa107596f
commit 16ac899869
12 changed files with 58 additions and 75 deletions

View File

@ -1,10 +1,9 @@
---
name: bug_report
about: 错误报告模板如果你要反馈BUG请使用这个问题模板
title: ''
labels: ''
title: ""
labels: ""
assignees: Suwings
---
提交 BUG 需要很多信息,请尽可能完善以下信息,若无法全面完善也无妨,写好之后请删除这行文字。
@ -13,7 +12,7 @@ assignees: Suwings
**面板版本:**
**Node版本:**
**Node 版本:**
**出现概率:**

View File

@ -1,10 +1,9 @@
---
name: Custom issue template
about: 若您想提交的内容与上述均无关系,请使用此模板
title: ''
labels: ''
assignees: ''
title: ""
labels: ""
assignees: ""
---
**内容:**

View File

@ -1,21 +1,17 @@
---
name: Feature request
about: 功能建议模板(如果你有任何想法,请使用这个模板)
title: ''
labels: ''
assignees: ''
title: ""
labels: ""
assignees: ""
---
**你对哪些功能有建议或想法?**
**这些功能有哪些代替方案?**
**对应你提出的内容,你觉得有什么价值?**
**其他内容:**
(功能请求或者功能建议均准许自由发挥,无特定限制模板,你可以在这里写下任何你想说的文字。)

View File

@ -48,7 +48,6 @@ class MinecraftServer extends ServerProcess {
};
}
//构建服务端配置信息
builder(args) {
this.dataModel.addCmd = this.configureParams(args, "addCmd", []);
@ -83,7 +82,6 @@ class MinecraftServer extends ServerProcess {
this.propertiesLoad();
}
// 修改实例信息
configureParams(args, key, defval = "") {
// 根据松散配置(局部修改)和严格配置(整体修改)对应配置不同的优先级
@ -95,7 +93,6 @@ class MinecraftServer extends ServerProcess {
return this.dataModel[key];
}
load() {
this.dataModel.load();
this.builder(this.dataModel);

View File

@ -148,10 +148,10 @@ class UserCenter {
// 暴力克隆对象
const newData = JSON.parse(JSON.stringify(this.userList[name].dataModel));
// 删除一部分隐私
delete newData['password'];
delete newData['salt'];
delete newData['__filename__'];
delete newData['apikey'];
delete newData["password"];
delete newData["salt"];
delete newData["__filename__"];
delete newData["apikey"];
list.push(newData);
}
return list;

View File

@ -140,9 +140,9 @@ router.get("/eac_quque", (req, res) => {
});
});
const multer = require('multer')
const upload = multer({ dest: 'tmp_upload/' });
router.post("/upload", upload.single('upload_file'), (req, res) => {
const multer = require("multer");
const upload = multer({ dest: "tmp_upload/" });
router.post("/upload", upload.single("upload_file"), (req, res) => {
//权限判断,需要登录
if (!req.session.fsos || !req.session.fsos.cwd) return;
let fileOperate;
@ -163,9 +163,8 @@ router.post("/upload", upload.single('upload_file'), (req, res) => {
} else {
res.send("Done");
}
fs.remove(req.file.path, () => { });
fs.remove(req.file.path, () => {});
});
}
});
@ -190,7 +189,7 @@ router.get("/download/:name", (req, res) => {
filename: encodeURIComponent(req.params.name.trim())
}
},
() => { }
() => {}
);
});

View File

@ -183,8 +183,7 @@
<br />
<div class="input-group input-group-sm">
<span class="input-group-addon">启动命令</span>
<input type="text" class="form-control" placeholder="程序启动命令.... (列如: java -jar xxx.jar)"
v-model="highCommande" />
<input type="text" class="form-control" placeholder="程序启动命令.... (列如: java -jar xxx.jar)" v-model="highCommande" />
</div>
<small>运行目录: {{serverCwd}} </small>
<br />
@ -319,5 +318,5 @@
});
});
MI.rListener("onend", function () { });
</script>
MI.rListener("onend", function () {});
</script>

View File

@ -34,14 +34,12 @@
<p>如果您 Java 环境无误,使用 "java" 环境变量即可</p>
<div class="input-group input-group-sm">
<span class="input-group-addon">Java 路径</span>
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="java"
placeholder="[未设定]" />
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="java" placeholder="[未设定]" />
</div>
<p>端根目录: [ {{ cwd }} ]</p>
<div class="input-group input-group-sm">
<span class="input-group-addon"> 服务端文件名 </span>
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="jarName"
placeholder="[未设定]" />
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="jarName" placeholder="[未设定]" />
</div>
<p>关服命令</p>
<div class="input-group input-group-sm">
@ -52,15 +50,13 @@
<p><small>设置按照 2018/10/1 格式,到期后将无法开启,需手动删除</small></p>
<div class="input-group input-group-sm">
<span class="input-group-addon"> 到期限制 </span>
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="timeLimitDate"
placeholder="[未设定 如 2018/10/1 2020/1/12]" />
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="timeLimitDate" placeholder="[未设定 如 2018/10/1 2020/1/12]" />
</div>
</div>
<div class="col-md-6">
<div class="input-group input-group-sm">
<span class="input-group-addon">启动附加参数</span>
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="addCmd"
placeholder="[可空 列如: -server -xxx 等]" />
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="addCmd" placeholder="[可空 列如: -server -xxx 等]" />
</div>
<p>服务端文件与数据的目录所在地。</p>
<div class="input-group input-group-sm">
@ -71,20 +67,19 @@
<p>实质是 -Xmx -Xms 参数,填写请加单位(M,G)</p>
<div class="input-group input-group-sm">
<span class="input-group-addon"> 最大内存堆 </span>
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="Xmx"
placeholder="[自动 如需修改请加单位]" />
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="Xmx" placeholder="[自动 如需修改请加单位]" />
</div>
<div class="input-group input-group-sm">
<span class="input-group-addon"> 初始内存堆 </span>
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="Xms"
placeholder="[自动 如需修改请加单位]" />
<input v-bind:disabled="isHighCommande" type="text" class="form-control" v-model="Xms" placeholder="[自动 如需修改请加单位]" />
</div>
<div class="row">
<div class="col-lg-12">
<p>
<small>
版本 1.9.X 以上可能需要输入编码为 UTF-8 <br />
默认值: Windows 默认 GBK 编码Linux 默认 UTF8 编码</small>
默认值: Windows 默认 GBK 编码Linux 默认 UTF8 编码</small
>
</p>
</div>
<div class="col-lg-6">
@ -110,8 +105,12 @@
</p>
<div class="input-group input-group-sm">
<span class="input-group-addon"> 自定义命令 </span>
<input type="text" class="form-control" v-model="highCommande"
placeholder="[ 尚未使用 | 列如: java -xxx -yyy Xmx4g Xms2g -Djline.terminal=jline.UnsupportedTerminal -jar test.jar --xxx ] " />
<input
type="text"
class="form-control"
v-model="highCommande"
placeholder="[ 尚未使用 | 列如: java -xxx -yyy Xmx4g Xms2g -Djline.terminal=jline.UnsupportedTerminal -jar test.jar --xxx ] "
/>
</div>
</div>
<br />
@ -223,5 +222,5 @@
VIEW_MODEL["ServerPanel"].oldServerName = VIEW_MODEL["ServerPanel"].name + "";
});
MI.rListener("onend", function () { });
</script>
MI.rListener("onend", function () {});
</script>

View File

@ -26,7 +26,7 @@
<br />
</div>
</div>
<div class="Panel ">
<div class="Panel">
<div class="PanelTitle">支持开发团队</div>
<div class="PanelBody">
<p>
@ -41,14 +41,15 @@
</div>
</div>
<div class="Panel ">
<div class="Panel">
<div class="PanelTitle">开源协议</div>
<div class="PanelBody">
<p>遵循 MIT 开源协议</p>
<p>
<small>A short and simple permissive license with conditions only requiring preservation of copyright and
license notices. Licensed works, modifications, and larger works may be distributed
under different terms and without source code.</small>
<small
>A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed
under different terms and without source code.</small
>
</p>
<br />
</div>
@ -74,5 +75,5 @@
});
});
MI.rListener("onend", function () { });
</script>
MI.rListener("onend", function () {});
</script>

View File

@ -91,16 +91,12 @@
</p>
</div>
<div class="col-xs-3" style="text-align: center">
<a href="javascript:void(0);" class="mbuttonWhite" v-on:click="toTerminal(item.serverName);"> <span
class="glyphicon glyphicon-console" aria-hidden="true"> </span>&nbsp; 终端 </a>
<a href="javascript:void(0);" class="mbuttonWhite" v-on:click="toConsole(item.serverName);"> <span
class="glyphicon glyphicon-th-large" aria-hidden="true"> </span>&nbsp; 管理 </a>
<a href="javascript:void(0);" class="mbuttonWhite"
v-on:click="onRedirect('./template/component/server.html','server/get',item.serverName);">
<a href="javascript:void(0);" class="mbuttonWhite" v-on:click="toTerminal(item.serverName);"> <span class="glyphicon glyphicon-console" aria-hidden="true"> </span>&nbsp; 终端 </a>
<a href="javascript:void(0);" class="mbuttonWhite" v-on:click="toConsole(item.serverName);"> <span class="glyphicon glyphicon-th-large" aria-hidden="true"> </span>&nbsp; 管理 </a>
<a href="javascript:void(0);" class="mbuttonWhite" v-on:click="onRedirect('./template/component/server.html','server/get',item.serverName);">
<span class="glyphicon glyphicon-cog" aria-hidden="true"> </span>&nbsp; 参数
</a>
<a href="javascript:void(0);" class="mbuttonWhite" v-on:click="toDeleteServer(item.serverName)">
<span class="glyphicon glyphicon-trash" aria-hidden="true"> </span>&nbsp; 删除 </a>
<a href="javascript:void(0);" class="mbuttonWhite" v-on:click="toDeleteServer(item.serverName)"> <span class="glyphicon glyphicon-trash" aria-hidden="true"> </span>&nbsp; 删除 </a>
</div>
</div>
</div>
@ -148,7 +144,7 @@
color: rgb(26, 26, 26);
}
.AppInlineBlockListTitleMuem>a {
.AppInlineBlockListTitleMuem > a {
color: #2e2e2e;
display: inline-block;
margin-left: 6px;
@ -254,5 +250,5 @@
});
});
MI.rListener("onend", function () { });
</script>
MI.rListener("onend", function () {});
</script>

View File

@ -279,7 +279,6 @@ router.post("/execute/", function (req, res) {
}
});
// 创建服务器实例JSON | API
router.post("/advanced_create_server", function (req, res) {
// 仅仅准许管理员使用
@ -300,7 +299,6 @@ router.post("/advanced_create_server", function (req, res) {
}
});
// 修改服务器实例JSON | API
router.post("/advanced_configure_server", function (req, res) {
// 仅仅准许管理员使用

View File

@ -12,18 +12,18 @@ const fs = require("fs");
const fsex = require("fs-extra");
const permission = require("../helper/Permission");
const multer = require('multer')
const upload = multer({ dest: 'tmp_upload/' });
const multer = require("multer");
const upload = multer({ dest: "tmp_upload/" });
router.post("/", upload.single('upload_file'), (req, res) => {
router.post("/", upload.single("upload_file"), (req, res) => {
// 任意目录的文件上传,仅限于管理员使用
if (!permission.needLogin(req, res)) return;
if (!permission.IsSessionMaster(req, res)) {
return res.status(500).send("权限不足");
}
// 文件上传域
if (req.file && req.body['cwd']) {
const target_path = req.body['cwd'];
if (req.file && req.body["cwd"]) {
const target_path = req.body["cwd"];
if (!fs.existsSync(target_path)) fsex.mkdirSync(target_path);
const originalname = req.file.originalname;
const dstPath = pathm.join(target_path, originalname);
@ -34,7 +34,7 @@ router.post("/", upload.single('upload_file'), (req, res) => {
MCSERVER.log("[ 文件上传 ] 用户", req.session["username"], "上传文件到", target_path);
res.send("Done");
}
fsex.remove(req.file.path, () => { });
fsex.remove(req.file.path, () => {});
});
}
});