filecat 7.1.0 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "filecat",
3
- "version": "7.1.0",
3
+ "version": "7.1.1",
4
4
  "description": "File browser and server manager",
5
5
  "author": "xiaobaidadada",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2851],{8694(e,t,s){s.d(t,{$K:()=>a,RB:()=>r,l5:()=>i,qB:()=>n,vo:()=>c,vr:()=>l});class n{targetProxyUrl;proxyPort;sysProxyPort}let o=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class a{open=!1;port;key="";async_ips=[]}class c{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=o.udp}let r=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class l{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class i{enabled;ip;port;bypass;useForLocal;type}},77481(e,t,s){s.d(t,{S:()=>r,X:()=>c});var n=s(96540),o=s(61443),a=s(74848);function c(e){const[t,s]=n.useState([]),c=(0,n.useRef)(-1),[r,l]=(0,n.useState)(-1),[i,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const p=()=>{c.current=-1,l(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let c=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(c=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:c}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(r===s?"row-dragging":"")+(i===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(c.current=s,l(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||c.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=c.current,s=i;p(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:p,children:t.map((s,n)=>{const o=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:o,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function r(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},42851(e,t,s){s.r(t),s.d(t,{default:()=>$});var n=s(96540),o=s(75725),a=s(14284),c=s(62042),r=s(53459),l=s(70447),i=s(61443),d=s(85997),p=s(77481),h=s(8694),u=s(14944),x=s(92275),j=s(86149),m=s(4412),v=s(74848);function g(e){const{t}=(0,j.B)(),[s,g]=(0,n.useState)(void 0),[y,f]=(0,n.useState)(!1),[_,S]=(0,n.useState)(""),[w,C]=(0,n.useState)([t(`${t("名称")}`),t(`${t("虚拟")}ip`),`${t("物理")}`,t("在线状态"),t("选择")]),[k,b]=(0,n.useState)([]),[I,A]=(0,n.useState)({}),[P,U]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=new x.hf(x.HK.vir_net_serverIno_get);u.ws.addMsg(x.HK.vir_net_serverIno_get,e=>{(e=>{for(const s of e){const e=s[s.length-1];s[s.length-1]=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l.fq,{ok:e}),t(e?"在线":"离线")]}),s[0]=(0,v.jsx)(l.xP,{context:s[0],tip_context:s[0]}),s[2]=(0,v.jsx)(l.xP,{context:s[2],tip_context:s[2]})}})(e.context),b(e.context)}),await u.ws.send(e)})();return(async()=>{const e=await a._U.get("vir/server/get");if(e.code!==r.m.Success)return;const t=e.data;g(t.port),S(t.key),f(t.open)})(),()=>{}},[]);return(0,v.jsxs)("div",{children:[(0,v.jsxs)(m.aZ,{position:"right",children:[!!Object.keys(I).length&&I[0],!!Object.keys(I).length&&(0,v.jsx)(d.rA,{icon:"delete",title:"删除",onClick:async()=>{await a._U.post("vir/server/delete/client",{ips:Object.keys(I)}),A({})}})]}),(0,v.jsx)(o.fI,{children:(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(l.Zp,{title:"",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.$K;e.open=y,e.key=_,P&&(e.async_ips=Object.keys(I)),s&&(e.port=parseInt(s));(await a._U.post("vir/server/save",e)).code===r.m.Success?((0,c.SK)("保存成功"),U(!1)):(0,c.zN)("网络错误")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"port",value:s,handleInputChange:e=>{g(e)}}),(0,v.jsx)(i.Sm,{type:"password",placeholder:"key ",value:_,handleInputChange:e=>{S(e)}}),(0,v.jsxs)("form",{children:[t("状态"),":",(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:y,onchange:()=>{f(!y)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!y,onchange:()=>{f(!y)}})]})]}),!!Object.keys(I).length&&(0,v.jsx)(i.GL,{context:t("sync_sv"),selected:P,onchange:()=>{U(!P)}})]}),(0,v.jsx)(l.Zp,{title:"",children:(0,v.jsx)(p.X,{headers:w,rows:k.map(e=>[...e,(0,v.jsx)(i.GL,{context:t(""),selected:I[e[1]],onchange:()=>{const t={...I};t[e[1]]?delete t[e[1]]:t[e[1]]=e,A(t)}})]),width:"10rem"})})]})})]})}function y(e){const{t}=(0,j.B)(),[s,m]=(0,n.useState)(""),[g,y]=(0,n.useState)(void 0),[f,_]=(0,n.useState)(""),[S,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(void 0),[b,I]=(0,n.useState)(!1),[A,P]=(0,n.useState)(""),[U,K]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=await a._U.get("vir/client/get");if(e.code!==r.m.Success)return;const t=e.data;if(k(t.serverPort),_(t.serverIp),m(t.ip),y(t.mask),P(t.key),I(t.open),w(t.client_name),t.open){const e=new x.hf(x.HK.vir_net_client_get),t=(await u.ws.send(e)).context.state;K(t),u.ws.addMsg(x.HK.vir_net_client_get,e=>{K(e.context.state)})}})()},[]);return(0,v.jsx)("div",{children:(0,v.jsx)(o.fI,{children:(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(l.Zp,{title:"",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.vo;e.ip=s,e.mask=parseInt(g),e.key=A,e.serverIp=f,e.serverPort=parseInt(C),e.open=b,e.client_name=S;(await a._U.post("vir/client/save",e)).code===r.m.Success?(0,c.SK)("保存成功"):(0,c.zN)("网络错误")}}),titleCom:(0,v.jsxs)("div",{children:[t("连接状态"),(0,v.jsx)(l.fq,{ok:U})]}),children:[(0,v.jsx)(i.Sm,{placeholder:"ip ",value:s,handleInputChange:e=>{m(e)}}),(0,v.jsx)(i.Sm,{placeholder:"mask",value:g,handleInputChange:e=>{y(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} ip`,value:f,handleInputChange:e=>{_(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} part`,value:C,handleInputChange:e=>{k(e)}}),(0,v.jsx)(i.Sm,{placeholder:"名称 ",value:S,handleInputChange:e=>{w(e)}}),(0,v.jsx)(i.Sm,{type:"password",placeholder:"key ",value:A,handleInputChange:e=>{P(e)}}),(0,v.jsxs)("form",{children:[t("状态"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:b,onchange:()=>{I(!b)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!b,onchange:()=>{I(!b)}})]})]})]}),(0,v.jsxs)(l.Zp,{title:"",children:[(0,v.jsx)("div",{children:"ip: 虚拟ip, “10.0.0.0 - 10.255.255.255”和“172.16.0.0 - 172.31.255.255”和“192.168.0.0 - 192.168.255.255”这三个网段属于内网ip"}),(0,v.jsx)("div",{children:"mask: 一些常见的子网掩码网段/8:255.0.0.0;/16:255.255.0.0 ;/24:255.255.255.0"}),(0,v.jsx)("div",{children:"key:用于验证身份信息并加密的和服务器设置的一样"})]})]})})})}var f=s(34843),_=s(82893),S=s(23430),w=s(78247),C=s(21499),k=s(24659),b=s(64694);function I(e){const{t}=(0,j.B)(),[s,u]=(0,n.useState)(""),[x,m]=(0,n.useState)(""),[g,y]=(0,n.useState)(""),[I,A]=(0,n.useState)(!1),[P,U]=(0,n.useState)(!1),[K,F]=(0,n.useState)({list:[]}),[$,H]=(0,f.fp)(_.AG.editorSetting),[N,Z]=(0,f.fp)(_.AG.user_base_info),O=[t("端口"),t("目标地址"),t("目标端口"),t("开启"),t("备注"),t("删除")],[B,D]=(0,n.useState)([]),E=[t("port"),t("ip"),t("type"),t("开启")],[z,V]=(0,n.useState)([]),M=[t("编辑"),t("开启"),t("备注"),t("删除")],T=(0,k.K)(),X=async()=>{const e=[a._U.post("vir/client/tcp_proxy/get"),a._U.post("http/proxy/server/get")];let t;N.sys===S.XM.mac?t=(async()=>{const e=await a._U.post("http/proxy/get/mac");if(e.code!==r.m.Success)return;const t=[],s=[];for(const n of e.data)"Wi-Fi"===n.name?t.push(n):s.push(n);V([...t,...s])})():N.sys===S.XM.win&&(t=(async()=>{const e=await a._U.post("http/proxy/get/win");if(e.code===r.m.Success){const t=e.data;u(t.ip),m(t.port),A(t.enabled),y(t.bypass),U(t.useForLocal)}})()),t&&e.push(t);const[s,n]=await Promise.all(e);s.code===r.m.Success&&D(s.data),n.code===r.m.Success&&F(n.data)};(0,n.useEffect)(()=>{X()},[]);return(0,v.jsx)("div",{children:(0,v.jsxs)(o.fI,{children:[N.sys===S.XM.win&&(0,v.jsx)(o.VP,{widthPer:33,children:(0,v.jsxs)(l.Zp,{title:"Http Proxy",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.l5;e.port=parseInt(x),e.enabled=I,e.useForLocal=P,e.ip=s,e.bypass=g;(await a._U.post("http/proxy/set/win",e)).code===r.m.Success&&(X(),(0,c.SK)("保存成功"))}}),children:[(0,v.jsx)(i.Sm,{placeholder:"ip (default localhost) ",value:s,handleInputChange:e=>{u(e)}}),(0,v.jsx)(i.Sm,{placeholder:"port ",value:x,handleInputChange:e=>{m(e)}}),(0,v.jsx)(i.Sm,{placeholder:t("忽略ip"),value:g,handleInputChange:e=>{y(e)}}),(0,v.jsxs)("form",{children:[t("pxy_nln"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:P,onchange:()=>{U(!P)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!P,onchange:()=>{U(!P)}})]})]}),(0,v.jsxs)("form",{children:[t("状态"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:I,onchange:()=>{A(!I)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!I,onchange:()=>{A(!I)}})]})]})]})}),N.sys===S.XM.mac&&(0,v.jsx)(o.VP,{children:z.map((e,s)=>(0,v.jsxs)(l.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e.name})," "]}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:()=>{(async e=>{const t=z[e];(await a._U.post("http/proxy/set/mac",[t])).code===r.m.Success&&(X(),(0,c.SK)("保存成功"))})(s)}})}),children:[(0,v.jsx)(p.X,{headers:E,rows:e.proxies.map((e,t)=>{const n=[(0,v.jsx)(i.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.ip,handleInputChange:t=>{e.ip=t},no_border:!0}),(0,v.jsx)("div",{children:1===e.type?"http":"https"}),(0,v.jsx)(i.l6,{value:e.enabled,onChange:e=>{((e,t,s)=>{const n=[...z];n[e].proxies[t].enabled=s,V(n)})(s,t,e)},options:T,no_border:!0})];return n}),width:"10rem"}),"ignore ips",(0,v.jsx)(i.Sm,{value:e.bypass,handleInputChange:e=>{z[s].bypass=e},no_border:!0})]},s))}),(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(l.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:t("Tcp Proxy")})," "]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(d.rA,{icon:"add",title:t("添加"),onClick:()=>{D([...B,{note:"",open:!1,port:0,target_port:0,target_ip:""}])}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{const e=[];for(let t=0;t<B.length;t++)B[t].index=t,e.push(B[t]);(await a._U.post("vir/client/tcp_proxy/save",e)).code===r.m.Success&&((0,c.SK)("保存成功"),X())}})]}),children:(0,v.jsx)(p.X,{headers:O,rows:B.map((e,s)=>{const n=[(0,v.jsx)(i.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.target_ip,handleInputChange:t=>{e.target_ip=t},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.target_port,handleInputChange:t=>{e.target_port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.l6,{value:e.open,onChange:e=>{B[s].open=e,D([...B])},options:T,no_border:!0}),(0,v.jsx)(i.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{B.splice(e,1),D([...B])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{D((0,b.TI)(B,e,t))}})}),(0,v.jsx)(l.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:t("Http Proxy Server")})," "]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(d.rA,{icon:"add",title:t("添加端口实例"),onClick:()=>{K.list.push({open:!1,port:0,note:"",list:[]}),F({...K})}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{(await a._U.post("http/proxy/server/save",K)).code===r.m.Success&&(0,c.SK)("保存成功")}})]}),children:K.list.map((e,s)=>(0,v.jsxs)("div",{className:"net-proxy-instance",children:[(0,v.jsxs)("div",{className:"net-proxy-instance__toolbar",children:[(0,v.jsxs)("span",{className:"net-proxy-instance__label",children:[t("端口实例")," #",s+1]}),(0,v.jsx)("span",{children:t("状态")}),(0,v.jsx)(i.l6,{value:e.open,width:"15%",onChange:t=>{e.open=t,F({...K})},options:T,no_border:!0}),(0,v.jsx)("span",{children:t("端口")}),(0,v.jsx)(i.Sm,{value:e.port||"",handleInputChange:t=>{e.port=t?parseInt(t):0,F({...K})},no_border:!0,width:"80px"}),(0,v.jsx)(d.rA,{icon:"add",title:t("添加规则"),onClick:()=>{e.list.push({note:"",open:!1}),F({...K})}}),(0,v.jsx)(d.rA,{icon:"delete",title:t("删除端口实例"),onClick:()=>{K.list.splice(s,1),F({...K})}}),(0,v.jsx)(i.Sm,{placeholder:t("备注"),width:"100%",value:e.note,handleInputChange:t=>{e.note=t,F({...K})},no_border:!0})]}),(0,v.jsx)(p.X,{headers:M,rows:e.list.map((n,o)=>{const c=[(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"edit",title:t("编辑"),onClick:()=>{(async(e,t)=>{const s=K.list[e];if(!s)return;const n=s.list[t];if(!n)return;n.random_key||(n.random_key=(0,C.hU)(),F({...K}));const o=await a._U.post("http/proxy/server/code/get",{key:n.random_key,name:n.random_key});H({model:"ace/mode/javascript",open:!0,fileName:"",can_format:!0,save:async e=>{0===(await a._U.post("http/proxy/server/code/save",{context:e,key:n.random_key})).code&&(w.xK.set_value_temp(""),H({open:!1,model:"",fileName:"",save:null}))}}),w.xK.set_value_temp(o.data)})(s,o)}})}),(0,v.jsx)(i.l6,{value:n.open,onChange:t=>{e.list[o].open=t,F({...K})},options:T,no_border:!0}),(0,v.jsx)(i.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{e.list.splice(o,1),F({...K})}})})];return c}),width:"10rem"})]},s))})]})]})})}var A=s(87361),P=s(82726),U=s(83529);function K(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[u,x]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[S,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[b,I]=(0,f.fp)(_.AG.showPrompt),[A,K]=(0,f.fp)(_.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await a.ez.get("ips/dnspod");if(e.code!==r.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);h(s),x(n),t.account&&(y(t.account.id),w(t.account.token)),k(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await a.ez.post("http/del",e)).code&&(0,c.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,v.jsxs)("div",{children:[(0,v.jsx)(m.aZ,{position:"right",children:(0,v.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{I({show:!0,type:U.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(l.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===P.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,v.jsx)(l.Zp,{title:"ipv6",children:u.length>0&&u.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===P.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(l.Zp,{title:t("账号设置"),rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(C&&(!g||!S))return void(0,c.zN)("id和token都不能为空");const e=new P.yL,t=[];for(const e of[...s,...u])e.ddnsHost&&t.push(e);e.ips=t,e.account={id:g,token:S},e.isOpen=C,e.ddnsType=P.E2.dnspod;(await a.ez.post("save",e)).code===r.m.DdnsAuthFail?(0,c.zN)("鉴权失败"):(0,c.SK)("success")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"ID",value:g,handleInputChange:e=>{y(e)}}),(0,v.jsx)(i.cA,{placeholder:"TOKEN",value:S,handleInputChange:e=>{w(e)}}),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:C,onchange:()=>{k(!C)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]}),(0,v.jsx)(l.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function F(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[u,x]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[S,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[b,I]=(0,f.fp)(_.AG.showPrompt),[A,K]=(0,f.fp)(_.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await a.ez.get("ips/tx");if(e.code!==r.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);h(s),x(n),t.account&&(y(t.account.secretid),w(t.account.secretkey)),k(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await a.ez.post("http/del",e)).code&&(0,c.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,v.jsxs)("div",{children:[(0,v.jsx)(m.aZ,{position:"right",children:(0,v.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{I({show:!0,type:U.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(l.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===P.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,v.jsx)(l.Zp,{title:"ipv6",children:u.length>0&&u.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===P.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(l.Zp,{title:t("账号设置"),rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(C&&(!g||!S))return void(0,c.zN)("SecretId和SecretKey都不能为空");const e=new P.yL,t=[];for(const e of[...s,...u])e.ddnsHost&&t.push(e);e.ips=t,e.account={secretid:g,secretkey:S},e.isOpen=C,e.ddnsType=P.E2.tengxun;(await a.ez.post("save",e)).code===r.m.DdnsAuthFail?(0,c.zN)("鉴权失败"):(0,c.SK)("成功")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"SecretId",value:g,handleInputChange:e=>{y(e)}}),(0,v.jsx)(i.cA,{placeholder:"SecretKey",value:S,handleInputChange:e=>{w(e)}}),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:C,onchange:()=>{k(!C)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]}),(0,v.jsx)(l.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function $(){const{t:e}=(0,j.B)(),{check_user_auth:t}=(0,w.MH)(),s=[];return t(S.oV.vir_net)&&s.push({index:1,name:e("系统代理"),rto:"proxy_sys/",component:(0,v.jsx)(I,{})},{index:2,name:"Tun proxy "+e("客户端"),rto:"client/",component:(0,v.jsx)(y,{})},{index:3,name:"Tun proxy "+e("服务端"),rto:"server/",component:(0,v.jsx)(g,{})}),t(S.oV.ddns)&&s.push({index:4,name:`ddns-dnspod(${e("腾讯")})`,rto:"dnspod/",component:(0,v.jsx)(K,{})},{index:5,name:`ddns-${e("腾讯")}${e("云")}`,rto:"tengxun/",component:(0,v.jsx)(F,{})}),(0,v.jsx)(o.W1,{optionList:s,father_route:A.o.net})}},24659(e,t,s){var n=s(86149);s.d(t,["K",0,()=>{const{t:e}=(0,n.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6805],{18840(e,n,t){t.d(n,{I:()=>s,gE:()=>i});class s{open;key;option_keys;port}class i{client_name;client_num_id;open=!1;serverIp;serverPort;key="";note;status;is_new;index}t.d(n,["FG",0,{content_max_width:"70%",content_padding:"4%",font_size:"16px",line_height:"1.8"},"mo",0,"\nnode_modules\n.venv\n.gradle\n.cache\nvendor\n"])},77481(e,n,t){t.d(n,{S:()=>c,X:()=>r});var s=t(96540),i=t(61443),l=t(74848);function r(e){const[n,t]=s.useState([]),r=(0,s.useRef)(-1),[c,o]=(0,s.useState)(-1),[a,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?t(Array.isArray(e.children)?e.children:[e.children]):t(e.rows)},[e.rows,e.children]);const _=()=>{r.current=-1,o(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((n,t)=>{const s=!!e.filter&&(e.filter.column??0)===t;let r=n;if(s){const t=e.filter,s=t.options.find(e=>e.value===t.value);null!=t.value&&s&&(r=`${n} (${s.label})`)}return(0,l.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,l.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:r}):n},t)})})}),(0,l.jsx)("tbody",{children:n.map((n,t)=>{const s=!!e.onRowDrag;return(0,l.jsx)("tr",{className:s?(c===t?"row-dragging":"")+(a===t?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},onDragStart:e=>{s&&(r.current=t,o(t),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||r.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(t))},onDrop:n=>{s&&(n.preventDefault(),(()=>{const n=r.current,t=a;_(),n<0||t<0||n===t||e.onRowDrag?.(n,t)})())},onDragEnd:_,children:n.map((t,s)=>{const i=s===n.length-1?"small":"";return(0,l.jsx)("td",{className:i,style:{width:e.width??"auto"},children:t},s)})},t)})})]})}function c(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,n)=>(0,l.jsx)("div",{children:e},n))})}},36805(e,n,t){t.r(n),t.d(n,{default:()=>F});var s=t(96540),i=t(75725),l=t(86149),r=t(70447),c=t(85997),o=t(77481),a=t(61443),d=t(14284),_=t(53459),x=t(7523),h=t(34843),p=t(82893),u=t(62042),j=(t(23430),t(21499),t(14944)),m=t(92275),v=t(6960),f=t(40505),g=t(4412),w=t(24659),y=t(74848);let S={};function C(){const{t:e,i18n:n}=(0,l.B)(),{initUserInfo:t,reloadUserInfo:C}=(0,s.useContext)(x.F),[k,I]=(0,h.fp)(p.AG.user_base_info),[b,A]=(0,s.useState)([]),[P,N]=(0,h.fp)(p.AG.prompt_card),$=(0,w.K)(),[F,K]=(0,s.useState)(),[B,U]=(0,s.useState)(void 0),[E,G]=(0,s.useState)(null),[D,V]=(0,s.useState)([]),[z,M]=(0,s.useState)([]),X=[e("序号"),e("名称"),e("在线状态"),e("时间"),e("备注")],Z=[e("序号"),e("服务端口"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],q=[e("序号"),e("服务端口"),e("fwd_nm"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],H=e=>null==e?"":(0,v.s)(e),O=async e=>{const n=await d.s9.post("server_bridge_get_one_fig",{server_client_num_id:e});if(n.code===_.m.Success){const e=n.data;for(const n of e)n.client_name=S?.[n.client_num_id]?.client_name??"";M(e)}},L=async e=>{const n=void 0===e?E:e,t=await d.s9.get("server_client_get");if(t.code===_.m.Success){const e=t.data,s=[],i=[];S={};for(const t of e)null!==n&&!!t.status!==n||(B?`${t.index}${t.client_name}${t.note}`.includes(B)&&s.push(t):s.push(t),i.push({label:t.client_name,value:t.client_num_id}),S[t.client_num_id]=t);A(s),V(i)}};(0,s.useEffect)(()=>{j.ws.addMsg(m.HK.tcp_forward_server_load,e=>{L()}),L()},[]);return(0,y.jsxs)(s.Fragment,{children:[(0,y.jsx)(g.aZ,{position:"right",children:F&&(0,y.jsx)("span",{children:`${F.client_name}${F.note?`(${F.note})`:""}`})}),(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:50,children:(0,y.jsx)(i.xh,{children:(0,y.jsx)(r.uF,{self_title:(0,y.jsx)("span",{className:" div-row ",children:(0,y.jsx)("h2",{children:e("客户端列表")})}),titleCom:(0,y.jsx)(a.Sm,{placeholder:e("过滤"),value:B,handleInputChange:e=>{U(e)},handlerEnter:()=>{L()}}),children:(0,y.jsx)(o.X,{headers:X,filter:{title:e("在线状态"),column:2,value:E,options:[{label:e("全部"),value:null},{label:e("在线"),value:!0},{label:e("离线"),value:!1}],onChange:e=>{G(e),L(e)}},rows:b.map((n,t)=>[(0,y.jsx)("p",{children:t}),(0,y.jsx)(r.xP,{children:n.client_name}),(0,y.jsx)(r.fq,{ok:n.status}),(0,y.jsx)(r.xP,{children:H(n.status?n.online_start_time:n.offline_time)}),(0,y.jsx)(r.xP,{children:n.note}),(0,y.jsxs)("div",{children:[(0,y.jsx)(c.rA,{icon:"edit",title:e("编辑"),onClick:()=>{K({...n}),O(n.client_num_id)}}),(0,y.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{N({open:!0,title:"share file",confirm:async()=>{N({open:!1}),await(async e=>{(await d.s9.post("server_client_del",{client_num_id:e})).code===_.m.Success&&((0,u.SK)("成功"),L())})(n.client_num_id)},context_div:(0,y.jsx)("div",{className:"card-content",children:e("确定删除这个吗客户端吗?")})})}})]})]),width:"10rem"})})})}),(0,y.jsx)(i.VP,{widthPer:50,children:F?(0,y.jsxs)(i.xh,{children:[(0,y.jsxs)(r.Zp,{self_title:(0,y.jsxs)("span",{className:" div-row ",children:[(0,y.jsx)("h2",{children:e("代理配置")})," "]}),rightBottomCom:(0,y.jsx)("div",{children:(0,y.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.s9.post("server_client_save",F)).code===_.m.Success&&(0,u.SK)("成功")}})}),children:[(0,y.jsx)(i.Yh,{left:e("远程地址"),center:F?.client_remote_address??""}),(0,y.jsx)(i.Yh,{left:e(F?.status?"在线时间":"离线时间"),center:H(F?.status?F?.online_start_time:F?.offline_time)}),(0,y.jsx)(a.Sm,{placeholder:"名称",value:F.client_name,handleInputChange:e=>{F.client_name=e,K({...F})}}),(0,y.jsxs)("form",{children:[e("fc_pxy"),":",(0,y.jsx)(o.S,{isFlex:!0,columns:[(0,y.jsx)(a.U6,{value:1,context:e("开启"),selected:F.open_filecat,onchange:()=>{F.open_filecat=!F.open_filecat,K({...F})}}),(0,y.jsx)(a.U6,{value:1,context:e("关闭"),selected:!F.open_filecat,onchange:()=>{F.open_filecat=!F.open_filecat,K({...F})}})]})]}),F.open_filecat&&(0,y.jsxs)(s.Fragment,{children:[(0,y.jsxs)("form",{children:[e("fc_pxyw"),":",(0,y.jsx)(o.S,{isFlex:!0,columns:[(0,y.jsx)(a.U6,{value:1,context:e("开启"),selected:F.filecat_use_local_page,onchange:()=>{F.filecat_use_local_page=!F.filecat_use_local_page,K({...F})}}),(0,y.jsx)(a.U6,{value:1,context:e("关闭"),selected:!F.filecat_use_local_page,onchange:()=>{F.filecat_use_local_page=!F.filecat_use_local_page,K({...F})}})]})]}),(0,y.jsx)(a.Sm,{placeholderOut:e("fc_pxyr"),placeholder:"127.0.0.1:5567",value:F.filecat_proxy_host_port,handleInputChange:e=>{F.filecat_proxy_host_port=e,K({...F})}}),(0,y.jsx)(c.rA,{icon:"content_copy",title:e("复制filecat代理url"),onClick:()=>{const e=`${window.location.origin}?tcp_client_num_id=${F.client_num_id}`;(0,f.lW)(e),(0,u.SK)(e)}})]}),(0,y.jsx)(a.Sm,{placeholder:"备注",value:F.note,handleInputChange:e=>{F.note=e,K({...F})}}),(0,y.jsx)(c.rA,{icon:"add",onClick:()=>{F.proxy_fig_list.push({open:!1}),K({...F})},title:e("添加")}),e("代理"),(0,y.jsx)(o.X,{headers:Z,rows:F.proxy_fig_list.map((n,t)=>[(0,y.jsx)("p",{children:t}),(0,y.jsx)(a.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,y.jsx)(a.Sm,{value:n.proxy_host,handleInputChange:e=>{n.proxy_host=e},no_border:!0}),(0,y.jsx)(a.Sm,{value:n.proxy_port,handleInputChange:e=>{n.proxy_port=parseInt(e)},no_border:!0}),(0,y.jsx)(a.l6,{value:!!n.open,onChange:e=>{n.open=e,K({...F})},options:$,no_border:!0}),(0,y.jsx)(a.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,y.jsx)("div",{children:(0,y.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{const e=[];for(let n=0;n<(F.proxy_fig_list.length??0);n++)n!==t&&e.push(F.proxy_fig_list[n]);F.proxy_fig_list=e,K({...F})}})})]),width:"10rem"})]}),(0,y.jsxs)(r.Zp,{self_title:(0,y.jsxs)("span",{className:" div-row ",children:[(0,y.jsx)("h2",{children:e("桥接配置")})," "]}),children:[(0,y.jsx)(c.rA,{icon:"add",onClick:()=>{z.push({open:!1,server_client_num_id:F.client_num_id}),M([...z])},title:e("添加")}),e("代理"),(0,y.jsx)(o.X,{headers:q,rows:z.map((n,t)=>[(0,y.jsx)("p",{children:t}),(0,y.jsx)(a.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,y.jsx)(a.Sm,{value:n.client_name,options:D,handleInputChange:e=>{const t=(e=>D.find(n=>String(n.value)===String(e)))(e);n.client_num_id=parseInt(String(t.value)),n.client_name=t.label,M([...z])},no_border:!0}),(0,y.jsx)(a.Sm,{value:n.client_proxy_host,handleInputChange:e=>{n.client_proxy_host=e},no_border:!0}),(0,y.jsx)(a.Sm,{value:n.client_proxy_port,handleInputChange:e=>{n.client_proxy_port=parseInt(e)},no_border:!0}),(0,y.jsx)(a.l6,{value:!!n.open,onChange:e=>{n.open=e,M([...z])},options:$,no_border:!0}),(0,y.jsx)(a.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,y.jsxs)("div",{children:[(0,y.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:async()=>{if(null==n.id){const e=[];for(let n=0;n<(z.length??0);n++)n!==t&&e.push(z[n]);M([...e])}else await(async(e,n)=>{(await d.s9.post("server_bridge_del_fig",{id:e})).code===_.m.Success&&((0,u.SK)("成功"),O(n))})(n.id,n.server_client_num_id)}}),null==n.id?(0,y.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,u.zN)("未选择转发送 client");(await d.s9.post("server_bridge_add_fig",e)).code===_.m.Success&&((0,u.SK)("成功"),O(e.server_client_num_id))})(n)}}):(0,y.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,u.zN)("未选择转发送 client");(await d.s9.post("server_bridge_edit_fig",e)).code===_.m.Success&&((0,u.SK)("成功"),O(e.server_client_num_id))})(n)}})]})]),width:"10rem"})]})]}):(0,y.jsx)(i.xh,{})})]})]})}var k=t(18840),I=t(7463);function b(e){const{t:n}=(0,l.B)(),[t,x]=(0,s.useState)([]),[h,p]=(0,s.useState)([]),[v,f]=(0,s.useState)([]),[g,S]=(0,s.useState)([]),C=[n("序号"),n("服务端口"),n("转发客户端名称")],b=[n("序号"),n("原客户端"),n("目标客户端"),n("待同步文件数量")],A=[n("序号"),n("port"),n("host"),n("名称"),n("key"),n("在线"),n("开启"),n("备注")],P=(0,w.K)(),N=async()=>{const e=await d.s9.get("client_get");if(e.code===_.m.Success){const n=e.data;x(n.list)}const n=await d.s9.get("client_bridge_get_all_fig");n.code===_.m.Success&&f(n.data);const t=await d.s9.get("client_sync_task_get");t.code===_.m.Success&&S(t.data)};(0,s.useEffect)(()=>(N(),j.ws.sendData(m.HK.tcp_proxy_client_status,{}).then(()=>{const e=(0,I.sg)(()=>N(),500);j.ws.addMsg(m.HK.tcp_proxy_client_status,e)}),()=>{j.ws.removeMsg(m.HK.tcp_proxy_client_status)}),[]);const $=async e=>{const n=new k.gE;n.index=e.index,n.key=e.key,n.serverIp=e.serverIp,n.serverPort=e.serverPort,n.open=e.open,n.client_name=e.client_name,n.client_num_id=e.client_num_id;(await d.s9.post("client_save",n)).code===_.m.Success?(0,u.SK)("保存成功"):(0,u.zN)("网络错误")};return(0,y.jsxs)("div",{children:[(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:33,children:(0,y.jsxs)(r.Zp,{title:"",rightBottomCom:(0,y.jsx)(c.C3,{text:n("保存"),clickFun:()=>{t[0].index=0,$(t[0])}}),titleCom:(0,y.jsxs)("div",{children:[n("连接状态"),(0,y.jsx)(r.fq,{ok:!!t[0]?.status})]}),children:[(0,y.jsx)(a.Sm,{placeholder:`${n("服务器")} ip`,value:t[0]?.serverIp,handleInputChange:e=>{t[0].serverIp=e}}),(0,y.jsx)(a.Sm,{type:"number",placeholder:`${n("服务器")} port`,value:t[0]?.serverPort,handleInputChange:e=>{const n=parseInt(e);!isNaN(n)&&n>=0&&n<=65535&&(t[0].serverPort=n)}}),(0,y.jsx)(a.Sm,{placeholder:n("名称"),value:t[0]?.client_name,handleInputChange:e=>{t[0].client_name=e}}),(0,y.jsx)(a.Sm,{type:"password",placeholder:"key ",value:t[0]?.key,handleInputChange:e=>{t[0].key=e}}),(0,y.jsxs)("form",{children:[n("状态"),(0,y.jsx)(o.S,{isFlex:!0,columns:[(0,y.jsx)(a.U6,{value:1,context:n("开启"),selected:t[0]?.open,onchange:()=>{t[0].open=!t[0].open,x([...t])}}),(0,y.jsx)(a.U6,{value:1,context:n("关闭"),selected:!t[0]?.open,onchange:()=>{t[0].open=!t[0].open,x([...t])}})]})]})]})}),(0,y.jsx)(i.VP,{widthPer:40,children:(0,y.jsxs)(r.Zp,{self_title:(0,y.jsxs)("span",{className:" div-row ",children:[(0,y.jsx)("h2",{children:n("更多服务器")})," "]}),children:[(0,y.jsx)(c.rA,{icon:"add",onClick:()=>{t.push({open:!1,is_new:!0}),x([...t])},title:n("添加")}),n("代理"),(0,y.jsx)(o.X,{headers:A,rows:t.slice(1).map((e,s)=>[(0,y.jsx)("p",{children:s}),(0,y.jsx)(a.Sm,{type:"number",value:e.serverPort,handleInputChange:n=>{const t=parseInt(n);!isNaN(t)&&t>=0&&t<=65535&&(e.serverPort=t)},no_border:!0}),(0,y.jsx)(a.Sm,{value:e.serverIp,handleInputChange:n=>{e.serverIp=n},no_border:!0}),(0,y.jsx)(a.Sm,{value:e.client_name,handleInputChange:n=>{e.client_name=n},no_border:!0}),(0,y.jsx)(a.Sm,{value:e.key,handleInputChange:n=>{e.key=n},no_border:!0}),(0,y.jsx)(r.fq,{ok:!!e.status}),(0,y.jsx)(a.l6,{value:!!e.open,onChange:n=>{e.open=n,x([...t])},options:P,no_border:!0}),(0,y.jsx)(a.Sm,{value:e.note,handleInputChange:n=>{e.note=n},no_border:!0}),(0,y.jsxs)("div",{children:[(0,y.jsx)(c.rA,{icon:"delete",title:n("删除"),onClick:async()=>{if(e.is_new){const e=[];for(let n=0;n<(t.length??0);n++)n!==s&&e.push(t[n]);x([...e])}else await(async e=>{(await d.s9.post("client_del",{index:e})).code===_.m.Success?((0,u.SK)("保存成功"),N()):(0,u.zN)("网络错误")})(s+1)}}),e.is_new?(0,y.jsx)(c.rA,{icon:"add",title:n("添加"),onClick:async()=>{e.index=s+1,await $(e)}}):(0,y.jsx)(c.rA,{icon:"save",title:n("保存"),onClick:async()=>{e.index=s+1,await $(e)}})]})]),width:"10rem"})]})})]}),(0,y.jsxs)(i.fI,{children:[!!v?.length&&(0,y.jsx)(i.VP,{widthPer:40,children:(0,y.jsx)(r.Zp,{title:n("br_port"),children:(0,y.jsx)(o.X,{headers:C,rows:v.map((e,n)=>[(0,y.jsx)("p",{children:n}),(0,y.jsx)(r.xP,{children:e.server_port}),(0,y.jsx)(r.xP,{children:e.client_name})]),width:"10rem"})})}),!!g?.length&&(0,y.jsx)(i.VP,{widthPer:40,children:(0,y.jsx)(r.Zp,{title:n("文件同步列表"),children:(0,y.jsx)(o.X,{headers:b,rows:g.map((e,n)=>[(0,y.jsx)("p",{children:n}),(0,y.jsx)(r.xP,{children:e.source_client_name}),(0,y.jsx)(r.xP,{children:e.target_client_name}),(0,y.jsx)(r.xP,{children:e.running_num})]),width:"10rem"})})})]})]})}function A(){const{t:e,i18n:n}=(0,l.B)(),{initUserInfo:t,reloadUserInfo:v}=(0,s.useContext)(x.F),[f,g]=(0,h.fp)(p.AG.user_base_info),[w,S]=(0,h.fp)(p.AG.prompt_card),[C,I]=(0,s.useState)(!1),[b,A]=(0,s.useState)([]),[P,N]=(0,s.useState)(null),[$,F]=(0,s.useState)([]),[K,B]=(0,s.useState)(void 0),[U,E]=(0,s.useState)(void 0),G=(0,s.useMemo)(()=>{const e=[...b];return null!=P?(e.sort((e,n)=>P?e.server_port-n.server_port:n.server_port-e.server_port),e):e},[b,P]),D=async()=>{const e=await d.s9.get("get_all_open_server_client_proxy_fig");if(e.code===_.m.Success){const n=[];for(const t of e.data)U?`${t.server_port}${t.client_name}${t.proxy_host}${t.server_port}${t.server_port_note}`.includes(U)&&n.push(t):n.push(t);A(n)}},V=async()=>{const e=await d.s9.get("server_get");e.code===_.m.Success&&(B(e.data.port),I(!!e.data.open),F(e.data.option_keys??[])),D()};(0,s.useEffect)(()=>{j.ws.addMsg(m.HK.tcp_forward_server_load,e=>{V()}),V()},[]);const z=async e=>{const n=new k.I;n.port=K,n.open=C,n.option_keys=$;(await d.s9.post("server_save",{fig:n,notice_client:e})).code===_.m.Success&&(0,u.SK)("成功")};return(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:33,children:(0,y.jsx)(i.xh,{children:(0,y.jsxs)(r.Zp,{title:e("服务器配置"),rightBottomCom:(0,y.jsxs)("div",{children:[(0,y.jsx)(c.C3,{text:e("sv_ntf"),clickFun:()=>{z(!0)}}),(0,y.jsx)(c.C3,{text:e("保存"),clickFun:()=>{z(!1)}})]}),children:[(0,y.jsx)(a.Sm,{placeholder:"port",value:K,handleInputChange:e=>{B(e)}}),(0,y.jsxs)("label",{children:[(0,y.jsx)(c.rA,{icon:"add",onClick:()=>{F([...$,""])},title:e("添加")}),e("key")]}),($??[]).map((n,t)=>(0,y.jsxs)("div",{style:{display:"flex"},children:[(0,y.jsx)("div",{style:{width:"90%"},children:(0,y.jsx)(a.Sm,{type:"password",value:n,handleInputChange:e=>{$[t]=e,F([...$])}})}),(0,y.jsx)(c.rA,{icon:"delete",onClick:()=>{$.splice(t,1),F([...$])},title:e("删除")})]},t)),(0,y.jsxs)("form",{children:[e("状态"),":",(0,y.jsx)(o.S,{isFlex:!0,columns:[(0,y.jsx)(a.U6,{value:1,context:e("开启"),selected:C,onchange:()=>{I(!C)}}),(0,y.jsx)(a.U6,{value:1,context:e("关闭"),selected:!C,onchange:()=>{I(!C)}})]})]})]})})}),(0,y.jsx)(i.VP,{widthPer:50,children:(0,y.jsx)(i.xh,{children:(0,y.jsx)(r.uF,{self_title:(0,y.jsx)("span",{className:" div-row ",children:(0,y.jsx)("h2",{children:e("服务器")+e("端口映射")})}),titleCom:(0,y.jsx)(a.Sm,{placeholder:e("过滤"),value:U,handleInputChange:e=>{E(e)},handlerEnter:()=>{D()}}),children:(0,y.jsx)(o.X,{headers:[e("序号"),(0,y.jsx)(c.rA,{title:e("服务端口"),onClick:()=>{N(e=>!e)}}),e("转发ip"),e("转发端口"),"client "+e("名称"),e("开启"),e("备注")],rows:G.map((e,n)=>[(0,y.jsx)("p",{children:n}),(0,y.jsx)(r.xP,{children:e.server_port}),(0,y.jsx)(r.xP,{children:e.proxy_host}),(0,y.jsx)(r.xP,{children:e.proxy_port}),(0,y.jsx)(r.xP,{children:e.client_name}),(0,y.jsx)(r.fq,{ok:!!e.open_success}),(0,y.jsx)(r.xP,{children:e.server_port_note})]),width:"10rem"})})})})]})}var P=t(78247);function N(){const{t:e,i18n:n}=(0,l.B)(),{initUserInfo:t,reloadUserInfo:j}=(0,s.useContext)(x.F),[m,v]=(0,h.fp)(p.AG.user_base_info),[f,g]=(0,h.fp)(p.AG.prompt_card),[,w]=(0,h.fp)(p.AG.confirm),[S,C]=(0,h.fp)(p.AG.editorSetting),[I,b]=(0,s.useState)([]),[A,N]=(0,s.useState)([]),$=[e("编号"),e("原客户端"),e("开启"),e("备注"),e("操作")],[F,K]=(0,s.useState)(null);(0,s.useEffect)(()=>{(async()=>{const e=await d.s9.get("server_client_get");if(e.code===_.m.Success){const n=e.data,t=[];for(const e of n)t.push({title:e.client_name,value:e.client_num_id});N(t),await B()}})()},[]);const B=async()=>{const e=await d.s9.get("sync_task_get");e.code===_.m.Success&&b(e.data)},U=(e,n,t)=>{F?.targets&&(F.targets[e]={...F.targets[e],[n]:t},K({...F,targets:[...F.targets]}))},E=async n=>{const t=await d.s9.post("sync_task_save",n);t.code===_.m.Success?((0,u.SK)(e("成功")),await B()):(0,u.zN)(t.message??e("操作失败"))};return(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,y.jsx)(i.xh,{children:(0,y.jsx)(r.uF,{self_title:(0,y.jsxs)("span",{className:" div-row ",children:[(0,y.jsx)("h2",{children:e("客户端文件同步")}),(0,y.jsx)(c.rA,{icon:"info",onClick:()=>{g({open:!0,title:"信息",context_div:(0,y.jsx)("div",{children:(0,y.jsxs)("ul",{children:[(0,y.jsx)("li",{children:e("sy_tp1")}),(0,y.jsx)("li",{children:e("sy_tp2")}),(0,y.jsx)("li",{children:e("sy_tp3")})]})})})},title:e("信息")})]}),titleCom:(0,y.jsx)("div",{children:(0,y.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:()=>{K({open:!1,source_client_num_id:void 0,source_dir:"",targets:[{client_num_id:void 0,dir:"",full_sync:!1}],delete_missing:!0,is_new:!0})}})}),children:(0,y.jsx)(o.X,{headers:$,rows:I.map((n,t)=>[(0,y.jsx)("p",{children:n.id?.slice(0,8)??t}),(0,y.jsx)(r.xP,{children:n.source_client_name}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(r.fq,{ok:!!n.open}),n.open?e("开启"):e("关闭")]}),(0,y.jsx)(r.xP,{children:n.note}),(0,y.jsxs)("div",{children:[(0,y.jsx)(c.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{K(JSON.parse(JSON.stringify(e)))})(n)}),(0,y.jsx)(c.rA,{icon:"sync",title:e("立即同步"),onClick:()=>(async n=>{if(!n.id||!n.open)return void(0,u.zN)(e("tsk_off"));const t=await d.s9.post("sync_task_rescan",{id:n.id});t.code===_.m.Success?(0,u.SK)(e("已触发同步")):(0,u.zN)(t.message??e("操作失败"))})(n)}),(0,y.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{w({open:!0,title:e("确定删除吗"),handle:async()=>{await(async n=>{(await d.s9.post("sync_task_del",{id:n})).code===_.m.Success&&((0,u.SK)(e("成功")),F?.id===n&&K(null),await B())})(n.id),w({open:!1,handle:null})}})}})]})]),width:"10rem"})})})}),(0,y.jsx)(i.VP,{widthPer:50,children:F&&(0,y.jsx)(i.xh,{children:(0,y.jsxs)(r.Zp,{self_title:(0,y.jsx)("span",{className:" div-row ",children:(0,y.jsx)("h2",{children:e(""+(F.is_new?"添加":"编辑"))})}),rightBottomCom:(0,y.jsxs)("div",{children:[(0,y.jsx)(c.rA,{icon:"cancel",title:e("取消"),onClick:()=>K(null)}),(0,y.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(!F)return;const n=F,t=await d.s9.post("sync_task_save",n);t.code===_.m.Success?((0,u.SK)(e("成功")),K(null),await B()):(0,u.zN)(t.message??e("操作失败"))}})]}),children:[(0,y.jsx)(a.BC,{label:e("开启"),label_width:"6rem",children:(0,y.jsx)(a.GL,{selected:!!F.open,onchange:()=>{K({...F,open:!F.open})}})}),(0,y.jsx)(a.BC,{label:e("备注"),label_width:"6rem",children:(0,y.jsx)(a.Sm,{value:F.note,handleInputChange:e=>{K({...F,note:e})}})}),(0,y.jsx)(a.BC,{label:e("原客户端"),label_width:"6rem",required:!0,children:(0,y.jsx)(a.l6,{value:F.source_client_num_id,options:A,onChange:e=>{const n=parseInt(String(e));K({...F,source_client_num_id:n})}})}),(0,y.jsx)(a.BC,{label:e("原目录"),label_width:"6rem",required:!0,children:(0,y.jsx)(a.Sm,{value:F.source_dir,placeholder:e("被同步的源目录"),handleInputChange:e=>{K({...F,source_dir:e})}})}),(0,y.jsx)("label",{children:e("目标列表")}),(F.targets??[]).map((n,t)=>(0,y.jsxs)("div",{className:"div-row",children:[(0,y.jsx)("div",{style:{width:"10rem"},children:(0,y.jsx)(a.l6,{value:n.client_num_id,options:A,onChange:e=>U(t,"client_num_id",parseInt(String(e)))})}),(0,y.jsx)("div",{style:{flex:1},children:(0,y.jsx)(a.Sm,{value:n.dir,placeholder:e("目标目录"),handleInputChange:e=>U(t,"dir",e)})}),(0,y.jsxs)("div",{className:"div-row",children:[(0,y.jsx)("span",{children:e("全量同步")}),(0,y.jsx)(a.GL,{selected:!!n.full_sync,onchange:()=>U(t,"full_sync",!n.full_sync)})]}),(0,y.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{if(!F?.targets)return;const n=[...F.targets];n.splice(e,1),K({...F,targets:n})})(t)})]},t)),(0,y.jsxs)("div",{className:"div-row",children:[(0,y.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:()=>{if(!F)return;const e=[...F.targets??[],{client_num_id:void 0,dir:"",full_sync:!1}];K({...F,targets:e})}}),(0,y.jsx)(c.rA,{icon:"edit",title:e("忽略目录"),onClick:()=>{var e;e=F,P.xK.set_value_temp(e.ignore_text??k.mo),C({model:"ace/mode/gitignore",open:!0,fileName:"",save:async n=>{e.ignore_text=n,K({...e}),P.xK.set_value_temp(""),await E(e)}})}})]})]})})})]})}var $=t(87361);function F(){const{t:e}=(0,l.B)(),n=[{index:1,name:e("客户端"),rto:"tcp_proxy_client/",component:(0,y.jsx)(b,{})},{index:2,name:e("服务端"),rto:"tcp_proxy_server_info/",component:(0,y.jsx)(A,{})},{index:3,name:e("服务端")+"-"+e("客户端列表"),rto:"tcp_proxy_server_client/",component:(0,y.jsx)(C,{})},{index:4,name:e("服务端")+"-"+e("客户端功能"),rto:"tcp_proxy_server_client_setting/",component:(0,y.jsx)(N,{})}];return(0,y.jsx)(i.W1,{optionList:n,father_route:$.o.net_proxy})}},6960(e,n,t){t.d(n,{s:()=>r});var s=t(72635);const i=1440,l=525600;function r(e){e=e>1e12?e:1e3*e;const n=Date.now(),t=Math.abs(n-e)/6e4;return t<1?s.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${s.Ay.t("分钟前")}`:t<i?`${(t/60).toFixed(0)} ${s.Ay.t("小时前")}`:t<43200?`${(t/i).toFixed(0)} ${s.Ay.t("天前")}`:t<l?`${(t/43200).toFixed(0)} ${s.Ay.t("月前")}`:`${(t/l).toFixed(0)} ${s.Ay.t("年前")}`}},24659(e,n,t){var s=t(86149);t.d(n,["K",0,()=>{const{t:e}=(0,s.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);