Skip to content

Commit

Permalink
7.1.15-3
Browse files Browse the repository at this point in the history
  • Loading branch information
showpy committed Dec 23, 2019
1 parent 20b6279 commit 8659709
Show file tree
Hide file tree
Showing 6 changed files with 286 additions and 254 deletions.
30 changes: 28 additions & 2 deletions BTPanel/static/js/crontab.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,9 +910,35 @@ function toFile(){

//从脚本
function toShell(){
var tBody = "<textarea class='txtsjs bt-input-text' name='sBody'></textarea>";
var shell_body = '';
var shell_name = '';
if($("b[val='toShell']").text() === '同步时间'){
shell_name = '定期同步服务器时间';
shell_body = 'echo "|-正在尝试从0.pool.bt.cn同步时间..";\n\
ntpdate -u 0.pool.bt.cn\n\
if [ $? = 1 ];then\n\
echo "|-正在尝试从1.pool.bt.cn同步时间..";\n\
ntpdate -u 1.pool.bt.cn\n\
fi\n\
if [ $? = 1 ];then\n\
echo "|-正在尝试从0.asia.pool.ntp.org同步时间..";\n\
ntpdate -u 0.asia.pool.ntp.org\n\
fi\n\
if [ $? = 1 ];then\n\
echo "|-正在尝试从www.bt.cn同步时间..";\n\
getBtTime=$(curl -sS --connect-timeout 3 -m 60 http://www.bt.cn/api/index/get_time)\n\
if [ "${getBtTime}" ];then \n\
date -s "$(date -d @$getBtTime +"%Y-%m-%d %H:%M:%S")"\n\
fi\n\
fi\n\
echo "|-正在尝试将当前系统时间写入硬件..";\n\
hwclock -w\n\
date\n\
echo "|-时间同步完成!";'
}
var tBody = "<textarea class='txtsjs bt-input-text' name='sBody' style='margin: 0px; width: 445px; height: 90px;line-height: 16px;'>"+shell_body+"</textarea>";
$("#implement").html(tBody);
$(".planname input[name='name']").removeAttr('readonly style').val("");
$(".planname input[name='name']").removeAttr('readonly style').val(shell_name);
}

function toPath() {
Expand Down
5 changes: 4 additions & 1 deletion BTPanel/templates/default/crontab.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ <h3 class="f16">{{data['lan']['H3']}}</h3>
<li>
<a role="menuitem" tabindex="-1" href="javascript:;" value="path">备份目录</a>
</li>
<li>
<a role="menuitem" tabindex="-1" href="javascript:;" value="toShell">同步时间</a>
</li>
<li>
<a role="menuitem" tabindex="-1" href="javascript:;" value="rememory">{{data['lan']['TT5']}}</a>
</li>
Expand All @@ -44,7 +47,7 @@ <h3 class="f16">{{data['lan']['H3']}}</h3>
</li>
</ul>
</div>
<span class="planSign"><i>*</i>{{data['lan']['PS']}}</span>
<span class="planSign"><i>*</i>{{data['lan']['PS']}}、备份目录、同步时间</span>
</div>
<div class="clearfix plan">
<span class="typename c4 pull-left f14 text-right mr20">{{data['lan']['T2']}}</span>
Expand Down
10 changes: 6 additions & 4 deletions class/acme_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,9 @@ def get_account_key(self):
self._config['account'][k] = {}

if not 'key' in self._config['account'][k]:
self._config['account'][k]['key'] = self.create_key().encode()
self._config['account'][k]['key'] = self.create_key()
if type(self._config['account'][k]['key']) == bytes:
self._config['account'][k]['key'] = self._config['account'][k]['key'].decode()
self.save_config()
return self._config['account'][k]['key']

Expand All @@ -1120,10 +1122,12 @@ def create_certificate_key(self, index):
return self._config['orders'][index]['private_key']
# 创建新的私钥
private_key = self.create_key()
if type(private_key) == bytes:
private_key = private_key.decode()
# 保存私钥到订单配置文件
self._config['orders'][index]['private_key'] = private_key
self.save_config()
return private_key.decode()
return private_key

# 创建Key
def create_key(self, key_type=OpenSSL.crypto.TYPE_RSA):
Expand Down Expand Up @@ -1322,8 +1326,6 @@ def echo_err(msg):
exit()

# 写日志


def write_log(log_str, mode="ab+"):
if __name__ == "__main__":
print(log_str)
Expand Down
Loading

0 comments on commit 8659709

Please sign in to comment.