File: /www/server/panel/BTPanel/static/js/useMethod8.js
import{e as c,_ as u,w,k as E,J as b,f as x}from"./utils-lib.js?v=1777008528";import{aI as A,n as I}from"./base-lib.js?v=1777008528";import{d as L,a as S}from"./ssl.js?v=1777008528";import{t as P}from"./index3.js?v=1777008528";import{reissueCertOrder as O,renewalCert as k,getVerifyResult as M}from"./site.js?v=1777008528";import{u as V}from"./useStore3.js?v=1777008528";import{c as N}from"./useController8.js?v=1777008528";import{u as F}from"./useStore11.js?v=1777008528";import{a as q}from"./useMethod3.js?v=1777008528";const{orderInfo:H,certVerifyInfo:U}=V(),i=x(),{activeTabs:p,sslIsRefresh:m,testIsRefresh:f,encryptIsRefresh:g,otherIsRefresh:_}=A(F()),se=e=>c({isAsync:!0,title:"【".concat(e.title,"】自动续签配置"),area:50,compData:e,component:()=>u(()=>import("./index166.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),showFooter:!0,confirmText:"保存配置",onCancel:e.cancel}),oe=async e=>{var s;let t,r=e.crontab_id;try{e.crontab_id=-1,await w({title:"删除【".concat(e.title,"】自动续签"),content:"删除该证书自动续签,是否继续操作?",icon:"warning",width:45}),t=i.load("正在删除证书自动续签,请稍候...");const o=await L({crontab_id:r});if(i.request(o),o.status){const n={ssl:()=>m.value=!0,test:()=>f.value=!0,encrypt:()=>g.value=!0,other:()=>_.value=!0};(s=n[p.value])==null||s.call(n)}}catch(o){o&&I(()=>{e.crontab_id=r})}finally{t&&t.close()}},ne=e=>{H.value=e,c({isAsync:!0,title:"完善商业证书资料",area:64,component:()=>u(()=>import("./index167.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{orderInfo:e,refreshEvent:()=>{var r;const t={ssl:()=>m.value=!0,test:()=>f.value=!0,encrypt:()=>g.value=!0,other:()=>_.value=!0};(r=t[p.value])==null||r.call(t)}}})},j=async(e,t,r)=>{try{const s=await E({loading:"正在验证商用证书,请稍后...",request:M({oid:e,cert_ssl_type:t,pid:r})});return s.status?{data:{oid:e,...s.data,isCNAME:s.data.data.dcvList[0].dcvMethod.indexOf("CNAME_")>-1},status:!0,msg:"验证商用证书成功"}:(i.request(s),{status:!1,msg:"验证商用证书失败"})}catch(s){return{status:!1,msg:"验证商用证书失败"}}},B=e=>(U.value=e,c({title:"验证域名-"+(e.isCNAME?"DNS验证":"文件验证"),area:64,component:()=>u(()=>import("./index168.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:e})),ie=async(e,t,r,s)=>{const{data:o,status:n}=await j(e,t,r);n&&(o.auto_verify_info=s,B({...o,cert_ssl_type:t,pid:r}))},le=async e=>{var o;await w({title:"商业证书续签",content:"当前证书订单需要重新生成新订单,需要手动续签,和重新部署证书,是否继续操作?"});const t={pdata:JSON.stringify({oid:e})},r=await E({loading:"正在续签商业证书,可能等待时间较长,请稍后...",request:O(t),data:Object});if(b(r)&&r.hasOwnProperty("order_info")){let n=r.order_info;N({oid:r.oid,wxcode:r.wxcode,alicode:r.alicode,orderInfo:n,productInfo:{...n,productName:n.title,totalPrice:r.data.price,isRenew:!0}})}else i.request(r);const s={ssl:()=>m.value=!0,test:()=>f.value=!0,encrypt:()=>g.value=!0,other:()=>_.value=!0};(o=s[p.value])==null||o.call(s)},ce=async e=>{var t,r,s,o,n,h,C;try{const v=await z(),{data:a}=await k({index:e.index});if(a.status===!1&&a.hasOwnProperty("err")&&b(a.err)){let l="",T=a.msg;if(((t=a.err)==null?void 0:t.challenges)===void 0)l+="\n <p><span>响应状态:</span>".concat(a.err.status,"</p>\n <p><span>错误类型:</span>").concat(a.err.type,'</p>\n <p><span>错误来源:</span><a class="bt-link" href=\'https://letsencrypt.org/\' rel="noreferrer noopener">Let\'s Encrypt官网</a></p>\n <div class="flex flex-col">\n 错误代码:\n <pre class="!text-white !bg-darkPrimary !inline-block !ml-[4px]">\n ').concat(a.err.detail,"\n </pre>\n </div>");else if(!((r=a.err)!=null&&r.challenges[1])&&((s=a.err)!=null&&s.challenges[0])&&(a.err.challenges[1]=a.err.challenges[0]),a.err.status==="invalid"){const D=a.err.identifier.value,y=a.err.challenges[1],Y=y==null?void 0:y.error.detail;l+="\n <p><span>验证域名:</span>".concat(D,"</p>\n ");const $="http://".concat(D,"/.well-known/acme-challenge/").concat((o=a.err)==null?void 0:o.challenges[0].token);l+='\n <p><span>验证URL:</span><a class="bt-link" href=\''.concat($,"' target='_blank' rel=\"noreferrer noopener\">点击查看</a></p>\n <p><span>验证内容:</span>").concat((n=a.err)==null?void 0:n.challenges[0].token,'</p>\n <div class="flex flex-col">\n 错误代码:\n <pre class="!text-white !bg-darkPrimary !inline-block !ml-[4px]">\n ').concat((h=a.err)==null?void 0:h.challenges[0].error.detail,"\n </pre>\n </div>\n "),l+="<p><span>验证结果:</span> <a style='color:red;'>验证失败</a></p>"}i.msg({customClass:"bt-message-error-html",dangerouslyUseHTMLString:!0,icon:"x",message:'\n <div class="flex items-center justify-center mt-[.8rem] mb-2rem">\n <i class="svgtofont-el-circle-close-filled mr-[.8rem] text-[var(--el-color-error-light-8)] !text-iconLarge"></i>\n <a style="color: var(--el-color-danger); font-size: var(--el-font-size-medium)">\n '.concat(T,'\n </a>\n </div>\n <div class="p-[2rem] border border-1 border-color-dark !rounded-base !mb-[12px] !leading-[26px] bg-light">\n ').concat(l,"\n </div>\n "),showClose:!0,duration:0}),v._props.onCancel();return}if(i.msg({dangerouslyUseHTMLString:!0,message:a.msg,type:a.status?"success":"error",duration:a.status?2e3:0,showClose:!a.status}),a.status){const l={ssl:()=>m.value=!0,test:()=>f.value=!0,encrypt:()=>g.value=!0,other:()=>_.value=!0};(C=l[p.value])==null||C.call(l)}v._props.onCancel()}catch(v){}},z=()=>c({isAsync:!0,area:[50,25],showFooter:!1,component:()=>u(()=>import("./index169.js?v=1777008528"),__vite__mapDeps([]),import.meta.url)}),ue=()=>{P({title:"SSL证书需求反馈收集",type:28,isNoRate:!0,softName:"1",isCard:!1,id:993})},de=e=>{c({isAsync:!0,title:"【".concat(e.title,"】部署证书"),area:50,component:()=>u(()=>import("./index170.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{row:e},showFooter:!0})},pe=async e=>{if(e.type==="1")window.open("/ssl?action=download_cert&oid=".concat(e.oid),"_blank","noopener,noreferrer");else if(e.type==="3"){let t={ssl_id:e.id,ssl_hash:e.hash,index:e.index};e.order_status?(delete t.ssl_id,delete t.ssl_hash):delete t.index;const r=await S(t);r.status?window.open(r.msg,"_blank","noopener,noreferrer"):i.error(r.msg)}},J=e=>c({isAsync:!0,title:"手动".concat(e.auth_type==="dns"?"解析TXT记录":"创建验证文件"),area:70,component:()=>u(()=>import("./index171.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{row:e},showFooter:!1}),W=e=>c({isAsync:!0,title:"【".concat(e.title,"】验证域名"),area:45,component:()=>u(()=>import("./index172.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{row:e},showFooter:!0}),me=e=>{if(e.type==="3"){J(e);return}W(e)},fe=()=>c({isAsync:!0,title:"上传证书",area:80,component:()=>u(()=>import("./index173.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),showFooter:!0}),d={OTHER:"other",TEST:"test",SSL:"ssl",ENCRYPT:"encrypt"},R={[d.OTHER]:{validate:e=>e.endDay>0,errorMessage:"选择的证书中没有可设置告警的证书!只有未过期的证书才能设置告警。",warningMessage:(e,t)=>"已过滤掉 ".concat(e," 个已过期的证书,只对 ").concat(t," 个未过期的证书设置告警。")},[d.TEST]:{validate:e=>e.stateCode==="COMPLETED"&&e.authDomain!==""&&e.endDay>0,errorMessage:"选择的证书中没有可设置告警的证书!只有订单完成、有认证域名且未过期的证书才能设置告警。",warningMessage:(e,t)=>"已过滤掉 ".concat(e," 个不符合条件的证书,只对 ").concat(t," 个符合条件的证书设置告警。")},[d.SSL]:{validate:e=>e.endDay>0,errorMessage:"选择的证书中没有可设置告警的证书!只有未过期的证书才能设置告警。",warningMessage:(e,t)=>"已过滤掉 ".concat(e," 个已过期的证书,只对 ").concat(t," 个未过期的证书设置告警。")},[d.ENCRYPT]:{validate:e=>e.order_status==="valid",errorMessage:"选择的证书中没有可设置告警的证书!只有订单状态为有效的证书才能设置告警。",warningMessage:(e,t)=>"已过滤掉 ".concat(e," 个订单状态无效的证书,只对 ").concat(t," 个有效证书设置告警。")}},ge=(e,t)=>{const r=R[t];return r?r.validate(e):!1},_e=(e,t)=>{const r=R[t];if(!r)return i.error("不支持的证书类型: ".concat(t)),!1;const s=e.filter(r.validate),o=s.length,n=e.length-o;return o===0?(i.error(r.errorMessage),!1):(n>0&&i.warn(r.warningMessage(n,o)),q({title:"证书",data:s,cancel:()=>{},isMulti:!0}),!0)};export{d as C,pe as a,ne as b,ie as c,de as d,se as e,oe as f,ce as g,_e as h,ge as i,z as l,ue as o,le as r,fe as u,me as v};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}