Skip to content

Commit

Permalink
Bug fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
h5mcbox committed Mar 1, 2024
1 parent d8c796d commit 6e6e1c0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ node app
| **public/common/URL.js** |URL定位器|
| **server/server_core**           |Minecraft 服务端核心目录,包括服务端文件,配置,Mod,以及插件|
| **server/x.json**               |Minecraft 服务器面板配置文件|
| **users/x.json**               |控制面板用户配置文件|
| **route/**                     |控制器,HTTP 请求业务逻辑层(可二次扩展)|
| **route/websocket/**            |控制器,Webscoket 请求业务逻辑层(可二次扩展)|
| **core/Process/**               |Minecraft Server 类实现|
Expand Down
4 changes: 2 additions & 2 deletions helper/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const os = require("os");
//这样, 用户截图时, 可以知道具体的版本
//请用户尽可能的不要修改本文件任何代码,因为每一次版本更新时,必定会冲突

const verisonA = "8.6.26 Production Version"; //发行版本
const verisonA = "8.6.27 Production Version"; //发行版本

const verisonB = "No.20240225"; //版本批次
const verisonB = "No.20240301"; //版本批次

let info = [os.type(), os.arch(), os.hostname(), os.release()].join(" ");

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mcsmanager-plus-worker",
"version": "8.6.26",
"version": "8.6.27",
"description": "A simple Minecraft server web panel.",
"Keywords": [
"MCSManager",
Expand Down Expand Up @@ -41,7 +41,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/Suwings/MCSManager"
"url": "https://github.com/h5mcbox/MCSManager-plus-Worker"
},
"scripts": {
"start": "node app.js",
Expand Down
4 changes: 2 additions & 2 deletions route/websocket/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ serverModel.ServerManager().on("open", data => {

//控制请求监听控制台实例
WebSocketObserver().define("server/console/ws", data => {
let serverName = data.body.trim();
let { serverName, userName } = data.body;

MCSERVER.log("[" + serverName + "] >>> 准许控制台监听");

Expand All @@ -76,7 +76,7 @@ WebSocketObserver().define("server/console/ws", data => {

// 重置用户历史指针
const instanceLogHistory = serverModel.ServerManager().getServer(serverName).logHistory;
if (instanceLogHistory) instanceLogHistory.setPoint("", 0);
if (instanceLogHistory) instanceLogHistory.setPoint(userName, 0);
return null;
});

Expand Down
12 changes: 6 additions & 6 deletions route/websocket/console/history.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
const { WebSocketObserver } = require("../../../model/WebSocketModel");
const permssion = require("../../../helper/Permission");
const serverModel = require("../../../model/ServerModel");
const response = require("../../../helper/Response");

const HISTORY_SIZE_LINE = 1024;

// 正序历史记录路由
WebSocketObserver().define("server/console/history", data => {
let bodyJson = data.body;
let serverName = bodyJson["serverName"] || "";
let { serverName = "", userName } = data.body;
const logHistory = serverModel.ServerManager().getServer(serverName).logHistory;
if (!logHistory) {
return "[控制面板]: 暂无任何历史记录.\r\n";
}
logHistory.readLine("", HISTORY_SIZE_LINE, (sendText) => {
let returnText = "";
logHistory.readLine(userName, HISTORY_SIZE_LINE, (sendText) => {
if (sendText) {
sendText = sendText.replace(/\n/gim, "\r\n");
sendText = sendText.replace(/\r\r\n/gim, "\r\n");
return sendText;
returnText = sendText;
} else {
return "[控制面板]: 无法再读取更多的服务端日志.\r\n";
returnText = "[控制面板]: 无法再读取更多的服务端日志.\r\n";
}
});
return returnText;
});

/*
Expand Down
1 change: 0 additions & 1 deletion route/websocket/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ WebSocketObserver().define("server/opt_all", data => {
continue;
}
}
response.wsMsgWindow(data.ws, "操作执行发出!需要一定时间,具体结果请看服务端运行状态.");
return true;
} catch (err) {
response.wsMsgWindow(data.ws, "执行失败:" + err);
Expand Down

0 comments on commit 6e6e1c0

Please sign in to comment.