Skip to content

Commit

Permalink
update 6.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jose committed Jul 30, 2019
1 parent 3fe1491 commit 1ea4c50
Show file tree
Hide file tree
Showing 14 changed files with 900 additions and 436 deletions.
6 changes: 5 additions & 1 deletion BTPanel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from werkzeug.wrappers import Response
from flask_socketio import SocketIO,emit,send
dns_client = None
app.config['DEBUG'] = os.path.exists('data/debug.pl')

#设置BasicAuth
basic_auth_conf = 'config/basic_auth.json'
Expand Down Expand Up @@ -413,9 +414,11 @@ def config(pdata = None):
data['basic_auth'] = c_obj.get_basic_auth_stat(None)
data['basic_auth']['value'] = public.GetMsg("CLOSE")
if data['basic_auth']['open']: data['basic_auth']['value'] = public.GetMsg("OPEN")
data['debug'] = ''
if app.config['DEBUG']: data['debug'] = 'checked'
return render_template( 'config.html',data=data)
import config
defs = ('get_panel_error_logs','clean_panel_error_logs','get_basic_auth_stat','set_basic_auth','get_cli_php_version','get_tmp_token','set_cli_php_version','DelOldSession', 'GetSessionCount', 'SetSessionConf', 'GetSessionConf','get_ipv6_listen','set_ipv6_status','GetApacheValue','SetApacheValue','GetNginxValue','SetNginxValue','get_token','set_token','set_admin_path','is_pro','get_php_config','get_config','SavePanelSSL','GetPanelSSL','GetPHPConf','SetPHPConf','GetPanelList','AddPanelInfo','SetPanelInfo','DelPanelInfo','ClickPanelInfo','SetPanelSSL','SetTemplates','Set502','setPassword','setUsername','setPanel','setPathInfo','setPHPMaxSize','getFpmConfig','setFpmConfig','setPHPMaxTime','syncDate','setPHPDisable','SetControl','ClosePanel','AutoUpdatePanel','SetPanelLock')
defs = ('get_cert_source','set_debug','get_panel_error_logs','clean_panel_error_logs','get_basic_auth_stat','set_basic_auth','get_cli_php_version','get_tmp_token','set_cli_php_version','DelOldSession', 'GetSessionCount', 'SetSessionConf', 'GetSessionConf','get_ipv6_listen','set_ipv6_status','GetApacheValue','SetApacheValue','GetNginxValue','SetNginxValue','get_token','set_token','set_admin_path','is_pro','get_php_config','get_config','SavePanelSSL','GetPanelSSL','GetPHPConf','SetPHPConf','GetPanelList','AddPanelInfo','SetPanelInfo','DelPanelInfo','ClickPanelInfo','SetPanelSSL','SetTemplates','Set502','setPassword','setUsername','setPanel','setPathInfo','setPHPMaxSize','getFpmConfig','setFpmConfig','setPHPMaxTime','syncDate','setPHPDisable','SetControl','ClosePanel','AutoUpdatePanel','SetPanelLock')
return publicObject(config.config(),defs,None,pdata);

@app.route('/ajax',methods=method_all)
Expand Down Expand Up @@ -918,6 +921,7 @@ def connected_msg(msg):


def check_csrf():
if app.config['DEBUG']: return True
request_token = request.cookies.get('request_token')
if session['request_token'] != request_token: return False
http_token = request.headers.get('x-http-token')
Expand Down
151 changes: 82 additions & 69 deletions BTPanel/static/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -582,74 +582,6 @@ html {
overflow: hidden
}

.sidebar-auto {
overflow: auto;
height: 100%;
margin-right: -18px
}

.mypcip {
display: block;
padding: 0 10px;
position: relative;
transition-duration: 500ms;
transition-property: background;
transition-timing-function: ease;
width: 100%;
cursor: pointer;
margin: 1px 0
}

.mypcip:hover {
background: #20a53a;
opacity: 1
}

.mypcip span {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAQCAYAAAAS7Y8mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAdgAAAHYBTnsmCAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAGPSURBVDiNldQ9ixRBEAbgZ3Zn1fVOuQU/wK9AMDDS1MvuRxj5CwTBP2CiYmYmGBsYGRsaa2qkkSiCgRd4y3ri3XqzbdDV7Lgs7uwLRc90V1dXv29VVymluxiiRoVkNaoYG7wN+9chpTTBBn7jKA5YhYR+JPQEDxYd6rAPeIwDnOgQuMEIz3F8mUMdC9/wqkPAxb1P0Yv/6ziLX/hTy9c6jXPYXSPwBQywF+Mz7GCCSRGMbqK1Ufwbmb4beI9TuNZFqFWoZCH7Mp0XcaX33y3dUDKfmRdD1bM+BYuoWtaEKeIdyqSvg5+RZSWX6Ri3ZUqmRbxjcqnsx3cyF7Utbpmf4YxcapXcWFNcjiSbOk7Yxhu5BocRaGBeoyXYNII32MTJsJ7cvR/D92aN1xFsFA6HYZ/iiiWjTVyVGyrhBz7jXSQxxq3wPahxJ7JuX30sd9IoshviC77KzdSmag+XYm4QNq0tF+0e7sc1SwPs4xFeLPHvt2ibsfwl24rFl/KLV/jdCho2ZC3a+I6HOB9rR38B10ZjDE49T6kAAAAASUVORK5CYII=") no-repeat 0 center;
display: inline-block;
line-height: 46px;
padding-left: 30px;
white-space: nowrap;
max-width: 146px;
overflow: hidden;
}

.btpc-plus {
line-height: 40px;
color: #aaa;
font-family: arial;
font-size: 26px;
cursor: pointer;
padding-left: 80px;
transition-duration: 500ms;
transition-property: background;
transition-timing-function: ease
}

.btpc-plus:hover {
background-color: #20a53a;
color: #fff
}

.mypcip .btedit {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAFVSURBVDiNndO/ahRRFMfxz+zOav6goKC1S54gBBUECy0lIKTeyrXwFcROyBuENCHdNhaCoCgiWoggGPAJxFgIsbEJJBmTrCfFnBFZNjHrDy4z5849935/Z84tIsJ/6gneFhFR4AHuYHjM4jN4iZWM13ALSyWWcR+rOERrzAYFNvP9Ka7jKrZExKeIWI8IpxivIuJrRFxo5lqJXfzDbwfvcQU3cAnTUOIsfif6zeYDfuEDzuM5LuIatrGBu/hcInCAy1mH2STawyLmknI+56bykFZDsJsUP7CAdhIMUeELXo9YGmbOn4o3Nah6vd5Ot9vd6ff7lfr3dXKMVZnIVVp4MRgMZtLW6LpneJhxpB1lJnfwE49yblRtfPsrLhoLpbqA7fT15jjUERXNQeO6biK11DXYnyCnymdIjI+4jXuJdlJXHqq7cArf620izkXEu5hMj5u7cAQCwbENi6a1WQAAAABJRU5ErkJggg==) no-repeat center center;
width: 16px;
height: 16px;
display: none;
position: absolute;
left: 156px;
top: 14px
}

.mypcip:hover .btedit {
display: block
}





.task {
position: absolute;
right: 6px;
Expand Down Expand Up @@ -5209,4 +5141,85 @@ select[disabled]{
border-bottom: 2px solid #20a53a;
color: #20a53a;
font-weight: bold;
}
}

.ssl_cert_from .layui-layer-ico{
width: 30px;
height: 30px;
display: inline-block;
position: absolute;
left: 50px;
}
.ssl_cert_from h3{
font-weight: bolder;
font-size: 18px;
margin-left: 75px;
display: inline-block;
height: 30px;
line-height: 30px;
}

.ssl_cert_from ul{
border: 1px solid #ececec;
border-radius: 10px;
margin: 0 auto;
margin-top: 20px;
margin-bottom: 20px;
background: #f7f7f7;
width: 80%;
padding: 15px;
list-style-type: inherit;
}

.ssl_cert_from ul li:nth-child(0){
margin-top: 12px;
color:red;
}
.ssl_cert_from ul li{
margin-left: 20px;
height: 25px;
line-height: 25px;
}
.ssl_cert_from>.line{
padding-top: 15px;
border-top: 1px solid #ececec;
width: 81%;
margin: 0 auto;
margin-top: 15px;
padding-bottom: 15px;
border-bottom: 1px solid #ececec;
}
.ssl_cert_from>.line .tname{
width:105px;
}

.ssl_cert_from>.line .info-r{
margin-left:70px;
height:30px;
line-height:30px;
}



.ssl_cert_from label{
font-weight: 400;
margin: 3px 5px 0px;
vertical-align: top;
}
.ssl_cert_from .details{
padding-top:10px;
width:80%;
margin:0 auto;
}
.ssl_cert_from .details a{
float: right;
position: relative;
top: 3px;
}

.ssl_cert_from>.line .line {
padding-bottom:0;
}
.ssl_cert_from>.line .line .info-r{
margin-bottom:0;
}
163 changes: 127 additions & 36 deletions BTPanel/static/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,41 +176,111 @@ function setTemplate(){

//设置面板SSL
function setPanelSSL(){
var status = $("#sshswitch").prop("checked")==true?1:0;
var msg = $("#panelSSL").attr('checked')?lan.config.ssl_close_msg:'<a style="font-weight: bolder;font-size: 16px;">'+lan.config.ssl_open_ps+'</a><li style="margin-top: 12px;color:red;">'+lan.config.ssl_open_ps_1+'</li><li>'+lan.config.ssl_open_ps_2+'</li><li>'+lan.config.ssl_open_ps_3+'</li><p style="margin-top: 10px;"><input type="checkbox" id="checkSSL" /><label style="font-weight: 400;margin: 3px 5px 0px;" for="checkSSL">'+lan.config.ssl_open_ps_4+'</label><a target="_blank" class="btlink" href="https://www.bt.cn/bbs/thread-4689-1-1.html" style="float: right;">'+lan.config.ssl_open_ps_5+'</a></p>';
layer.confirm(msg,{title:lan.config.ssl_title,closeBtn:2,icon:3,area:'550px',cancel:function(){
if(status == 0){
$("#panelSSL").prop("checked",false);
}
else{
$("#panelSSL").prop("checked",true);
}
}},function(){
if(window.location.protocol.indexOf('https') == -1){
if(!$("#checkSSL").prop('checked')){
layer.msg(lan.config.ssl_ps,{icon:2});
return false;
}
}
var loadT = layer.msg(lan.config.ssl_msg,{icon:16,time:0,shade: [0.3, '#000']});
$.post('/config?action=SetPanelSSL','',function(rdata){
layer.close(loadT);
layer.msg(rdata.msg,{icon:rdata.status?1:5});
if(rdata.status === true){
$.get('/system?action=ReWeb',function(){});
setTimeout(function(){
window.location.href = ((window.location.protocol.indexOf('https') != -1)?'http://':'https://') + window.location.host + window.location.pathname;
},1500);
}
});
},function(){
if(status == 0){
$("#panelSSL").prop("checked",false);
}
else{
$("#panelSSL").prop("checked",true);
}
});
var status = $("#panelSSL").prop("checked");
var loadT = layer.msg(lan.config.ssl_msg,{icon:16,time:0,shade: [0.3, '#000']});
if(status){
var confirm = layer.confirm('Whether to close the panel SSL certificate', {title:'Tips',btn: ['Confirm','Cancel'],icon:0,closeBtn:2}, function() {
bt.send('SetPanelSSL', 'config/SetPanelSSL', {}, function (rdata) {
layer.close(loadT);
if (rdata.status) {
layer.msg(rdata.msg,{icon:1});
$.get('/system?action=ReWeb', function () {
});
setTimeout(function () {
window.location.href = ((window.location.protocol.indexOf('https') != -1) ? 'http://' : 'https://') + window.location.host + window.location.pathname;
}, 1500);
}
else {
layer.msg(res.rdata,{icon:2});
}
});
return;
})
}
else {
bt.send('get_cert_source', 'config/get_cert_source', {}, function (rdata) {
layer.close(loadT);
var sdata = rdata;
var _data = {
title: 'Panel SSL',
area: '630px',
class:'ssl_cert_from',
list: [
{
html:'<div><i class="layui-layer-ico layui-layer-ico3"></i><h3>'+lan.config.ssl_open_ps+'</h3><ul><li style="color:red;">'+lan.config.ssl_open_ps_1+'</li><li>'+lan.config.ssl_open_ps_2+'</li><li>'+lan.config.ssl_open_ps_3+'</li></ul></div>'
},
{
title: 'Cert Type',
name: 'cert_type',
type: 'select',
width: '200px',
value: sdata.cert_type,
items: [{value: '1', title: 'Self-signed certificate'}, {value: '2', title: 'Let\'s Encrypt'}],
callback: function (obj) {
var subid = obj.attr('name') + '_subid';
$('#' + subid).remove();
if (obj.val() == '2') {
var _tr = bt.render_form_line({
title: 'Admin E-Mail',
name: 'email',
width: '320px',
placeholder: 'Admin E-Mail',
value: sdata.email
});
obj.parents('div.line').append('<div class="line" id=' + subid + '>' + _tr.html + '</div>');
}
}
},
{
html:'<div class="details"><input type="checkbox" id="checkSSL" /><label style="font-weight: 400;margin: 3px 5px 0px;" for="checkSSL">'+lan.config.ssl_open_ps_4+'</label><a target="_blank" class="btlink" href="https://forum.aapanel.com/d/167-common-problems-after-opening-the-panel-certificate">'+lan.config.ssl_open_ps_5+'</a></p></div>'
}

],
btns: [
{
title: 'Close', name: 'close', callback: function (rdata, load, callback) {
load.close();
$("#panelSSL").prop("checked", false);
}
},
{
title: 'Submit', name: 'submit', css: 'btn-success', callback: function (rdata, load, callback) {
if(!$('#checkSSL').is(':checked')){
bt.msg({status:false,msg:'Please confirm the risk first!'})
return;
}
var confirm = layer.confirm('Whether to open the panel SSL certificate', {title:'Tips',btn: ['Confirm','Cancel'],icon:0,closeBtn:2}, function() {
var loading = bt.load();
bt.send('SetPanelSSL', 'config/SetPanelSSL', rdata, function (rdata) {
loading.close()
if (rdata.status) {
layer.msg(rdata.msg,{icon:1});
$.get('/system?action=ReWeb', function () {
});
setTimeout(function () {
window.location.href = ((window.location.protocol.indexOf('https') != -1) ? 'http://' : 'https://') + window.location.host + window.location.pathname;
}, 1500);
}
else {
layer.msg(rdata.msg,{icon:2});
}
})
});
}

}
],
end: function () {
$("#panelSSL").prop("checked", false);
}
};

var _bs = bt.render_form(_data);
setTimeout(function () {
$('.cert_type' + _bs).trigger('change')
}, 200);
});
}
}

function GetPanelSSL(){
Expand Down Expand Up @@ -261,8 +331,29 @@ function SavePanelSSL(){
});
}

function SetDebug() {
var status_s = {false:'Open',true:'Close'}
var debug_stat = $("#panelDebug").prop('checked');
bt.confirm({
title: status_s[debug_stat] + "Developer mode",
msg: "Do you really want "+ status_s[debug_stat]+" developer mode?",
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 () {
console.log('index.html');
$("#panelDebug").prop('checked',debug_stat);
});
}

if(window.location.protocol.indexOf('https') != -1){
$("#panelSSL").attr('checked',true);
$("#panelSSL").prop('checked',true);
}

var weChat = {
Expand Down
Loading

0 comments on commit 1ea4c50

Please sign in to comment.