3 lines
30 KiB
JavaScript
3 lines
30 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/form-DiMx9Zfm.js?v=1773287522785","js/index-DIKmrNCq.js?v=1773287522785","js/index-BTglIPU2.js?v=1773287522785","js/vue-core-DJjvd5ZC.js?v=1773287522785","js/prismjs-BZPoR7_J.js?v=1773287522785","css/prismjs-D-3FhBe_.css?v=1773287522785","js/naive-ui--dJnpVcV.js?v=1773287522785","css/index-DEM1fxGq.css?v=1773287522785","js/index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785","js/index-CZps0rIN.js?v=1773287522785","css/index-CdMsogou.css?v=1773287522785","js/firewall-jQIxKxfN.js?v=1773287522785","js/export-DIF0eTHW.js?v=1773287522785","js/process-37Vo1bwg.js?v=1773287522785","js/useLoading-CZ2gSAW7.js?v=1773287522785","js/log-BxlMh4sF.js?v=1773287522785","js/form-4lYVXWag.js?v=1773287522785","js/export-Cklx7x73.js?v=1773287522785","js/form-C18YmHSH.js?v=1773287522785","js/check-CNel7fTH.js?v=1773287522785","js/form-ApdfCR0U.js?v=1773287522785","js/data-BVsViUMm.js?v=1773287522785"])))=>i.map(i=>d[i]);
|
|
import{_ as re}from"./index-COOnaZWq.js?v=1773287522785";import{_ as Me}from"./index-BRQskX9P.js?v=1773287522785";import{m as H,v as Q,h as K,x as ae,P as X,i as V,ap as se,t as Oe,Q as Be,aq as ze,n as Ke,_ as Ve,aJ as Ne,ar as je,ao as We}from"./index-BTglIPU2.js?v=1773287522785";import{i as ke,e as Je,d as $e,a as Ge,u as Qe,b as Xe,f as Ae,h as Ze,j as Ce,k as He,l as Ye,m as et,n as Re,o as tt,p as it,q as at,g as nt,s as ot,r as lt,t as rt,c as st}from"./firewall-jQIxKxfN.js?v=1773287522785";import{_ as de}from"./index.vue_vue_type_script_setup_true_lang-DgjjuUjT.js?v=1773287522785";import{_ as ce}from"./index.vue_vue_type_script_setup_true_lang-C5hb-Th7.js?v=1773287522785";import{_ as ue}from"./index.vue_vue_type_script_setup_true_lang-HxsqzSKU.js?v=1773287522785";import{_ as _e}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{_ as pe}from"./index.vue_vue_type_script_setup_true_lang-D2Bk83Ev.js?v=1773287522785";import{u as ye}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{u as me}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import{u as fe}from"./file-B5PwfK2h.js?v=1773287522785";import{B as N,ar as we,a3 as De,ag as qe,k as dt,a8 as ct,a0 as ut,a2 as _t,$ as pt}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as j,R as G,r as ee,$ as T,a8 as J,a9 as s,a0 as n,q as Se,X as z,S as e,e as ne,F as le,j as P,N as te,o as he,Z as Y,aa as x,a3 as Z,_ as M,a6 as ge,am as yt,aw as mt,l as Ie,P as ft,ad as wt,ak as St}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{u as Fe}from"./index-BqDzHU0m.js?v=1773287522785";import{_ as ht}from"./index-DIKmrNCq.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 gt=".json",Le="/www/server/panel/data/firewall",Ft=j({__name:"import",emits:["finish"],setup(W,{emit:C}){const b=C,{t:_}=G(),p=ee([]),S=async({file:r})=>{const{close:t}=H.loading(_("Security.Firewall.Api.index_1"));try{const o=new FormData;o.append("f_path",Le),o.append("f_name",r.name),o.append("f_start","0"),r.file&&(o.append("blob",r.file),o.append("f_size",r.file.size.toString())),await fe(o);const u="".concat(Le,"/").concat(r.name);await ke({rule:"port",file:u}),b("finish",u)}finally{p.value=[],t()}};return(r,t)=>{const o=N,u=we;return T(),J(u,{ref:"upload",class:"w-auto",action:"","file-list":e(p),"onUpdate:fileList":t[0]||(t[0]=c=>z(p)?p.value=c:null),accept:gt,multiple:!1,"show-file-list":!1,"custom-request":S},{default:s(()=>[n(o,null,{default:s(()=>[Se(r.$slots,"default")]),_:3})]),_:3},8,["file-list"])}}}),xt=j({__name:"index",emits:["refresh"],setup(W,{expose:C,emit:b}){const _=Z(()=>X(()=>import("./form-DiMx9Zfm.js?v=1773287522785"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),p=Z(()=>X(()=>import("./export-DIF0eTHW.js?v=1773287522785"),__vite__mapDeps([12,8,3,4,5,6,11,2,7]))),S=Z(()=>X(()=>import("./process-37Vo1bwg.js?v=1773287522785"),__vite__mapDeps([13,2,3,4,5,6,7,14,11]))),r=b,{t}=G(),o=()=>{l(),r("refresh")},u=Q(t("Security.Firewall.Port.index_1"),{isEdit:!1,onRefresh:()=>{o()}}),c=()=>{u.data.row=void 0,u.data.isEdit=!1,u.title=t("Security.Firewall.Port.index_1"),u.show=!0},B=i=>{u.data.row=i,u.data.isEdit=!0,u.title=t("Security.Firewall.Port.index_8"),u.show=!0},L=Q(t("Security.Firewall.Port.index_3")),v=()=>{L.data.chain=m.chain,L.show=!0},k=i=>"".concat(i.Port,"-").concat(i.Family,"-").concat(i.Protocol),m=ne({chain:"ALL",query:"",p:1,row:20}),D=new Map([["3306",t("Security.Firewall.Port.index_9")],["888",t("Security.Firewall.Port.index_10")],["22",t("Security.Firewall.Port.index_11")],["20",t("Security.Firewall.Port.index_12")],["21",t("Security.Firewall.Port.index_13")],["39000-40000",t("Security.Firewall.Port.index_14")],["30000-40000",t("Security.Firewall.Port.index_14")],["11211",t("Security.Firewall.Port.index_15")],["873",t("Security.Firewall.Port.index_16")],["80",t("Security.Firewall.Port.index_17")]]),{keys:g,table:$,columns:d,setLoading:f}=ye([{type:"selection",width:40},{key:"Protocol",title:t("Security.Firewall.Port.index_18")},{key:"Port",title:t("Security.Firewall.Port.index_19"),render:i=>i.Port+(i.Family==="ipv6"?" (ipv6)":"")},{key:"status",title:()=>n(le,null,[n("span",{class:"mr-4px"},[t("Security.Firewall.Port.index_36")]),n("a",{class:"bt-ico-ask",href:"https://www.yakpanel.com/forum/d/1088-description-of-firewall-status",target:"_blank"},[P("?")])]),render:i=>{var y,U;return n(le,null,[n("span",null,[i.status===0?t("Security.Firewall.Port.index_22"):i.status===1&&!((y=i.Port)!=null&&y.includes("-"))?t("Security.Firewall.Port.index_37"):t("Security.Firewall.Port.index_20")]),i.status!==2||(U=i.Port)!=null&&U.includes("-")||i.Protocol==="udp"?"":n("a",{class:"bt-link",onClick:()=>{A(i)}},[t("Security.Firewall.Port.index_38")])])}},{key:"Strategy",title:t("Security.Firewall.Port.index_21"),render:i=>n("a",{class:["bt-link",i.Strategy=="accept"?"":"error"],onClick:()=>{a(i)}},[i.Strategy=="accept"?t("Security.Firewall.Port.index_39"):t("Security.Firewall.Port.index_40")])},{key:"Chain",title:t("Security.Firewall.Port.index_23"),render:i=>i.Chain==="INPUT"?t("Security.Firewall.Port.index_5"):t("Security.Firewall.Port.index_6")},{key:"Address",title:t("Security.Firewall.Port.index_24"),render:i=>i.sid>0?i.domain:i.Address==="all"?t("Security.Firewall.Port.index_25"):i.Address},{key:"brief",title:t("Security.Firewall.Port.index_26"),minWidth:150,width:"8%",ellipsis:{tooltip:!0},render:i=>i.brief||D.get(i.Port)||"--"},{key:"addtime",title:t("Security.Firewall.Port.index_27"),width:"8%",minWidth:140},me({width:140,options:i=>[{label:t("Public.Btn.Edit"),onClick:()=>{B(i)}},{label:t("Public.Btn.Del"),onClick:()=>{h(i)}}]})]),R=Q(""),A=i=>{R.data.row=i,R.title=t("Security.Firewall.Port.index_28",[i.Port]),R.show=!0},a=i=>{K({title:t("Security.Firewall.Port.index_29",[i.Port]),content:i.Strategy==="accept"?t("Security.Firewall.Port.index_41"):t("Security.Firewall.Port.index_30"),onConfirm:async()=>{await Je({new_data:{protocol:i.Protocol,address:i.Address,port:i.Port,strategy:i.Strategy==="accept"?"drop":"accept",chain:i.Chain,brief:i.brief},old_data:te(i)}),$.data.filter(y=>y.Port===i.Port).forEach(y=>{y.Strategy=y.Strategy==="accept"?"drop":"accept"})}})},h=i=>{K({title:t("Security.Firewall.Port.index_31",[i.Port]),content:t("Security.Firewall.Port.index_32"),onConfirm:async()=>{await $e({protocol:i.Protocol,address:i.Address,port:i.Port,strategy:i.Strategy,chain:i.Chain,brief:i.brief,domain:i.domain}),o()}})},q=[{key:"delete",type:"confirm",label:t("Security.Firewall.Port.index_33"),confirm:{title:t("Security.Firewall.Port.index_34"),desc:t("Security.Firewall.Port.index_35"),api:i=>$e({protocol:i.Protocol,address:i.Address,port:i.Port,strategy:i.Strategy,chain:i.Chain,brief:i.brief,domain:i.domain},!1),done:()=>{o()},columns:[{key:"Port",title:t("Security.Firewall.Port.index_19"),render:i=>i.Port+(i.Family==="ipv6"?" (ipv6)":"")}]}}],E=()=>{m.p=1,l()},l=async()=>{try{f(!0);const{message:i}=await Ge(te(m));V(i)&&($.data=i.data,$.total=se(i.page))}finally{g.value=[],f(!1)}};return he(()=>{l()}),C({init:l}),(i,y)=>{const U=N,I=qe,O=De,F=pe,xe=_e,be=ue,Pe=ce,oe=de,ie=ae;return T(),Y("div",null,[n(oe,null,{toolsLeft:s(()=>[n(U,{type:"primary",onClick:c},{default:s(()=>[P(x(i.$t("Security.Firewall.Port.index_1")),1)]),_:1}),n(Ft,{onFinish:o},{default:s(()=>[P(x(i.$t("Security.Firewall.Port.index_2")),1)]),_:1}),n(U,{onClick:v},{default:s(()=>[P(x(i.$t("Security.Firewall.Port.index_3")),1)]),_:1})]),toolsRight:s(()=>[n(O,{value:e(m).chain,"onUpdate:value":[y[0]||(y[0]=w=>e(m).chain=w),E]},{default:s(()=>[n(I,{value:"ALL"},{default:s(()=>[P(x(i.$t("Security.Firewall.Port.index_4")),1)]),_:1}),n(I,{value:"INPUT"},{default:s(()=>[P(x(i.$t("Security.Firewall.Port.index_5")),1)]),_:1}),n(I,{value:"OUTPUT"},{default:s(()=>[P(x(i.$t("Security.Firewall.Port.index_6")),1)]),_:1})]),_:1},8,["value"]),n(F,{value:e(m).query,"onUpdate:value":y[1]||(y[1]=w=>e(m).query=w),width:"240",placeholder:i.$t("Security.Firewall.Port.index_7"),onSearch:E},null,8,["value","placeholder"])]),table:s(()=>[n(xe,{"checked-row-keys":e(g),"onUpdate:checkedRowKeys":y[2]||(y[2]=w=>z(g)?g.value=w:null),"row-key":k,loading:e($).loading,data:e($).data,columns:e(d)},null,8,["checked-row-keys","loading","data","columns"])]),pageLeft:s(()=>[n(be,{"checked-row-keys":e(g),"onUpdate:checkedRowKeys":y[3]||(y[3]=w=>z(g)?g.value=w:null),"row-key":k,data:e($).data,options:q},null,8,["checked-row-keys","data"])]),pageRight:s(()=>[n(Pe,{page:e(m).p,"onUpdate:page":y[4]||(y[4]=w=>e(m).p=w),"page-size":e(m).row,"onUpdate:pageSize":y[5]||(y[5]=w=>e(m).row=w),"item-count":e($).total,"store-key":"firewall-port",onRefresh:l},null,8,["page","page-size","item-count"])]),_:1}),n(ie,{show:e(u).show,"onUpdate:show":y[6]||(y[6]=w=>e(u).show=w),title:e(u).title,data:e(u).data,width:460,"min-height":396,footer:!0,component:e(_)},null,8,["show","title","data","component"]),n(ie,{show:e(L).show,"onUpdate:show":y[7]||(y[7]=w=>e(L).show=w),title:e(L).title,data:e(L).data,width:420,"min-height":72,footer:!0,component:e(p)},null,8,["show","title","data","component"]),n(ie,{show:e(R).show,"onUpdate:show":y[8]||(y[8]=w=>e(R).show=w),title:e(R).title,data:e(R).data,width:420,"min-height":162,component:e(S)},null,8,["show","title","data","component"])])}}}),bt={class:"p-16px"},Pt={class:"flex justify-center"},ve=j({__name:"index",setup(W){const C=Z(()=>X(()=>import("./log-BxlMh4sF.js?v=1773287522785"),__vite__mapDeps([15,11,2,3,4,5,6,7]))),b=Q("Migrating firewall data",{path:""}),_=()=>{K({title:"Migrating firewall data",content:"Firewall data is about to be migrated, firewalld/ufw will be reloaded, and iptables rules may be cleared. Please confirm that iptables rules are persisted before proceeding). Do you want to continue?",onConfirm:async()=>{const{message:p}=await Qe();V(p)&&p.task_id&&(b.data.path="/www/server/panel/tmp/"+p.task_id+".log",b.show=!0)}})};return(p,S)=>{const r=ht,t=N,o=ae;return T(),Y("div",bt,[S[3]||(S[3]=M("div",{class:"text-#e6a23c font-bold text-center text-4xl!"},"Detected the need to migrate the old firewall to the new service",-1)),n(r,{class:"mt-4 mb-8"},{default:s(()=>S[1]||(S[1]=[M("li",null," Only the firewall function of the panel will be migrated, and the existing rules of the system firewall (firewall/ufw) will not be affected. ",-1),M("li",null," If you have used the iptables command line to add non-persistent rules, they will be lost! Please pay attention to persist or save iptables rules ",-1)])),_:1,__:[1]}),M("div",Pt,[n(t,{type:"primary",onClick:_},{default:s(()=>S[2]||(S[2]=[P(" Migrate now ")])),_:1,__:[2]})]),n(o,{show:e(b).show,"onUpdate:show":S[0]||(S[0]=u=>e(b).show=u),title:e(b).title,data:e(b).data,width:550,"min-height":300,component:e(C),hideClose:!0},null,8,["show","title","data","component"])])}}}),kt=".json",Ue="/www/server/panel/data/firewall",vt=j({__name:"import",emits:["finish"],setup(W,{emit:C}){const b=C,{t:_}=G(),p=ee([]),S=async({file:r})=>{const{close:t}=H.loading(_("Security.Firewall.Api.index_1"));try{const o=new FormData;o.append("f_path",Ue),o.append("f_name",r.name),o.append("f_start","0"),r.file&&(o.append("blob",r.file),o.append("f_size",r.file.size.toString())),await fe(o);const u="".concat(Ue,"/").concat(r.name);await ke({rule:"ip",file:u}),b("finish",u)}finally{p.value=[],t()}};return(r,t)=>{const o=N,u=we;return T(),J(u,{ref:"upload",class:"w-auto",action:"","file-list":e(p),"onUpdate:fileList":t[0]||(t[0]=c=>z(p)?p.value=c:null),accept:kt,multiple:!1,"show-file-list":!1,"custom-request":S},{default:s(()=>[n(o,null,{default:s(()=>[Se(r.$slots,"default")]),_:3})]),_:3},8,["file-list"])}}}),$t=j({__name:"index",emits:["refresh"],setup(W,{expose:C,emit:b}){const _=Z(()=>X(()=>import("./form-4lYVXWag.js?v=1773287522785"),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11]))),p=Z(()=>X(()=>import("./export-Cklx7x73.js?v=1773287522785"),__vite__mapDeps([17,8,3,4,5,6,11,2,7]))),S=b,{t:r}=G(),t=Oe(),o=Fe(),{firewallStatus:u}=ge(o),c=Q(r("Security.Firewall.IP.index_1"),{isEdit:!1,onRefresh:()=>{D()}}),B=()=>{c.data.row=void 0,c.data.isEdit=!1,c.title=r("Security.Firewall.IP.index_1"),c.show=!0},L=l=>{c.data.row=l,c.data.isEdit=!0,c.title=r("Security.Firewall.IP.index_8"),c.show=!0},v=Q(r("Security.Firewall.IP.index_2")),k=()=>{v.data.chain=g.chain,v.show=!0},m=l=>"".concat(l.Address,"-").concat(l.Chain),D=()=>{E(),S("refresh")},g=ne({chain:"ALL",query:"",p:1,row:20}),{keys:$,table:d,columns:f,setLoading:R}=ye([{type:"selection",width:40,disabled:l=>l.stype==="2"},{key:"Address",title:r("Security.Firewall.IP.index_9")},{key:"area",title:r("Security.Firewall.IP.index_10"),render:l=>{if(t.isFree)return n("a",{class:"bt-link",onClick:()=>{Be({source:116})}},[r("Security.Firewall.IP.index_24")]);const{area:i}=l;return i.info||"--"}},{key:"Strategy",title:r("Security.Firewall.IP.index_11"),render:l=>n("a",{class:["bt-link",l.Strategy=="accept"?"":"error"],onClick:()=>{A(l)}},[l.Strategy=="accept"?r("Security.Firewall.IP.index_23"):r("Security.Firewall.IP.index_12")])},{key:"Chain",title:r("Security.Firewall.IP.index_13"),render:l=>l.Chain==="INPUT"?r("Security.Firewall.IP.index_5"):r("Security.Firewall.IP.index_6")},{key:"brief",title:r("Security.Firewall.IP.index_14"),render:l=>l.brief||"--"},{key:"addtime",title:r("Security.Firewall.IP.index_15"),render:l=>l.addtime||"--"},me({width:100,options:l=>[{label:r("Public.Btn.Edit"),disabled:l.stype==="2",onClick:()=>{L(l)}},{label:r("Public.Btn.Del"),disabled:l.stype==="2",onClick:()=>{a(l)}}]})]);f.value.splice(2,1);const A=l=>{K({title:r("Security.Firewall.IP.index_16",[l.Address]),content:l.Strategy==="accept"?r("Security.Firewall.IP.index_25"):r("Security.Firewall.IP.index_17"),onConfirm:async()=>{await Xe({new_data:{address:l.Address,strategy:l.Strategy==="accept"?"drop":"accept",chain:l.Chain,brief:l.brief,family:l.Family},old_data:te(l)}),l.Strategy=l.Strategy==="accept"?"drop":"accept"}})},a=l=>{K({title:r("Security.Firewall.IP.index_18",[l.Address]),content:r("Security.Firewall.IP.index_19"),onConfirm:async()=>{await Ae({address:l.Address,strategy:l.Strategy,chain:l.Chain,brief:l.brief,family:l.Family}),D()}})},h=[{key:"delete",type:"confirm",label:r("Security.Firewall.IP.index_20"),confirm:{title:r("Security.Firewall.IP.index_21"),desc:r("Security.Firewall.IP.index_22"),api:l=>Ae({address:l.Address,strategy:l.Strategy,chain:l.Chain,brief:l.brief,family:l.Family},!1),done:()=>{D()},columns:[{key:"Address",title:r("Security.Firewall.IP.index_9")}]}}],q=()=>{g.p=1,E()},E=async()=>{try{R(!0);const{message:l}=await Ze(te(g));V(l)&&(d.data=l.data,d.total=se(l.page))}finally{$.value=[],R(!1)}};return he(()=>{u.value.initStatus&&E()}),C({init:E}),(l,i)=>{const y=N,U=qe,I=De,O=pe,F=_e,xe=ue,be=ce,Pe=de,oe=ae,ie=re;return T(),J(ie,{install:e(u).initStatus},{desc:s(()=>[n(ve)]),default:s(()=>[n(Pe,null,{toolsLeft:s(()=>[n(y,{type:"primary",onClick:B},{default:s(()=>[P(x(l.$t("Security.Firewall.IP.index_1")),1)]),_:1}),n(vt,{onFinish:D},{default:s(()=>[P(x(l.$t("Security.Firewall.IP.index_2")),1)]),_:1}),n(y,{onClick:k},{default:s(()=>[P(x(l.$t("Security.Firewall.IP.index_3")),1)]),_:1})]),toolsRight:s(()=>[n(I,{value:e(g).chain,"onUpdate:value":[i[0]||(i[0]=w=>e(g).chain=w),q]},{default:s(()=>[n(U,{value:"ALL"},{default:s(()=>[P(x(l.$t("Security.Firewall.IP.index_4")),1)]),_:1}),n(U,{value:"INPUT"},{default:s(()=>[P(x(l.$t("Security.Firewall.IP.index_5")),1)]),_:1}),n(U,{value:"OUTPUT"},{default:s(()=>[P(x(l.$t("Security.Firewall.IP.index_6")),1)]),_:1})]),_:1},8,["value"]),n(O,{value:e(g).query,"onUpdate:value":i[1]||(i[1]=w=>e(g).query=w),width:"240",placeholder:l.$t("Security.Firewall.IP.index_7"),onSearch:q},null,8,["value","placeholder"])]),table:s(()=>[n(F,{"checked-row-keys":e($),"onUpdate:checkedRowKeys":i[2]||(i[2]=w=>z($)?$.value=w:null),"row-key":m,loading:e(d).loading,data:e(d).data,columns:e(f)},null,8,["checked-row-keys","loading","data","columns"])]),pageLeft:s(()=>[n(xe,{"checked-row-keys":e($),"onUpdate:checkedRowKeys":i[3]||(i[3]=w=>z($)?$.value=w:null),"row-key":m,data:e(d).data,options:h},null,8,["checked-row-keys","data"])]),pageRight:s(()=>[n(be,{page:e(g).p,"onUpdate:page":i[4]||(i[4]=w=>e(g).p=w),"page-size":e(g).row,"onUpdate:pageSize":i[5]||(i[5]=w=>e(g).row=w),"item-count":e(d).total,"store-key":"firewall-ip",onRefresh:E},null,8,["page","page-size","item-count"])]),_:1}),n(oe,{show:e(c).show,"onUpdate:show":i[6]||(i[6]=w=>e(c).show=w),title:e(c).title,data:e(c).data,width:420,"min-height":384,footer:!0,component:e(_)},null,8,["show","title","data","component"]),n(oe,{show:e(v).show,"onUpdate:show":i[7]||(i[7]=w=>e(v).show=w),title:e(v).title,data:e(v).data,width:420,"min-height":72,footer:!0,component:e(p)},null,8,["show","title","data","component"])]),_:1},8,["install"])}}}),At=".json",Ee="/www/server/panel/data/firewall",Ct=j({__name:"import",emits:["finish"],setup(W,{emit:C}){const b=C,{t:_}=G(),p=ee([]),S=async({file:r})=>{const{close:t}=H.loading(_("Security.Firewall.Api.index_1"));try{const o=new FormData;o.append("f_path",Ee),o.append("f_name",r.name),o.append("f_start","0"),r.file&&(o.append("blob",r.file),o.append("f_size",r.file.size.toString())),await fe(o);const u="".concat(Ee,"/").concat(r.name);await ke({rule:"forward",file:u}),b("finish",u)}finally{p.value=[],t()}};return(r,t)=>{const o=N,u=we;return T(),J(u,{ref:"upload",class:"w-auto",action:"","file-list":e(p),"onUpdate:fileList":t[0]||(t[0]=c=>z(p)?p.value=c:null),accept:At,multiple:!1,"show-file-list":!1,"custom-request":S},{default:s(()=>[n(o,null,{default:s(()=>[Se(r.$slots,"default")]),_:3})]),_:3},8,["file-list"])}}}),Rt=j({__name:"index",emits:["refresh"],setup(W,{expose:C,emit:b}){const _=Z(()=>X(()=>import("./form-C18YmHSH.js?v=1773287522785"),__vite__mapDeps([18,1,2,3,4,5,6,7,8,19,11]))),p=Fe(),{firewallStatus:S}=ge(p),r=b,{t}=G(),o=Q(t("Security.Firewall.Forward.index_1"),{isEdit:!1,onRefresh:()=>{v()}}),u=()=>{o.data.row=void 0,o.data.isEdit=!1,o.title=t("Security.Firewall.Forward.index_1"),o.show=!0},c=a=>{o.data.row=a,o.data.isEdit=!0,o.title=t("Security.Firewall.Forward.index_5"),o.show=!0},B=async()=>{if(m.data.length===0){H.error(t("Security.Firewall.index_21"));return}const{message:a}=await Ye({rule:"forward"});V(a)&&ze(a.result)},L=a=>"".concat(a.id),v=()=>{A(),r("refresh")},{keys:k,table:m,columns:D,setLoading:g}=ye([{type:"selection",width:40},{key:"Protocol",title:t("Security.Firewall.Forward.index_6"),render:a=>a.Protocol.toUpperCase()},{key:"S_Port",title:t("Security.Firewall.Forward.index_7")},{key:"T_Address",title:t("Security.Firewall.Forward.index_8"),render:a=>a.T_Address?a.T_Address:"127.0.0.1"},{key:"T_Port",title:t("Security.Firewall.Forward.index_9")},{key:"brief",title:t("Security.Firewall.Forward.index_10"),render:a=>a.brief||"--"},{key:"addtime",title:t("Security.Firewall.Forward.index_11"),render:a=>a.addtime||"--"},me({width:100,options:a=>[{label:t("Public.Btn.Edit"),onClick:()=>{c(a)}},{label:t("Public.Btn.Del"),onClick:()=>{$(a)}}]})]),$=a=>{K({width:540,title:t("Security.Firewall.Forward.index_12",[a.S_Port,a.T_Port]),content:t("Security.Firewall.Forward.index_13"),onConfirm:async()=>{await Ce({protocol:a.Protocol.toLowerCase(),S_Address:a.S_Address,S_Port:a.S_Port,T_Address:a.T_Address,T_Port:a.T_Port}),v()}})},d=[{key:"delete",type:"confirm",label:t("Security.Firewall.Forward.index_14"),confirm:{title:t("Security.Firewall.Forward.index_15"),desc:t("Security.Firewall.Forward.index_16"),api:a=>Ce({protocol:a.Protocol.toLowerCase(),S_Address:a.S_Address,S_Port:a.S_Port,T_Address:a.T_Address,T_Port:a.T_Port},!1),done:()=>{v()},columns:[{key:"T_Address",title:t("Security.Firewall.Forward.index_8"),render:a=>a.T_Address?a.T_Address:"127.0.0.1"}]}}],f=ne({query:"",p:1,row:20}),R=()=>{f.p=1,A()},A=async()=>{try{g(!0);const{message:a}=await He(te(f));V(a)&&(m.data=a.data,m.total=se(a.page))}finally{k.value=[],g(!1)}};return he(()=>{S.value.initStatus&&A()}),C({init:A}),(a,h)=>{const q=N,E=pe,l=_e,i=ue,y=ce,U=de,I=ae,O=re;return T(),J(O,{install:e(S).initStatus},{desc:s(()=>[n(ve)]),default:s(()=>[n(U,null,{toolsLeft:s(()=>[n(q,{type:"primary",onClick:u},{default:s(()=>[P(x(a.$t("Security.Firewall.Forward.index_1")),1)]),_:1}),n(Ct,{onFinish:v},{default:s(()=>[P(x(a.$t("Security.Firewall.Forward.index_2")),1)]),_:1}),n(q,{onClick:B},{default:s(()=>[P(x(a.$t("Security.Firewall.Forward.index_3")),1)]),_:1})]),toolsRight:s(()=>[n(E,{value:e(f).query,"onUpdate:value":h[0]||(h[0]=F=>e(f).query=F),width:"240",placeholder:a.$t("Security.Firewall.Forward.index_4"),onSearch:R},null,8,["value","placeholder"])]),table:s(()=>[n(l,{"checked-row-keys":e(k),"onUpdate:checkedRowKeys":h[1]||(h[1]=F=>z(k)?k.value=F:null),"row-key":L,loading:e(m).loading,data:e(m).data,columns:e(D)},null,8,["checked-row-keys","loading","data","columns"])]),pageLeft:s(()=>[n(i,{"checked-row-keys":e(k),"onUpdate:checkedRowKeys":h[2]||(h[2]=F=>z(k)?k.value=F:null),"row-key":L,data:e(m).data,options:d},null,8,["checked-row-keys","data"])]),pageRight:s(()=>[n(y,{page:e(f).p,"onUpdate:page":h[3]||(h[3]=F=>e(f).p=F),"page-size":e(f).row,"onUpdate:pageSize":h[4]||(h[4]=F=>e(f).row=F),"item-count":e(m).total,"store-key":"firewall-forward",onRefresh:A},null,8,["page","page-size","item-count"])]),_:1}),n(I,{show:e(o).show,"onUpdate:show":h[5]||(h[5]=F=>e(o).show=F),title:e(o).title,data:e(o).data,width:420,"min-height":344,footer:!0,component:e(_)},null,8,["show","title","data","component"])]),_:1},8,["install"])}}}),It=".json",Te="/www/server/panel/data/firewall",Lt=j({__name:"import",emits:["finish"],setup(W,{emit:C}){const b=C,{t:_}=G(),p=ee([]),S=async({file:r})=>{const{close:t}=H.loading(_("Security.Firewall.Api.index_1"));try{const o=new FormData;o.append("f_path",Te),o.append("f_name",r.name),o.append("f_start","0"),r.file&&(o.append("blob",r.file),o.append("f_size",r.file.size.toString())),await fe(o);const u="".concat(Te,"/").concat(r.name);await et({file_name:r.name}),b("finish",u)}finally{p.value=[],t()}};return(r,t)=>{const o=N,u=we;return T(),J(u,{ref:"upload",class:"w-auto",action:"","file-list":e(p),"onUpdate:fileList":t[0]||(t[0]=c=>z(p)?p.value=c:null),accept:It,multiple:!1,"show-file-list":!1,"custom-request":S},{default:s(()=>[n(o,null,{default:s(()=>[Se(r.$slots,"default")]),_:3})]),_:3},8,["file-list"])}}}),Ut=j({__name:"index",emits:["refresh"],setup(W,{expose:C,emit:b}){const _=Z(()=>X(()=>import("./form-ApdfCR0U.js?v=1773287522785"),__vite__mapDeps([20,8,3,4,5,6,2,7,21,19,11]))),p=Fe(),{firewallStatus:S}=ge(p),r=b,{t}=G(),o=Q(t("Security.Firewall.Area.index_1"),{isEdit:!1,onRefresh:()=>{v()}}),u=()=>{o.data.row=void 0,o.data.isEdit=!1,o.title=t("Security.Firewall.Area.index_1"),o.show=!0},c=a=>{o.data.row=a,o.data.isEdit=!0,o.title=t("Security.Firewall.Area.index_5"),o.show=!0},B=async()=>{if(m.data.length===0){H.error(t("Security.Firewall.index_21"));return}const{message:a}=await it();V(a)&&ze(a.result)},L=a=>"".concat(a.id),v=()=>{A(),r("refresh")},{keys:k,table:m,columns:D,setLoading:g}=ye([{type:"selection",width:40},{key:"country",title:t("Security.Firewall.Area.index_6"),render:a=>"".concat(a.country," (").concat(a.brief,")")},{key:"Strategy",title:t("Security.Firewall.Area.index_7"),render:a=>n("a",{class:["bt-link",a.types=="accept"?"":"error"]},[(a.types=="accept",t("Security.Firewall.Area.index_8"))])},{key:"ports",title:t("Security.Firewall.Area.index_9"),render:a=>a.ports||t("Security.Firewall.Area.index_10")},{key:"addtime",title:t("Security.Firewall.Area.index_11"),render:a=>a.addtime||"--"},me({width:100,options:a=>[{label:t("Public.Btn.Edit"),onClick:()=>{c(a)}},{label:t("Public.Btn.Del"),onClick:()=>{$(a)}}]})]),$=a=>{K({title:t("Security.Firewall.Area.index_12",[a.country]),content:t("Security.Firewall.Area.index_13"),onConfirm:async()=>{await Re({id:a.id,types:a.types,country:a.country,brief:a.brief,addtime:a.addtime,ports:a.ports}),v()}})},d=[{key:"delete",type:"confirm",label:t("Security.Firewall.Area.index_14"),confirm:{title:t("Security.Firewall.Area.index_15"),desc:t("Security.Firewall.Area.index_16"),api:a=>Re({id:a.id,types:a.types,country:a.country,brief:a.brief,addtime:a.addtime,ports:a.ports},!1),done:()=>{v()},columns:[{key:"country",title:t("Security.Firewall.Area.index_6"),render:a=>"".concat(a.country," (").concat(a.brief,")")}]}}],f=ne({p:1,limit:20,query:""}),R=()=>{f.p=1,A()},A=async()=>{try{g(!0);const{message:a}=await tt(te(f));V(a)?(m.data=Ke(a.data)?a.data:[],m.total=se(a.page)):(m.data=[],m.total=0)}finally{k.value=[],g(!1)}};return he(()=>{S.value.initStatus&&A()}),C({init:A}),(a,h)=>{const q=N,E=pe,l=_e,i=ue,y=ce,U=de,I=ae,O=re;return T(),J(O,{install:e(S).initStatus},{desc:s(()=>[n(ve)]),default:s(()=>[n(U,null,{toolsLeft:s(()=>[n(q,{type:"primary",onClick:u},{default:s(()=>[P(x(a.$t("Security.Firewall.Area.index_1")),1)]),_:1}),n(Lt,{onFinish:v},{default:s(()=>[P(x(a.$t("Security.Firewall.Area.index_2")),1)]),_:1}),n(q,{onClick:B},{default:s(()=>[P(x(a.$t("Security.Firewall.Area.index_3")),1)]),_:1})]),toolsRight:s(()=>[n(E,{value:e(f).query,"onUpdate:value":h[0]||(h[0]=F=>e(f).query=F),width:"240",placeholder:a.$t("Security.Firewall.Area.index_4"),onSearch:R},null,8,["value","placeholder"])]),table:s(()=>[n(l,{"checked-row-keys":e(k),"onUpdate:checkedRowKeys":h[1]||(h[1]=F=>z(k)?k.value=F:null),"row-key":L,loading:e(m).loading,data:e(m).data,columns:e(D)},null,8,["checked-row-keys","loading","data","columns"])]),pageLeft:s(()=>[n(i,{"checked-row-keys":e(k),"onUpdate:checkedRowKeys":h[2]||(h[2]=F=>z(k)?k.value=F:null),"row-key":L,data:e(m).data,options:d},null,8,["checked-row-keys","data"])]),pageRight:s(()=>[n(y,{page:e(f).p,"onUpdate:page":h[3]||(h[3]=F=>e(f).p=F),"page-size":e(f).limit,"onUpdate:pageSize":h[4]||(h[4]=F=>e(f).limit=F),"item-count":e(m).total,"store-key":"firewall-area",onRefresh:A},null,8,["page","page-size","item-count"])]),_:1}),n(I,{show:e(o).show,"onUpdate:show":h[5]||(h[5]=F=>e(o).show=F),title:e(o).title,data:e(o).data,width:460,"min-height":188,footer:!0,component:e(_)},null,8,["show","title","data","component"])]),_:1},8,["install"])}}}),Et={class:"mr-10px"},Tt={class:"mx-20px"},zt={class:"mr-10px"},Dt={class:"mx-20px"},qt={class:"mx-16px"},Mt={class:"font-bold"},di=j({__name:"index",setup(W){const C=Fe(),{firewallStatus:b}=ge(C),{t:_}=G(),p=ee("port"),S=ee([{key:"port",label:_("Security.Firewall.index_7",[0])},{key:"ip",label:_("Security.Firewall.index_8",[0])},{key:"forward",label:_("Security.Firewall.index_9",[0])},{key:"area",label:_("Security.Firewall.index_10",[0])}]),r=new Map([["port",xt],["ip",$t],["forward",Rt],["area",Ut]]),t={},o=(d,f)=>{t[f]=d},u=(d,f)=>{var R,A;t[f]&&((A=(R=t[f]).init)==null||A.call(R))},c=ne({loading:!1,ping:!1,size:"0 B",log_path:"/www/wwwlogs"}),B=async()=>{try{c.loading=!0;const{message:d}=await at();V(d)&&(c.ping=!d.ping,S.value[0].label=_("Security.Firewall.index_7",[d.port]),S.value[1].label=_("Security.Firewall.index_8",[d.ip]),S.value[2].label=_("Security.Firewall.index_9",[d.trans]),S.value[3].label=_("Security.Firewall.index_10",[d.country]))}finally{c.loading=!1}},L=async()=>{const{message:d}=await nt();V(d)&&(c.size=d.size,c.log_path=d.log_path)},v=d=>{K({title:_(d?"Security.Firewall.index_18":"Security.Firewall.index_11"),content:_(d?"Security.Firewall.index_19":"Security.Firewall.index_12"),onConfirm:async()=>{await ot({status:d?1:0}),b.value.status=d}})},k=d=>{K({title:_(d?"Security.Firewall.index_13":"Security.Firewall.index_22"),content:_(d?"Security.Firewall.index_20":"Security.Firewall.index_14"),onConfirm:async()=>{await lt({status:d?0:1}),c.ping=d}})},m=()=>{K({title:_("Site.Proxy.index_27"),content:"After clearing the cache, the system will reload. Do you want to continue?",onConfirm:async()=>{await rt(),setTimeout(()=>{window.location.reload()},1e3)}})},D=yt(),g=()=>{Ne("Path",c.log_path),D.push("/files")},$=()=>{je({title:_("Security.Firewall.index_15"),content:_("Security.Firewall.index_16"),onConfirm:async()=>{const{message:d}=await st();H.success(_("Security.Firewall.index_17")),c.size=V(d)&&We(d.result)?d.result:"0 B"}})};return C.getStatus(),L(),B(),(d,f)=>{const R=ct,A=ut,a=Ve,h=N,q=dt,E=_t,l=pt,i=Me,y=re,U=mt("load-text");return T(),Y(le,null,[n(E,{class:"mb-16px"},{default:s(()=>[n(q,{class:"items-center p-16px",size:0},{default:s(()=>[M("div",Et,x(d.$t("Security.Firewall.index_1")),1),n(R,{value:e(b).status,loading:e(c).loading,"onUpdate:value":v},null,8,["value","loading"]),M("div",Tt,[n(A,{class:"mx-0! text-20px",vertical:""})]),M("div",zt,x(d.$t("Security.Firewall.index_2")),1),n(R,{value:e(c).ping,loading:e(c).loading,"onUpdate:value":k},null,8,["value","loading"]),M("div",Dt,[n(A,{class:"mx-0! text-20px",vertical:""})]),M("div",null,[M("span",null,x(d.$t("Security.Firewall.index_3")),1),n(a,{disabled:e(c).loading,onClick:g},{default:s(()=>[Ie((T(),Y("span",null,[P(x(e(c).log_path),1)])),[[U,e(c).loading]])]),_:1},8,["disabled"])]),M("div",qt,[Ie((T(),Y("span",null,[P(x(e(c).size),1)])),[[U,e(c).loading]])]),n(h,{size:"small",onClick:$},{default:s(()=>[P(x(d.$t("Security.Firewall.index_4")),1)]),_:1}),n(h,{size:"small",class:"ml-10px",onClick:m},{default:s(()=>[P(x(d.$t("Site.Proxy.index_27")),1)]),_:1})]),_:1})]),_:1}),n(y,{install:e(b).status},{desc:s(()=>[M("div",Mt,[P(x(d.$t("Security.Firewall.index_5")),1),n(a,{class:"font-bold!",onClick:f[0]||(f[0]=I=>v(!0))},{default:s(()=>[P(x(d.$t("Security.Firewall.index_6")),1)]),_:1})])]),default:s(()=>[n(E,{class:"p-16px"},{default:s(()=>[n(i,{value:e(p),"onUpdate:value":f[1]||(f[1]=I=>z(p)?p.value=I:null)},{default:s(()=>[(T(!0),Y(le,null,ft(e(S),I=>(T(),J(l,{key:I.key,name:I.key,tab:I.label,"tab-props":{onClick:O=>{u(O,I.key)}}},{default:s(()=>[e(r).get(e(p))?(T(),J(wt(e(r).get(e(p))),{key:0,ref_for:!0,ref:O=>o(O,I.key),onRefresh:B},null,544)):St("",!0)]),_:2},1032,["name","tab","tab-props"]))),128))]),_:1},8,["value"])]),_:1})]),_:1},8,["install"])],64)}}});export{di as default};
|