import{c as a,s as e,v as s,x as t,e as l,j as i,r as o,o as n,z as r,y as u,B as d,C as m,A as v,an as c,be as p}from"./base-lib.js?v=1761009159";import{l as f,u as g,aH as _,P as h,ak as b,_ as y}from"./utils-lib.js?v=1761009159";import{u as w}from"./useController5.js?v=1761009159";import{F as x,G as L,H as j,I as C,J as k,K as I,L as P,M as T}from"./useMethod5.js?v=1761009159";import{p as q,k as N}from"./validator.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./site.js?v=1761009159";import"./column.js?v=1761009159";import"./index106.js?v=1761009159";import"./useStore4.js?v=1761009159";import"./useController6.js?v=1761009159";const R={class:"p-[2rem]"},z=a({__name:"basic-setting",setup:a=>(e(A()),(a,e)=>{const i=f;return s(),t("div",R,[l(i)])})}),A=i("WP-PROTECTION-STORE",()=>{const a=o(!1);return{file:n({status:!1,number:0,pid:-1}),fileLoad:o(!1),firewall:n({status:!1,number:0}),firewallLoad:o(!1),hotlink:o(!1),hotlinkLoad:o(!1),pid:o(-1),tabActive:o("basic"),tabComponent:[{name:"basic",label:"基本设置",component:z}],isRefreshBasicList:a}}),{file:H,fileLoad:O,firewall:B,firewallLoad:E,hotlink:F,hotlinkLoad:M,pid:S}=e(A()),{localRow:W}=e(w()),{payment:G}=g(),J=async a=>{try{if(O.value=!0,"ltd"!==G.value.authType)return void q({disablePro:!0,sourceId:334});const{data:e}=await _({sName:"tamper_core"});if(!e.setup)return N({type:"i",name:"tamper_core"});a?await h({request:x({paths:[{path:W.value.path,ps:W.value.ps}]}),loading:"正在开启文件保护...",message:!0}):await h({request:L({path_id:H.value.pid}),loading:"正在关闭文件保护...",message:!0}),U()}finally{O.value=!1}},K=async a=>{try{if(E.value=!0,"ltd"!==G.value.authType)return void q({disablePro:!0,sourceId:334});const{data:e}=await _({sName:"btwaf"});if(!e.setup)return N({type:"i",name:"btwaf"});a?await h({request:j({site_name:W.value.name}),loading:"正在开启防火墙设置...",message:!0}):await h({request:C({site_name:W.value.name}),loading:"正在关闭防火墙设置...",message:!0}),U()}finally{E.value=!1}},D=async a=>{try{M.value=!0;const{data:e}=await k({id:W.value.id,name:W.value.name});if(b(e)){const s={id:W.value.id,name:W.value.name,fix:e.fix,domains:e.domains,return_rule:e.return_rule,status:a,http_status:"true"===e.http_status};await I(s),F.value=!!a}}finally{M.value=!1}},Q=a=>{O.value=a,E.value=a,M.value=a},U=async()=>{try{Q(!0);const{data:{msg:a}}=await P({id:W.value.id,path:W.value.path,site_name:W.value.name});if(b(a)&&(H.value.status=1===a.file_status,H.value.number=a.file_count,B.value.status=1===a.firewall_status,B.value.number=a.firewall_count,F.value=1===a.hotlink_status,1===a.file_status)){const{data:{msg:a}}=await T({path:W.value.path});b(a)&&(H.value.pid=a.pid)}}finally{Q(!1)}},V={class:"p-[2rem]"},X={class:"tools-card"},Y={class:"tools-desc flex items-center"},Z={class:"tools-card"},$={class:"tools-desc"},aa={class:"tools-card"},ea=y(a({__name:"index",setup(a){const{file:i,fileLoad:o,firewall:n,firewallLoad:f,hotlink:g,hotlinkLoad:_}=e(A());return U(),(a,e)=>{const h=c,b=p;return s(),t("div",V,[r("div",X,[e[1]||(e[1]=r("div",{class:"tools-img"},[r("span",{class:"svgtofont-tamper-pro !text-extraLarge text-primary"})],-1)),e[2]||(e[2]=r("div",{class:"tools-name"},"防篡改",-1)),l(h,{"model-value":u(i).status,loading:u(o),onChange:u(J)},null,8,["model-value","loading","onChange"]),e[3]||(e[3]=r("i",{class:"svgtofont-icon-ltd !text-extraLarge text-ltd"},null,-1)),r("div",Y,[l(b,{type:"danger",size:"small",bordered:!1},{default:d(()=>[m(v(u(i).number),1)]),_:1}),e[0]||(e[0]=r("span",{class:"ml-[.5rem]"}," 今天的修改被阻止 ",-1))])]),r("div",Z,[e[5]||(e[5]=r("div",{class:"tools-img"},[r("span",{class:"svgtofont-left-waf !text-subtitleLarge text-primary"})],-1)),e[6]||(e[6]=r("div",{class:"tools-name"},"Nginx WAF",-1)),l(h,{"model-value":u(n).status,loading:u(f),onChange:u(K)},null,8,["model-value","loading","onChange"]),e[7]||(e[7]=r("i",{class:"svgtofont-icon-ltd !text-extraLarge text-ltd"},null,-1)),r("div",$,[l(b,{type:"danger",size:"small",bordered:!1},{default:d(()=>[m(v(u(n).number),1)]),_:1}),e[4]||(e[4]=r("span",{class:"ml-[.5rem]"}," 恶意请求今天被阻止 ",-1))])]),r("div",aa,[e[8]||(e[8]=r("div",{class:"tools-img"},[r("span",{class:"svgtofont-el-link !text-subtitleLarge text-primary"})],-1)),e[9]||(e[9]=r("div",{class:"tools-name"},"防盗链",-1)),l(h,{"model-value":u(g),loading:u(_),onChange:u(D)},null,8,["model-value","loading","onChange"])])])}}}),[["__scopeId","data-v-b735174e"]]);export{ea as default};
