From 22915ba97733062dad8743a68b798b93d3d8a7ab Mon Sep 17 00:00:00 2001 From: "bt.cn" <287962566@qq.com> Date: Thu, 1 Aug 2019 16:49:01 +0800 Subject: [PATCH] 6.9.29 --- BTPanel/__init__.py | 2 +- BTPanel/static/js/config.js | 50 ++++++++++++++++++------------ BTPanel/static/js/public_backup.js | 7 +++-- class/common.py | 2 +- class/jobs.py | 12 +++++++ class/panelSite.py | 2 +- 6 files changed, 51 insertions(+), 24 deletions(-) diff --git a/BTPanel/__init__.py b/BTPanel/__init__.py index dbe73cc1..76b1d3dd 100644 --- a/BTPanel/__init__.py +++ b/BTPanel/__init__.py @@ -1015,7 +1015,7 @@ def notfound(e): except IndexError: pass return errorStr,404 -@app.errorhandler(Exception) +@app.errorhandler(500) def internalerror(e): if str(e).find('Permanent Redirect') != -1: return e errorStr = public.ReadFile('./BTPanel/templates/' + public.GetConfigValue('template') + '/error.html') diff --git a/BTPanel/static/js/config.js b/BTPanel/static/js/config.js index b3dd7e37..94d9793a 100644 --- a/BTPanel/static/js/config.js +++ b/BTPanel/static/js/config.js @@ -329,36 +329,48 @@ function SavePanelSSL(){ }); } + function SetDebug() { var status_s = {false:'开启',true:'关闭'} var debug_stat = $("#panelDebug").prop('checked'); - bt.confirm({ title: status_s[debug_stat] + "开发者模式", msg: "您真的要" + status_s[debug_stat]+"开发者模式吗?"}, function () { - var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); - $.post('/config?action=set_debug', {}, function (rdata) { - layer.close(loadT); - if (rdata.status) { - layer.closeAll(); - } - layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - }); - }); + bt.confirm({ + title: status_s[debug_stat] + "开发者模式", + msg: "您真的要"+ status_s[debug_stat]+"开发者模式?", + cancel: function () { + $("#panelDebug").prop('checked',debug_stat); + }}, function () { + var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('/config?action=set_debug', {}, function (rdata) { + layer.close(loadT); + if (rdata.status) layer.closeAll() + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + }); + },function () { + $("#panelDebug").prop('checked',debug_stat); + }); } function set_local() { var status_s = { false: '开启', true: '关闭' } var debug_stat = $("#panelLocal").prop('checked'); - bt.confirm({ title: status_s[debug_stat] + "离线模式", msg: "您真的要" + status_s[debug_stat] + "离线模式?" }, function () { - var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); - $.post('/config?action=set_local', {}, function (rdata) { - layer.close(loadT); - if (rdata.status) { - layer.closeAll(); - } - layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - }); + bt.confirm({ + title: status_s[debug_stat] + "离线模式", + msg: "您真的要"+ status_s[debug_stat] + "离线模式 ?", + cancel: function () { + $("#panelLocal").prop('checked',debug_stat); + }}, function () { + var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] }); + $.post('/config?action=set_local', {}, function (rdata) { + layer.close(loadT); + if (rdata.status) layer.closeAll(); + layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); + }); + },function () { + $("#panelLocal").prop('checked',debug_stat); }); } + if(window.location.protocol.indexOf('https') != -1){ $("#panelSSL").attr('checked',true); } diff --git a/BTPanel/static/js/public_backup.js b/BTPanel/static/js/public_backup.js index f9b23a40..64cbda6d 100644 --- a/BTPanel/static/js/public_backup.js +++ b/BTPanel/static/js/public_backup.js @@ -533,7 +533,7 @@ var bt = layer.msg(msg,btnObj); }, - confirm : function(config,callback){ + confirm : function(config,callback,callback1){ var btnObj = { title:config.title?config.title:false, time : config.time?config.time:0, @@ -541,10 +541,13 @@ var bt = closeBtn: config.closeBtn?config.closeBtn:2, scrollbar:true, shade:0.3, - icon:3 + icon:3, + cancel: (config.cancel?config.cancel:function(){}) }; layer.confirm(config.msg, btnObj, function(index){ if(callback) callback(index); + },function(index){ + if(callback1) callback1(index); }); }, load : function(msg) diff --git a/class/common.py b/class/common.py index 77cd588b..8b4ba08e 100644 --- a/class/common.py +++ b/class/common.py @@ -27,7 +27,7 @@ def init(self): if ua: ua = ua.lower(); if ua.find('spider') != -1 or ua.find('bot') != -1: return redirect('https://www.baidu.com'); - g.version = '6.9.8' + g.version = '6.9.29' g.title = public.GetConfigValue('title') g.uri = request.path session['version'] = g.version; diff --git a/class/jobs.py b/class/jobs.py index 35fb2dfb..39c14af9 100644 --- a/class/jobs.py +++ b/class/jobs.py @@ -65,6 +65,7 @@ def control_init(): clean_session() #set_crond() clean_max_log('/www/server/panel/plugin/rsync/lsyncd.log') + remove_tty1() #清理大日志 @@ -76,6 +77,17 @@ def clean_max_log(log_file,max_size = 104857600,old_line = 100): public.writeFile(log_file,old_body) except:pass +#删除tty1 +def remove_tty1(): + file_path = '/etc/systemd/system/getty@tty1.service' + if not os.path.exists(file_path): return False + if not os.path.islink(file_path): return False + if os.readlink(file_path) != '/dev/null': return False + try: + os.remove(file_path) + except:pass + + #默认禁用指定PHP函数 def disable_putenv(fun_name): try: diff --git a/class/panelSite.py b/class/panelSite.py index c74a0722..28c78708 100644 --- a/class/panelSite.py +++ b/class/panelSite.py @@ -2511,7 +2511,7 @@ def ModifyProxy(self, get): subfilter = json.loads(get.subfilter) if str(proxyUrl[i]["subfilter"]) != str(subfilter): if re.search(sub_rep, ng_conf): - sub_rep = "\s+proxy_set_header\s+Accept-Encoding.*[\n\s\w\_\";]+off;" + sub_rep = "\s+proxy_set_header\s+Accept-Encoding(.|\n)+off;" ng_conf = re.sub(sub_rep,"",ng_conf) # 构造替换字符串