This commit is contained in:
midoks
2022-11-14 13:35:22 +08:00
parent efb148db2e
commit 80560f3763
4 changed files with 42 additions and 40 deletions
+1 -1
View File
@@ -315,7 +315,7 @@ class cert_request:
return OpenSSL.crypto.sign(pk, message.encode("utf8"), self.__digest)
def getSiteRunPathByid(self, site_id):
if mw.M('sites').where('id=? and project_type=?', (site_id, 'PHP')).count() >= 1:
if mw.M('sites').where('id=?', (site_id,)).count() >= 1:
site_path = public.M('sites').where(
'id=?', site_id).getField('path')
if not site_path:
+1 -1
View File
@@ -933,7 +933,7 @@ def makeConf():
file = getRunDir() + '/data/json/config.json'
if not os.path.exists(file):
c = {}
c['title'] = '祖龙面板'
c['title'] = '猫王面板'
c['home'] = 'http://github/midoks/mdserver-web'
c['recycle_bin'] = True
c['template'] = 'default'
+19 -21
View File
@@ -30,32 +30,30 @@ class site_api:
def __init__(self):
# nginx conf
self.setupPath = mw.getServerDir() + '/web_conf'
self.vhostPath = vh = self.setupPath + '/nginx/vhost'
if not os.path.exists(vh):
mw.execShell("mkdir -p " + vh + " && chmod -R 755 " + vh)
self.rewritePath = rw = self.setupPath + '/nginx/rewrite'
if not os.path.exists(rw):
mw.execShell("mkdir -p " + rw + " && chmod -R 755 " + rw)
self.passPath = self.setupPath + '/nginx/pass'
# if not os.path.exists(pp):
# mw.execShell("mkdir -p " + rw + " && chmod -R 755 " + rw)
self.redirectPath = self.setupPath + '/nginx/redirect'
if not os.path.exists(self.redirectPath):
mw.execShell("mkdir -p " + self.redirectPath +
" && chmod -R 755 " + self.redirectPath)
self.vhostPath = vhost = self.setupPath + '/nginx/vhost'
if not os.path.exists(vhost):
mw.execShell("mkdir -p " + vhost + " && chmod -R 755 " + vhost)
self.rewritePath = rewrite = self.setupPath + '/nginx/rewrite'
if not os.path.exists(rewrite):
mw.execShell("mkdir -p " + rewrite + " && chmod -R 755 " + rewrite)
self.proxyPath = self.setupPath + '/nginx/proxy'
if not os.path.exists(self.proxyPath):
mw.execShell("mkdir -p " + self.proxyPath +
" && chmod -R 755 " + self.proxyPath)
self.passPath = passwd = self.setupPath + '/nginx/pass'
if not os.path.exists(passwd):
mw.execShell("mkdir -p " + passwd + " && chmod -R 755 " + passwd)
self.redirectPath = redirect = self.setupPath + '/nginx/redirect'
if not os.path.exists(redirect):
mw.execShell("mkdir -p " + redirect +
" && chmod -R 755 " + redirect)
self.proxyPath = proxy = self.setupPath + '/nginx/proxy'
if not os.path.exists(proxy):
mw.execShell("mkdir -p " + proxy + " && chmod -R 755 " + proxy)
self.logsPath = mw.getRootDir() + '/wwwlogs'
# ssl conf
if mw.isAppleSystem():
self.sslDir = self.setupPath + '/letsencrypt/'
else:
self.sslDir = '/etc/letsencrypt/live/'
self.sslDir = self.setupPath + '/ssl'
##### ----- start ----- ###
def listApi(self):
+21 -17
View File
@@ -2044,29 +2044,33 @@ function opSSL(type, id, siteName, callback){
layer.close(loadT);
var rdata = data['data'];
var issuer = rdata['cert_data']['issuer'].split(" ");
var domains = rdata['cert_data']['dns'].join("、");
if (rdata['cert_data']){
var issuer = rdata['cert_data']['issuer'].split(" ");
var domains = rdata['cert_data']['dns'].join("、");
var cert_data = "<div class='state_info_flex'>\
<div class='state_item'><span>证书品牌:</span><span class='ellipsis_text'>"+issuer[0]+"</span></div>\
<div class='state_item'><span>到期时间:</span><span class='btlink'>剩余"+rdata['cert_data']['endtime']+"天到期</span></div>\
</div>\
<div class='state_info_flex'>\
<div class='state_item'><span>认证域名:</span><span class='ellipsis_text'>"+domains+"</span></div>\
<div class='state_item'><span>强制HTTPS:</span><span class='switch'>\
<input class='btswitch btswitch-ios' id='toHttps' type='checkbox'>\
<label class='btswitch-btn' for='toHttps' onclick=\"httpToHttps('" + siteName + "')\">\
</span></div>\
</div>";
$(".ssl_state_info").html(cert_data);
$(".ssl_state_info").css('display','block');
var cert_data = "<div class='state_info_flex'>\
<div class='state_item'><span>证书品牌:</span><span class='ellipsis_text'>"+issuer[0]+"</span></div>\
<div class='state_item'><span>到期时间:</span><span class='btlink'>剩余"+rdata['cert_data']['endtime']+"天到期</span></div>\
</div>\
<div class='state_info_flex'>\
<div class='state_item'><span>认证域名:</span><span class='ellipsis_text'>"+domains+"</span></div>\
<div class='state_item'><span>强制HTTPS:</span><span class='switch'>\
<input class='btswitch btswitch-ios' id='toHttps' type='checkbox'>\
<label class='btswitch-btn' for='toHttps' onclick=\"httpToHttps('" + siteName + "')\">\
</span></div>\
</div>";
$(".ssl_state_info").html(cert_data);
$(".ssl_state_info").css('display','block');
}
console.log(rdata);
$("#toHttps").attr('checked',rdata.httpTohttps);
console.log(rdata);
if(rdata.status){
$('.warning_info').css('display','none');
$(".ssl-btn").append("<button class='btn btn-default btn-sm' onclick=\"ocSSL('close_ssl_conf','"+siteName+"')\" style='margin-left:10px'>关闭SSL</button>");
}
if(rdata.key == false) rdata.key = '';
if(rdata.csr == false) rdata.csr = '';
$("#key").val(rdata.key);