diff --git a/class/core/site_api.py b/class/core/site_api.py index ad0130102..a6b276278 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -60,6 +60,28 @@ class site_api: pid = request.form.get('pid', '').encode('utf-8') return self.getDomain(pid) + # 获取站点所有域名 + def getSiteDomainsApi(self): + pid = request.form.get('id', '').encode('utf-8') + + data = {} + domains = public.M('domain').where( + 'pid=?', (pid,)).field('name,id').select() + binding = public.M('binding').where( + 'pid=?', (pid,)).field('domain,id').select() + if type(binding) == str: + return binding + for b in binding: + tmp = {} + tmp['name'] = b['domain'] + tmp['id'] = b['id'] + domains.append(tmp) + data['domains'] = domains + data['email'] = public.M('users').getField('email') + if data['email'] == '287962566@qq.com': + data['email'] = '' + return public.returnJson(True, 'OK', data) + def getIndexApi(self): sid = request.form.get('id', '').encode('utf-8') data = {} diff --git a/class/core/ssl_api.py b/class/core/ssl_api.py new file mode 100755 index 000000000..19723c9bf --- /dev/null +++ b/class/core/ssl_api.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +import psutil +import time +import os +import sys +import public +import re +import json +import pwd + +from flask import session +from flask import request + + +class ssl_api: + + def __init__(self): + pass + + ##### ----- start ----- ### + # 获取证书列表 + def getCertListApi(self): + try: + vpath = public.getServerDir() + '/ssl' + if not os.path.exists(vpath): + os.system('mkdir -p ' + vpath) + data = [] + for d in os.listdir(vpath): + mpath = vpath + '/' + d + '/info.json' + if not os.path.exists(mpath): + continue + tmp = public.readFile(mpath) + if not tmp: + continue + tmp1 = json.loads(tmp) + data.append(tmp1) + return data + except: + return [] + ##### ----- end ----- ### diff --git a/route/static/app/site.js b/route/static/app/site.js index 3496c86cf..55f81fb4e 100755 --- a/route/static/app/site.js +++ b/route/static/app/site.js @@ -983,17 +983,17 @@ function setIndexList(id){ function webEdit(id,website,endTime,addtime){ var system = "{$Think.session.system}"; var eMenu = ''; - eMenu = "

"+lan.site.site_menu_1+"

" - +"

"+lan.site.site_menu_2+"

" + eMenu = "

子目录绑定

" + +"

网站目录

" +"

流量限制

" +"

伪静态

" +"

默认文档

" +"

配置文件

" - +"

"+lan.site.site_menu_7+"

" + +"

SSL

" +"

PHP版本

" - +"

"+lan.site.site_menu_10+"

" - +"

"+lan.site.site_menu_11+"

" - +"

"+lan.site.site_menu_12+"

" + +"

301重定向

" + +"

反向代理

" + +"

防盗链

" +"

响应日志

"; layer.open({ type: 1, @@ -1011,7 +1011,7 @@ function webEdit(id,website,endTime,addtime){ }); domainEdit(id,website); //域名输入提示 - var placeholder = "
"+lan.site.domain_help+"
"; + var placeholder = "
每行填写一个域名,默认为80端口
泛解析添加方法 *.domain.com
如另加端口格式为 www.domain.com:88
"; $('#newdomain').after(placeholder); $(".placeholder").click(function(){ $(this).hide(); @@ -1513,10 +1513,9 @@ function set_cert_ssl(certName,siteName){ //宝塔ssl function setSSL(id,siteName){ var mBody = '
\ - '+lan.site.bt_ssl+'\ - Let\'s Encrypt\ - '+lan.site.other_ssl+'\ - '+lan.public.close+'\ + Let\'s Encrypt\ + 其他证书\ + 关闭\ 证书夹' + '
\ 强制HTTPS\ @@ -1611,17 +1610,11 @@ function closeSSLHTML(txt,siteName){ $(".tab-con").html("
"+lan.get('ssl_enable',[txt])+"
"); } -//宝塔SSL -function BTssl(type,id,siteName){ - var a = '
'+lan.site.bt_bind_no+'
' - + '
'+lan.site.bt_user+'
' - + '
'+lan.site.password+'
' - + '
' - + '
  • '+lan.site.bt_ssl_help_1+'
  • '+lan.site.bt_ssl_help_2+'
  • '+lan.site.bt_ssl_help_3+'
  • '+lan.site.bt_ssl_help_4+'
' - + '
'; +//SSL +function opSSL(type,id,siteName){ var b = '
'+lan.site.domain+'
' + '
' - + '
'+lan.site.domain+''+lan.site.endtime+''+lan.site.status+'?'+lan.site.operate+'
' + + '
域名到期时间状态?操作
' + '
  • '+lan.site.bt_ssl_help_5+'(包括根域名)
  • '+lan.site.bt_ssl_help_6+'
  • '+lan.site.bt_ssl_help_7+'
  • 建议使用二级域名为www的域名申请证书,此时系统会默认赠送顶级域名为可选名称
  • 在未指定SSL默认站点时,未开启SSL的站点使用HTTPS会直接访问到已开启SSL的站点
' + '
'; @@ -1633,41 +1626,8 @@ function BTssl(type,id,siteName){ var other = '
'+lan.site.ssl_key+'
' + '
'+lan.site.ssl_crt+'
' + '
' - + ''; - + + ''; switch(type){ - case 'a': - $.get("/ssl?action=GetUserInfo",function(rdata){ - if(rdata.status){ - BTssl('b',id,siteName); - } - else{ - $(".tab-con").html(a); - $("#btusername").blur(function(){ - if(!(/^1(3|4|5|7|8)\d{9}$/.test($(this).val()))){ - $("#btusername").css("border","1px solid #e53451"); - $("#btusername").next("i").html(lan.site.phone_input); - } - else{ - $("#btusername").removeAttr("style").css("width","200px"); - $("#btusername").next("i").empty(); - } - }); - $(".btlogin").click(function(){ - var data = "username="+$("#btusername").val()+"&password="+$("#btpassword").val(); - $.post("/ssl?action=GetToken",data,function(tdata){ - if(tdata.status){ - layer.msg(tdata.msg,{icon:1}); - BTssl('b',id,siteName); - } - else{ - layer.msg(tdata.msg,{icon:2}) - } - }) - }) - } - }); - break; case 'b': $(".tab-con").html(b); var opt = ''; @@ -1766,7 +1726,7 @@ function BTssl(type,id,siteName){ $.post('site?action=GetSSL','siteName='+siteName,function(rdata){ if(rdata.csr === false){ setCookie('letssl',0); - BTssl(type,id,siteName); + opSSL(type,id,siteName); return; } var lets = '
'+lan.site.ssl_key+'
' @@ -1780,15 +1740,16 @@ function BTssl(type,id,siteName){ } $(".tab-con").html(lets); var opt=''; - $.post('/site?action=GetSiteDomains',{id:id}, function(rdata) { - for(var i=0;i'+rdata.domains[i].name+'' + opt+='
  • '+data.domains[i].name+'
  • ' } } - $("input[name='admin_email']").val(rdata.email); + $("input[name='admin_email']").val(data.email); $("#ymlist").html(opt); $("#ymlist li input").click(function(e){ e.stopPropagation(); @@ -1815,7 +1776,7 @@ function BTssl(type,id,siteName){ newSSL(siteName,domains); }) - }); + },'json'); break; case 'other': $(".tab-con").html(other); @@ -1834,7 +1795,7 @@ function BTssl(type,id,siteName){ }); break; } - table_fixed("btssl_table_list") + // table_fixed("btssl_table_list") } //取证书列表