import{u as a,R as t,p as e,V as s,M as r}from"./utils-lib.js?v=1761009159";import{r as n,g as u}from"./base-lib.js?v=1761009159";import{u as o,S as c}from"./useStore4.js?v=1761009159";import{S as l}from"./useStore14.js?v=1761009159";const{activeType:v,siteInfo:i,isBindExtranet:p,siteType:h}=o(),{getFileEvent:m,saveFileEvent:y}=c(),{viewFileHistoryEvent:g,recoverFileEvent:d,getComposerPathEvent:w}=l(),{plugin:f}=a(),b=n("config"),j=n([{label:"配置文件",name:"config",render:()=>{}},{label:"Composer配置文件",name:"composer",render:()=>{}}]),x=n(""),E=n(),F=n(""),S=u(()=>{const a="nodejs"===v.value?"node":v.value,t="php"!==v.value&&"proxy"!==v.value&&"proxy"!==v.value?"".concat(a,"_"):"",e="/www/server/panel/vhost/".concat(f.value.webserver,"/").concat(t).concat(i.value.name,".conf");return"config"===b.value?e.replace(/\/+/g,"/"):_.value}),_=n("");n(!1);const C=n(!1),T=async a=>{try{C.value=!0;const{data:e}=await m(a);x.value=e.data,t(e.historys)&&(E.value=e.historys),C.value=!1}catch(e){return{status:!1,msg:"获取配置文件失败"}}},q=(a,t)=>{b.value=t,T({path:S.value})},B=async(a={data:x.value,encoding:"utf-8",path:S.value})=>{try{(await y(a)).status&&T({path:a.path})}catch(t){return{status:!1,msg:"保存文件失败"}}},H=async a=>{try{const t=await g({row:a,path:S.value});return F.value=t.status?t.data:"文件不存在",t}catch(t){return{status:!1,msg:"获取文件历史失败"}}},I=async a=>{try{await e({title:"恢复历史文件",content:"是否恢复历史文件 ".concat(s(a))});const t=await d({row:a,path:S.value});return r.request({status:t.status,msg:t.status?"恢复成功":"恢复失败"}),t.status&&T({path:S.value}),t.status}catch(t){}},M=()=>{const{project_type:a,project_config:t,name:e}=i.value;p.value=!!(null==t?void 0:t.bind_extranet);["php","html","proxy"].includes(a)&&(p.value=!0),"php"===a&&P()},P=async()=>{try{const a=await w(i.value.path);return a.status&&(_.value=a.data),a}catch(a){return{status:!1,msg:"获取composer路径失败"}}},R=async()=>{M(),p.value&&await T({path:S.value})};export{q as a,C as b,_ as c,b as d,x as e,F as f,T as g,E as h,R as i,M as j,I as r,B as s,j as t,H as v};
