pull/109/head
Mr Chen 7 years ago
parent 1d436c3cc5
commit 53208913d8
  1. 6
      class/core/public.py
  2. 36
      route/plugins.py
  3. 9
      route/system.py
  4. 78
      static/js/index.js
  5. 16
      templates/default/index.html
  6. 2
      templates/default/layout.html

@ -18,13 +18,11 @@ from random import Random
def getRunDir(): def getRunDir():
# 运行目录
return os.getcwd() return os.getcwd()
def getBinDir(): def getRootDir():
# 安装软件 return os.path.dirname(os.path.dirname(getRunDir()))
pass
def M(table): def M(table):

@ -10,7 +10,7 @@ import sys
import os import os
import json import json
sys.path.append("class/") sys.path.append("class/core")
import public import public
@ -130,7 +130,7 @@ def installed():
infoJsonPos = __plugin_name + '/' + name + '/' + 'info.json' infoJsonPos = __plugin_name + '/' + name + '/' + 'info.json'
if not os.path.exists(infoJsonPos): if not os.path.exists(infoJsonPos):
return public.retJson(-1, "配置数据(info.json)不存在!", ()) return public.returnJson(-1, "配置数据(info.json)不存在!", ())
pluginInfo = json.loads(public.readFile(infoJsonPos)) pluginInfo = json.loads(public.readFile(infoJsonPos))
@ -139,26 +139,12 @@ def installed():
print request.args print request.args
return '' return ''
# 取分页
@plugins.route('/check_installed', methods=['POST'])
def checkInstalled():
def get_page(data, args): checks = ['nginx', 'apache', 'php', 'mysql']
# 包含分页类 for name in checks:
import page filename = public.getRootDir() + "/server/" + name
# 实例化分页类 if os.path.exists(filename):
page = page.Page() return "True"
info = {} return "False"
info['count'] = len(data)
info['row'] = __row_num
info['p'] = 1
if hasattr(args, 'p'):
info['p'] = int(get['p'])
info['uri'] = {}
info['return_js'] = ''
if hasattr(args, 'tojs'):
info['return_js'] = args.tojs
# 获取分页数据
result = {}
result['page'] = page.GetPage(info)
return result

@ -145,8 +145,13 @@ def diskinfo():
return jsonify(diskInfo) return jsonify(diskInfo)
@system.route("/systemtotal") @system.route("/update_panel")
def systemtotal(): def updatePanel():
return public.returnJson(False, "12")
@system.route("/system_total")
def systemTotal():
# 取系统统计信息 # 取系统统计信息
data = GetMemInfo() data = GetMemInfo()
cpu = GetCpuInfo(1) cpu = GetCpuInfo(1)

@ -1,5 +1,5 @@
//检测是否安装环境 //检测是否安装环境
$.post("/ajax?action=CheckInstalled", function(rdata) { $.post("/plugins/check_installed", function(rdata) {
if (rdata == false) { if (rdata == false) {
RecInstall(); RecInstall();
} }
@ -180,7 +180,7 @@ function ClearSystem() {
} }
function getInfo() { function getInfo() {
$.get("/system?action=GetSystemTotal", function(info) { $.get("/system/system_total", function(info) {
setCookie("memRealUsed", parseInt((info.memRealUsed))); setCookie("memRealUsed", parseInt((info.memRealUsed)));
$("#memory").html(parseInt((info.memRealUsed)) + '/' + info.memTotal + ' (MB)'); $("#memory").html(parseInt((info.memRealUsed)) + '/' + info.memTotal + ' (MB)');
setCookie("mem-before", $("#memory").text()); setCookie("mem-before", $("#memory").text());
@ -205,7 +205,7 @@ function getInfo() {
$("#messageError").append('<p><span class="glyphicon glyphicon-alert" style="color: #ff4040; margin-right: 10px;"></span>' + lan.index.user_warning + '<span class="c7 mr5" title="此安全问题不可忽略,请尽快处理" style="cursor:no-drop"> [不可忽略]</span><a class="btlink" href="javascript:setUserName();"> [立即修改]</a></p>') $("#messageError").append('<p><span class="glyphicon glyphicon-alert" style="color: #ff4040; margin-right: 10px;"></span>' + lan.index.user_warning + '<span class="c7 mr5" title="此安全问题不可忽略,请尽快处理" style="cursor:no-drop"> [不可忽略]</span><a class="btlink" href="javascript:setUserName();"> [立即修改]</a></p>')
} }
setImg(); setImg();
}); },'json');
} }
@ -450,25 +450,25 @@ function setImg() {
setImg(); setImg();
//检查更新 //检查更新
setTimeout(function() { // setTimeout(function() {
$.get('/ajax?action=UpdatePanel', function(rdata) { // $.get('/system/update_panel', function(rdata) {
if (rdata.status == false) return; // if (rdata.status == false) return;
if (rdata.version != undefined) { // if (rdata.version != undefined) {
$("#toUpdate").html('<a class="btlink" href="javascript:updateMsg();">' + lan.index.update_go + '</a>'); // $("#toUpdate").html('<a class="btlink" href="javascript:updateMsg();">' + lan.index.update_go + '</a>');
return; // return;
} // }
$.get('/system?action=ReWeb', function() {}); // $.get('/system?action=ReWeb', function() {});
layer.msg(rdata.msg, { icon: 1 }); // layer.msg(rdata.msg, { icon: 1 });
setTimeout(function() { // setTimeout(function() {
window.location.reload(); // window.location.reload();
}, 3000); // }, 3000);
}).error(function() { // }).error(function() {
$.get('/system?action=ReWeb', function() {}); // $.get('/system?action=ReWeb', function() {});
setTimeout(function() { // setTimeout(function() {
window.location.reload(); // window.location.reload();
}, 3000); // }, 3000);
}); // },'json');
}, 3000); // }, 3000);
//检查更新 //检查更新
@ -603,20 +603,20 @@ function WSafeRestart() {
$.post('/system?action=RestartServer', '', function(rdata) { $.post('/system?action=RestartServer', '', function(rdata) {
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p>" + lan.index.reboot_msg_4 + "...</p>"); $(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p>" + lan.index.reboot_msg_4 + "...</p>");
var sEver = setInterval(function() { var sEver = setInterval(function() {
$.get("/system?action=GetSystemTotal", function(info) { $.get("/system/system_total", function(info) {
clearInterval(sEver); clearInterval(sEver);
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p class='c9'>" + lan.index.reboot_msg_4 + "</p><p>" + lan.index.reboot_msg_5 + "</p>"); $(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p class='c9'>" + lan.index.reboot_msg_4 + "</p><p>" + lan.index.reboot_msg_5 + "</p>");
setTimeout(function() { setTimeout(function() {
layer.closeAll(); layer.closeAll();
}, 3000); }, 3000);
}).error(function() { },'json').error(function() {
}); });
}, 3000); }, 3000);
}).error(function() { }).error(function() {
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p>" + lan.index.reboot_msg_4 + "...</p>"); $(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p>" + lan.index.reboot_msg_4 + "...</p>");
var sEver = setInterval(function() { var sEver = setInterval(function() {
$.get("/system?action=GetSystemTotal", function(info) { $.get("/system/system_total", function(info) {
clearInterval(sEver); clearInterval(sEver);
$(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p class='c9'>" + lan.index.reboot_msg_4 + "</p><p>" + lan.index.reboot_msg_5 + "</p>"); $(".SafeRestartCode").html("<p class='c9'>" + lan.index.reboot_msg_1 + "</p><p class='c9'>" + lan.index.reboot_msg_2 + "</p><p class='c9'>" + lan.index.reboot_msg_3 + "</p><p class='c9'>" + lan.index.reboot_msg_4 + "</p><p>" + lan.index.reboot_msg_5 + "</p>");
setTimeout(function() { setTimeout(function() {
@ -624,7 +624,7 @@ function WSafeRestart() {
window.location.reload(); window.location.reload();
}, 3000); }, 3000);
}).error(function() { },'json').error(function() {
}); });
}, 3000); }, 3000);
@ -635,19 +635,19 @@ function WSafeRestart() {
} }
function reWeb() { function reWeb() {
layer.confirm(lan.index.panel_reboot_msg, { title: lan.index.panel_reboot_title, closeBtn: 2, icon: 3 }, function() { // layer.confirm(lan.index.panel_reboot_msg, { title: lan.index.panel_reboot_title, closeBtn: 2, icon: 3 }, function() {
var loadT = layer.msg(lan.index.panel_reboot_to, { icon: 16, time: 0, shade: [0.3, '#000'] }); // var loadT = layer.msg(lan.index.panel_reboot_to, { icon: 16, time: 0, shade: [0.3, '#000'] });
$.get('/system?action=ReWeb', function(rdata) { // $.get('/system?action=ReWeb', function(rdata) {
layer.close(loadT); // layer.close(loadT);
layer.msg(rdata.msg, { icon: 5 }); // layer.msg(rdata.msg, { icon: 5 });
}).error(function() { // }).error(function() {
layer.close(loadT); // layer.close(loadT);
layer.msg(lan.index.panel_reboot_ok, { icon: 1 }); // layer.msg(lan.index.panel_reboot_ok, { icon: 1 });
setTimeout(function() { // setTimeout(function() {
window.location.reload(); // window.location.reload();
}, 3000) // }, 3000)
}); // });
}); // });
} }

@ -6,7 +6,7 @@
<a class="plr10 c4" href="/">首页</a>/<span class="plr10 c4">服务器状态</span> <a class="plr10 c4" href="/">首页</a>/<span class="plr10 c4">服务器状态</span>
</div> </div>
<span class="pull-right f12 c6" style="line-height:42px; margin-right:15px"> <span class="pull-right f12 c6" style="line-height:42px; margin-right:15px">
免费<span id="btversion" class="mr5" onclick="openLog()">0.0.1</span> 本信息 <span id="btversion" class="mr5" onclick="openLog()">0.0.1</span>
<span id="toUpdate"><a class="btlink" href="javascript:checkUpdate();">检查更新</a></span> <span id="toUpdate"><a class="btlink" href="javascript:checkUpdate();">检查更新</a></span>
</span> </span>
</div> </div>
@ -146,13 +146,13 @@
setCookie('serverType', '$web.ctx.session.webserver'); setCookie('serverType', '$web.ctx.session.webserver');
var serverType = getCookie('serverType'); var serverType = getCookie('serverType');
</script> </script>
<script type="text/javascript" src="/static/js/echarts.min.js"></script> <script type="text/javascript" src="/static/js/echarts.min.js?v={{config.version}}"></script>
<script type="text/javascript" src="/static/js/site.js?date=20180523"></script> <script type="text/javascript" src="/static/js/site.js?v={{config.version}}"></script>
<script type="text/javascript" src="/static/js/ftp.js?date=20180307"></script> <script type="text/javascript" src="/static/js/ftp.js?v={{config.version}}"></script>
<script type="text/javascript" src="/static/js/data.js?date=20180307"></script> <script type="text/javascript" src="/static/js/data.js?v={{config.version}}"></script>
<script type="text/javascript" src="/static/js/jquery.dragsort-0.5.2.min.js"></script> <script type="text/javascript" src="/static/js/jquery.dragsort-0.5.2.min.js?v={{config.version}}"></script>
<script type="text/javascript" src="/static/js/soft.js?date=20180523"></script> <script type="text/javascript" src="/static/js/soft.js?v={{config.version}}"></script>
<script type="text/javascript" src="/static/js/index.js?date=20180523"></script> <script type="text/javascript" src="/static/js/index.js?v={{config.version}}"></script>
<script type="text/javascript"> <script type="text/javascript">
setTimeout(function() { setTimeout(function() {
GetDiskInfo(); GetDiskInfo();

@ -48,7 +48,7 @@
<script src="/static/js/clipboard.min.js?v={{config.version}}"></script> <script src="/static/js/clipboard.min.js?v={{config.version}}"></script>
<script src="/static/js/public.js?v={{config.version}}"></script> <script src="/static/js/public.js?v={{config.version}}"></script>
{% block content %}{% endblock %} {% block content %}{% endblock %}
<div class="footer bgw">mdserver-web &copy;2018- 面板 (github.com/midoks/mdserver-web)<a style="margin-left:20px;color:#20a53a;" href="//github.com/midoks/mdserver-web" target="_blank">help</a><a style="margin-left:20px;color:#20a53a;" href="//github.com/midoks/mdserver-web" target="_blank">《使用手册》</a></div> <div class="footer bgw">mdserver-web &copy;2018- 面板 (github.com/midoks/mdserver-web)<a style="margin-left:20px;color:#20a53a;" href="//github.com/midoks/mdserver-web" target="_blank">help</a><a style="margin-left:20px;color:#20a53a;" href="//github.com/midoks/mdserver-web" target="_blank">《使用手册》</a></div>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save