From 5a93b07968440bb7a99b93f265d6a22402db229b Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 19 Sep 2022 20:47:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=BC=80=E5=8F=91=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + class/core/config_api.py | 16 +++++++++++++++- route/static/app/config.js | 15 ++++++++++++++- route/templates/default/config.html | 8 ++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d09f3ecf6..1bce39313 100644 --- a/.gitignore +++ b/.gitignore @@ -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* diff --git a/class/core/config_api.py b/class/core/config_api.py index 0e09a4b45..72821da45 100755 --- a/class/core/config_api.py +++ b/class/core/config_api.py @@ -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' diff --git a/route/static/app/config.js b/route/static/app/config.js index a9137eb53..61feae9f1 100755 --- a/route/static/app/config.js +++ b/route/static/app/config.js @@ -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(); diff --git a/route/templates/default/config.html b/route/templates/default/config.html index 8ada07c7a..e6b068a45 100755 --- a/route/templates/default/config.html +++ b/route/templates/default/config.html @@ -18,6 +18,14 @@ +
+ 开发模式 +
+ + +
+
+
监听IPv6