Update config.js

This commit is contained in:
Mr Chen
2024-05-26 13:52:12 +08:00
parent 3523f8d6c8
commit f3f7ef4a3d
+97 -4
View File
@@ -81,10 +81,103 @@ $('input[name="bind_domain"]').change(function(){
});
$('input[name="bind_ssl"]').click(function(){
var open_ssl = $(this).prop("checked");
$.post('/config/set_panel_ssl',{}, function(rdata){
showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000);
},'json');
var panel_ssl = $(this).prop("checked");
$(this).prop("checked",!panel_ssl);
// console.log(panel_ssl);
//开启证书
if (panel_ssl){
layer.open({
type:1,
closeBtn: 1,
title:"开启SSL证书",
area: ['600px','440px'],
btn: ["开启SSL证书访问"],
maxmin:false,
shadeClose: true,
content: '<div class="bt-form" style="padding: 25px 40px;">\
<div style="text-align: center;">\
<h3 style="font-size: 20px;color: #333;margin-left: 5px;">【开启SSL证书】保护面板访问安全</h3>\
</div>\
<ul class="help-info-text c7 pd15" style="color: #333;font-size: 14px;background: #F5F7FA;margin-top: 24px;padding: 10px 20px 10px 20px;border-radius: 2px;">\
<li>自签证书访问步骤:</li>\
<li>1. 部署SSL证书</li>\
<li>2. 浏览器地址栏修改为https://访问</li>\
<li>3. 如提醒风险(正常现象)点击【高级】或【详情】</li>\
<li>4.【继续访问】或【接收风险并继续】</li>\
</ul>\
<div class="pt10" style="margin-top: 20px;">\
<div class="line" style="font-size: 14px;">\
<span class="tname" style="width: 78px;">类型</span>\
<div class="info-r" style="margin-left: 78px;">\
<select class="bt-input-text mr5" name="cert_type" style="width: 440px;">\
<option value="0">自签证书 (推荐,浏览器会提示不安全。可忽略,请放心开启)</option>\
<option value="1">ACME</option>\
</select>\
</div>\
</div>\
<ul class="help-info-text c7 sslSafeTips">\
<li><span>开启后导致面板不能访问,可以点击查看</span></li>\
<li>自签证书不被浏览器信任,显示不安全是正常现象</li>\
</ul>\
</div>\
</div>',
yes: function(){
var cert_type = $('select[name=cert_type]').val();
console.log(cert_type);
if ( cert_type == 0 ){
$.post('/config/set_panel_local_ssl',{'cert_type':cert_type}, function(rdata){
console.log(rdata);
showMsg(rdata.msg,function(){
// window.location.reload();
},{icon:rdata.status?1:2},5000);
},'json');
}
}
});
} else {
//关闭SSL
layer.open({
type:1,
closeBtn: 1,
title:"关闭SSL证书",
area: ['480px','280px'],
btn: ["确定","取消"],
shadeClose: true,
content: '<div class="bt-form" style="padding: 25px 40px;">\
<div class="hint_title" style="font-size: 15px;color: #111;text-align:center;">\
<div class="hint_con">关闭SSL极易被抓包攻击导致账号密码泄露,请勿关闭</div>\
</div>\
<div class="confirm-info-box" style="background-color: #f0f0f0;clear: both;font-size: 14px;height: 105px;line-height: 26px;padding: 20px 20px;margin-top: 20px;">\
<div>请手动输入【<span style="color: #fc6d26;">我要关闭</span>】,完成验证</div>\
<input onpaste="return false;" id="prompt_input_box" style="height: 30px;line-height: 30px;margin-top: 5px;width: 360px;color: #444;outline: none;border: 1px solid #ccc;padding: 0 5px;" type="text" value="" autocomplete="off">\
</div>\
</div>',
yes: function(index){
var val = $('#prompt_input_box').val();
if (val != '我要关闭'){
layer.msg("关闭SSL失败!");
return;
}
$.post('/config/close_panel_ssl',{}, function(rdata){
var to_http = window.location.href.replace('https','http');
showMsg(rdata.msg,function(){
window.location.href = to_http;
},{icon:rdata.status?1:2},3000);
},'json');
}
});
}
// $.post('/config/set_panel_ssl',{}, function(rdata){
// showMsg(rdata.msg,function(){
// window.location.reload();
// },{icon:rdata.status?1:2},2000);
// },'json');
});
/** op **/