This commit is contained in:
Mr Chen
2019-02-21 19:19:55 +08:00
parent 6ec4e4d85e
commit cfb549f754
3 changed files with 26 additions and 1 deletions
+10
View File
@@ -134,6 +134,16 @@ class config_api:
public.restartMw()
return public.returnJson(True, '修改成功!')
def closePanelApi(self):
filename = 'data/close.pl'
if os.path.exists(filename):
os.remove(filename)
return public.returnJson(True, '开启成功')
public.writeFile(filename, 'True')
public.execShell("chmod 600 " + filename)
public.execShell("chown root.root " + filename)
return public.returnJson(True, '面板已关闭!')
##### ----- end ----- ###
def getVersion(self):
+15
View File
@@ -14,6 +14,21 @@ $(".set-submit").click(function(){
});
//关闭面板
function closePanel(){
layer.confirm('关闭面板会导致您无法访问面板 ,您真的要关闭宝塔Linux面板吗?',{title:'关闭面板',closeBtn:2,icon:13,cancel:function(){
$("#closePl").prop("checked",false);
}}, function() {
$.post('/config/close_panel','',function(rdata){
layer.msg(rdata.msg,{icon:rdata.status?1:2});
setTimeout(function(){window.location.reload();},1000);
},'json');
},function(){
$("#closePl").prop("checked",false);
});
}
function modifyAuthPath() {
var auth_path = $("#admin_path").val();
btn = "<button type='button' class='btn btn-success btn-sm' onclick=\"bindBTName(1,'b')\">确定</button>";
+1 -1
View File
@@ -14,7 +14,7 @@
<em>关闭面板</em>
<div class="ssh-item">
<input class="btswitch btswitch-ios" id="closePl" type="checkbox">
<label class="btswitch-btn" for="closePl" onclick="ClosePanel()"></label>
<label class="btswitch-btn" for="closePl" onclick="closePanel()"></label>
</div>
</div>