diff --git a/class/core/site_api.py b/class/core/site_api.py index 78c70cb8d..e521ae52c 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -22,6 +22,8 @@ class site_api: setupPath = None # 安装路径 isWriteLogs = None # 是否写日志 + sslDir = None + def __init__(self): self.setupPath = public.getServerDir() path = self.setupPath + '/openresty/nginx/conf/vhost' @@ -31,9 +33,22 @@ class site_api: if not os.path.exists(path): public.execShell("mkdir -p " + path + " && chmod -R 755 " + path) + self.sslDir = public.getServerDir() + '/letsencrypt' + ##### ----- start ----- ### def listApi(self): - return self.list() + _list = public.M('sites').where('', ()).field( + 'id,name,path,status,ps,addtime,edate').limit('0,5').order('id desc').select() + _ret = {} + _ret['data'] = _list + + count = public.M('sites').where('', ()).count() + _page = {} + _page['count'] = count + _page['tojs'] = 'getWeb' + + _ret['page'] = public.getPage(_page) + return public.getJson(_ret) def getPhpVersionApi(self): return self.getPhpVersion() @@ -130,7 +145,7 @@ class site_api: if siteConf.find('301-START') != -1: return public.returnJson(False, '检测到您的站点做了301重定向设置,请先关闭重定向!') - letpath = '/etc/letsencrypt/live/' + siteName + letpath = public.getServerDir() + '/letsencrypt/live/' + siteName csrpath = letpath + "/fullchain.pem" # 生成证书路径 keypath = letpath + "/privkey.pem" # 密钥文件路径 @@ -212,11 +227,11 @@ class site_api: home_cert = home_path + '/fullchain.cer' home_key = home_path + '/' + domains[0] + '.key' + print home_cert + cmd = 'export ACCOUNT_EMAIL=' + email + ' && ' + execStr result = public.execShell(cmd) - print home_cert - if not os.path.exists(home_cert.replace("\*", "*")): data = {} data['err'] = result @@ -253,11 +268,6 @@ class site_api: result['key'] = public.readFile(keypath) public.restartWeb() - print execStr - print domains - print file - print result[0] - print result[1] return public.getJson(True, 'OK') def getIndexApi(self): @@ -507,20 +517,6 @@ class site_api: def getIndexConf(self): return public.getServerDir() + '/openresty/nginx/conf/nginx.conf' - def list(self): - _list = public.M('sites').where('', ()).field( - 'id,name,path,status,ps,addtime,edate').limit('0,5').order('id desc').select() - _ret = {} - _ret['data'] = _list - - count = public.M('sites').where('', ()).count() - _page = {} - _page['count'] = count - _page['tojs'] = 'getWeb' - - _ret['page'] = public.getPage(_page) - return public.getJson(_ret) - def getDomain(self, pid): _list = public.M('domain').where("pid=?", (pid,)).field( 'id,pid,name,port,addtime').select() diff --git a/route/static/app/site.js b/route/static/app/site.js index a4e71c165..1337b97a2 100755 --- a/route/static/app/site.js +++ b/route/static/app/site.js @@ -1564,32 +1564,42 @@ function setSSL(id,siteName){ // } // }); } + + //关闭SSL -function closeSSL(siteName){ - var loadT = layer.msg(lan.site.the_msg,{icon:16,time:0,shade: [0.3, '#000']}); - $.post('site?action=GetSSL','siteName='+siteName,function(rdata){ - layer.close(loadT); - switch(rdata.type){ - case -1: - var txt = "
关闭SSL以后,请务必清除浏览器缓存再访问站点
\ +域名 | 到期时间 | 状态? | 操作 |
---|