Skip to content

Commit

Permalink
7.1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
showpy committed Dec 4, 2019
1 parent 027c562 commit b1d6185
Show file tree
Hide file tree
Showing 27 changed files with 883 additions and 554 deletions.
288 changes: 225 additions & 63 deletions BTPanel/__init__.py

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions BTPanel/static/js/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ function GetFiles(Path, sort) {
}
}

var old_scroll_top = 0;
if (getCookie('Path') === Path) {
old_scroll_top = $(".oldTable").scrollTop();
}

var sorted = '';
var reverse = '';
if (!sort) {
Expand Down Expand Up @@ -577,7 +582,7 @@ function GetFiles(Path, sort) {
shtml += '<li style="text-align: center;"><a href="javascript: ;" onclick="set_file_store(\'' + rdata.PATH + '\')">管理收藏夹</a></li></ul></div>'

BarTools += shtml;

var copyName = getCookie('copyFileName');
var cutName = getCookie('cutFileName');
var isPaste = (copyName == 'null') ? cutName : copyName;
Expand All @@ -591,11 +596,13 @@ function GetFiles(Path, sort) {
if (isBatch == 1 || isBatch == '1') {
BatchTools += ' <button onclick="javascript:BatchPaste();" class="btn btn-default btn-sm">' + lan.files.paste_all + '</button>';
}


$("#Batch").html(BatchTools);
$("#setBox").prop("checked", false);

$("#BarTools").html(BarTools);

$(".oldTable").scrollTop(old_scroll_top);
$("input[name=id]").click(function () {
if ($(this).prop("checked")) {
$(this).prop("checked", true);
Expand Down
6 changes: 4 additions & 2 deletions BTPanel/static/js/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ var aceEditor = {
var _this = this;
$(window).resize(function(){
var _id = $('.ace_conter_menu .active').attr('data-id');
aceEditor.editor['ace_editor_'+_id].ace.resize();
_this.setEditorView()
if(_id != undefined){
aceEditor.editor['ace_editor_'+_id].ace.resize();
_this.setEditorView()
}
})
$(document).click(function(e){
$('.ace_toolbar_menu').hide();
Expand Down
44 changes: 34 additions & 10 deletions BTPanel/static/js/public_backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4626,18 +4626,42 @@ bt.site = {
},
get_site_ssl:function(siteName,callback){
var loadT = bt.load(lan.site.the_msg);
bt.send('GetSSL','site/GetSSL',{siteName:siteName},function(rdata){
loadT.close();
if(callback) callback(rdata);
})
bt.send('GetSSL', 'site/GetSSL', { siteName: siteName }, function (rdata) {
loadT.close();
if (callback) callback(rdata);
});
},
create_let:function(data,callback){
var loadT = bt.load(lan.site.ssl_apply_2);
bt.send('CreateLet','site/CreateLet',data,function(rdata){
loadT.close();
if(callback) callback(rdata);
})
},
var loadT = layer.open({
title: false,
type:1,
closeBtn:0,
shade: 0.3,
area: "500px",
offset: "30%",
content: "<pre style='margin-bottom: 0px;height:250px;text-align: left;background-color: #000;color: #fff;white-space: pre-wrap;' id='create_lst'>正在准备申请证书...</pre>",
success:function(layers,index){
bt.site.get_let_logs();
bt.send('CreateLet', 'site/CreateLet', data, function (rdata) {
layer.close(loadT);
if (callback) callback(rdata);
});
}
});
},
get_let_logs: function () {
bt.send('get_lines','ajax/get_lines',{
num: 10,
filename: "/www/server/panel/logs/letsencrypt.log"
},function(rdata){
if ($("#create_lst").text() === "") return;
if (rdata.status === true) {
$("#create_lst").text(rdata.msg);
$("#create_lst").scrollTop($("#create_lst")[0].scrollHeight);
}
setTimeout(function () { bt.site.get_let_logs(); }, 1000);
});
},
get_dns_api:function(callback){
var loadT = bt.load();
bt.send('GetDnsApi','site/GetDnsApi',{},function(rdata){
Expand Down
11 changes: 8 additions & 3 deletions BTPanel/static/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -1587,9 +1587,9 @@ var site = {
var area_size = '500px';
var err_info = "";

if (!new_data.msg[1].challenges[1]) {
if (new_data.msg[1].challenges[0]) {
new_data.msg[1].challenges[1] = new_data.msg[1].challenges[0]
if (!ldata.msg[1].challenges[1]) {
if (ldata.msg[1].challenges[0]) {
ldata.msg[1].challenges[1] = ldata.msg[1].challenges[0]
}
}

Expand Down Expand Up @@ -1629,6 +1629,11 @@ var site = {
site.reload();
bt.msg(ret);
} else {
if (ret.msg[1] === false) {
layer.msg(ret.msg[0], { icon: 2 });
return;
}

if (!ret.msg[1].challenges[1]) {
if (ret.msg[1].challenges[0]) {
ret.msg[1].challenges[1] = ret.msg[1].challenges[0]
Expand Down
6 changes: 3 additions & 3 deletions BTPanel/static/language/Simplified_Chinese/log.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"MYSQL_CHECK_ERR": "检测到MySQL配置文件异常,可能导致mysqld服务无法正常启动,已自动修复!",
"SYS_EXEC_ERR": "执行失败: {1}",
"SYS_EXEC_SUCCESS": "{1}执行成功",
"LOGIN_ERR_CODE": "<a style='color:red;'>验证码错误</a>,帐号:{1},验证码:{2},登录IP:{3}",
"LOGIN_ERR_PASS": "<a style='color:red;'>密码错误</a>,帐号:{1},密码:{2},登录IP:{3}",
"LOGIN_SUCCESS": "<a style='color:green;'>登录成功</a>,帐号:{1},登录IP:{2}"
"LOGIN_ERR_CODE": "验证码错误,帐号:{1},验证码:{2},登录IP:{3}",
"LOGIN_ERR_PASS": "密码错误,帐号:{1},密码:{2},登录IP:{3}",
"LOGIN_SUCCESS": "登录成功,帐号:{1},登录IP:{2}"
}
4 changes: 2 additions & 2 deletions BTPanel/templates/default/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ <h3 class="mypcip"><span class="f14 cw">{{session['address']}}</span></h3>
msg_body += '<div class="mw-con">\
<ul class="waiting-down-list">\
<li>\
<div class="down-filse-name"><span class="fname" style="width:80%;" title="正在下载: '+ task_list[i].other + '">正在下载: ' + task_list[i].other + '</span><span style="position: absolute;left: 84%;top: 25px;color: #999;">' + task_list[i].log.pre + '%</span><span class="btlink" onclick="remove_task(' + task_list[i].id + ')" style="position: absolute;top: 25px;right: 20px;">取消</span></div>\
<div class="down-filse-name"><span class="fname" style="width:80%;" title="正在下载: '+ task_list[i].shell + '">正在下载: ' + task_list[i].shell + '</span><span style="position: absolute;left: 84%;top: 25px;color: #999;">' + task_list[i].log.pre + '%</span><span class="btlink" onclick="remove_task(' + task_list[i].id + ')" style="position: absolute;top: 25px;right: 20px;">取消</span></div>\
<div class="down-progress"><div class="done-progress" style="width:'+ task_list[i].log.pre + '%"></div></div>\
<div class="down-info"><span class="total-size"> '+ ToSize(task_list[i].log.used) + '/' + ToSize(task_list[i].log.total) + '</span><span class="speed-size">' + (task_list[i].log.speed==0?'正在连接..':ToSize(task_list[i].log.speed)) +'/s</span></div>\
<div class="down-info"><span class="total-size"> '+ task_list[i].log.used + '/' + ToSize(task_list[i].log.total) + '</span><span class="speed-size">' + (task_list[i].log.speed == 0 ? '正在连接..' : task_list[i].log.speed) + '/s</span><span style="margin-left: 20px;">预计还要: ' + task_list[i].log.time +'</span></div>\
</li>\
</ul>\
</div>'
Expand Down
7 changes: 6 additions & 1 deletion class/ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,11 @@ def php_info(self,args):
del(result['modules'])
del(result['ini'])
return result


#取指定行
def get_lines(self,args):
if not os.path.exists(args.filename): return public.returnMsg(False,'指定日志文件不存在!')
s_body = public.ExecShell("tail -n {} {}".format(args.num,args.filename))[0]
return public.returnMsg(True,s_body)


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 = '7.0.3'
g.version = '7.1.13'
g.title = public.GetConfigValue('title')
g.uri = request.path
session['version'] = g.version;
Expand Down
23 changes: 9 additions & 14 deletions class/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,16 +500,16 @@ def SyncToDatabases(self,get):

#配置
def mypass(self,act,root):
public.ExecShell("sed -i '/user=root/d' /etc/my.cnf")
public.ExecShell("sed -i '/password=/d' /etc/my.cnf")
conf_file = '/etc/my.cnf'
public.ExecShell("sed -i '/user=root/d' {}".format(conf_file))
public.ExecShell("sed -i '/password=/d' {}".format(conf_file))
if act:
mycnf = public.readFile('/etc/my.cnf');
rep = "\[mysqldump\]\nuser=root"
sea = "[mysqldump]\n"
subStr = sea + "user=root\npassword=\"" + root + "\"\n";
if type(mycnf)==bool:return False
mycnf = mycnf.replace(sea,subStr)
if len(mycnf) > 100: public.writeFile('/etc/my.cnf',mycnf);
mycnf = public.readFile(conf_file);
src_dump = "[mysqldump]\n"
sub_dump = src_dump + "user=root\npassword=\"{}\"\n".format(root);
if not mycnf: return False
mycnf = mycnf.replace(src_dump,sub_dump)
if len(mycnf) > 100: public.writeFile(conf_file,mycnf);
return True
return True

Expand All @@ -530,11 +530,6 @@ def ToDataBase(self,find):
#password = find['password']

self.__CreateUsers(find['name'],find['username'],password,find['accept'])
#panelMysql.panelMysql().execute("drop user '" + find['username'] + "'@'localhost'")
#panelMysql.panelMysql().execute("drop user '" + find['username'] + "'@'" + find['accept'] + "'")
#panelMysql.panelMysql().execute("grant all privileges on " + find['name'] + ".* to '" + find['username'] + "'@'localhost' identified by '" + password + "'")
#panelMysql.panelMysql().execute("grant all privileges on " + find['name'] + ".* to '" + find['username'] + "'@'" + find['accept'] + "' identified by '" + password + "'")
#panelMysql.panelMysql().execute("flush privileges")
return 1


Expand Down
7 changes: 6 additions & 1 deletion class/fastcgi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ def __waitForResponse(self, requestId):
if response['type'] == self.FCGI_STATE_SUCCESS:
self.requests[requestId]
if self.requests[requestId]['response'].find('\r\n\r\n') != -1:
self.requests[requestId]['response'] = self.requests[requestId]['response'].split('\r\n\r\n')[1]
tmp = ""
tmp2 = self.requests[requestId]['response'].split('\r\n\r\n')
for i in range(len(tmp2)):
if i == 0: continue
tmp += tmp2[i] + '\r\n\r\n'
self.requests[requestId]['response'] = tmp.strip()
return self.requests[requestId]['response']

def __repr__(self):
Expand Down
Loading

0 comments on commit b1d6185

Please sign in to comment.