filecat 6.67.1 → 6.67.4
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/build/dist/1384.161648dee57d2dc24774.js +1 -0
- package/build/dist/{1472.9e05a1e9497ac2d82d6f.js → 1472.de2b1c3a9e8fda0034d4.js} +1 -1
- package/build/dist/2351.4e4083ef34e56b749945.js +1 -0
- package/build/dist/2851.299da14729933754cb28.js +1 -0
- package/build/dist/4091.c5fe7b19156391f0531f.js +1 -0
- package/build/dist/676.b8b34f9a4887c29ce00d.js +1 -0
- package/build/dist/7181.266e5f360fd66da27dda.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.8c116bf496e7441faee5.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/1384.3138b56fd880b4ef6b5a.js +0 -1
- package/build/dist/2851.6570385ed3b21d196648.js +0 -1
- package/build/dist/3345.9c2f5ecefdb4d58ac3c1.js +0 -1
- package/build/dist/4091.98a37edf8f05b8b8a0e7.js +0 -1
- package/build/dist/676.59a6aae24e044a731ead.js +0 -1
- package/build/dist/7181.830061f438f0682ad112.js +0 -1
- package/build/dist/main.ab70755b677fb8e89fe8.js +0 -2
- /package/build/dist/{main.ab70755b677fb8e89fe8.js.LICENSE.txt → main.8c116bf496e7441faee5.js.LICENSE.txt} +0 -0
|
@@ -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:()=>F});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),_(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=S,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:S,handleInputChange:e=>{_(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("同步信息给选中服务器"),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,S]=(0,n.useState)(""),[_,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),S(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=_;(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=>{S(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} part`,value:C,handleInputChange:e=>{k(e)}}),(0,v.jsx)(i.Sm,{placeholder:"名称 ",value:_,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=s(82893),_=s(23430),w=s(78247),C=s(21499),k=s(24659);function b(e){const{t}=(0,j.B)(),[s,u]=(0,n.useState)(""),[x,m]=(0,n.useState)(""),[g,y]=(0,n.useState)(""),[b,I]=(0,n.useState)(!1),[A,P]=(0,n.useState)(!1),[U,K]=(0,n.useState)({list:[]}),[F,$]=(0,f.fp)(S.AG.editorSetting),[H,N]=(0,f.fp)(S.AG.user_base_info),Z=[t("端口"),t("目标地址"),t("目标端口"),t("开启"),t("备注"),t("删除")],[O,B]=(0,n.useState)([]),D=[t("port"),t("ip"),t("type"),t("开启")],[E,z]=(0,n.useState)([]),V=[t("编辑"),t("开启"),t("备注"),t("删除")],M=(0,k.K)(),X=async()=>{const e=[a._U.post("vir/client/tcp_proxy/get"),a._U.post("http/proxy/server/get")];let t;H.sys===_.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);z([...t,...s])})():H.sys===_.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),I(t.enabled),y(t.bypass),P(t.useForLocal)}})()),t&&e.push(t);const[s,n]=await Promise.all(e);s.code===r.m.Success&&B(s.data),n.code===r.m.Success&&K(n.data)};(0,n.useEffect)(()=>{X()},[]);return(0,v.jsx)("div",{children:(0,v.jsxs)(o.fI,{children:[H.sys===_.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=b,e.useForLocal=A,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("请勿将代理服务器用于本地(Intranet)地址"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:A,onchange:()=>{P(!A)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!A,onchange:()=>{P(!A)}})]})]}),(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)}})]})]})]})}),H.sys===_.XM.mac&&(0,v.jsx)(o.VP,{children:E.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=E[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:D,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=[...E];n[e].proxies[t].enabled=s,z(n)})(s,t,e)},options:M,no_border:!0})];return n}),width:"10rem"}),"ignore ips",(0,v.jsx)(i.Sm,{value:e.bypass,handleInputChange:e=>{E[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:()=>{B([...O,{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<O.length;t++)O[t].index=t,e.push(O[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:Z,rows:O.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=>{O[s].open=e,B([...O])},options:M,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=>{O.splice(e,1),B([...O])})(s)})})];return n}),width:"10rem"})}),(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:()=>{U.list.push({open:!1,port:0,note:"",list:[]}),K({...U})}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{(await a._U.post("http/proxy/server/save",U)).code===r.m.Success&&(0,c.SK)("保存成功")}})]}),children:U.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,K({...U})},options:M,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,K({...U})},no_border:!0,width:"80px"}),(0,v.jsx)(d.rA,{icon:"add",title:t("添加规则"),onClick:()=>{e.list.push({note:"",open:!1}),K({...U})}}),(0,v.jsx)(d.rA,{icon:"delete",title:t("删除端口实例"),onClick:()=>{U.list.splice(s,1),K({...U})}}),(0,v.jsx)(i.Sm,{placeholder:t("备注"),width:"100%",value:e.note,handleInputChange:t=>{e.note=t,K({...U})},no_border:!0})]}),(0,v.jsx)(p.X,{headers:V,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=U.list[e];if(!s)return;const n=s.list[t];if(!n)return;n.random_key||(n.random_key=(0,C.hU)(),K({...U}));const o=await a._U.post("http/proxy/server/code/get",{key:n.random_key,name:n.random_key});$({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(""),$({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,K({...U})},options:M,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),K({...U})}})})];return c}),width:"10rem"})]},s))})]})]})})}var I=s(87361),A=s(82726),P=s(18538);function U(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[u,x]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[_,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[b,I]=(0,f.fp)(S.AG.showPrompt),[U,K]=(0,f.fp)(S.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:P.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===A.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===A.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||!_))return void(0,c.zN)("id和token都不能为空");const e=new A.yL,t=[];for(const e of[...s,...u])e.ddnsHost&&t.push(e);e.ips=t,e.account={id:g,token:_},e.isOpen=C,e.ddnsType=A.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:_,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 K(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[u,x]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[_,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[b,I]=(0,f.fp)(S.AG.showPrompt),[U,K]=(0,f.fp)(S.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:P.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===A.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===A.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||!_))return void(0,c.zN)("SecretId和SecretKey都不能为空");const e=new A.yL,t=[];for(const e of[...s,...u])e.ddnsHost&&t.push(e);e.ips=t,e.account={secretid:g,secretkey:_},e.isOpen=C,e.ddnsType=A.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:_,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(){const{t:e}=(0,j.B)(),{check_user_auth:t}=(0,w.MH)(),s=[];return t(_.oV.vir_net)&&s.push({index:1,name:e("系统代理"),rto:"proxy_sys/",component:(0,v.jsx)(b,{})},{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(_.oV.ddns)&&s.push({index:4,name:`ddns-dnspod(${e("腾讯")})`,rto:"dnspod/",component:(0,v.jsx)(U,{})},{index:5,name:`ddns-${e("腾讯")}${e("云")}`,rto:"tengxun/",component:(0,v.jsx)(K,{})}),(0,v.jsx)(o.W1,{optionList:s,father_route:I.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([[3345],{18840(e,t,n){n.d(t,{I:()=>r,gE:()=>s});class r{open;key;option_keys;port}class s{client_name;client_num_id;open=!1;serverIp;serverPort;key="";note;status;is_new;index}n.d(t,["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"])},33345(e,t,n){n.r(t),n.d(t,{default:()=>Re});var r=n(96540),s=n(34843),o=n(82893),a=n(78247),c=n(23430),l=n(85997),i=n(57952),u=n(62042),d=n(53459),m=n(14284),h=n(57889),f=n(86149),p=n(42845),g=n(1575),v=n(89781),_=n(61396),k=n(46762),b=n(73337),y=n(89552),w=n(86059),x=n(58903);const M=(0,w.of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),$={align:{default:null}},S={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:$,parseDOM:[{tag:"p"}],toDOM:e=>["p",e.attrs.align?{style:`text-align:${e.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...$},defining:!0,parseDOM:[1,2,3,4,5,6].map(e=>({tag:`h${e}`,attrs:{level:e}})),toDOM(e){const t=e.attrs.align?{style:`text-align:${e.attrs.align}`}:{};return[`h${e.attrs.level}`,t,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:e=>({order:Number(e.getAttribute("start")??1)})}],toDOM:e=>1===e.attrs.order?["ol",0]:["ol",{start:e.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:e=>{const t=e,n=t.querySelector("input[type=checkbox]");if(n)return{checked:n.checked};const r=t.getAttribute("data-checked");return{checked:null===r?null:"true"===r}}}],toDOM:e=>null!==e.attrs.checked?["li",{"data-checked":String(e.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{const t=e.querySelector("code"),n=/language-([\w-]+)/.exec(t?.className??"");return{language:n?n[1]:""}}}],toDOM:e=>["pre",{"data-language":e.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:e=>{const t=e;return{src:t.getAttribute("src"),alt:t.getAttribute("alt"),title:t.getAttribute("title")}}}],toDOM(e){const{src:t,alt:n,title:r}=e.attrs,s={src:t};return n&&(s.alt=n),r&&(s.title=r),["img",s]}},text:{group:"inline"},...M},j={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:e=>"PRE"!==e.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>{const t=e;return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(e){const{href:t,title:n}=e.attrs;return["a",{href:t,title:n,rel:"noopener noreferrer",target:"_blank"},0]}}},E=new x.Sj({nodes:S,marks:j});const A=new(n(22091).A)({html:!0,linkify:!0,breaks:!1,typographer:!1});function C(e){const t=A.render(e??""),n=document.createElement("div");return n.innerHTML=t,x.S4.fromSchema(E).parse(n)}function D(e){let t="";return e.forEach(e=>{if(e.isText){let n=e.marks.some(e=>"code"===e.type.name)?e.text??"":function(e){return e.replace(/([\\`*_[\]<>])/g,"\\$1")}(e.text??"");for(const t of e.marks)switch(t.type.name){case"code":n=`\`${e.text??""}\``;break;case"strong":n=`**${n}**`;break;case"em":n=`*${n}*`;break;case"strike":n=`~~${n}~~`;break;case"link":n=`[${n}](${t.attrs.href}${t.attrs.title?` "${t.attrs.title}"`:""})`}t+=n}else if("image"===e.type.name){const{src:n,alt:r,title:s}=e.attrs;t+=``}else"hard_break"===e.type.name&&(t+=" \n")}),t}function O(e){const t=[];if(e.forEach(e=>{const n=[],r=[];e.forEach(e=>{var t;n.push((t=e.textContent,t.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),r.push("table_header"===e.type.name)}),t.push({cells:n,header_flags:r})}),0===t.length)return"";const n=Math.max(...t.map(e=>e.cells.length)),r=t[0].header_flags.some(e=>e),s=Array.from({length:n},(e,n)=>Math.max(3,...t.map(e=>N(e.cells[n]??"")))),o=e=>`| ${Array.from({length:n},(t,n)=>{return r=e[n]??"",o=s[n],r+" ".repeat(Math.max(0,o-N(r)));var r,o}).join(" | ")} |`,a=[];if(r){a.push(o(t[0].cells)),a.push(`| ${s.map(e=>"-".repeat(e)).join(" | ")} |`);for(let e=1;e<t.length;e++)a.push(o(t[e].cells))}else{a.push(o(new Array(n).fill(""))),a.push(`| ${s.map(e=>"-".repeat(e)).join(" | ")} |`);for(const e of t)a.push(o(e.cells))}return a.join("\n")}function N(e){let t=0;for(const n of e){const e=n.codePointAt(0)??0;t+=e>=4352&&e<=4447||e>=11904&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510?2:1}return t}function L(e,t=""){switch(e.type.name){case"paragraph":default:return t+D(e);case"heading":return`${t}${"#".repeat(e.attrs.level)} ${D(e)}`;case"blockquote":return z(e,"").split("\n").map(e=>`${t}> ${e}`).join("\n");case"code_block":{const n=e.attrs.language??"";return`${t}\`\`\`${n}\n${e.textContent}\n${t}\`\`\``}case"horizontal_rule":return`${t}---`;case"bullet_list":{const n=[];return e.forEach((e,r,s)=>{n.push(R(e,t,`${t}- `,`${t} `,s))}),n.join("\n")}case"ordered_list":{const n=[],r=e.attrs.order??1;return e.forEach((e,s,o)=>{n.push(R(e,t,`${t}${r+o}. `,`${t} `,o))}),n.join("\n")}case"table":return O(e).split("\n").map(e=>t+e).join("\n")}}function R(e,t,n,r,s){const o=e.attrs.checked,a=null===o?"":o?"[x] ":"[ ] ",c=[];e.forEach((e,t,n)=>{c.push(L(e,0===n?"":r))});const l=c.join("\n").split("\n");return n+a+l[0]+(l.length>1?"\n"+l.slice(1).join("\n"):"")}function z(e,t=""){const n=[];return e.forEach(e=>{n.push(L(e,t))}),n.join("\n\n")}function F(e){return z(e).trim()+"\n"}var P=n(74848);function G(e){const{t}=(0,f.B)(),[n,s]=(0,r.useState)(new Set),o=(0,r.useMemo)(()=>function(e){const t=[],n=[];for(const r of e){const e={...r,children:[]};for(;n.length>0&&n[n.length-1].level>=e.level;)n.pop();0===n.length?t.push(e):n[n.length-1].children.push(e),n.push(e)}return t}(e.items),[e.items]),a=(r,o)=>r.map(r=>{const c=r.children.length>0,l=n.has(r.pos),i=r.pos===e.active_pos;return(0,P.jsxs)("div",{children:[(0,P.jsxs)("div",{className:`md-outline-item md-outline-item--h${r.level}${i?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:r.text,onClick:()=>e.on_click(r),children:[(0,P.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?e=>{return t=r.pos,e.stopPropagation(),void s(e=>{const n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n});var t}:void 0,children:c?l?"arrow_right":"arrow_drop_down":""}),(0,P.jsx)("span",{className:"md-outline-text",children:r.text||t("未命名标题")})]}),c&&!l&&a(r.children,o+1)]},r.pos)});return 0===e.items.length?(0,P.jsxs)("div",{className:"md-outline md-outline--empty",children:[(0,P.jsx)("div",{className:"md-outline-header",children:t("大纲")}),(0,P.jsx)("div",{className:"md-outline-tip",children:t("正文里还没有标题")})]}):(0,P.jsxs)("div",{className:"md-outline",children:[(0,P.jsx)("div",{className:"md-outline-header",children:t("大纲")}),(0,P.jsx)("div",{className:"md-outline-list",children:a(o,0)})]})}var T=n(38341),q=n(3772);function I(){const e=E;return(0,T.sM)({rules:[(0,T.JJ)(/^(#{1,6})\s$/,e.nodes.heading,e=>({level:e[1].length})),(0,T.JJ)(/^```([\w-]*)\s$/,e.nodes.code_block,e=>({language:e[1]??""})),(0,T.tG)(/^\s*>\s$/,e.nodes.blockquote),(0,T.tG)(/^\s*([-+*])\s$/,e.nodes.bullet_list),(0,T.tG)(/^(\d+)\.\s$/,e.nodes.ordered_list,e=>({order:Number(e[1])})),...T.Fr,T.gO]})}function W(e){return(t,n)=>{const r=t.schema.marks[e];return!!r&&(0,k.wh)(r)(t,n)}}function H(e,t={}){return(n,r)=>{const s=n.schema.nodes[e];if(!s)return!1;const{$from:o,$to:a}=n.selection,c=o.blockRange(a);if(!c)return!1;const l=o.parent,i=l.type===s&&Object.entries(t).every(([e,t])=>l.attrs[e]===t),u=i?n.schema.nodes.paragraph:s,d=i?{}:t;return r&&r(n.tr.setBlockType(c.start,c.end,u,d)),!0}}const B=(e,t)=>(0,q.Sd)(e.schema.nodes.bullet_list)(e,t),U=(e,t)=>(0,q.Sd)(e.schema.nodes.ordered_list)(e,t),V=(e,t)=>{const{blockquote:n}=e.schema.nodes,{$from:r,$to:s}=e.selection,o=r.blockRange(s);if(!o)return!1;if(o.parent.type===n&&o.depth>0){const n=r.before(o.depth),s=e.tr.doc.nodeAt(n);if(s&&1===s.childCount)return t&&t(e.tr.replaceWith(n,n+s.nodeSize,s.child(0)).scrollIntoView()),!0;if(t){const n=e.tr,s=r.parent,a=r.after(o.depth);n.delete(o.start,o.end),n.insert(a,s),t(n.scrollIntoView())}return!0}return t&&t(e.tr.wrap(o,[{type:n}]).scrollIntoView()),!0},K={sink:(0,q.$B)(E.nodes.list_item),lift:(0,q.T2)(E.nodes.list_item),split:(0,q.wn)(E.nodes.list_item),wrap_bullet:B,wrap_ordered:U};n(41631),n(50576),n(70432);function J(e){return 0===e?H("paragraph"):H("heading",{level:e})}function X(e){return!(!e.ctrlKey&&!e.metaKey)}function Y(e,t){return(0,w.D8)(1)(e,t)}const Z=r.forwardRef(function(e,t){const n=(0,r.useRef)(null),s=(0,r.useRef)(null),o=(0,r.useRef)(e.on_change),a=(0,r.useRef)(e.on_save),c=(0,r.useRef)(e.on_selection_change);return(0,r.useEffect)(()=>{o.current=e.on_change,a.current=e.on_save,c.current=e.on_selection_change}),(0,r.useEffect)(()=>{if(!n.current)return;const r=p.$t.create({doc:C(e.value??""),plugins:[I(),(0,_.w)({"Mod-b":W("strong"),"Mod-i":W("em"),"Mod-Shift-x":W("strike"),"Mod-`":W("code"),"Mod-1":(e,t)=>J(1)(e,t),"Mod-2":(e,t)=>J(2)(e,t),"Mod-3":(e,t)=>J(3)(e,t),"Mod-0":(e,t)=>J(0)(e,t),"Mod-Shift-8":B,"Mod-Shift-9":U,"Mod-Shift-.":V,Tab:K.sink,"Shift-Tab":K.lift,"Mod-Enter":Y,"Mod-s":()=>(a.current?.(),!0)}),(0,w.LF)({allowTableNodeSelection:!0}),(0,w.AL)(),(0,b.A)({color:"var(--primary, #1a73e8)",width:2}),(0,y.z)(),(0,v.b6)(),(0,_.w)({Enter:(0,k.st)(k.pC,K.split,k.Z1,k.iz,k.aw),"Shift-Enter":(e,t)=>{const{hard_break:n}=e.schema.nodes;return t&&t(e.tr.replaceSelectionWith(n.create()).scrollIntoView()),!0},"Mod-Enter":k.I$}),(0,_.w)(k.RV)]}),l=new g.Lz(n.current,{state:r,editable:()=>!1!==e.editable,handleClickOn(e,t,n,r,s){if(!X(s))return!1;const o=function(e){if(!(e instanceof Element))return null;const t=e.closest("a[href]"),n=t?.getAttribute("href");return n||null}(s.target)??function(e,t){const n=e.doc.content.size,r=Math.max(0,Math.min(t,n));let s;try{s=e.doc.resolve(r)}catch{return null}for(const t of[1,-1]){const s=1===t?r:r-1;if(!(s<0||s>=n))try{const t=e.doc.resolve(s).marks().find(e=>"link"===e.type.name);if(t?.attrs?.href)return t.attrs.href}catch{}}try{const e=s.parent.marks.find(e=>"link"===e.type.name);if(e?.attrs?.href)return e.attrs.href}catch{}return null}(e.state,t);return!!o&&(window.open(o,"_blank","noopener,noreferrer"),!0)},handleDOMEvents:{keydown:(e,t)=>(X(t)&&e.dom.classList.add("md-ctrl-down"),!1),keyup:(e,t)=>(X(t)||e.dom.classList.remove("md-ctrl-down"),!1),blur:e=>(e.dom.classList.remove("md-ctrl-down"),!1)},dispatchTransaction(e){const t=l.state.apply(e);l.updateState(t),e.docChanged&&o.current?.(F(t.doc)),(e.selectionSet||e.docChanged)&&c.current?.()},attributes:{class:"md-wysiwyg-content",spellcheck:"false"}});s.current=l;const i={get_markdown:()=>F(l.state.doc),set_markdown:e=>{const t=C(e);l.dispatch(l.state.tr.replaceWith(0,l.state.doc.content.size,t.content))},focus:()=>l.focus(),get_view:()=>s.current,in_table:()=>function(e){const{$from:t}=e.selection;for(let e=t.depth;e>0;e--){if("table"===t.node(e).type.name)return!0}return!1}(l.state),active_marks:()=>(l.state.storedMarks??l.state.selection.$from.marks()).map(e=>e.type.name),active_block:()=>{const{$from:e}=l.state.selection;for(let t=e.depth;t>0;t--){const n=e.node(t);if("heading"===n.type.name)return{name:"heading",level:n.attrs.level};if("paragraph"===n.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(e=3,t=3)=>{const n=function(e,t,n){const r=(0,w.e)(e),s=r.table,o=r.row,a=r.cell,c=r.header_cell??r.cell;if(!s||!o||!a)return null;const l=e=>o.create(null,Array.from({length:t},()=>e.createAndFill())),i=l(c),u=Array.from({length:n},()=>l(a));return s.create(null,[i,...u])}(l.state.schema,e,t);if(!n)return;const{from:r}=l.state.selection,s=l.state.doc.resolve(r);let o=r;for(let e=s.depth;e>0;e--)if("table"===s.node(e).type.name){o=s.after(e);break}const a=l.state.tr;o===r?a.replaceSelectionWith(n):a.insert(o,n),l.dispatch(a.scrollIntoView());const c=l.state.doc.resolve(Math.min(o+3,l.state.doc.content.size));try{l.dispatch(l.state.tr.setSelection(l.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(e){const t=[];return e.doc.descendants((e,n)=>("heading"!==e.type.name||t.push({level:e.attrs.level,text:e.textContent,pos:n}),!0)),t}(l.state),scroll_to_pos:e=>{const t=l.state.doc.content.size,n=Math.max(0,Math.min(e,t)),r=l.state.doc.nodeAt(n);let s;try{s=r?p.U3.near(l.state.doc.resolve(n+1),1):p.U3.near(l.state.doc.resolve(n),1)}catch{s=p.U3.near(l.state.doc.resolve(0),1)}l.dispatch(l.state.tr.setSelection(s).scrollIntoView()),l.focus()}};return"function"==typeof t?t(i):t&&(t.current=i),e.on_ready?.(i),()=>{l.destroy(),s.current=null}},[]),(0,P.jsx)("div",{className:"md-wysiwyg",ref:n})});function Q(e){const{t}=(0,f.B)(),n=(0,r.useRef)(null),[s,o]=(0,r.useState)({marks:[],block:{name:"paragraph"}}),[a,c]=(0,r.useState)(null),l=(0,r.useCallback)(()=>{const t=e.get_view();if(!t)return;const n=t.state.selection,r=t.state.storedMarks??n.$from.marks();if(o({marks:r.map(e=>e.type.name),block:ee(n.$from)}),n.empty)return void c(null);const s=t.coordsAtPos(n.from),a=t.coordsAtPos(n.to),l=(Math.min(s.left,a.left)+Math.max(s.right,a.right))/2,i=Math.min(s.top,a.top),u=Math.max(s.bottom,a.bottom);c({top:i,bottom:u,left:l})},[e.get_view]);(0,r.useEffect)(()=>{l();const t=e.get_view();if(!t)return;const n=()=>l();t.dom.addEventListener("keyup",n),t.dom.addEventListener("mouseup",n),document.addEventListener("selectionchange",n);const r=t.dom.closest(".md-editor-context");return r?.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{t.dom.removeEventListener("keyup",n),t.dom.removeEventListener("mouseup",n),document.removeEventListener("selectionchange",n),r?.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[l,e.get_view,e.refresh_key]);const i=t=>{const n=e.get_view();n&&(t(n.state,n.dispatch),n.focus(),l())},u=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,h]=(0,r.useState)({w:0,h:36});if((0,r.useLayoutEffect)(()=>{if(!a||!n.current)return;const e=n.current.offsetWidth,t=n.current.offsetHeight;h(n=>n.w===e&&n.h===t?n:{w:e,h:t})},[a,e.refresh_key]),!a)return null;const p=(e,n,r,s,o=!1)=>(0,P.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(r),onMouseDown:e=>e.preventDefault(),onClick:s,children:n},e),g=m.w/2,v=g+4,_=Math.max(v,window.innerWidth-g-4),k=document.querySelector(".header")?.getBoundingClientRect().bottom??0,b=a.top-m.h-8,y=b<k+4,w={top:y?Math.min(a.bottom+8,window.innerHeight-m.h-4):b,left:Math.min(_,Math.max(v,a.left))};return(0,P.jsxs)("div",{className:"mdtb mdtb--floating"+(y?" mdtb--below":""),ref:n,style:w,children:[p("h1","H1","一级标题",()=>i(H("heading",{level:1})),d(1)),p("h2","H2","二级标题",()=>i(H("heading",{level:2})),d(2)),p("h3","H3","三级标题",()=>i(H("heading",{level:3})),d(3)),(0,P.jsx)("span",{className:"mdtb__sep"}),p("b","B","加粗",()=>i(W("strong")),u("strong")),p("i","I","斜体",()=>i(W("em")),u("em")),p("s","S","删除线",()=>i(W("strike")),u("strike")),p("code","</>","行内代码",()=>i(W("code")),u("code")),(0,P.jsx)("span",{className:"mdtb__sep"}),p("ul","≔","无序列表",()=>i(B)),p("ol","1.","有序列表",()=>i(U)),p("quote","❝","引用",()=>i(V))]})}function ee(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.name;if("heading"===n)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===n)return{name:"paragraph"}}return{name:"paragraph"}}var te=n(75725);const ne="cut",re="copy",se="paste",oe="strong",ae="em",ce="strike",le="code",ie="h1",ue="h2",de="h3",me="paragraph",he="bullet",fe="ordered",pe="quote",ge="code_block",ve="clean",_e="row_before",ke="row_after",be="row_delete",ye="col_before",we="col_after",xe="col_delete",Me="header_toggle",$e="cell_merge",Se="cell_split",je="table_delete",Ee="table_insert",Ae="select_all";function Ce(e){const{t}=(0,f.B)(),[n,s]=(0,r.useState)(null),o=(0,r.useRef)(e.get_view);o.current=e.get_view,(0,r.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const n=e.target;if(!n||!n.closest(".md-wysiwyg-content"))return;e.preventDefault();const r=t.posAtCoords({left:e.clientX,top:e.clientY});if(r){const e=t.state.selection;if(r.pos<e.from||r.pos>e.to){const{TextSelection:e}=t.state.selection.constructor;try{t.dispatch(t.state.tr.setSelection(e.near(t.state.doc.resolve(r.pos))))}catch{}}}const a=!!n.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:a||(0,w.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const a=()=>s(null),c=(0,r.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),a())},[]),l=e=>{const t=o.current();t?.focus(),document.execCommand(e),a()};if(!n)return null;const i=n.in_table?[{r:t("上方插入行"),v:_e},{r:t("下方插入行"),v:ke},{r:t("左侧插入列"),v:ye},{r:t("右侧插入列"),v:we},{r:t("删除行"),v:be},{r:t("删除列"),v:xe},{r:t("切换表头行"),v:Me},{r:t("合并单元格"),v:$e},{r:t("拆分单元格"),v:Se},{r:t("删除表格"),v:je}]:[],u=[{r:t("剪切"),v:ne},{r:t("复制"),v:re},{r:t("粘贴"),v:se},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:oe},{r:t("斜体"),v:ae},{r:t("删除线"),v:ce},{r:t("行内代码"),v:le}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:ie},{r:t("二级标题"),v:ue},{r:t("三级标题"),v:de},{r:t("正文"),v:me}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:he},{r:t("有序列表"),v:fe},{r:t("引用"),v:pe},{r:t("代码块"),v:ge},{r:t("插入表格"),v:Ee}]},...i.length?[{r:t("表格"),v:"table",items:i}]:[],{r:t("清除格式"),v:ve},{r:t("全选"),v:Ae}];return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(te.rY,{click:a}),(0,P.jsx)(te.Pu,{x:n.x,y:n.y,items:u,click:t=>{switch(t){case ne:return l("cut");case re:return l("copy");case se:return l("paste");case oe:return c(W("strong"));case ae:return c(W("em"));case ce:return c(W("strike"));case le:return c(W("code"));case ie:return c(H("heading",{level:1}));case ue:return c(H("heading",{level:2}));case de:return c(H("heading",{level:3}));case me:return c(H("paragraph"));case he:return c(B);case fe:return c(U);case pe:return c(V);case ge:return c(H("code_block"));case Ee:return a(),void e.on_insert_table?.();case _e:return c(w.JD);case ke:return c(w.gC);case ye:return c(w.RC);case we:return c(w.GU);case be:return c(w.aR);case xe:return c(w.gR);case Me:return c(w.uC);case $e:return c(w.w7);case Se:return c(w.L0);case je:return c(w.kG);case ve:return c((e,t)=>{const{from:n,to:r}=e.selection;let s=e.tr;return e.doc.nodesBetween(n,r,(e,t)=>{if(e.isText)for(const n of e.marks)s=s.removeMark(t,t+e.nodeSize,n.type)}),t?.(s),!0});case Ae:return c((e,t)=>{const{TextSelection:n}=e.selection.constructor;return t?.(e.tr.setSelection(n.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var De=n(69918),Oe=n(2543),Ne=n(86090),Le=n(87361);function Re(){const{t:e}=(0,f.B)(),t=(0,Ne.Zp)(),{check_user_auth:n}=(0,a.MH)(),p=n(c.oV.md_editor_setting),[g,v]=(0,s.fp)(o.AG.md_editor),[_,k]=(0,r.useState)(null),[b,y]=(0,r.useState)(!1),[w,x]=(0,r.useState)(!1),[M,$]=(0,r.useState)(0),S=(0,r.useRef)(null),[j,E]=(0,r.useState)([]),[A,C]=(0,r.useState)(-1),[D,O]=(0,r.useState)(15),[N,L]=(0,r.useState)(!1),R=(0,r.useRef)(null),z=(0,r.useRef)(null),[F,T]=(0,s.fp)(o.AG.md_editor_show_outline),[q,I]=(0,s.fp)(o.AG.md_editor_mode),[W,H]=(0,r.useState)(""),B=(0,r.useRef)(null),U=(0,r.useCallback)(()=>{const e="wysiwyg"===q?"source":"wysiwyg";if("source"===e){const e=S.current?.get_markdown();void 0!==e&&H(e)}else k(W),K(e=>e+1);I(e)},[q,W]),[V,K]=(0,r.useState)(0),[J,X]=(0,r.useState)(De.FG),Y=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e=!1;return(0,De.gC)().then(t=>{e||X(t)}),()=>{e=!0}},[]),(0,r.useEffect)(()=>{(0,De.Ce)(Y.current,J)},[J]);const ee=(0,r.useRef)([]),te=(0,r.useCallback)(()=>{let e;if("source"===q)e=function(e){const t=[];if(!e)return t;const n=e.split(/(\n)/);let r=null,s=0;for(let e=0;e<n.length;e+=2){const o=n[e],a=s;s+=o.length+(n[e+1]?.length??0);const c=o.endsWith("\r")?o.slice(0,-1):o,l=c.trimStart(),i=/^(`{3,}|~{3,})/.exec(l);if(i){const e=i[1][0];null===r?r=e:r===e&&(r=null);continue}if(null!==r)continue;const u=/^ {0,3}(#{1,6})\s+(.*)$/.exec(c);if(!u)continue;const d=u[1].length,m=u[2].replace(/\s+#+\s*$/,"").trim();t.push({level:d,text:m,pos:a})}return t}(W);else{const t=S.current;if(!t)return;e=t.get_headings()}ee.current=e,E(e)},[q,W]),ne=(0,r.useCallback)(()=>{if("source"===q){const e=B.current;if(!e)return;return void C(function(e,t){let n=-1;for(const r of e){if(!(r.pos<=t))break;n=r.pos}return n}(ee.current,e.selectionStart))}const e=S.current?.get_view();if(!e)return;const t=e.state.selection.from;let n=-1;for(const e of ee.current){if(!(e.pos<=t))break;n=e.pos}C(n)},[q]);(0,r.useEffect)(()=>{let t=!1;if(g?.url)return x(!1),y(!0),h.l.get(g.url).then(e=>{if(t)return;const n=e??"";k(n),H(n)}).catch(()=>{t||((0,u.zN)(e("打开失败")),k(""),H(""))}).finally(()=>{t||y(!1)}),()=>{t=!0};k(null)},[g?.url]),(0,r.useEffect)(()=>{const e=()=>$(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]);const re=(0,r.useRef)(U);re.current=U,(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"/"===e.key&&(e.preventDefault(),e.stopPropagation(),re.current())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,r.useEffect)(()=>{te(),ne()},[M,te,ne]);const se=(0,r.useCallback)(Oe.throttle(e=>{if(!R.current||!z.current)return;const t=parseFloat(getComputedStyle(R.current).fontSize),n=e.clientX/t,r=window.innerWidth/t-4,s=2.25+z.current.offsetWidth/t;n<=r&&n>=s&&O(parseFloat(n.toFixed(2)))},32),[]),oe=()=>{L(!1),R.current?.removeEventListener("pointermove",se)},ae=async()=>{if(!g?.name||!g?.path)return;const t="source"===q?W:S.current?.get_markdown();if(void 0===t)return;const n=g.path.slice(0,g.path.length-g.name.length),r=`${encodeURIComponent(n)}${g.name}`;(await m.$M.post(`save/${r}`,{context:t})).code===d.m.Success?(x(!1),(0,u.SK)(e("保存成功"))):(0,u.zN)(e("保存失败"))},ce=(0,r.useRef)(ae);ce.current=ae;const le=()=>{v({}),x(!1),k(null),S.current=null,g?.close?.()},ie=(0,r.useMemo)(()=>g?.url??"md_editor",[g?.url]);return g?.name?(0,P.jsxs)("div",{id:"md-editor-container",ref:Y,children:[(0,P.jsx)(i.A,{ignore_tags:!0,left_children:[(0,P.jsx)(l.rA,{title:e("关闭"),icon:"close",onClick:le},1),...w?[(0,P.jsx)(l.rA,{title:e("保存"),icon:"save",onClick:ae},2)]:[],(0,P.jsx)(l.rA,{title:e("大纲"),icon:"list",onClick:()=>T(e=>!e),selected:F},4),(0,P.jsx)(l.rA,{title:e("wysiwyg"===q?"源码模式":"实时编辑模式"),icon:"wysiwyg"===q?"code":"edit",onClick:U},5),...p?[(0,P.jsx)(l.rA,{title:e("编辑器设置"),icon:"settings",onClick:()=>{le(),t(Le.o.md_editor_setting_page)}},6)]:[],(0,P.jsx)("title",{children:g.name},3)]}),(0,P.jsxs)("div",{className:"md-editor-context",ref:R,children:[b&&(0,P.jsxs)("div",{className:"common-box common-box-center",children:[e("加载中"),"..."]}),!b&&null!==_&&(0,P.jsxs)(r.Fragment,{children:[F&&(0,P.jsx)("div",{className:"md-outline-panel",style:{width:`${D}em`},children:(0,P.jsx)(G,{items:j,active_pos:A,on_click:e=>{if("source"===q){const t=B.current;if(!t)return;t.focus(),t.setSelectionRange(e.pos,e.pos);const n=W.slice(0,e.pos).split(/\r?\n/).length-1,r=parseFloat(getComputedStyle(t).lineHeight)||20;return t.scrollTop=Math.max(0,n*r-2*r),void C(e.pos)}S.current?.scroll_to_pos(e.pos),C(e.pos)}})}),F&&(0,P.jsx)("div",{className:"md-editor-divider",ref:z,onPointerDown:()=>{L(!0),R.current?.addEventListener("pointermove",se)},onPointerUp:oe}),N&&(0,P.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:oe}),(0,P.jsx)("div",{className:"md-editor-scroll",children:(0,P.jsx)("div",{className:"md-editor-sheet",children:"wysiwyg"===q?(0,P.jsxs)(r.Fragment,{children:[(0,P.jsx)(Q,{get_view:()=>S.current?.get_view()??null,refresh_key:M}),(0,P.jsx)(Z,{value:_,ref:S,on_ready:e=>{const t=e.get_headings();ee.current=t,E(t),C(-1)},on_change:()=>{w||x(!0)},on_save:()=>ce.current(),on_selection_change:()=>$(e=>e+1)},`${ie}#${V}`),(0,P.jsx)(Ce,{get_view:()=>S.current?.get_view()??null,on_insert_table:()=>{S.current?.insert_table(3,3),x(!0)}})]}):(0,P.jsx)("textarea",{className:"md-source-editor",ref:B,value:W,spellCheck:!1,wrap:"off",onChange:e=>{H(e.target.value),w||x(!0)},onSelect:()=>ne(),onClick:()=>ne(),onKeyUp:e=>{(e.key.startsWith("Arrow")||"Home"===e.key||"End"===e.key||"PageUp"===e.key||"PageDown"===e.key)&&ne()},onKeyDown:e=>{if("Tab"===e.key){e.preventDefault();const t=e.currentTarget,n=t.selectionStart,r=t.selectionEnd,s=`${W.slice(0,n)} ${W.slice(r)}`;H(s),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=n+2}),w||x(!0)}}})})})]})]})]}):null}},69918(e,t,n){n.d(t,{Ce:()=>l,FG:()=>r.FG,fy:()=>c,gC:()=>a});var r=n(18840),s=n(14284),o=n(53459);async function a(){try{const e=await s.XO.get("md_editor_setting/get");return{...r.FG,...e?.data??{}}}catch(e){return{...r.FG}}}async function c(e){const t=await s.XO.post("md_editor_setting/save",e);return t?.code!==o.m.Success?null:{...r.FG,...t.data??e}}function l(e,t){e&&(e.style.setProperty("--md-editor-max-width",t.content_max_width),e.style.setProperty("--md-editor-padding",t.content_padding),e.style.setProperty("--md-editor-font-size",t.font_size),e.style.setProperty("--md-editor-line-height",t.line_height))}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4091],{84091(e,t,n){n.r(t),n.d(t,{default:()=>l});var i=n(96540),o=n(80952),s=(n(82327),n(1766),n(24854),n(90008),n(90846),n(40975),n(44286),n(30766),n(14973),n(69687),n(1234),n(47507),n(87268),n(24522)),r=n(34843),c=n(82893),a=n(78247),d=n(74848);function l(e){const t=(0,i.useRef)(null),[n,l]=(0,r.fp)(c.AG.user_base_info),u=n.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,i.useEffect)(()=>{const n=o.edit(t.current,{value:a.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${u}`,mode:e.model??s.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return n.setOptions({}),n.container.addEventListener("wheel",function(e){e.preventDefault()}),n.focus(),n.on("change",function(t){e.on_change&&e.on_change()}),t.current=n,n.formatCode=()=>{const e=o.require("ace/ext/beautify"),n=t.current;n&&e.beautify(n.session)},a.xK.set_editor_temp(n,e.editor_id),()=>{a.xK.delete_editor_temp(e.editor_id),n.destroy()}},[]),(0,d.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}o.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`),o.config.set("modePath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`),o.config.set("themePath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`),o.config.set("workerPath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`),o.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`)}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[676,4091,8319],{77481(e,t,n){n.d(t,{S:()=>l,X:()=>a});var s=n(96540),r=n(61443),i=n(74848);function a(e){const[t,n]=s.useState([]),a=(0,s.useRef)(-1),[l,o]=(0,s.useState)(-1),[c,u]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const d=()=>{a.current=-1,o(-1),u(-1)};return(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((t,n)=>{const s=!!e.filter&&(e.filter.column??0)===n;let a=t;if(s){const n=e.filter,s=n.options.find(e=>e.value===n.value);null!=n.value&&s&&(a=`${t} (${s.label})`)}return(0,i.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,i.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},n)})})}),(0,i.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,i.jsx)("tr",{className:s?(l===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(a.current=n,o(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",u(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=a.current,n=c;d(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:d,children:t.map((n,s)=>{const r=s===t.length-1?"small":"";return(0,i.jsx)("td",{className:r,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function l(e){return(0,i.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,i.jsx)("div",{children:e},t))})}},84091(e,t,n){n.r(t),n.d(t,{default:()=>u});var s=n(96540),r=n(80952),i=(n(82327),n(1766),n(24854),n(90008),n(90846),n(40975),n(44286),n(30766),n(14973),n(69687),n(1234),n(47507),n(87268),n(24522)),a=n(34843),l=n(82893),o=n(78247),c=n(74848);function u(e){const t=(0,s.useRef)(null),[n,u]=(0,a.fp)(l.AG.user_base_info),d=n.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,s.useEffect)(()=>{const n=r.edit(t.current,{value:o.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${d}`,mode:e.model??i.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return n.setOptions({}),n.container.addEventListener("wheel",function(e){e.preventDefault()}),n.focus(),n.on("change",function(t){e.on_change&&e.on_change()}),t.current=n,n.formatCode=()=>{const e=r.require("ace/ext/beautify"),n=t.current;n&&e.beautify(n.session)},o.xK.set_editor_temp(n,e.editor_id),()=>{o.xK.delete_editor_temp(e.editor_id),n.destroy()}},[]),(0,c.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}r.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`),r.config.set("modePath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`),r.config.set("themePath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`),r.config.set("workerPath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`),r.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`)},60676(e,t,n){n.r(t),n.d(t,{default:()=>C});var s=n(96540),r=n(57952),i=n(85997),a=n(14284),l=n(86090),o=n(77481),c=n(70447),u=n(34843),d=n(82893),p=n(84091),h=n(78247),f=n(61443),m=n(23496),x=n(62042),_=n(86149),j=n(53459),v=n(7523),g=n(74848);function b(e,t="auto"){return"s"===t||"auto"===t&&e>=1e3?`${(e/1e3).toFixed(2)} s`:`${Math.round(e)} ms`}function S(e){const{running:t=!1,resetKey:n=0,format:r="auto",prefix:i="",onTick:a,className:l}=e,[o,c]=(0,s.useState)(0),u=(0,s.useRef)(0),d=(0,s.useRef)(null),p=(0,s.useRef)(t);p.current=t;const h=(0,s.useCallback)(()=>{null!==d.current&&(cancelAnimationFrame(d.current),d.current=null)},[]),f=(0,s.useCallback)(()=>{h();const e=()=>{const t=performance.now()-u.current;c(t),a?.(t),p.current&&(d.current=requestAnimationFrame(e))};e()},[a,h]);return(0,s.useEffect)(()=>{u.current=performance.now(),c(0),a?.(0),p.current&&f()},[n]),(0,s.useEffect)(()=>{t?f():h()},[t,f,h]),(0,s.useEffect)(()=>()=>h(),[h]),(0,g.jsxs)("span",{className:l,children:[i,b(o,r)]})}var q=n(87361),y=n(28319);function w(e){const[t,n]=(0,s.useState)("");return(0,g.jsxs)("div",{className:"db-query-preset-input",children:[(0,g.jsx)(f.Sm,{placeholder:e.placeholder,value:t,handleInputChange:n}),(0,g.jsx)("div",{className:"db-query-preset-input__actions",children:(0,g.jsx)(i.C3,{text:e.confirmText,clickFun:()=>e.onConfirm(t.trim())})})]})}function C(){const e=(0,l.Zp)(),{t}=(0,_.B)(),{initUserInfo:n}=(0,s.useContext)(v.F),[b]=(0,u.fp)(d.AG.sqlite_query_context),[C]=(0,u.fp)(d.AG.user_base_info),[,k]=(0,u.fp)(d.AG.prompt_card),N=(0,s.useMemo)(()=>b?.path??"",[b?.path]),E=(0,s.useMemo)(()=>b?.path?`${b?.name||"数据库"} | ${b.path}`:"未选择数据库",[b?.name,b?.path]),A=97,[$,K]=(0,s.useState)(""),[L,F]=(0,s.useState)("table"),[R,M]=(0,s.useState)(!1),[Q,O]=(0,s.useState)(""),[P,D]=(0,s.useState)(null),[T,G]=(0,s.useState)(!1),[I,J]=(0,s.useState)(0),[Z,W]=(0,s.useState)(!1),[B,H]=(0,s.useState)([]),[V,X]=(0,s.useState)(-1);(0,s.useEffect)(()=>{const e=C?.user_data?.sql_preset_list;e&&e.length?H([...e]):H([{index:0,note:t("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}])},[C?.user_data?.sql_preset_list]);const U=async e=>{const t=e.map((e,t)=>({...e,index:t})),s=await a.wm.post(m.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:t});return s?.code===j.m.Success&&(await n(),H(t),!0)},z=async(e,n)=>{const s=[...B,{note:n||t("SQL 预设"),sql:e,env:y.sqlEnvDefault}];await U(s)&&(k({open:!1}),(0,x.SK)(t("创建成功")),X(s.length-1))},Y=(e,t)=>{if(!e)return"";for(const n of e.split("\n")){const e=n.indexOf("=");if(!(e<0)&&n.slice(0,e).trim()===t)return n.slice(e+1).trim()}return""},[ee,te]=(0,s.useState)(""),[ne,se]=(0,s.useState)("");(0,s.useEffect)(()=>{h.xK.set_value_temp($,A)},[$]),(0,s.useEffect)(()=>{K(""),O(""),D(null),F("table"),G(!1),W(!1),J(0),te(""),se(""),h.xK.set_value_temp("",A),N||O("请先从文件右键打开一个数据库")},[N,b?.open]);const re=async()=>{const e=(h.xK.get_editor_value(A)??$).trim();if(!N)return O("请先从文件右键打开一个数据库"),void D(null);if(!e)return O("请输入 SQL 语句"),void D(null);M(!0),O(""),W(!0),J(e=>e+1),G(!0);try{const n=(t=e,ee?t.split(ee).join(ne):t),s=await a.$M.post("sqlite/query",{path:N,sql:n});D(s.data),F("table")}catch(e){O(e?.message??`${e}`),D(null)}finally{G(!1),M(!1)}var t},ie=P?.columns?.length?P.columns:Object.keys(P?.rows?.[0]??{}),ae=(P?.rows??[]).map(e=>ie.map(t=>{return null==(n=e[t])?"":"object"==typeof n?JSON.stringify(n):`${n}`;var n}));return(0,g.jsxs)("div",{className:"db-query-page",children:[(0,g.jsx)(r.A,{ignore_tags:!0,left_children:[(0,g.jsx)(i.rA,{icon:"arrow_back",title:"返回",onClick:()=>e(-1)},"back"),(0,g.jsx)(i.rA,{icon:"play_arrow",title:"执行",onClick:re},"run"),(0,g.jsx)(i.rA,{icon:"table_chart",title:"表格视图",onClick:()=>F("table")},"table"),(0,g.jsx)(i.rA,{icon:"data_object",title:"原 JSON",onClick:()=>F("json")},"json"),(0,g.jsx)(i.rA,{icon:"settings",title:t("SQL预设设置"),onClick:()=>{e(q.o.sql_preset_setting_page)}},"preset-setting")],children:(0,g.jsx)(c.xP,{context:E,tip_context:"点击复制数据库信息"})}),(0,g.jsxs)("div",{className:"db-query-page__content",children:[(0,g.jsxs)(c.Zp,{title:"SQL 查询",titleCom:(0,g.jsxs)("div",{className:"db-query-page__preset-bar",children:[ee&&(0,g.jsx)(f.Sm,{placeholder:`${t("替换")}: ${ee}`,value:ne,handleInputChange:se,width:"12rem"}),B.length>0&&(0,g.jsx)(f.l6,{width:"16rem",tip:t("SQL预设"),value:V,onChange:e=>{const t=B[e];t&&(X(e),(e=>{h.xK.set_value_temp(e,A);const t=h.xK.get_editor(A);t&&t.setValue(e,-1),K(e)})(t.sql),te(Y(t.env??"","find")),se(""),O(""))},options:B.map((e,t)=>({value:t,title:`${e.note||e.sql.slice(0,24)}`}))}),(0,g.jsx)(i.C3,{text:t(V>=0?"更新保存":"创建新预选项"),clickFun:async()=>{const e=(h.xK.get_editor_value(A)??$).trim();if(!e)return void O(t("请输入 SQL 语句"));const n=[...B];if(V>=0&&n[V]){n[V].sql=e,n[V].note||(n[V].note=t("SQL 预设"));await U(n)&&(0,x.SK)(t("更新成功"))}else k({open:!0,title:t("创建新预选项"),context_div:(0,g.jsx)(w,{placeholder:t("请输入备注"),confirmText:t("确认"),onConfirm:t=>z(e,t)}),cancel:()=>k({open:!1})})}})]}),rightBottomCom:(0,g.jsxs)("div",{className:"db-query-page__actions",children:[(0,g.jsx)(i.C3,{text:R?"查询中...":"执行查询",clickFun:re}),(0,g.jsx)(i.C3,{text:"清空",clickFun:()=>{h.xK.set_value_temp("",A);const e=h.xK.get_editor(A);e&&e.setValue("",-1),K("")}}),(0,g.jsx)(i.C3,{text:"table"===L?"表格视图":"切换到表格",clickFun:()=>F("table")}),(0,g.jsx)(i.C3,{text:"json"===L?"原 JSON":"切换到 JSON",clickFun:()=>F("json")})]}),children:[(0,g.jsx)("div",{className:"db-query-page__editor",children:(0,g.jsx)(p.default,{name:"sqlite.sql",editor_id:A,model:"ace/mode/sql",on_change:()=>{const e=h.xK.get_editor_value(A)??"";K(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})}),Q&&(0,g.jsx)("div",{className:"db-query-page__error",children:Q})]}),(0,g.jsxs)(c.Zp,{title:"查询结果",titleCom:(0,g.jsxs)("span",{className:"db-query-page__result-meta",children:[P?`${P.row_count} 行`:"暂无结果",Z&&(0,g.jsx)("span",{className:"db-query-page__elapsed",children:(0,g.jsx)(S,{running:T,resetKey:I,prefix:`${t("耗时")}: `,format:"auto"})})]}),children:[P&&"table"===L&&(0,g.jsx)(o.X,{headers:ie,rows:ae}),P&&"json"===L&&(0,g.jsx)("pre",{className:"db-query-page__result-json",children:JSON.stringify(P.rows,null,2)}),!P&&!Q&&(0,g.jsx)("div",{className:"db-query-page__hint",children:"先输入查询语句,再执行。支持 `select`、`with`、`pragma`、`explain`。"}),!P&&Q&&(0,g.jsx)("div",{className:"db-query-page__hint",children:Q})]})]})]})}},28319(e,t,n){n.r(t),n.d(t,{default:()=>q,defaultSqlPreset:()=>b});var s=n(96540),r=n(86149),i=n(4412),a=n(85997),l=n(75725),o=n(77481),c=n(70447),u=n(61443),d=n(34843),p=n(82893),h=n(14284),f=n(23496),m=n(53459),x=n(62042),_=n(7523),j=n(78247),v=n(86090),g=n(74848);function b(e){return{index:0,note:e("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}}const S='# 可选:设置 SQL 中的"替换词"(在查询页选中该预设后,会显示输入框)\n# 例子:SQL 为 SELECT * FROM t WHERE id = 123456 ,请填写下面的 find=123456\n# 这样查询页输入新值即可把 SQL 中的 123456 替换掉后再查询\nfind=';function q(){const{t:e}=(0,r.B)(),{initUserInfo:t}=(0,s.useContext)(_.F),[,n]=(0,d.fp)(p.AG.editorSetting),[q]=(0,d.fp)(p.AG.user_base_info),y=(0,v.Zp)(),w=s.useRef(-1),[C,k]=(0,s.useState)([]);(0,s.useEffect)(()=>{const t=q?.user_data?.sql_preset_list;k(t?.length?[...t]:[b(e)])},[e,q?.user_data?.sql_preset_list]);const N=async()=>{const n=C.map((e,t)=>({...e,index:t})),s=await h.wm.post(f.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:n});s?.code===m.m.Success&&(await t(),(0,x.SK)(e("保存成功")))},E=(e,t)=>{w.current=e;const s=C[e][t]??"";j.xK.set_value_temp(s),n({model:"sql"===t?"ace/mode/sql":"ace/mode/ini",open:!0,fileName:"",save:async e=>{C[w.current][t]=e,k([...C]),j.xK.set_value_temp(""),N()}})},A=[e("编号"),e("备注"),e("SQL代码"),e("env编辑"),e("操作")];return(0,g.jsxs)("div",{children:[(0,g.jsx)(i.aZ,{position:"right",children:(0,g.jsx)(a.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>y(-1)})}),(0,g.jsx)(l.jW,{isFull:!0,more:!0,children:(0,g.jsx)(l.NN,{children:(0,g.jsx)(l.xh,{children:(0,g.jsx)(l.fI,{children:(0,g.jsx)(l.VP,{widthPer:60,children:(0,g.jsx)(c.uF,{self_title:(0,g.jsx)("span",{className:"div-row",children:(0,g.jsx)("h2",{children:e("SQL 预设")})}),titleCom:(0,g.jsxs)("div",{className:"db-query-setting__toolbar",children:[(0,g.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>k([...C,{note:"",sql:"",env:S}])}),(0,g.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>N()})]}),children:(0,g.jsx)(o.X,{headers:A,rows:C.map((t,n)=>[(0,g.jsx)("div",{children:n+1}),(0,g.jsx)(u.Sm,{value:t.note,no_border:!0,placeholder:e("备注"),handleInputChange:e=>{t.note=e,k([...C])}}),(0,g.jsx)("div",{children:(0,g.jsx)(a.rA,{icon:"short_text",title:e("编辑SQL"),onClick:()=>E(n,"sql")})}),(0,g.jsx)("div",{children:(0,g.jsx)(a.rA,{icon:"settings",title:e("env编辑"),onClick:()=>E(n,"env")})}),(0,g.jsx)("div",{children:(0,g.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>{C.splice(n,1),k([...C])}})})]),width:"8rem"})})})})})})})]})}n.d(t,["sqlEnvDefault",0,S])}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4091,7181],{84091(e,t,n){n.r(t),n.d(t,{default:()=>d});var i=n(96540),o=n(80952),s=(n(82327),n(1766),n(24854),n(90008),n(90846),n(40975),n(44286),n(30766),n(14973),n(69687),n(1234),n(47507),n(87268),n(24522)),c=n(34843),r=n(82893),l=n(78247),a=n(74848);function d(e){const t=(0,i.useRef)(null),[n,d]=(0,c.fp)(r.AG.user_base_info),f=n.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,i.useEffect)(()=>{const n=o.edit(t.current,{value:l.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${f}`,mode:e.model??s.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return n.setOptions({}),n.container.addEventListener("wheel",function(e){e.preventDefault()}),n.focus(),n.on("change",function(t){e.on_change&&e.on_change()}),t.current=n,n.formatCode=()=>{const e=o.require("ace/ext/beautify"),n=t.current;n&&e.beautify(n.session)},l.xK.set_editor_temp(n,e.editor_id),()=>{l.xK.delete_editor_temp(e.editor_id),n.destroy()}},[]),(0,a.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}o.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`),o.config.set("modePath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`),o.config.set("themePath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`),o.config.set("workerPath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`),o.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${o.version}/src-min-noconflict/`)},57181(e,t,n){n.r(t),n.d(t,{default:()=>h});var i=n(96540),o=n(85997),s=n(57952),c=n(34843),r=n(82893),l=n(78247),a=(n(62042),n(84091)),d=n(34289),f=n(34251),u=n(74848);function h(){const[e,t]=(0,c.fp)(r.AG.editorSetting),[n,h]=(0,i.useState)(!1),[m,_]=(0,c.fp)(r.AG.fileShellShow),[v,p]=(0,c.fp)(r.AG.file_shell_hidden);async function g(){e.save&&n&&(await e.save(l.xK.get_editor_value()),l.xK.set_value_temp(""),h(!1))}const x=t=>{(t.ctrlKey||t.metaKey)&&"s"===t.key&&(t.preventDefault(),e.save&&n&&g())};return(0,i.useEffect)(()=>()=>{h(!1)},[e]),(0,i.useEffect)(()=>(document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}),[n,e]),e.open&&(0,u.jsxs)("div",{id:"editor-container",children:[(0,u.jsxs)(s.A,{ignore_tags:!0,left_children:[(0,u.jsx)(o.rA,{title:"取消",icon:"close",onClick:function(){l.xK.set_value_temp(""),t({open:!1,model:"",fileName:"",save:null}),e?.close?.()}},1),(0,u.jsx)("div",{children:e.fileName},2)],children:[e.menu_list&&e.menu_list,(e.can_format||(0,f.zr)(e.fileName))&&(0,u.jsx)(o.rA,{title:"格式化",icon:"data_object",onClick:function(){l.xK.get_editor()?.formatCode()}}),e.opt_shell&&(0,u.jsx)(o.rA,{icon:"terminal",title:"shell",onClick:function(){m.show?p(!v):_({show:!0,path:(0,d.GG)("file",(0,d.vX)())})}}),n&&(0,u.jsx)(o.rA,{title:"保存",icon:"save",onClick:g}),(0,u.jsx)("title",{children:e.fileName})]}),(0,u.jsx)(a.default,{name:e.fileName,model:e.model,on_change:function(){n||h(!0)}})]})}}}]);
|