← Back
Editing: no-port-config.js
import{n as e,L as a,p as l,K as s,M as t,k as o,c as n}from"./utils-lib.js?v=VERSION_NUMBER";import{c as r,q as i,M as c,A as m,y as u,B as p,z as d,v,x as E,C as f,aW as x,r as y,p as k,e as _,F as I,a_ as V,P as D,af as T,D as A,ag as C}from"./base-lib.js?v=VERSION_NUMBER";import{j as b}from"./validator.js?v=VERSION_NUMBER";import{ag as g}from"./config.js?v=VERSION_NUMBER";import"./__commonjsHelpers__.js?v=VERSION_NUMBER";import"./index104.js?v=VERSION_NUMBER";import"./column.js?v=VERSION_NUMBER";const h={class:"text-[1.2rem] flex items-center"},w={key:0,class:"inline-flex items-cenetr"},R=r({__name:"index",props:{tips:{default:""},showSurvey:{type:Boolean,default:!0}},setup:e=>(e,a)=>{const l=x;return i(),c(l,{type:"error",closable:!1,class:"!mb-10px"},{title:m((()=>[u("div",h,[a[3]||(a[3]=u("i",{class:"svgtofont-el-warning-filled text-[#F56C6C] mr-4px !text-[1.6rem]"},null,-1)),p(" "+d(e.tips||"本功能将在下个正式版本被移除")+", ",1),e.showSurvey?(i(),v("div",w,[a[1]||(a[1]=p(" 如有疑问请直接 ")),a[2]||(a[2]=u("i",{class:"svgtofont-el-service mx-2px text-[#20a53a]"},null,-1)),u("span",{class:"bt-link",onClick:a[0]||(a[0]=e=>E(b)())}," 联系客服")])):f("",!0)])])),_:1})}}),S={class:"p-24px"},N={class:"flex items-center"},P={class:"w-[20rem] flex ml-[1rem]"},j={class:"my-6 flex items-center leading-[3rem]"},F={class:"flex ml-[1rem]"},K={key:0,class:"flex mt-12px"},B={class:"flex-1 mr-20px"},Y={class:"flex-1"},z={class:"list-disc text-[#777] px-20px pt-12px"},U={class:"flex items-center"},G=r({__name:"no-port-config",props:{compData:{}},emits:["close"],setup(r,{emit:c}){const x=r,b=c,h=y("auto"),w=[{title:"自定义证书",value:"auto"},{title:"不部署证书",value:"no"},{title:"选择已有证书",value:"select"}],G=y(x.compData),M=l=>{h.value=l,"select"===l&&e({title:"选择已有证书",component:()=>a((()=>import("./cert-list-dialog.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url),area:70,compData:{refreshData:e=>{G.value.domain=(null==e?void 0:e.dns[0].replace(/^\*\./,"panel."))||"",G.value.cert=(null==e?void 0:e.fullchain)||"",G.value.key=(null==e?void 0:e.privkey)||"",G.value.certInfo=e.info||{}}}})},L=async()=>{(x.compData.domain?/^(?!:\/\/)([a-zA-Z0-9-_]{1,63}\.)+[a-zA-Z]{2,6}$/.test(x.compData.domain)?"no"===h.value||x.compData.key&&x.compData.cert||(t.error("请填写证书内容"),0):(t.error("域名格式不正确"),0):(t.error("域名不能为空"),0))&&(await l({title:"提示",icon:"warning-filled",content:"基于Nginx/Apache,如果环境运行异常会导致无法访问,是否继续操作?"}),await s({loading:"正在设置免端口访问配置,请稍候...",request:g({domain:x.compData.domain,key:"no"===h.value?"":G.value.key,cert:"no"===h.value?"":G.value.cert}),message:!0}),x.compData.refresh(),b("close"))},q=async(e,a)=>{if(!a)try{const a=await navigator.clipboard.readText(),l="key"===e?[/-----BEGIN PRIVATE KEY-----[\s\S]*?-----END PRIVATE KEY-----/,/-----BEGIN RSA PRIVATE KEY-----[\s\S]*?-----END RSA PRIVATE KEY-----/,/-----BEGIN EC PRIVATE KEY-----[\s\S]*?-----END EC PRIVATE KEY-----/]:[/-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/,/-----BEGIN CERTIFICATE REQUEST-----[\s\S]*?-----END CERTIFICATE REQUEST-----/];for(const s of l){const l=a.match(s);if(l&&l[0])switch(t.success("已从粘贴板检测到".concat("key"===e?"密钥":"证书")),e){case"key":G.value.key=l[0];break;case"cert":G.value.cert=l[0]}}}catch(l){}},Q=()=>{window.location.href="/site/nginx"};return k((()=>{h.value=x.compData.use_ssl?"auto":"no"})),(e,a)=>{const l=R,s=o,t=C,r=T,c=A,x=n;return i(),v("div",S,[_(l),u("div",N,[a[6]||(a[6]=u("span",null,"绑定域名:",-1)),u("div",P,[_(s,{modelValue:E(G).domain,"onUpdate:modelValue":a[0]||(a[0]=e=>E(G).domain=e),placeholder:"请输入绑定域名"},null,8,["modelValue"])])]),u("div",j,[a[7]||(a[7]=u("span",null,"SSL证书:",-1)),u("div",F,[_(r,{modelValue:E(h),"onUpdate:modelValue":a[1]||(a[1]=e=>D(h)?h.value=e:null),size:"small",onChange:M},{default:m((()=>[(i(),v(I,null,V(w,((e,a)=>_(t,{key:a,label:e.value},{default:m((()=>[u("span",null,d(e.title),1)])),_:2},1032,["label"]))),64))])),_:1},8,["modelValue"])])]),"no"!==E(h)?(i(),v("div",K,[u("div",B,[a[8]||(a[8]=u("div",{class:"text-[1.2rem] mb-[.8rem]"},"密钥(KEY)",-1)),_(s,{class:"text-[1.2rem]",type:"textarea",modelValue:E(G).key,"onUpdate:modelValue":a[2]||(a[2]=e=>E(G).key=e),rows:13,size:"small",onFocus:a[3]||(a[3]=e=>q("key",E(G).key))},null,8,["modelValue"])]),u("div",Y,[a[9]||(a[9]=u("div",{class:"text-[1.2rem] mb-[.8rem]"},"证书(PEM格式)",-1)),_(s,{type:"textarea",modelValue:E(G).cert,"onUpdate:modelValue":a[4]||(a[4]=e=>E(G).cert=e),rows:13,size:"small",onFocus:a[5]||(a[5]=e=>q("cert",E(G).cert))},null,8,["modelValue"])])])):f("",!0),_(c,{onClick:L,type:"primary",class:"mt-4"},{default:m((()=>a[10]||(a[10]=[p("保存")]))),_:1}),u("ul",z,[u("li",null,[a[11]||(a[11]=p("配置后可在网站--反向代理项目中管理,")),u("span",{class:"text-[#20a53a] cursor-pointer",onClick:Q},"点击前往")]),a[14]||(a[14]=u("li",null,"配置此域名的证书到面板,浏览器即可信任访问",-1)),u("li",null,[u("div",U,[a[13]||(a[13]=p(" 粘贴您的*.key以及*.pem内容,然后保存即可 ")),_(x,{href:"https://www.bt.cn/bbs/thread-105443-1-1.html"},{default:m((()=>a[12]||(a[12]=[p("帮助")]))),_:1})])]),a[15]||(a[15]=u("li",null,"如果浏览器提示证书链不完整,请检查是否正确拼接PEM证书",-1)),a[16]||(a[16]=u("li",null,"PEM格式证书 = 域名证书.crt + 根证书(root_bundle).crt",-1))])])}}});export{G as default}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel