diff --git a/content/PHPMC7/assets/js/console.js b/content/PHPMC7/assets/js/console.js
index 59a61ab..57dad88 100644
--- a/content/PHPMC7/assets/js/console.js
+++ b/content/PHPMC7/assets/js/console.js
@@ -1,3 +1,6 @@
+// 此处设置 AJAX 延迟,可根据自己的情况进行调整
+// 单位毫秒,例如 1000 就代表 1 秒
+var ajaxtimeout = 1000;
var oldlog;
var ConnectURL;
var server;
@@ -11,7 +14,7 @@ function ajaxload() {
try {
$(document).ready(function(){
var start = new Date();
- var htmlobj = $.ajax({url:ConnectURL, async:true, timeout:5000, error: function(){
+ var htmlobj = $.ajax({url:ConnectURL, async:true, timeout:10000, error: function(){
$("#ping").html("连接超时");
window.parent.frames.showmsg("与 Daemon 服务器的连接已断开。");
clearInterval(Interval);
@@ -20,18 +23,18 @@ function ajaxload() {
$("#ping").html(end + " 毫秒");
if(oldlog != htmlobj.responseText) {
$("#debug").html(""
- + htmlobj.responseText.replace(//g, ">").replace(/\n/g,"
")
- .replace(/INFO\]/g, "信息]").replace(/WARN\]/g, "警告]")
- .replace(/ERROR\]/g, "错误]").replace(/\[Server/g, "[服务器").replace(/thread\//g, "主线程/")
- .replace(/Done \(/g, "启动完成,耗时 (")
- .replace(/s\)\! For help\, type \"help\" or \"\?\"/g, " 秒)!需要帮助,请输入 “help” 或 “?”")
- .replace(/Unknown command\. Type \"\/help\" for help\./g, "未知命令,请输入 “help” 查看帮助。")
- .replace(/Usage\:/g, "使用方法:").replace(/Stopping the server/g, "正在关闭服务器")
- .replace(/You need to agree to the EULA in order to run the server. Go to eula.txt for more info./,
+ + htmlobj.responseText.replace("<", "<").replace(">", ">").replace("\n","
")
+ .replace("INFO]", "信息]").replace("WARN]", "警告]")
+ .replace("ERROR]", "错误]").replace("[Server", "[服务器").replace("thread/", "主线程/")
+ .replace("Done (", "启动完成,耗时 (").replace("s)! For help, type \"help\" or \"?\"", " 秒)!需要帮助,请输入 “help” 或 “?”")
+ .replace("Unknown command. Type \"/help\" for help.", "未知命令,请输入 “help” 查看帮助。")
+ .replace("Usage:", "使用方法:").replace("Stopping the server", "正在关闭服务器")
+ .replace("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.",
"你需要接受 EULA 协议才能开启服务器,编辑服务端的 eula.txt ,将 eula=false 改为 eula=true 并保存即可。")
- .replace(/Stopping server/, "正在终止服务器进程").replace(/Loading properties/, "正在加载配置文件")
- .replace(/Failed to load/, "无法加载").replace(/Starting minecraft server version/, "正在启动 Minecraft 服务器,版本:")
- .replace(/Default game type:/, "默认游戏模式:") + "
");
+ .replace("Stopping server", "正在终止服务器进程").replace("Loading properties", "正在加载配置文件")
+ .replace("Failed to load", "无法加载").replace("Starting minecraft server version", "正在启动 Minecraft 服务器,版本:")
+ .replace("Default game type:", "默认游戏模式:").replace("Container not found", "提示:服务器未在运行状态")
+ .replace("Token Error", "错误:授权验证失败,请检查 Daemon 设置。") + "");
if(autoflush.checked == true) {
debug.scrollTop = debug.scrollHeight;
}
@@ -61,7 +64,7 @@ window.onkeydown = function(event){
};
function sendCommand(cmd) {
- var htmlobj = $.ajax({url:"?action=sendcommand&id=" + server + "&cmd=" + encodeURIComponent(cmd), async:true, timeout:5000, error: function(){
+ var htmlobj = $.ajax({url:"?action=sendcommand&id=" + server + "&cmd=" + encodeURIComponent(cmd), async:true, timeout:10000, error: function(){
window.parent.frames.showmsg(htmlobj.responseText);
}});
}
@@ -73,31 +76,32 @@ window.onload = function() {
};
function startServer() {
- var htmlobj = $.ajax({url:"?action=start&id=" + server, async:true, timeout:5000, error: function(){
+ var htmlobj = $.ajax({url:"?action=start&id=" + server, async:true, timeout:10000, error: function(){
window.parent.frames.showmsg(htmlobj.responseText);
}});
};
function stopServer() {
- var htmlobj = $.ajax({url:"?action=stop&id=" + server, async:true, timeout:5000, error: function(){
+ var htmlobj = $.ajax({url:"?action=stop&id=" + server, async:true, timeout:10000, error: function(){
window.parent.frames.showmsg(htmlobj.responseText);
}});
};
function restartServer() {
- var htmlobj = $.ajax({url:"?action=restart&id=" + server, async:true, timeout:5000, error: function(){
+ var htmlobj = $.ajax({url:"?action=restart&id=" + server, async:true, timeout:10000, error: function(){
window.parent.frames.showmsg(htmlobj.responseText);
}});
};
function selectServer(id, element) {
+ window.parent.frames.progressshow("请稍后,正在加载...");
clearInterval(Interval);
$(".server-hover").attr("style", "");
element.style.border = "1px solid rgba(255,255,255,0.3)";
var htmlobj = $.ajax({
url:"?action=getserver&id=" + id,
async:true,
- timeout:5000,
+ timeout:10000,
error: function() {
window.parent.frames.showmsg(htmlobj.responseText);
},
@@ -111,14 +115,15 @@ function selectServer(id, element) {
ftppass.innerHTML = obj.ftppass;
oldlog = "";
ConnectURL = obj.host + "?action=getlogs&token=" + obj.token + "&name=" + obj.uuid;
- Interval = setInterval("ajaxload()", 1000);
+ window.parent.frames.progressunshow();
+ Interval = setInterval("ajaxload()", ajaxtimeout);
return;
}
});
};
function serverStatus() {
- var htmlobjs = $.ajax({url:"?action=status&id=" + server, async:true, timeout:5000, success: function(){
+ var htmlobjs = $.ajax({url:"?action=status&id=" + server, async:true, timeout:10000, success: function(){
var rpt = htmlobjs.responseText;
var fallback = rpt.split("\/");
$("#online").html(fallback[0]);
diff --git a/content/PHPMC7/daemon-list.html b/content/PHPMC7/daemon-list.html
index 6893afe..3d7a992 100644
--- a/content/PHPMC7/daemon-list.html
+++ b/content/PHPMC7/daemon-list.html
@@ -99,6 +99,7 @@