Skip to content

Commit

Permalink
Merge branch '7.x' of http://git.bt.cn:30000/root/linux-panel into 7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
19950219 committed Apr 15, 2022
2 parents 108772e + 75a6b79 commit 16b7426
Show file tree
Hide file tree
Showing 27 changed files with 7,657 additions and 1,095 deletions.
20 changes: 13 additions & 7 deletions BT-Panel
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ if is_debug:
logger.debug('检测到文件: {} -> {}'.format(filename,in_type))

fname = os.path.basename(filename)
if fname in ['task.py','BT-Task']:
if fname in ['BT-Task']:
logger.debug('正在后台任务...')
public.ExecShell("{} {}/BT-Task".format(public.get_python_bin(),_PATH))
if os.path.getsize(filename) < 4096:
public.ExecShell("{} {}/BT-Task".format(public.get_python_bin(),_PATH))
else:
public.ExecShell("{}/BT-Task".format(_PATH))
logger.debug('后台任务已启动!')
else:
logger.debug('正在重启面板...')
Expand Down Expand Up @@ -129,11 +132,14 @@ if __name__ == '__main__':
err_f.close()

import threading
import jobs

job = threading.Thread(target=jobs.control_init)
job.start()

os.system("nohup {} {}/jobs.py &>/dev/null &".format(public.get_python_bin(),public.get_class_path()))
import task
p1 = threading.Thread(target=task.systemTask)
p1.start()
p2 = threading.Thread(target=task.check502Task)
p2.start()
p3 = threading.Thread(target=task.update_software_list)
p3.start()

if is_ssl:
ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
Expand Down
11 changes: 7 additions & 4 deletions BT-Task
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
# | Author: hwliang <[email protected]>
# +-------------------------------------------------------------------

import os,sys
os.chdir('/www/server/panel')
import task
task.main()
import os
os.chdir("/www/server/panel")
os.system("cd task && make")
os.system("chmod 700 /www/server/panel/BT-Task")
os.system("/www/server/panel/BT-Task &")
if os.path.getsize("/www/server/panel/BT-Task") > 4096:
os.system("rm -rf /www/server/panel/task")
15 changes: 15 additions & 0 deletions BTPanel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,24 @@ def panel_warning(pdata=None):
# 首页安全警告
comReturn = comm.local()
if comReturn: return comReturn

get = get_input()
ikey = 'warning_list'
if get.action == 'get_list':
result = cache.get(ikey)
if not result or 'force' in get:
result = public.ExecShell("{} {}/script/warning_list.py".format(public.get_python_bin(),public.get_panel_path()))[0]
try:
json.loads(result)
cache.set(ikey, result, 3600)
except:
result = '{"ignore":[],"risk":[],"security":[]}'
return result,json_header
import panelWarning
dataObject = panelWarning.panelWarning()
defs = ('get_list', 'set_ignore', 'check_find')
if get.action == 'set_ignore':
cache.delete(ikey)
return publicObject(dataObject, defs, None, pdata)


Expand Down
Binary file added BTPanel/static/img/preview/site_scanning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion BTPanel/static/js/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ var controlObj = {
})
// 购买
$('.daily-product-buy a').click(function () {
bt.soft.updata_ltd()
bt.soft.updata_ltd(false, 22);
})
return false;
}
Expand Down
28 changes: 20 additions & 8 deletions BTPanel/static/js/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -6408,19 +6408,25 @@ var product_recommend = {
* @description 获取支付状态
*/
get_pay_status:function(){
var pro_end = parseInt(bt.get_cookie('pro_end') || -1);
var ltd_end = parseInt(bt.get_cookie('ltd_end') || -1);
var is_pay = pro_end >= -1 && ltd_end > -1; // 是否购买付费版本
var pro_end = parseInt(bt.get_cookie('pro_end') || -1)
var ltd_end = parseInt(bt.get_cookie('ltd_end') || -1)
var is_pay = pro_end > -1 || ltd_end > -1; // 是否购买付费版本
var advanced = 'ltd'; // 已购买,企业版优先显示
if(pro_end === -2 || pro_end > -1) advanced = 'pro';
if(ltd_end === -2 || ltd_end > -1) advanced = 'ltd';
var end_time = advanced === 'ltd'? ltd_end:pro_end; // 到期时间
return { advanced: advanced, is_pay:is_pay, end_time:end_time };
},

pay_product_sign:function (type,source) {
bt.set_cookie('pay_source',source)
bt.soft['updata_'+ type ]()
pay_product_sign:function (type, source) {
switch (type) {
case 'pro':
bt.soft['updata_' + type](source);
break;
case 'ltd':
bt.soft['updata_' + type](false, source);
break;
}
},
/**
* @description 获取项目类型
Expand Down Expand Up @@ -6467,8 +6473,14 @@ var product_recommend = {
})
// 立即购买
$('.buyNow').click(function(){
bt.set_cookie('pay_source',config.pay)
bt.soft['updata_' + status.advanced]()
switch (status.advanced) {
case 'pro':
bt.soft['updata_' + status.advanced](config.pay);
break;
case 'ltd':
bt.soft['updata_' + status.advanced](false, config.pay);
break;
}
})
}
})
Expand Down
96 changes: 72 additions & 24 deletions BTPanel/static/js/public_backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4176,6 +4176,12 @@ bt.soft = {
var bt_user_info = bt.get_cookie('bt_user_info'),
ltd_end = bt.get_cookie('ltd_end'),
pro_end = bt.get_cookie('pro_end');

var totalNum = config.totalNum ? config.totalNum : '';
if (totalNum) {
bt.set_cookie('pay_source', parseInt(totalNum));
}

// 判断登录
if (!bt_user_info) {
bt.pub.bind_btname(function () {
Expand Down Expand Up @@ -4539,25 +4545,37 @@ bt.soft = {
_source = 0,
_locahostURL = window.location.pathname;
var pay_source = parseInt(bt.get_cookie('pay_source') || 0)
switch (_locahostURL) {
case '/':
if($('.btpro-gray').length == 1){ //是否免费版
_source = 27;
}else{
_source = 28;
}
break;
case '/control':
_source = 22
break;
case '/soft':
_source = $('.libPay-content-box').data('index');
break;
case '/btwaf/index':
_source = 25
break;
};
if(_source && !pay_source) bt.set_cookie('pay_source', _source);
if (pay_source === 0) {
if ($('.btpro-gray').length == 1) { // 是否免费版
pay_source = 27;
} else {
pay_source = 28;
}
}
// switch (_locahostURL) {
// case '/':
// if($('.btpro-gray').length == 1){ //是否免费版
// _source = 27;
// }else{
// _source = 28;
// }
// break;
// case '/control':
// _source = 22
// break;
// case '/soft':
// case '/site':
// case '/ftp':
// case '/database':
// _source = $('.libPay-content-box').data('index');
// break;
// case '/btwaf/index':
// _source = 25
// break;
// };
// if(_source && !pay_source) bt.set_cookie('pay_source', _source);
// console.log(pay_source)
// console.log(_source)

$(".wx-pay-ico").hide()
$(".libPay-loading").show();
Expand All @@ -4571,7 +4589,7 @@ bt.soft = {
that.pro.create_order({
pid: _product.pid,
cycle: _cycle.cycle,
source: pay_source || _source
source: pay_source
}, function (rdata) {
var start = that.pay_loading.get('start')
var end = that.pay_loading.set('end')
Expand Down Expand Up @@ -4733,7 +4751,11 @@ bt.soft = {
pid: 100000032,
limit: 'ltd'
};
if(num) param['totalNum'] = num
if (typeof num !== 'undefined') {
param['totalNum'] = num;
}
bt.set_cookie('pay_source', num);

if (is_alone || false) $.extend(param, {
source: 5,
is_alone: true
Expand All @@ -4747,7 +4769,8 @@ bt.soft = {
pid: 100000011,
limit: 'pro'
}
if(num) param['totalNum'] = num
if(num) param['totalNum'] = num;
bt.set_cookie('pay_source', num);
bt.soft.product_pay_view(param);
},
//遍历数组和对象
Expand Down Expand Up @@ -8195,12 +8218,37 @@ bt.public = {
layer.close(indexs)
setTimeout(function () { location.reload() },200)
}else{
layer.msg(res.msg,{ icon:res.status?1:2, area:'650px',time:0,shade:.3,closeBtn:2})
// layer.msg(res.msg, { icon:res.status?1:2, time:0, shade:.3, closeBtn:2})
if (res.msg === '此功能为企业版专享功能,请先购买企业版') {
bt.confirm({
title: '提示',
msg: '此功能为企业版专享功能,是否购买企业版?'
}, function () {
bt.soft.updata_pro(51);
});
} else {
layer.msg(res.msg, {
time: 0,
shade: .3,
closeBtn: 2,
maxWidth: 650,
icon: res.status ? 1 : 2
});
}
}
})
}else{
bt.public.modify_mysql_quota({data:JSON.stringify({size:quota_size,db_name:row.name})},function (res) {
bt.msg(res)
if (res.status === false && res.msg === '此功能为企业版专享功能,请先购买企业版') {
bt.confirm({
title: '提示',
msg: '此功能为企业版专享功能,是否购买企业版?'
}, function () {
bt.soft.updata_pro(52);
});
} else {
bt.msg(res)
}
if(res.status){
layer.close(indexs)
setTimeout(function () { location.reload() },200)
Expand Down
Loading

0 comments on commit 16b7426

Please sign in to comment.