import{fU as e,k as a,p as t,n as l,gg as s,gh as o,b as r,gi as n,d as c,L as i,bq as u,e as p,bA as _}from"./utils-lib.js?v=1761009159";import{_ as f}from"./version-compare.vue_vue_type_script_setup_true_lang.js?v=1761009159";import{c as d,v as m,x as v,z as x,e as y,y as C,q as k,B as w,C as g,A as b,K as P,Q as I}from"./base-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const V={class:"p-[20px] flex"},S={class:"flex-1 flex flex-col mr-[15px]"},j={class:"flex-1 flex flex-col"},h=d({__name:"index",setup(t){const{certInfo:l}=e();return(e,t)=>{const s=a;return m(),v("div",V,[x("div",S,[t[2]||(t[2]=x("span",{class:"mb-[5px]"},"密钥 (KEY)",-1)),y(s,{type:"textarea",rows:16,modelValue:C(l).private_key,"onUpdate:modelValue":t[0]||(t[0]=e=>C(l).private_key=e),class:"w-full"},null,8,["modelValue"])]),x("div",j,[t[3]||(t[3]=x("span",{class:"mb-[5px]"},"证书 (CRT/PEM)",-1)),y(s,{type:"textarea",rows:16,modelValue:C(l).certificate,"onUpdate:modelValue":t[1]||(t[1]=e=>C(l).certificate=e),class:"w-full"},null,8,["modelValue"])])])}}}),{request:U,error:q}=r(),{getInfo:E,hasCert:L,serverIP:A,serverProtocol:K,serverPort:M,certInfo:R,getCertInfo:z}=e(),B=new Map([["start","启动"],["stop","停止"],["reload","重载"],["restart","重启"]]),F=e=>{const a=B.get(e)||"";t({title:"".concat(a,"服务"),content:"是否".concat(a,"虚拟主机服务，是否继续？"),onConfirm:async()=>{const a=await n(e);await U(a),E()}})},H=async()=>{L.value?l({title:"设置SSL证书",area:70,component:h,showFooter:!0,onOpen:()=>{z()},onConfirm:async()=>{const{certificate:e,private_key:a}=R.value,t=await s(e,a);await U(t)}}):q("请先上传证书")},O=async()=>{if(""===A.value)return void q("Please enter the server IP");const e=await o(A.value);await U(e)},Q=()=>{window.open("".concat(K.value,"://").concat(A.value).concat(M.value,"/account/login"),"_blank","noopener,noreferrer")},T={class:""},Y={class:"ml-[100px] mt-[2px]"},D=d({__name:"index",setup(t){const{isServerRunning:l,serverIP:s,serverProtocol:o,serverPort:r,resetServerEvent:n,getServerIP:d,getCertInfo:V}=e();return k(()=>{V(),d()}),(e,t)=>{const d=c,k=i,V=u,S=a,j=p,h=_;return m(),v("div",T,[y(f),y(h,{class:"my-[16px]"},{default:w(()=>[y(V,{label:"服务状态"},{default:w(()=>[x("div",{class:P(["mr-[8px] text-secondary flex items-center",C(l).color])},[g(b(C(l).tips),1),y(d,{icon:"icon-".concat(C(l).icon),class:P(["mr-[4px]",C(l).color])},null,8,["icon","class"])],2),y(k,{onClick:t[0]||(t[0]=e=>C(F)(C(l).type))},{default:w(()=>[g(b(C(l).text),1)]),_:1}),y(k,{onClick:t[1]||(t[1]=e=>C(F)("restart"))},{default:w(()=>t[4]||(t[4]=[g("重启",-1)])),_:1,__:[4]}),y(k,{onClick:t[2]||(t[2]=e=>C(F)("reload"))},{default:w(()=>t[5]||(t[5]=[g("重载",-1)])),_:1,__:[5]})]),_:1}),y(V,{label:"证书SSL"},{default:w(()=>[y(k,{type:"primary",onClick:C(H)},{default:w(()=>t[6]||(t[6]=[g("修改",-1)])),_:1,__:[6]},8,["onClick"])]),_:1}),y(V,{label:"IP地址"},{default:w(()=>[y(S,{modelValue:C(s),"onUpdate:modelValue":t[3]||(t[3]=e=>I(s)?s.value=e:null),class:"mr-[10px] w-[250px]"},null,8,["modelValue"]),y(k,{onClick:C(O),type:"primary"},{default:w(()=>t[7]||(t[7]=[g("修改",-1)])),_:1,__:[7]},8,["onClick"]),y(k,{onClick:C(n)},{default:w(()=>t[8]||(t[8]=[g("重置",-1)])),_:1,__:[8]},8,["onClick"])]),_:1}),x("p",Y,[t[9]||(t[9]=x("span",{class:"mr-[4px]"},"访问地址:",-1)),y(j,{onClick:C(Q)},{default:w(()=>[g(b("".concat(C(o),"://").concat(C(s)).concat(C(r),"/account/login")),1)]),_:1},8,["onClick"])])]),_:1})])}}});export{D as default};
