File: /www/server/panel/BTPanel/static/js/useStore15.js
import{u as a,c as h,g8 as R,o as y,ca as E,k as l,cm as j,w as _,f as B,e as $,_ as U}from"./utils-lib.js?v=1777008528";import{aI as F,aJ as S,g as A,r}from"./base-lib.js?v=1777008528";import{k as x,d as I,a as f,b as O,c as M,v as N}from"./index3.js?v=1777008528";const G=t=>a.post("ftp/SetStatus",{data:t,check:"msg"}),P=t=>a.post("/datalist/batch/batch_set_ftp_status",{data:t,check:"msg",customType:"model"}),H=t=>a.post("ftp/DeleteUser",{data:t,check:"msg"}),J=t=>a.post("ftp/SetUser",{data:t,check:"msg"}),V=t=>a.post("ftp/AddUser",{data:t,check:"msg"}),K=t=>a.post("ftp/setPort",{data:t,check:"msg"}),it=t=>a.post("ftp/GetFtpUserAccess",{data:t,check:"msg"}),ut=t=>a.post("ftp/ModifyFtpUserAccess",{data:t,check:"msg"}),k=t=>a.post("/logs/ftp/set_ftp_log",{customType:"model",data:t,check:"msg"}),W=t=>a.post("/logs/ftp/get_login_log",{customType:"model",data:t,check:"object"}),z=t=>a.post("/logs/ftp/get_action_log",{customType:"model",data:t}),gt=t=>a.post("ftp/get_cron_config",{data:t,check:"object"}),dt=t=>a.post("ftp/set_cron_config",{data:t,check:"msg"}),mt=t=>a.post("project/quota/modify_path_quota",{data:t,customType:"model",check:"object"}),ft=()=>a.post("logs/ftp/get_analysis_config",{customType:"model",check:"object"}),ht=t=>a.post("logs/ftp/set_analysis_config",{data:t,customType:"model",check:"msg"}),yt=t=>a.post("logs/ftp/log_analysis",{data:t,customType:"model"}),_t=t=>a.post("logs/ftp/set_cron_task",{data:t,customType:"model",check:"msg"}),Ft=t=>a.post("logs/ftp/set_white_list",{data:t,customType:"model",check:"msg"}),Tt=()=>a.post("logs/ftp/get_white_list",{customType:"model",check:"object"}),bt=t=>a.post("safe/firewall/create_ip_rules",{data:t,customType:"model",check:"msg"}),wt=()=>a.post("logs/ftp/ftp_users",{customType:"model",check:"array"}),Pt=t=>a.post("/datalist/batch/batch_set_ftp_password",{data:t,check:"array",customType:"model"}),Q=()=>a.post("ftp/view_ftp_types",{check:"object"}),kt=t=>a.post("ftp/add_ftp_types",{check:"object",data:t}),vt=t=>a.post("ftp/update_ftp_types",{check:"object",data:t}),St=t=>a.post("ftp/delete_ftp_types",{check:"object",data:t}),X=t=>a.post("/datalist/batch/batch_set_ftp_type",{check:"object",data:t,customType:"model"}),Y=t=>a.post("/datalist/batch/batch_delete_ftp",{check:"object",data:t,customType:"model"}),Z=S("FTP-STORE",()=>{const{plugin:t,getGlobalInfo:s}=h(),e=A(()=>t.value.ftp.port),c=r(),o=r({}),n=r(!1);return{ftpPort:e,pluginInfo:o,rowData:c,isRefreshFtpList:n}}),tt=()=>F(Z()),st=B(),{payment:et,getGlobalInfo:at}=h(),At=r(!1),Dt=async(t,s,e)=>{try{return(await l({loading:"正在".concat(s?"修改":"添加","FTP账号,请稍后..."),request:s?J(t):V(t),data:{status:Boolean},message:!0,success:o=>{d.value=!0,e&&e(o)}})).status}catch(c){return!1}},Lt=async t=>{try{const s=await l({loading:"正在修改FTP端口,请稍后...",request:K({port:t.port}),data:{status:Boolean},message:!0});return s.status&&at(),s.status}catch(s){return!1}},{isRefreshFtpList:d,pluginInfo:ot,rowData:ct}=tt(),Ct=async()=>{try{const{data:t}=await j({name:"pure-ftpd"});return ot.value=t,t}catch(t){return{}}};let g={};const qt=async t=>{const s=JSON.stringify(t),e=Date.now();try{const{data:{data:c,page:o,search_history:n,error:p}}=await R({...t,table:"ftps"});return g[s]={data:{data:c,total:y(o),other:{search_history:n,error:p}},timestamp:e},g[s].data}catch(c){return c.message==="canceled"&&g[s]&&e-g[s].timestamp<100?g[s].data:{data:[],total:0,other:{search_history:[]}}}},Rt=async t=>{try{await _({icon:"warning-filled",title:"删除FTP用户【".concat(t.name,"】"),content:"删除FTP用户后,该FTP用户将失去访问权限,是否继续操作?"}),await l({loading:"正在删除FTP用户,请稍后...",request:H({id:t.id,username:t.name}),message:!0,success:s=>{d.value=!0}})}catch(s){}},Et=async({id:t,status:s,name:e},c)=>{try{const o=!!Number(s);await _({title:"".concat(o?"停用":"启用","FTP用户【").concat(e,"】"),content:"".concat(o?"停用":"启用","选中的FTP用户后,该FTP用户将").concat(o?"失去":"恢复","访问权限,是否继续操作?")}),await l({loading:"正在设置FTP状态,请稍后...",request:G({id:t,username:e,status:+!Number(s)}),message:!0,success:n=>{d.value=!0,c&&c(n)}})}catch(o){}},jt=t=>{const s=Math.floor(Date.now()/1e3);let e=new Date(Number(t.end_time)).getTime()<s;const c=Number(t.end_time)-s;let n=Math.floor(c/(60*60*24))<7;return t.end_time==="0"&&(e=!1,n=!1),{isEnd:e,isOrange:n}},Bt=async()=>{try{let t=[];return await l({request:Q(),data:{msg:Array},success:({msg:s})=>{t=[{label:"全部分类",value:"all"},...s.map(e=>({label:e.ps,value:String(e.id)}))]}}),t||[]}catch(t){return[]}},$t=async(t,s,e,c)=>{await I({name:"Ftp分类",options:e.value,selectList:t.value,request:async(o,n)=>{const{enable:p,exclude:i}=c,m=f(t.value,i,p,{params:{id:o.id}});await l({loading:"正在批量设置FTP分类,请稍后...",request:X(m),message:!0}),s(),d.value=!0,n()}})},Ut=async(t,s,e,c,o,n)=>{const{label:p,value:i}=c,{enable:m,exclude:T}=n,D=new Map([["start","批量启用已选的FTP用户,启用后恢复访问权限"],["stop","批量停用已选的FTP用户,停用后暂停访问权限"],["delete","批量删除已选的FTP用户,删除后彻底失去访问和操作权限"]]),L=async()=>{const u=new Map([["start",P],["stop",P],["delete",Y]]).get(i);switch(i){case"start":case"stop":const w=i==="start"?1:0,C=f(e.value,T,m,{params:{status:w}});if(u)return await u(C);break;case"delete":const q=f(e.value,T,m);if(u)return await u(q);break}};await t({title:"批量".concat(p,"用户"),content:"".concat(D.get(i),",是否继续操作!"),column:[{label:"用户名",prop:"name"},O()],onConfirm:async()=>{const b=await L();d.value=!0;const{data:u,msg:w}=M(b.data);o&&o(),N(u,{title:"".concat(p,"用户")})}})},xt=async t=>{try{const{data:{data:s,page:e}}=await W(t);return Array.isArray(s)?{data:s,total:y(e)}:{data:[],total:0}}catch(s){return{data:[],total:0}}},It=async t=>{try{const{data:{data:s,page:e}}=await z(t);return Array.isArray(s)?{data:s,total:y(e)}:{data:[],total:0}}catch(s){return{data:[],total:0}}},v=t=>{$({title:"查看FTP日志【"+t.name+"】",area:[70,58],compData:t,component:()=>U(()=>import("./index419.js?v=1777008528"),__vite__mapDeps([]),import.meta.url)})},Ot=async t=>{let s;try{if(ct.value=t,et.value.authType!=="free"){s=st.load("正在获取日志服务状态,请稍后...");const{status:e,msg:c}=await k({exec_name:"getlog"});if(s.close(),!e||c==="stop"){await _({title:"开启FTP日志服务",content:"开启FTP日志服务后,将记录FTP用户的访问日志,是否继续操作?"});const o=await l({loading:"正在开启FTP日志服务,请稍后...",request:k({exec_name:"start"}),data:{status:Boolean},message:!0});o!=null&&o.status&&v(t)}else v(t)}else x({sourceId:57})}catch(e){}finally{s&&s.close()}},Mt=()=>{g={},E(["/ftp?action=view_ftp_types","/panel/public/get_soft_status","/datalist/data/get_data_list"])},nt=S("FTP-ADD-USER-STORE",()=>{const t=h(),{panel:s}=F(t),e=A(()=>s.value.sitePath),c=r(),o=r({name:"",password:"",path:e.value||""});return{isEdit:r(!1),addFtpRef:c,ftpForm:o,defaultPath:e}}),Nt=()=>F(nt());export{yt as A,Tt as B,_t as C,ht as D,ft as E,Z as F,wt as G,ut as H,it as I,Pt as J,It as K,xt as L,Nt as a,kt as b,vt as c,St as d,Lt as e,qt as f,Bt as g,Et as h,jt as i,Rt as j,Ct as k,Ut as l,Dt as m,At as n,Ot as o,Mt as p,dt as q,gt as r,$t as s,mt as t,tt as u,k as v,bt as w,H as x,G as y,Ft as z};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}