加入开发模式开关

This commit is contained in:
midoks
2022-09-19 20:47:12 +08:00
parent b5195ba685
commit 5a93b07968
4 changed files with 38 additions and 2 deletions
+1
View File
@@ -122,6 +122,7 @@ data/datadir.pl
data/502Task.pl
data/default.pl
data/backup.pl
data/debug.pl
data/default_site.pl
lib/python*
+15 -1
View File
@@ -207,6 +207,14 @@ class config_api:
mw.execShell("chown root.root " + filename)
return mw.returnJson(True, '面板已关闭!')
def openDebugApi(self):
filename = 'data/debug.pl'
if os.path.exists(filename):
os.remove(filename)
return mw.returnJson(True, '开发模式关闭!')
mw.writeFile(filename, 'True')
return mw.returnJson(True, '开发模式开启!')
def setIpv6StatusApi(self):
ipv6_file = 'data/ipv6.pl'
if os.path.exists('data/ipv6.pl'):
@@ -316,11 +324,17 @@ class config_api:
data['admin_path'] = mw.readFile(admin_path_file)
ipv6_file = 'data/ipv6.pl'
if os.path.exists('data/ipv6.pl'):
if os.path.exists(ipv6_file):
data['ipv6'] = 'checked'
else:
data['ipv6'] = ''
debug_file = 'data/debug.pl'
if os.path.exists(debug_file):
data['debug'] = 'checked'
else:
data['debug'] = ''
ssl_file = 'data/ssl.pl'
if os.path.exists('data/ssl.pl'):
data['ssl'] = 'checked'
+14 -1
View File
@@ -26,13 +26,26 @@ function closePanel(){
}}, function() {
$.post('/config/close_panel','',function(rdata){
layer.msg(rdata.msg,{icon:rdata.status?1:2});
setTimeout(function(){window.location.reload();},1000);
setTimeout(function(){
window.location.reload();
},1000);
},'json');
},function(){
$("#closePl").prop("checked",false);
});
}
//开发模式
function debugMode(){
var loadT = layer.msg('正在发送请求,请稍候...', { icon: 16, time: 0, shade: [0.3, '#000'] });
$.post('/config/open_debug', {}, function (rdata) {
layer.close(loadT);
showMsg(rdata.msg, function(){
window.location.reload();
} ,{icon:rdata.status?1:2}, 1000);
},'json');
}
function modifyAuthPath() {
var auth_path = $("#admin_path").val();
+8
View File
@@ -18,6 +18,14 @@
</div>
</div>
<div class="ss-text pull-left mr50">
<em>开发模式</em>
<div class="ssh-item">
<input class="btswitch btswitch-ios" id="debugMode" type="checkbox" {{data['debug']}}>
<label class="btswitch-btn" for="debugMode" onclick="debugMode()"></label>
</div>
</div>
<div class="ss-text pull-left mr50">
<em title="开启后允许使用ipv6访问面板">监听IPv6</em>
<div class='ssh-item'>