import{_ as de}from"./index-BRQskX9P.js?v=1773287522785";import{_ as me}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{k as z,R as J,r as F,e as q,$ as f,Z as C,_ as h,j as m,aa as u,F as D,P as ne,S as t,ak as L,a0 as s,a9 as i,a8 as A,l as ye,v as fe,X,N as ge}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{as as U,a3 as he,i as E,c as se,n as oe,h as Y,ap as be,l as xe,cq as ke}from"./index-BTglIPU2.js?v=1773287522785";import{ad as Z,a8 as ae,_ as ve,a1 as Se,a0 as Ie,b as ee,al as we,B as N,k as G,a6 as $e,a2 as Ce}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{_ as te}from"./index-DIKmrNCq.js?v=1773287522785";import{u as K}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{_ as He}from"./index.vue_vue_type_script_setup_true_lang-DgjjuUjT.js?v=1773287522785";import{_ as Ue}from"./index.vue_vue_type_script_setup_true_lang-C5hb-Th7.js?v=1773287522785";import{_ as Re}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{_ as Te}from"./index.vue_vue_type_script_setup_true_lang-D2Bk83Ev.js?v=1773287522785";import{u as Be}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import{u as Le}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-B7YvCBmY.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";import"./index-S15tYq5l.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DeTfbeeM.js?v=1773287522785";import"./index-Cg6fMjw6.js?v=1773287522785";const{t:W}=he.global,ie=()=>U.post("/breaking_through?action=get_config"),V=d=>U.post("/breaking_through?action=set_config",d,{requestOptions:{loading:W("Security.Api.Index_6"),successMessage:!0}}),Fe=d=>U.post("/breaking_through?action=check_local_ip_white",d,{requestOptions:{loading:"",successMessage:!1,errorMessage:!1}}),le=d=>U.post("/breaking_through?action=panel_ip_white",d,{requestOptions:{loading:W("Security.Api.Index_4"),successMessage:!0}}),re=d=>U.post("/breaking_through?action=get_black_white",d),ue=d=>U.post("/breaking_through?action=add_black_white",d,{requestOptions:{loading:W("Security.Api.Index_6"),successMessage:!0}}),Pe=d=>U.post("/breaking_through?action=get_history_record",d),qe=()=>U.post("/breaking_through?action=clear_history_record_limit",{},{requestOptions:{loading:W("Security.Api.Index_7"),successMessage:!0}}),Ae=d=>U.post("/breaking_through?action=set_history_record_limit",d,{requestOptions:{loading:W("Security.Api.Index_6"),successMessage:!0}}),ze=()=>U.post("/breaking_through?action=get_protected_services"),Oe={class:"pl-5px"},Me={key:0},Ne={class:"mb-15px"},We={class:"mr-10px"},je={key:0},Ve={class:"mr-10px"},De=z({__name:"index",setup(d,{expose:b}){const{t:n}=J(),l=F(null),k=F(null),v=F(null),r=q({protectionUsername:!0,minutes:5,failures:5,radio:0,check:!1}),e=q({protectionIP:!0,minutes:15,failures:5,ip:"1s",check:!1}),c=q({failures:360}),_=q({user:["yakpanel"],ip:["ssh"]}),x=async o=>{await V({username_status:o})},S=async o=>{await V({ip_status:o})},w=async()=>{c.failures&&await Ae({history_limit:c.failures})},H={minutes:{trigger:["blur","change"],validator:(o,a)=>a===null||a===0?new Error(n("Security.Conf.Index_27")):!0},failures:{required:!0,type:"number",trigger:["blur","change"],message:n("Security.Conf.Index_28")}},g={minutes:{trigger:["blur","change"],validator:(o,a)=>a===null||a===0?new Error(n("Security.Conf.Index_27")):!0},failures:{required:!0,type:"number",trigger:["blur","change"],message:n("Security.Conf.Index_28")}},y={failures:{required:!0,type:"number",trigger:["blur","change"],message:n("Security.Conf.Index_28")}},I=()=>({username_limit:r.minutes,username_count:r.failures,username_type:r.radio,username_limit_root:r.check,ip_limit:e.minutes,ip_count:e.failures,ip_command:e.ip,ip_ipset_filter:e.check,history_limit:c.failures}),Q=async()=>{var o,a,T;await((o=l.value)==null?void 0:o.validate()),await((a=k.value)==null?void 0:a.validate()),await((T=v.value)==null?void 0:T.validate()),await V(I()),P()},P=async()=>{const{message:o}=await ie();E(o)&&(r.protectionUsername=o.username_status,r.minutes=o.based_on_username.limit,r.failures=o.based_on_username.count,r.radio=o.based_on_username.type,r.check=o.based_on_username.limit_root,e.protectionIP=o.ip_status,e.minutes=o.based_on_ip.limit,e.failures=o.based_on_ip.count,e.ip=o.based_on_ip.command,e.check=o.based_on_ip.ipset_filter,c.failures=o.history_limit);const{message:a}=await ze();E(a)&&(_.user=a.based_on_username,_.ip=a.based_on_ip)};return P(),b({init:P}),(o,a)=>{const T=Z,j=ae,B=ve,R=Se,O=me,$=Ie,ce=ee,_e=we,pe=N;return f(),C("div",Oe,[h("h3",null,[m(u(o.$t("Security.Conf.Index_5"))+" ("+u(o.$t("Security.Conf.Index_37"))+" ",1),(f(!0),C(D,null,ne(t(_).user,(p,M)=>(f(),C("span",{key:M},[m(u(p),1),M[m(u(o.$t("Security.Conf.Index_6")),1)]),_:1}),h("div",Ne,[h("span",We,u(o.$t("Site.TableRow.index_14")),1),s(j,{size:"small",value:t(r).protectionUsername,"onUpdate:value":[a[0]||(a[0]=p=>t(r).protectionUsername=p),x]},null,8,["value"])]),t(r).protectionUsername?(f(),A(O,{key:0,ref_key:"userFormRef",ref:l,"label-placement":"top",model:t(r),rules:H},{default:i(()=>[s(R,{label:o.$t("Security.Conf.Index_7"),path:"minutes"},{default:i(()=>[s(B,{"show-button":!1,value:t(r).minutes,"onUpdate:value":a[1]||(a[1]=p=>t(r).minutes=p)},null,8,["value"])]),_:1},8,["label"]),s(R,{label:o.$t("Security.Conf.Index_8"),path:"failures"},{default:i(()=>[s(B,{"show-button":!1,value:t(r).failures,"onUpdate:value":a[2]||(a[2]=p=>t(r).failures=p)},null,8,["value"])]),_:1},8,["label"])]),_:1},8,["model"])):L("",!0),s($,{class:"mb-20px!"}),h("h3",null,[m(u(o.$t("Security.Conf.Index_12"))+" ("+u(o.$t("Security.Conf.Index_37"))+" ",1),(f(!0),C(D,null,ne(t(_).ip,(p,M)=>(f(),C("span",{key:M},[m(u(p),1),M[m(u(o.$t("Security.Conf.Index_13")),1)]),_:1}),h("span",Ve,u(o.$t("Site.TableRow.index_14")),1),s(j,{size:"small",value:t(e).protectionIP,"onUpdate:value":[a[3]||(a[3]=p=>t(e).protectionIP=p),S]},null,8,["value"]),t(e).protectionIP?(f(),A(O,{key:1,ref_key:"ipFormRef",ref:k,"label-placement":"top",model:t(e),rules:g,class:"pt-15px"},{default:i(()=>[s(R,{label:o.$t("Security.Conf.Index_14"),path:"minutes"},{default:i(()=>[s(B,{"show-button":!1,value:t(e).minutes,"onUpdate:value":a[4]||(a[4]=p=>t(e).minutes=p)},null,8,["value"])]),_:1},8,["label"]),s(R,{label:o.$t("Security.Conf.Index_15"),path:"failures"},{default:i(()=>[s(B,{"show-button":!1,value:t(e).failures,"onUpdate:value":a[5]||(a[5]=p=>t(e).failures=p)},null,8,["value"])]),_:1},8,["label"]),s(R,{label:o.$t("Security.Conf.Index_16")},{default:i(()=>[s(ce,{class:"w-150px!",value:t(e).ip,"onUpdate:value":a[6]||(a[6]=p=>t(e).ip=p),placeholder:o.$t("Security.Conf.Index_38")},null,8,["value","placeholder"])]),_:1},8,["label"]),s(_e,{checked:t(e).check,"onUpdate:checked":a[7]||(a[7]=p=>t(e).check=p)},{default:i(()=>[m(u(o.$t("Security.Conf.Index_17")),1)]),_:1},8,["checked"]),ye(h("div",{class:"mt-10px ml-24px text-desc"},u(o.$t("Security.Conf.Index_39",[t(e).minutes])),513),[[fe,t(e).check]])]),_:1},8,["model"])):L("",!0),s($,{class:"my-20px!"}),h("h3",null,u(o.$t("Security.Conf.Index_22")),1),s(O,{"label-placement":"top",model:t(c),rules:y,ref_key:"historyFormRef",ref:v,class:"pt-15px"},{default:i(()=>[s(R,{label:o.$t("Security.Conf.Index_23"),path:"failures"},{default:i(()=>[s(B,{"show-button":!1,placeholder:o.$t("Site.Placeholder.Index_10"),value:t(c).failures,"onUpdate:value":a[8]||(a[8]=p=>t(c).failures=p),onBlur:w},null,8,["placeholder","value"])]),_:1},8,["label"])]),_:1},8,["model"]),s($,{class:"mb-20px!"}),s(pe,{type:"primary",onClick:Q},{default:i(()=>[m(u(o.$t("Site.Cert.index_60")),1)]),_:1})])}}}),Ee=se(De,[["__scopeId","data-v-89ebe7d8"]]),Je={class:"pl-5px"},Xe=z({__name:"index",setup(d,{expose:b}){const n=F(""),{loading:l,setLoading:k}=K(!0),v=async()=>{const e=JSON.stringify(n.value);await ue({ips:e.replace(/^"|"$/g,""),types:"white",hand:!0}),r()},r=async()=>{try{k(!0);const{message:e}=await re({types:"white"});oe(e)&&(n.value=e.map(c=>"".concat(c.ip," # ").concat(c.ps)).join("\n"))}finally{k(!1)}};return r(),b({init:r}),(e,c)=>{const _=Z,x=ee,S=te,w=G,H=N;return f(),C("div",Je,[s(_,{"show-icon":!1},{default:i(()=>[m(u(e.$t("Security.WhiteList.Index_1")),1)]),_:1}),s(w,{class:"items-center my-15px"},{default:i(()=>[s(x,{class:"w-500px!",type:"textarea",loading:t(l),value:t(n),"onUpdate:value":c[0]||(c[0]=g=>X(n)?n.value=g:null),autosize:{minRows:10},placeholder:e.$t("Ftp.Placeholder.Index_3")},null,8,["loading","value","placeholder"]),s(S,null,{default:i(()=>[h("li",null,u(e.$t("Security.WhiteList.Index_2")),1),h("li",null,u(e.$t("Security.WhiteList.Index_3")),1),h("li",null,u(e.$t("Security.WhiteList.Index_4")),1)]),_:1})]),_:1}),s(H,{type:"primary",onClick:v},{default:i(()=>[m(u(e.$t("Site.Cert.index_60")),1)]),_:1})])}}}),Ze={class:"pl-5px"},Ge=z({__name:"index",setup(d,{expose:b}){const n=F(""),{loading:l,setLoading:k}=K(!0),v=async()=>{const e=JSON.stringify(n.value);await ue({ips:e.replace(/^"|"$/g,""),types:"black",hand:!0}),r()},r=async()=>{try{k(!0);const{message:e}=await re({types:"black"});oe(e)&&(n.value=e.map(c=>"".concat(c.ip," # ").concat(c.ps)).join("\n"))}finally{k(!1)}};return r(),b({init:r}),(e,c)=>{const _=Z,x=ee,S=te,w=G,H=N;return f(),C("div",Ze,[s(_,{"show-icon":!1},{default:i(()=>[m(u(e.$t("Security.BlackList.Index_1")),1)]),_:1}),s(w,{class:"items-center my-15px"},{default:i(()=>[s(x,{class:"w-500px!",type:"textarea",loading:t(l),value:t(n),"onUpdate:value":c[0]||(c[0]=g=>X(n)?n.value=g:null),autosize:{minRows:10},placeholder:e.$t("Ftp.Placeholder.Index_3")},null,8,["loading","value","placeholder"]),s(S,null,{default:i(()=>[h("li",null,u(e.$t("Security.WhiteList.Index_2")),1),h("li",null,u(e.$t("Security.WhiteList.Index_3")),1),h("li",null,u(e.$t("Security.WhiteList.Index_4")),1)]),_:1})]),_:1}),s(H,{type:"primary",onClick:v},{default:i(()=>[m(u(e.$t("Site.Cert.index_60")),1)]),_:1})])}}}),Ke=z({__name:"index",setup(d,{expose:b}){const{t:n}=J(),l=q({p:1,limit:10,keyword:"",types:"login"}),k=[{key:"user",title:n("Security.History.Index_7"),width:"15%"},{key:"ip",title:n("Security.History.Index_8"),width:"15%"},{key:"service",title:n("Security.History.Index_10"),width:"15%"},{key:"logintime",title:n("Security.History.Index_11"),align:"center",width:"10%"}],v=[{key:"ip",title:n("Security.History.Index_8"),width:"15%"},{key:"lock_status",title:n("Home.index_66"),width:"20%"},{key:"block_reason",title:n("Security.Anti.Index_21"),width:"20%"},{key:"exptime",title:n("Security.History.index_20"),width:"20%"},{key:"timeleft",title:n("Security.History.index_21"),width:"20%",align:"center"},Be({title:n("Public.Table.Action"),align:"right",options:y=>[{label:n("Security.History.Index_16"),onClick:async()=>{Y({title:"".concat(n("Security.History.Index_16")," [").concat(y.ip,"]"),content:n("Security.History.Index_17"),onConfirm:async()=>{await le({ip:y.ip,hand:!0,ps:"Manually add",clear_black:1}),g()}})}}]})],{keys:r,table:e,columns:c}=Le(k),_=[{label:n("Security.History.Index_3"),value:"login"},{label:n("Security.History.Index_5"),value:"ip"}],x=async()=>{l.keyword="",l.p=1,e.data=[],c.value=l.types==="ip"?v:k,g()},S=async()=>{Y({title:n("Security.History.Index_1"),content:n("Security.History.Index_18"),onConfirm:async()=>{await qe(),g()}})},{loading:w,setLoading:H}=K(!0),g=async()=>{try{H(!0);const{message:y}=await Pe(ge(l));E(y)?(e.data=y.data,e.total=be(y.page)):(e.data=[],e.total=0)}finally{r.value=[],H(!1)}};return g(),b({init:g}),(y,I)=>{const Q=xe,P=N,o=$e,a=Te,T=G,j=Re,B=Ue,R=He,O=te;return f(),C(D,null,[s(R,{class:"pl-5px"},{toolsLeft:i(()=>[s(P,{type:"primary",onClick:g},{icon:i(()=>[s(Q,{name:"refresh",size:"14"})]),default:i(()=>[m(" "+u(y.$t("Public.Btn.Refresh")),1)]),_:1}),s(P,{onClick:S},{default:i(()=>[m(u(y.$t("Security.History.Index_1")),1)]),_:1})]),toolsRight:i(()=>[m(u(y.$t("Security.History.Index_2"))+" ",1),s(T,{class:"flex-nowrap!"},{default:i(()=>[s(o,{value:t(l).types,"onUpdate:value":[I[0]||(I[0]=$=>t(l).types=$),x],options:_,class:"w-200px"},null,8,["value"]),s(a,{value:t(l).keyword,"onUpdate:value":I[1]||(I[1]=$=>t(l).keyword=$),placeholder:y.$t("Security.History.Index_14"),onSearch:g},null,8,["value","placeholder"])]),_:1})]),table:i(()=>[s(j,{loading:t(w),data:t(e).data,columns:t(c)},null,8,["loading","data","columns"])]),pageRight:i(()=>[s(B,{page:t(l).p,"onUpdate:page":I[2]||(I[2]=$=>t(l).p=$),"page-size":t(l).limit,"onUpdate:pageSize":I[3]||(I[3]=$=>t(l).limit=$),"item-count":t(e).total,onRefresh:g},null,8,["page","page-size","item-count"])]),_:1}),t(l).types==="ip"?(f(),A(O,{key:0},{default:i(()=>[h("li",null,u(y.$t("Security.History.Index_19")),1)]),_:1})):L("",!0)],64)}}}),Qe=z({__name:"index",setup(d){const{t:b}=J(),n=F("config"),l=[{key:"config",label:b("Security.Tabs.Index_1"),component:Ee},{key:"white",label:b("Security.Tabs.Index_2"),component:Xe},{key:"black",label:b("Security.Tabs.Index_3"),component:Ge},{key:"history",label:b("Security.Tabs.Index_4"),component:Ke}];return(k,v)=>{const r=de;return f(),A(r,{value:t(n),"onUpdate:value":v[0]||(v[0]=e=>X(n)?n.value=e:null),options:l},null,8,["value"])}}}),Ye={class:"mr-15px"},et=z({__name:"index",setup(d){const{t:b}=J(),n=q({address:"",show:!1}),l=F(!1),k=async _=>{l.value=!_;const x=b("Security.Conf.Index_1"),S=b("Security.Conf.Index_4");Y({title:x,content:S,onConfirm:async({hide:w})=>{await V({global_status:_}),l.value=_,w()}})},v=async()=>{await le({ip:n.address,hand:!0}),c()},{loading:r,setLoading:e}=K(!0),c=async()=>{e(!0);const{message:_}=await ie();if(E(_)&&(l.value=_.global_status,e(!1),!_.global_status))return;const{data:x}=await ke.get("https://api.ipify.org?format=json");n.address=x.ip;try{await Fe({ip:x.ip}),n.show=!1}catch(S){n.show=!0,console.error(S)}};return c(),(_,x)=>{const S=N,w=Z,H=ae,g=G,y=Ce;return f(),C(D,null,[t(n).show&&t(l)?(f(),A(w,{key:0,class:"py-10px",type:"warning",bordered:!1},{default:i(()=>[h("span",Ye,u(_.$t("Security.Conf.Index_2",[t(n).address])),1),s(S,{text:"",type:"primary",onClick:v},{default:i(()=>[m(" ["+u(_.$t("Security.Conf.Index_3"))+"] ",1)]),_:1})]),_:1})):L("",!0),s(y,{class:"my-15px"},{default:i(()=>[s(g,{class:"p-15px items-center"},{default:i(()=>[h("span",null,u(_.$t("Security.Conf.Index_1")),1),s(H,{value:t(l),"onUpdate:value":[x[0]||(x[0]=I=>X(l)?l.value=I:null),k],"rubber-band":!1,loading:t(r),size:"small"},null,8,["value","loading"])]),_:1})]),_:1}),t(l)?(f(),A(y,{key:1,class:"p-15px"},{default:i(()=>[s(Qe)]),_:1})):L("",!0)],64)}}}),kt=se(et,[["__scopeId","data-v-be40dd88"]]);export{kt as default};