Skip to content

Commit

Permalink
6.9.29
Browse files Browse the repository at this point in the history
  • Loading branch information
showpy committed Aug 1, 2019
1 parent faf39a6 commit 22915ba
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 24 deletions.
2 changes: 1 addition & 1 deletion BTPanel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
50 changes: 31 additions & 19 deletions BTPanel/static/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 5 additions & 2 deletions BTPanel/static/js/public_backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,18 +533,21 @@ 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,
shadeClose: config.shadeClose?config.shadeClose:true,
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)
Expand Down
2 changes: 1 addition & 1 deletion class/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions class/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def control_init():
clean_session()
#set_crond()
clean_max_log('/www/server/panel/plugin/rsync/lsyncd.log')
remove_tty1()


#清理大日志
Expand All @@ -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/[email protected]'
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:
Expand Down
2 changes: 1 addition & 1 deletion class/panelSite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

# 构造替换字符串
Expand Down

0 comments on commit 22915ba

Please sign in to comment.