mirror of
https://github.com/MCSManager/UI.git
synced 2025-02-17 18:39:30 +08:00
Merge branch 'master' of github.com:Suwings/MCSManager-UI
This commit is contained in:
commit
786c9b0a53
8
package-lock.json
generated
8
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mcsmanager-ui",
|
||||
"version": "1.6.2",
|
||||
"version": "1.7.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -7696,9 +7696,9 @@
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"minipass": {
|
||||
|
@ -167,3 +167,24 @@ export function jsonToMap(json, topTitle = "", map = {}) {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
export function toUnicode(str) {
|
||||
var value = "";
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if ((/([\u4E00-\u9FA5]|[\uFE30-\uFFA0])/g).test(str[i])) {
|
||||
value += "\\u" + leftZero4(parseInt(str.charCodeAt(i)).toString(16));
|
||||
} else {
|
||||
value += str[i];
|
||||
}
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function leftZero4(str) {
|
||||
if (str != null && str != "" && str != "undefined") {
|
||||
if (str.length == 2) {
|
||||
return "00" + str;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
@ -101,6 +101,7 @@ export default {
|
||||
this.$router.push({
|
||||
path: `/process_config_file/${this.serviceUuid}/${this.instanceUuid}/`,
|
||||
query: {
|
||||
type: this.type,
|
||||
configName,
|
||||
configPath,
|
||||
extName
|
||||
|
@ -74,7 +74,7 @@
|
||||
|
||||
import Panel from "../../components/Panel";
|
||||
import { request } from "../service/protocol";
|
||||
import { API_PROCESS_CONFIG_FILE } from "../service/common";
|
||||
import { API_PROCESS_CONFIG_FILE, toUnicode } from "../service/common";
|
||||
|
||||
import serverProperties from "../../components/mc_process_config/server.properties";
|
||||
import spigotYml from "../../components/mc_process_config/spigot.yml";
|
||||
@ -101,6 +101,7 @@ export default {
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
type: this.$route.query.type,
|
||||
serviceUuid: this.$route.params.serviceUuid,
|
||||
instanceUuid: this.$route.params.instanceUuid,
|
||||
configName: null,
|
||||
@ -133,6 +134,19 @@ export default {
|
||||
},
|
||||
async save() {
|
||||
try {
|
||||
const config = { ...this.config };
|
||||
if (
|
||||
this.configPath == "server.properties" &&
|
||||
this.type &&
|
||||
this.type.startsWith("minecraft/java")
|
||||
) {
|
||||
for (const key in config) {
|
||||
const value = config[key];
|
||||
if (value && typeof value == "string") {
|
||||
config[key] = toUnicode(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
await request({
|
||||
method: "PUT",
|
||||
url: API_PROCESS_CONFIG_FILE,
|
||||
@ -142,7 +156,7 @@ export default {
|
||||
fileName: this.configPath,
|
||||
type: this.$route.query.extName
|
||||
},
|
||||
data: this.config
|
||||
data: config
|
||||
});
|
||||
this.$message({ message: "更新成功", type: "success" });
|
||||
} catch (err) {
|
||||
@ -162,6 +176,7 @@ export default {
|
||||
type: this.$route.query.extName
|
||||
}
|
||||
});
|
||||
console.log(info);
|
||||
this.config = info;
|
||||
this.configName = configName;
|
||||
} catch {
|
||||
|
@ -643,6 +643,9 @@ export default {
|
||||
},
|
||||
pushHistoryCommand(cmd) {
|
||||
if (cmd.trim().length <= 0) return;
|
||||
// 清除重复的记录和当前指令一样的记录
|
||||
this.commandhistory = Array.from(new Set(this.commandhistory)).filter((r) => r != cmd);
|
||||
// 往前方插入当前输入的指令
|
||||
this.commandhistory.unshift(cmd);
|
||||
if (this.commandhistory.length > 40) {
|
||||
this.commandhistory.pop();
|
||||
|
Loading…
Reference in New Issue
Block a user