filecat 7.16.0 → 7.17.0

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.16.0",
3
+ "version": "7.17.0",
4
4
  "description": "A self-hosted Web File browser and lightweight server management tool.",
5
5
  "author": "xiaobaidadada",
6
6
  "repository": {
@@ -35,7 +35,8 @@
35
35
  "build-exe-mac-arm": "npm run exe-build && npm run build-exe-pkg filecat-mac-arm.tar.gz",
36
36
  "start": "node build/main.js",
37
37
  "test": "prebuild --upload-files-gz filecat-linux --set-version \"\" -u 11234 ",
38
- "server-debug-js2": "tsc && node build/server/main/server.js --env ./env2"
38
+ "server-debug-js2": "tsc && node build/server/main/server.js --env ./env2",
39
+ "tcp-client-build-test": "tsc && npx webpack --config shell/config/webpack.tcp-client-cli.config.js"
39
40
  },
40
41
  "optionalDependencies": {
41
42
  "@xiaobaidadada/dockerode": "^4.0.9",
@@ -0,0 +1,46 @@
1
+ /**
2
+ * 内网穿透客户端命令行工具(tcp client CLI)专用 webpack 配置。
3
+ *
4
+ * 入口是 tsc 编译后的产物(与 webpack.npm.config.js 的做法一致,项目没有 ts-loader):
5
+ * 1. npx tsc -> build/server/main/domain/net/tool_cmd_export/main.js
6
+ * 2. npx webpack --config shell/config/webpack.tcp-client-cli.config.js
7
+ * 3. 产物:build/cli/filecat-tcp-client.js
8
+ *
9
+ * 可直接用 node 运行,也可配合 pkg 打成单文件可执行程序。
10
+ */
11
+ const path = require('path');
12
+ const webpack = require('webpack');
13
+ const TerserPlugin = require("terser-webpack-plugin");
14
+ const {common_plugins, pkg_externals} = require("./base.webpack.config");
15
+
16
+ const root = path.resolve(__dirname, "..", "..");
17
+
18
+ module.exports = {
19
+ target: 'node',
20
+ mode: 'production',
21
+ entry: path.join(root, "build", "server", "main", "domain", "net", "tool_cmd_export", "main.js"),
22
+ output: {
23
+ path: path.join(root, "build", "cli"),
24
+ filename: 'filecat-tcp-client.js',
25
+ // 让 require.main === module 在打包后依然可用
26
+ libraryTarget: 'commonjs2',
27
+ },
28
+ resolve: {
29
+ extensions: ['.js', '.node']
30
+ },
31
+ // 只用 node 内置模块,第三方包一律不打包
32
+ externalsPresets: {node: true},
33
+ externals: pkg_externals,
34
+ plugins: [
35
+ new webpack.DefinePlugin(common_plugins),
36
+ ],
37
+ optimization: {
38
+ minimize: true,
39
+ minimizer: [new TerserPlugin()],
40
+ },
41
+ // 保留 __dirname 语义,运行时的路径解析交给使用者
42
+ node: {
43
+ __dirname: false,
44
+ __filename: false,
45
+ },
46
+ };
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6805],{47996(e,n,t){t.d(n,{d:()=>l});t(96540);var s=t(74848);function l(e){return(0,s.jsxs)("div",{className:"instance-item",children:[(0,s.jsxs)("div",{className:"instance-item__toolbar",children:[(0,s.jsx)("span",{className:"instance-item__label",children:e.title}),e.toolbar]}),e.children]})}},77481(e,n,t){t.d(n,{S:()=>a,X:()=>r});var s=t(96540),l=t(61443),i=t(74848);function r(e){const[n,t]=s.useState([]),r=(0,s.useRef)(-1),[a,c]=(0,s.useState)(-1),[o,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,c(-1),d(-1)};return(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.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,i.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,i.jsx)(l.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:r}):n},t)})})}),(0,i.jsx)("tbody",{children:n.map((n,t)=>{const s=!!e.onRowDrag;return(0,i.jsx)("tr",{className:s?(a===t?"row-dragging":"")+(o===t?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},onDragStart:e=>{s&&(r.current=t,c(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=o;_(),n<0||t<0||n===t||e.onRowDrag?.(n,t)})())},onDragEnd:_,children:n.map((t,s)=>{const l=s===n.length-1?"small":"";return(0,i.jsx)("td",{className:l,style:{width:e.width??"auto"},children:t},s)})},t)})})]})}function a(e){return(0,i.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,n)=>(0,i.jsx)("div",{children:e},n))})}},36805(e,n,t){t.r(n),t.d(n,{default:()=>K});var s=t(96540),l=t(75725),i=t(22022),r=t(70447),a=t(85997),c=t(77481),o=t(61443),d=t(14284),_=t(53459),h=t(7523),x=t(34843),u=t(82893),p=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,i.Bd)(),{initUserInfo:t,reloadUserInfo:C}=(0,s.useContext)(h.F),[b,k]=(0,x.fp)(u.AG.user_base_info),[I,A]=(0,s.useState)([]),[P,$]=(0,x.fp)(u.AG.prompt_card),N=(0,w.K)(),[F,K]=(0,s.useState)(),[B,U]=(0,s.useState)(void 0),[D,E]=(0,s.useState)(null),[G,V]=(0,s.useState)([]),[q,M]=(0,s.useState)([]),X=[e("序号"),e("名称"),e("在线状态"),e("时间"),e("备注")],Z=[e("序号"),e("服务端口"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],z=[e("序号"),e("服务端口"),e("fwd_nm"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],T=e=>null==e?"":(0,v.s)(e),H=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)}},O=async e=>{const n=void 0===e?D:e,t=await d.s9.get("server_client_get");if(t.code===_.m.Success){const e=t.data,s=[],l=[];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),l.push({label:t.client_name,value:t.client_num_id}),S[t.client_num_id]=t);A(s),V(l)}};(0,s.useEffect)(()=>{j.ws.addMsg(m.HK.tcp_forward_server_load,e=>{O()}),O()},[]);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)(l.fI,{children:[(0,y.jsx)(l.VP,{widthPer:50,children:(0,y.jsx)(l.xh,{children:(0,y.jsx)(r.uF,{self_title:(0,y.jsx)("span",{className:" div-row ",children:(0,y.jsx)("h2",{children:e("客户端列表")})}),rightTopCom:(0,y.jsx)(o.Sm,{placeholder:e("过滤"),value:B,handleInputChange:e=>{U(e)},handlerEnter:()=>{O()}}),children:(0,y.jsx)(c.X,{headers:X,filter:{title:e("在线状态"),column:2,value:D,options:[{label:e("全部"),value:null},{label:e("在线"),value:!0},{label:e("离线"),value:!1}],onChange:e=>{E(e),O(e)}},rows:I.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:T(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)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>{K({...n}),H(n.client_num_id)}}),(0,y.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>{$({open:!0,title:"share file",confirm:async()=>{$({open:!1}),await(async e=>{(await d.s9.post("server_client_del",{client_num_id:e})).code===_.m.Success&&((0,p.SK)("成功"),O())})(n.client_num_id)},context_div:(0,y.jsx)("div",{className:"card-content",children:e("确定删除这个吗客户端吗?")})})}})]})]),width:"10rem"})})})}),(0,y.jsx)(l.VP,{widthPer:50,children:F?(0,y.jsxs)(l.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)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.s9.post("server_client_save",F)).code===_.m.Success&&(0,p.SK)("成功")}})}),children:[(0,y.jsx)(l.Yh,{left:e("远程地址"),center:F?.client_remote_address??""}),(0,y.jsx)(l.Yh,{left:e(F?.status?"在线时间":"离线时间"),center:T(F?.status?F?.online_start_time:F?.offline_time)}),(0,y.jsx)(o.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)(c.S,{isFlex:!0,columns:[(0,y.jsx)(o.U6,{value:1,context:e("开启"),selected:F.open_filecat,onchange:()=>{F.open_filecat=!F.open_filecat,K({...F})}}),(0,y.jsx)(o.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)(c.S,{isFlex:!0,columns:[(0,y.jsx)(o.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)(o.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)(o.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)(a.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,p.SK)(e)}})]}),(0,y.jsx)(o.Sm,{placeholder:"备注",value:F.note,handleInputChange:e=>{F.note=e,K({...F})}}),(0,y.jsx)(a.rA,{icon:"add",onClick:()=>{F.proxy_fig_list.push({open:!1}),K({...F})},title:e("添加")}),e("代理"),(0,y.jsx)(c.X,{headers:Z,rows:F.proxy_fig_list.map((n,t)=>[(0,y.jsx)("p",{children:t}),(0,y.jsx)(o.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,y.jsx)(o.Sm,{value:n.proxy_host,handleInputChange:e=>{n.proxy_host=e},no_border:!0}),(0,y.jsx)(o.Sm,{value:n.proxy_port,handleInputChange:e=>{n.proxy_port=parseInt(e)},no_border:!0}),(0,y.jsx)(o.l6,{value:!!n.open,onChange:e=>{n.open=e,K({...F})},options:N,no_border:!0}),(0,y.jsx)(o.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,y.jsx)("div",{children:(0,y.jsx)(a.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)(a.rA,{icon:"add",onClick:()=>{q.push({open:!1,server_client_num_id:F.client_num_id}),M([...q])},title:e("添加")}),e("代理"),(0,y.jsx)(c.X,{headers:z,rows:q.map((n,t)=>[(0,y.jsx)("p",{children:t}),(0,y.jsx)(o.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,y.jsx)(o.Sm,{value:n.client_name,options:G,handleInputChange:e=>{const t=(e=>G.find(n=>String(n.value)===String(e)))(e);n.client_num_id=parseInt(String(t.value)),n.client_name=t.label,M([...q])},no_border:!0}),(0,y.jsx)(o.Sm,{value:n.client_proxy_host,handleInputChange:e=>{n.client_proxy_host=e},no_border:!0}),(0,y.jsx)(o.Sm,{value:n.client_proxy_port,handleInputChange:e=>{n.client_proxy_port=parseInt(e)},no_border:!0}),(0,y.jsx)(o.l6,{value:!!n.open,onChange:e=>{n.open=e,M([...q])},options:N,no_border:!0}),(0,y.jsx)(o.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,y.jsxs)("div",{children:[(0,y.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:async()=>{if(null==n.id){const e=[];for(let n=0;n<(q.length??0);n++)n!==t&&e.push(q[n]);M([...e])}else await(async(e,n)=>{(await d.s9.post("server_bridge_del_fig",{id:e})).code===_.m.Success&&((0,p.SK)("成功"),H(n))})(n.id,n.server_client_num_id)}}),null==n.id?(0,y.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,p.zN)("未选择转发送 client");(await d.s9.post("server_bridge_add_fig",e)).code===_.m.Success&&((0,p.SK)("成功"),H(e.server_client_num_id))})(n)}}):(0,y.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,p.zN)("未选择转发送 client");(await d.s9.post("server_bridge_edit_fig",e)).code===_.m.Success&&((0,p.SK)("成功"),H(e.server_client_num_id))})(n)}})]})]),width:"10rem"})]})]}):(0,y.jsx)(l.xh,{})})]})]})}var b=t(18840),k=t(7463);function I(e){const{t:n}=(0,i.Bd)(),[t,h]=(0,s.useState)([]),[x,u]=(0,s.useState)([]),[v,f]=(0,s.useState)([]),[g,S]=(0,s.useState)([]),C=[n("序号"),n("服务端口"),n("转发客户端名称")],I=[n("序号"),n("原客户端"),n("目标客户端"),n("待同步文件数量")],A=[n("序号"),n("port"),n("host"),n("名称"),n("key"),n("在线"),n("开启"),n("备注")],P=(0,w.K)(),$=async()=>{const e=await d.s9.get("client_get");if(e.code===_.m.Success){const n=e.data;h(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)(()=>($(),j.ws.sendData(m.HK.tcp_proxy_client_status,{}).then(()=>{const e=(0,k.sg)(()=>$(),500);j.ws.addMsg(m.HK.tcp_proxy_client_status,e)}),()=>{j.ws.removeMsg(m.HK.tcp_proxy_client_status)}),[]);const N=async e=>{const n=new b.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,p.SK)("保存成功"):(0,p.zN)("网络错误")};return(0,y.jsxs)("div",{children:[(0,y.jsxs)(l.fI,{children:[(0,y.jsx)(l.VP,{widthPer:33,children:(0,y.jsxs)(r.Zp,{title:"",rightBottomCom:(0,y.jsx)(a.C3,{text:n("保存"),clickFun:()=>{t[0].index=0,N(t[0])}}),rightTopCom:(0,y.jsxs)("div",{children:[n("连接状态"),(0,y.jsx)(r.fq,{ok:!!t[0]?.status})]}),children:[(0,y.jsx)(o.Sm,{placeholder:`${n("服务器")} ip`,value:t[0]?.serverIp,handleInputChange:e=>{t[0].serverIp=e}}),(0,y.jsx)(o.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)(o.Sm,{placeholder:n("名称"),value:t[0]?.client_name,handleInputChange:e=>{t[0].client_name=e}}),(0,y.jsx)(o.Sm,{type:"password",placeholder:"key ",value:t[0]?.key,handleInputChange:e=>{t[0].key=e}}),(0,y.jsxs)("form",{children:[n("状态"),(0,y.jsx)(c.S,{isFlex:!0,columns:[(0,y.jsx)(o.U6,{value:1,context:n("开启"),selected:t[0]?.open,onchange:()=>{t[0].open=!t[0].open,h([...t])}}),(0,y.jsx)(o.U6,{value:1,context:n("关闭"),selected:!t[0]?.open,onchange:()=>{t[0].open=!t[0].open,h([...t])}})]})]})]})}),(0,y.jsx)(l.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)(a.rA,{icon:"add",onClick:()=>{t.push({open:!1,is_new:!0}),h([...t])},title:n("添加")}),n("代理"),(0,y.jsx)(c.X,{headers:A,rows:t.slice(1).map((e,s)=>[(0,y.jsx)("p",{children:s}),(0,y.jsx)(o.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)(o.Sm,{value:e.serverIp,handleInputChange:n=>{e.serverIp=n},no_border:!0}),(0,y.jsx)(o.Sm,{value:e.client_name,handleInputChange:n=>{e.client_name=n},no_border:!0}),(0,y.jsx)(o.Sm,{value:e.key,handleInputChange:n=>{e.key=n},no_border:!0}),(0,y.jsx)(r.fq,{ok:!!e.status}),(0,y.jsx)(o.l6,{value:!!e.open,onChange:n=>{e.open=n,h([...t])},options:P,no_border:!0}),(0,y.jsx)(o.Sm,{value:e.note,handleInputChange:n=>{e.note=n},no_border:!0}),(0,y.jsxs)("div",{children:[(0,y.jsx)(a.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]);h([...e])}else await(async e=>{(await d.s9.post("client_del",{index:e})).code===_.m.Success?((0,p.SK)("保存成功"),$()):(0,p.zN)("网络错误")})(s+1)}}),e.is_new?(0,y.jsx)(a.rA,{icon:"add",title:n("添加"),onClick:async()=>{e.index=s+1,await N(e)}}):(0,y.jsx)(a.rA,{icon:"save",title:n("保存"),onClick:async()=>{e.index=s+1,await N(e)}})]})]),width:"10rem"})]})})]}),(0,y.jsxs)(l.fI,{children:[!!v?.length&&(0,y.jsx)(l.VP,{widthPer:40,children:(0,y.jsx)(r.Zp,{title:n("br_port"),children:(0,y.jsx)(c.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)(l.VP,{widthPer:40,children:(0,y.jsx)(r.Zp,{title:n("文件同步列表"),children:(0,y.jsx)(c.X,{headers:I,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,i.Bd)(),{initUserInfo:t,reloadUserInfo:v}=(0,s.useContext)(h.F),[f,g]=(0,x.fp)(u.AG.user_base_info),[w,S]=(0,x.fp)(u.AG.prompt_card),[C,k]=(0,s.useState)(!1),[I,A]=(0,s.useState)([]),[P,$]=(0,s.useState)(null),[N,F]=(0,s.useState)([]),[K,B]=(0,s.useState)(void 0),[U,D]=(0,s.useState)(void 0),E=(0,s.useMemo)(()=>{const e=[...I];return null!=P?(e.sort((e,n)=>P?e.server_port-n.server_port:n.server_port-e.server_port),e):e},[I,P]),G=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),k(!!e.data.open),F(e.data.option_keys??[])),G()};(0,s.useEffect)(()=>{j.ws.addMsg(m.HK.tcp_forward_server_load,e=>{V()}),V()},[]);const q=async e=>{const n=new b.I;n.port=K,n.open=C,n.option_keys=N;(await d.s9.post("server_save",{fig:n,notice_client:e})).code===_.m.Success&&(0,p.SK)("成功")};return(0,y.jsxs)(l.fI,{children:[(0,y.jsx)(l.VP,{widthPer:33,children:(0,y.jsx)(l.xh,{children:(0,y.jsxs)(r.Zp,{title:e("服务器配置"),rightBottomCom:(0,y.jsxs)("div",{children:[(0,y.jsx)(a.C3,{text:e("sv_ntf"),clickFun:()=>{q(!0)}}),(0,y.jsx)(a.C3,{text:e("保存"),clickFun:()=>{q(!1)}})]}),children:[(0,y.jsx)(o.Sm,{placeholder:"port",value:K,handleInputChange:e=>{B(e)}}),(0,y.jsxs)("label",{children:[(0,y.jsx)(a.rA,{icon:"add",onClick:()=>{F([...N,""])},title:e("添加")}),e("key")]}),(N??[]).map((n,t)=>(0,y.jsxs)("div",{style:{display:"flex"},children:[(0,y.jsx)("div",{style:{width:"90%"},children:(0,y.jsx)(o.Sm,{type:"password",value:n,handleInputChange:e=>{N[t]=e,F([...N])}})}),(0,y.jsx)(a.rA,{icon:"delete",onClick:()=>{N.splice(t,1),F([...N])},title:e("删除")})]},t)),(0,y.jsxs)("form",{children:[e("状态"),":",(0,y.jsx)(c.S,{isFlex:!0,columns:[(0,y.jsx)(o.U6,{value:1,context:e("开启"),selected:C,onchange:()=>{k(!C)}}),(0,y.jsx)(o.U6,{value:1,context:e("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]})]})})}),(0,y.jsx)(l.VP,{widthPer:50,children:(0,y.jsx)(l.xh,{children:(0,y.jsx)(r.uF,{self_title:(0,y.jsx)("span",{className:" div-row ",children:(0,y.jsx)("h2",{children:e("服务器")+e("端口映射")})}),rightTopCom:(0,y.jsx)(o.Sm,{placeholder:e("过滤"),value:U,handleInputChange:e=>{D(e)},handlerEnter:()=>{G()}}),children:(0,y.jsx)(c.X,{headers:[e("序号"),(0,y.jsx)(a.rA,{title:e("服务端口"),onClick:()=>{$(e=>!e)}}),e("转发ip"),e("转发端口"),"client "+e("名称"),e("开启"),e("备注")],rows:E.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(47996),$=t(78247);function N(){const{t:e,i18n:n}=(0,i.Bd)(),{initUserInfo:t,reloadUserInfo:j}=(0,s.useContext)(h.F),[m,v]=(0,x.fp)(u.AG.user_base_info),[f,g]=(0,x.fp)(u.AG.prompt_card),[,w]=(0,x.fp)(u.AG.confirm),[S,C]=(0,x.fp)(u.AG.editorSetting),[k,I]=(0,s.useState)([]),[A,N]=(0,s.useState)([]),F=[e("编号"),e("原客户端"),e("开启"),e("备注"),e("操作")],[K,B]=(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({label:e.client_name,value:e.client_num_id});N(t),await U()}})()},[]);const U=async()=>{const e=await d.s9.get("sync_task_get");e.code===_.m.Success&&I(e.data)},D=e=>A.find(n=>String(n.value)===String(e))?.label??"",E=e=>A.find(n=>String(n.value)===String(e)),G=(e,n,t)=>{K?.targets&&(K.targets[e]={...K.targets[e],[n]:t},B({...K,targets:[...K.targets]}))},V=async e=>{(await d.s9.post("sync_task_save",e)).code===_.m.Success&&await U()};return(0,y.jsxs)(l.fI,{children:[(0,y.jsx)(l.VP,{widthPer:50,maxWidth:"40rem",children:(0,y.jsx)(l.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)(a.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("信息")})]}),rightTopCom:(0,y.jsx)("div",{children:(0,y.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{B({open:!1,source_client_num_id:void 0,source_dir:"",targets:[],delete_missing:!0,is_new:!0})}})}),children:(0,y.jsx)(c.X,{headers:F,rows:k.map((n,t)=>[(0,y.jsx)("p",{children: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)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{B(JSON.parse(JSON.stringify(e)))})(n)}),(0,y.jsx)(a.rA,{icon:"sync",title:e("立即同步"),onClick:()=>(async n=>{if(!n.id||!n.open)return void(0,p.zN)(e("tsk_off"));const t=await d.s9.post("sync_task_rescan",{id:n.id});t.code===_.m.Success?(0,p.SK)(e("已触发同步")):(0,p.zN)(t.message??e("操作失败"))})(n)}),(0,y.jsx)(a.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,p.SK)(e("成功")),K?.id===n&&B(null),await U())})(n.id),w({open:!1,handle:null})}})}})]})]),width:"10rem"})})})}),(0,y.jsx)(l.VP,{widthPer:50,children:K&&(0,y.jsx)(l.xh,{children:(0,y.jsxs)(r.Zp,{self_title:(0,y.jsx)("span",{className:" div-row ",children:(0,y.jsx)("h2",{children:e(""+(K.is_new?"添加":"编辑"))})}),rightBottomCom:(0,y.jsxs)("div",{children:[(0,y.jsx)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>B(null)}),(0,y.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(!K)return;const n=K,t=await d.s9.post("sync_task_save",n);t.code===_.m.Success?((0,p.SK)(e("成功")),B(null),await U()):(0,p.zN)(t.message??e("操作失败"))}})]}),children:[(0,y.jsx)(o.BC,{label:e("开启"),label_width:"6rem",children:(0,y.jsx)(o.GL,{selected:!!K.open,onchange:()=>{B({...K,open:!K.open})}})}),(0,y.jsx)(o.BC,{label:e("备注"),label_width:"6rem",children:(0,y.jsx)(o.Sm,{value:K.note,handleInputChange:e=>{B({...K,note:e})}})}),(0,y.jsx)(o.BC,{label:e("原客户端"),label_width:"6rem",required:!0,children:(0,y.jsx)(o.Sm,{value:D(K.source_client_num_id),options:A,handleInputChange:e=>{const n=E(e);n&&B({...K,source_client_num_id:parseInt(String(n.value))})}})}),(0,y.jsx)(o.BC,{label:e("原目录"),label_width:"6rem",required:!0,children:(0,y.jsx)(o.Sm,{value:K.source_dir,placeholder:e("被同步的源目录"),handleInputChange:e=>{B({...K,source_dir:e})}})}),(0,y.jsx)("label",{children:e("目标列表")}),(K.targets??[]).map((n,t)=>(0,y.jsxs)(P.d,{title:`${e("目标")}${t+1}`,toolbar:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(o.BC,{label:e("全量同步"),label_width:"6rem",children:(0,y.jsx)(o.GL,{selected:!!n.full_sync,onchange:()=>G(t,"full_sync",!n.full_sync)})}),(0,y.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{if(!K?.targets)return;const n=[...K.targets];n.splice(e,1),B({...K,targets:n})})(t)})]}),children:[(0,y.jsx)(o.BC,{label:e("客户端"),label_width:"6rem",required:!0,children:(0,y.jsx)(o.Sm,{value:D(n.client_num_id),options:A,handleInputChange:e=>{const n=E(e);n&&G(t,"client_num_id",parseInt(String(n.value)))}})}),(0,y.jsx)(o.BC,{label:e("目标目录"),label_width:"6rem",required:!0,children:(0,y.jsx)(o.Sm,{value:n.dir,handleInputChange:e=>G(t,"dir",e)})})]},t)),(0,y.jsxs)("div",{className:"div-row",children:[(0,y.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{if(!K)return;const e=[...K.targets??[],{client_num_id:void 0,dir:"",full_sync:!1}];B({...K,targets:e})}}),(0,y.jsx)(a.rA,{icon:"edit",title:e("忽略目录"),onClick:()=>{var e;e=K,$.xK.set_value_temp(e.ignore_text??b.mo),C({model:"ace/mode/gitignore",open:!0,fileName:"",save:async n=>{e.ignore_text=n,B({...e}),$.xK.set_value_temp(""),await V(e)}})}})]})]})})})]})}var F=t(87361);function K(){const{t:e}=(0,i.Bd)(),n=[{index:1,name:e("客户端"),rto:"tcp_proxy_client/",component:(0,y.jsx)(I,{})},{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)(l.W1,{optionList:n,father_route:F.o.net_proxy})}},6960(e,n,t){t.d(n,{s:()=>r});var s=t(72635);const l=1440,i=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<l?`${(t/60).toFixed(0)} ${s.Ay.t("小时前")}`:t<43200?`${(t/l).toFixed(0)} ${s.Ay.t("天前")}`:t<i?`${(t/43200).toFixed(0)} ${s.Ay.t("月前")}`:`${(t/i).toFixed(0)} ${s.Ay.t("年前")}`}},24659(e,n,t){t.d(n,{K:()=>l});var s=t(22022);const l=()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9299],{47374(e,t,i){i.d(t,{e:()=>p});var n=i(96540),s=i(52671),o=i(64694),a=i(34289),l=i(61443),r=i(75725),c=i(22022),d=i(85997),_=i(74848);function p(e){let t=(0,s.zy)();const[i,p]=(0,n.useState)([]),[f,h]=(0,n.useState)("/"),[u,m]=(0,n.useState)(void 0),{t:w,i18n:v}=(0,c.Bd)();n.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const n=i.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(i.slice(0,n),e.baseRoute);const a=i.slice(n+1);for(let e=0;e<a.length;e++){const i=a[e];s.push({value:i,href:0===e?`${t}${i}/`:(0,o.IO)(s[e-1].href,i)})}h(t),p(s)}},[t]);const g=t=>{t.stopPropagation(),e.clickFun(t)};return(0,_.jsx)("div",{className:"breadcrumbs",onClick:e=>{m(void 0!==u?void 0:"")},children:(0,_.jsx)(n.Fragment,{children:void 0===u?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:f,onClick:g,children:(0,_.jsx)(d.In,{icon:"home"})})}),i.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,onClick:g,children:decodeURIComponent(e.value)})]},t))]}):(0,_.jsx)(r.QM,{click:()=>{m(void 0)},children:(0,_.jsx)(l.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),m(void 0)}})})})})}},77481(e,t,i){i.d(t,{S:()=>l,X:()=>a});var n=i(96540),s=i(61443),o=i(74848);function a(e){const[t,i]=n.useState([]),a=(0,n.useRef)(-1),[l,r]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?i(Array.isArray(e.children)?e.children:[e.children]):i(e.rows)},[e.rows,e.children]);const _=()=>{a.current=-1,r(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,i)=>{const n=!!e.filter&&(e.filter.column??0)===i;let a=t;if(n){const i=e.filter,n=i.options.find(e=>e.value===i.value);null!=i.value&&n&&(a=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},i)})})}),(0,o.jsx)("tbody",{children:t.map((t,i)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(l===i?"row-dragging":"")+(c===i?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(a.current=i,r(i),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(i))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=a.current,i=c;_(),t<0||i<0||t===i||e.onRowDrag?.(t,i)})())},onDragEnd:_,children:t.map((i,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:i},n)})},i)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},19299(e,t,i){i.r(t),i.d(t,{default:()=>q});var n=i(96540),s=i(47374),o=i(34843),a=i(82893),l=i(14284),r=i(52671),c=i(4412),d=i(89824),_=i(34289),p=i(53459),f=i(99214),h=i(61443),u=i(47022),m=i(62042),w=i(22022),v=i(7523),g=i(78247),x=i(88815),y=i(6960),j=i(47071),k=i(14944),G=i(92275),A=i(23430);var b=i(34251),C=i(60096),S=i(87361),M=i(97952),$=i(85997),z=i(77481),D=i(70447),N=i(74848);const P=500;function E(e){const{t}=(0,w.Bd)(),i=(0,r.Zp)(),[,s]=(0,o.fp)(a.AG.prompt_card),[l,c]=(0,n.useState)(""),[d,_]=(0,n.useState)(!1),[p,f]=(0,n.useState)([]),[u,m]=(0,n.useState)(0),[v,g]=(0,n.useState)(!1),x=(0,n.useMemo)(()=>new M.I(window.location.host,"file_deep_search"),[]),y=(0,n.useRef)(!1),j=decodeURIComponent(e.base_path);(0,n.useEffect)(()=>{let e=[],t=null;const i=()=>{if(t=null,y.current||!e.length)return;const i=e;e=[],m(e=>e+i.length),f(e=>e.length>=P?e:[...e,...i].slice(0,P))},n=()=>{y.current||_(!1)};return x.addMsg(G.HK.file_deep_search_data,n=>{y.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(i,100)))}),x.addMsg(G.HK.file_deep_search_end,()=>{y.current||(i(),_(!1))}),x.on_message("close",n),()=>{y.current=!0,clearTimeout(t),x.sendData(G.HK.file_deep_search_cancel,{}).catch(()=>{}),x.off_message("close",n),x.close()}},[]);const k=()=>{const t=l.trim();if(!t||d)return;f([]),m(0),g(!0),_(!0);const i={param_path:e.base_path,keyword:t};x.sendData(G.HK.file_deep_search,i).catch(()=>{})},A=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),s({open:!1}),i(S.o.file+t.split("/").map(encodeURIComponent).join("/"))};return(0,N.jsxs)("div",{className:"file-deep-search",children:[(0,N.jsxs)("div",{className:"file-deep-search__bar",children:[(0,N.jsx)(h.$Z,{icon:"search",value:l,placeholder:t("搜文件名"),handleInputChange:e=>c(e),handleEnterPress:k}),(0,N.jsx)("button",{className:"button button--flat",onClick:d?()=>{x.sendData(G.HK.file_deep_search_cancel,{}).catch(()=>{}),_(!1)}:k,children:t(d?"取消":"搜索")})]}),(0,N.jsxs)("div",{className:"file-deep-search__hint",children:[(0,N.jsxs)("span",{children:[t("范围"),":",j]}),u>0&&(0,N.jsx)("span",{className:"file-deep-search__count",children:u>P?`${t("已显示")} 500 / ${u}`:`${u}`})]}),(0,N.jsxs)("div",{className:"file-deep-search__body",children:[p.length>0&&(0,N.jsx)(z.X,{headers:[t("名称"),t("路径"),""],rows:p.map(e=>{const i=e.path.slice(0,e.path.lastIndexOf("/")+1);return[e.is_dir?(0,N.jsx)("span",{className:"file-deep-search__dir",children:e.name}):e.name,(0,N.jsx)(D.xP,{context:i}),(0,N.jsx)($.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>A(e)})]})}),d&&(0,N.jsxs)("div",{className:"file-deep-search__empty",children:[(0,N.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!d&&u>P&&(0,N.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!d&&0===p.length&&(0,N.jsx)("div",{className:"file-deep-search__empty",children:t(v?"无匹配":"输入后搜")})]})]})}var F=i(23496),I=i(12730),X=i(75725),R=i(40505);let K={};function H(){const{t:e}=(0,w.Bd)();let t=(0,r.zy)();const i=(0,r.Zp)(),{check_user_auth:s}=(0,g.MH)(),[c,p]=(0,o.fp)(a.AG.nowFileList),[h,x]=(0,o.fp)(a.AG.uploadFiles),[y,j]=(0,o.fp)(a.AG.showPrompt),[C,M]=(0,o.fp)(a.AG.selectedFileList),[z,P]=(0,o.fp)(a.AG.copyedFileList),[E,F]=(0,o.fp)(a.AG.cutedFileList),[R,H]=(0,o.fp)(a.AG.selectedFileList),[L,U]=(0,o.fp)(a.AG.clickFileList),[Y,B]=(0,o.fp)(a.AG.fileShellShow),[O]=(0,o.fp)(a.AG.current_mount),[Z,W]=(0,o.fp)(a.AG.file_root_list),[T,V]=(0,o.fp)(a.AG.file_root_index),[q,J]=(0,n.useState)(void 0),[Q,ee]=(0,n.useState)(""),[te,ie]=(0,o.fp)(a.AG.workflow_show),[ne,se]=(0,o.fp)(a.AG.workflow_realtime_show),[oe,ae]=(0,o.fp)(a.AG.work_flow_show),{initUserInfo:le}=(0,n.useContext)(v.F),[re,ce]=(0,o.fp)(a.AG.user_base_info),{click_file:de}=(0,f.kZ)(),[_e,pe]=(0,o.fp)(a.AG.prompt_card),fe=(0,n.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type!==u.Iw.folder?1:0),0),[c]),he=(0,n.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type===u.Iw.folder?1:0),0)+(c.folders?.length??0),[c]);function ue(e){(0,m.SK)(e)}(0,n.useEffect)(()=>{K={}},[t]),(0,n.useEffect)(()=>()=>{B({show:!1,path:""})},[]);const me=(0,f.Vs)(),we=t=>{pe({open:!0,title:e("信息"),context_div:(0,N.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,N.jsx)(X.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,N.jsx)(X.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,N.jsx)(X.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,N.jsx)(X.Yh,{left:`${e("文件夹数")}`,right:he}),(0,N.jsx)(X.Yh,{left:`${e("文件数")}`,right:fe}),(0,N.jsx)(X.Yh,{left:`${e("当前位置")}`,right:(0,N.jsx)(D.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{k.ws.removeMsg(G.HK.file_info)}})};return(0,N.jsxs)(n.Fragment,{children:[C.length>0&&(0,N.jsx)($.rA,{icon:"delete",title:e("删除"),onClick:()=>{j({show:!0,type:d.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),C.length>0&&(0,N.jsx)($.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,f.ib)(c,C);P(e.map(e=>(0,f.Ok)(e.name))),F([]),ue("已复制")}}),C.length>0&&(0,N.jsx)($.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,f.ib)(c,C);F(e.map(e=>(0,f.Ok)(e.name))),P([]),ue("已剪切")}}),(z.length>0||E.length>0)&&(0,N.jsx)($.rA,{onClick:function(){j({show:!0,type:d.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:z.length+E.length}),C.length>0&&(0,N.jsx)($.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,f.ib)(c,C);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,f.Ok)(i.name))}const t=l.$M.getDownloadUrl(e);window.open(t)}}),C.length>0&&(0,N.jsx)($.rA,{icon:"compress",title:e("压缩"),onClick:function(){const e=(0,f.ib)(c,C);for(let t=0;t<e.length;t++){const i=e[t];e[t]=(0,f.Ok)(i.name)}e&&0!==e.length?j({show:!0,type:d.PromptEnum.Compress,overlay:!0,data:{files:e}}):(0,m.zN)("没有选中")}}),1===C.length&&(0,N.jsx)($.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){j({show:!0,type:d.PromptEnum.FileRename,overlay:!0,data:{}})}}),oe&&(0,N.jsx)($.rA,{icon:"api",title:"workflow",onClick:()=>{ie(!te)}}),!O&&(0,N.jsx)($.rA,{icon:"terminal",title:"shell",onClick:function(){Y.show?B({show:!1,path:""}):B({show:!0,path:(0,_.GG)("file",(0,_.vX)())})}}),s(A.oV.share_file)&&(0,N.jsx)($.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`${S.o.share_list_setting_page}`)}}),(0,N.jsx)($.rA,{icon:"grid_view",title:e("切换样式"),onClick:me}),(0,N.jsx)($.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){j({show:!0,type:d.PromptEnum.DirNew,overlay:!0,data:{dir:(0,_.GG)("file",(0,_.vX)())}})}}),(0,N.jsx)($.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){j({show:!0,type:d.PromptEnum.FileNew,overlay:!0,data:{dir:(0,_.GG)("file",(0,_.vX)())}})}}),(0,N.jsx)($.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{j({show:!0,type:d.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],a=i?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=a,i&&s.add((0,I.S)(a)),n.push(o)}const o=[];if(i)for(const e of s)o.push({isDir:!0,fullPath:e,name:e});o.push(...n),x(o),j({show:!0,type:d.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,N.jsx)($.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!K.now_absolute_path){k.ws.addMsg(G.HK.file_info,t=>{const i=t.context;e&&(K={...K,...i},k.ws.removeMsg(G.HK.file_info),we(K))});const t=await k.ws.sendData(G.HK.file_info,{type:u.Iw.folder,path:(0,_.GG)("file",(0,_.vX)())});e=t.context,K=e,we(K)}we(K)}}),(0,N.jsx)($.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new b.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory,n.items=Z,n.item_pre_value=T,n.textClick=async t=>{if(-1===t)return i(`${S.o.setting_private_env_setting}`),j({data:void 0,overlay:!1,type:"",show:!1}),void(0,m.N9)(e("请配置 文件夹路径"));(async e=>{V(e),await l.$M.post("base_switch",{root_index:e}),await le(),i("/file/"),H([]),U([])})(t),j({data:void 0,overlay:!1,type:"",show:!1})},j({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var L=i(2543),U=i(21499),Y=i(64694),B=i(17903);const O=n.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(i.bind(i,63659))),Z=n.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(i.bind(i,81636))),W=n.lazy(()=>Promise.all([i.e(4946),i.e(2626),i.e(892),i.e(9334),i.e(6104)]).then(i.bind(i,69857)));let T,V="";function q(){const[e,t]=(0,o.fp)(a.AG.editorSetting),[,i]=(0,o.fp)(a.AG.md_editor),[,m]=(0,o.fp)(a.AG.log_viewer),[,M]=(0,o.fp)(a.AG.image_editor),[,z]=(0,o.fp)(a.AG.markdown),[,D]=(0,o.fp)(a.AG.excalidraw_editor),[,P]=(0,o.fp)(a.AG.mind_editor),[,I]=(0,o.fp)(a.AG.timeline_editor),[,X]=(0,o.fp)(a.AG.excel_editor),[K,q]=(0,o.fp)(a.AG.file_preview),{t:J}=(0,w.Bd)();let Q=(0,r.zy)();const ee=(0,r.Zp)(),[te,ie]=(0,o.fp)(a.AG.nowFileList),[ne]=(0,o.fp)(a.AG.file_list_refresh),[se]=(0,o.fp)(a.AG.mount_enabled),[oe,ae]=(0,o.fp)(a.AG.current_mount),[le,re]=(0,o.fp)(a.AG.showPrompt),[ce,de]=(0,o.fp)(a.AG.selectedFileList),[_e,pe]=(0,o.fp)(a.AG.clickFileList),[fe,he]=(0,o.fp)(a.AG.fileShellShow),[ue,me]=(0,n.useState)(""),[we,ve]=(0,o.fp)(a.AG.workflow_show),[ge,xe]=(0,o.fp)(a.AG.workflow_realtime_show),[ye,je]=(0,o.fp)(a.AG.work_flow_show),{initUserInfo:ke}=(0,n.useContext)(v.F),[Ge,Ae]=(0,o.fp)(a.AG.user_base_info),{check_user_auth:be}=(0,g.MH)(),{click_file:Ce}=(0,f.kZ)(),[Se]=(0,r.ok)(),Me=(0,f._A)(),$e=n.useRef(null),[ze,De]=(0,o.fp)(a.AG.to_running_files),[Ne,Pe]=(0,o.fp)(a.AG.file_page),[Ee]=(0,o.fp)(a.AG.blank_search_mode),[,Fe]=(0,o.fp)(a.AG.prompt_card),[Ie,Xe]=(0,o.fp)(a.AG.blank_search_mode_for_temp),Re=(0,f.oT)(),Ke="1"===Se.get("chat_open"),He=be(A.oV.ai_agent_page);(0,n.useEffect)(()=>{Ge?.user_data&&Ke&&!He&&Re("chat_open",null)},[Ke,He,Ge]);const[Le,Ue]=(0,o.fp)(a.AG.studio_chat_width),Ye=n.useRef(null),[Be,Oe]=(0,n.useState)(!1),[Ze,We]=(0,n.useState)(void 0),Te=(0,f.dN)(),[Ve,qe]=(0,o.fp)(a.AG.ai_chat_session_by_cwd),Je=function(){const[e,t]=(0,o.fp)(a.AG.user_base_info),{t:i}=(0,w.Bd)(),{check_user_auth:s}=(0,g.MH)(),[c,p]=(0,o.fp)(a.AG.router_jump),h=(0,r.Zp)(),{initUserInfo:m}=(0,n.useContext)(v.F),[x,y]=(0,o.fp)(a.AG.nowFileList),[j,C]=(0,o.fp)(a.AG.showPrompt),[M,$]=(0,o.fp)(a.AG.fileShellShow),[z,D]=(0,o.fp)(a.AG.blank_search_mode);return t=>{t.preventDefault(),t.stopPropagation();const n=new b.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory;const o=[{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.time_minx_max),children:i("时间逆序")}),v:A.t8.time_minx_max},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.time_max_min),children:i("时间顺序")}),v:A.t8.time_max_min}],a=[{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.size_min_max),children:i("大小顺序")}),v:A.t8.size_min_max},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.size_max_min),children:i("大小逆序")}),v:A.t8.size_max_min}],r=[{r:(0,N.jsx)("span",{style:(0,R.ok)(!e.user_data.file_list_pagination_mode||e.user_data.file_list_pagination_mode===A.yM.all),children:i("全部加载文件")}),v:A.yM.all},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.file_list_pagination_mode===A.yM.pagination),children:i("scrll_l")}),v:A.yM.pagination}],c=[{r:(0,N.jsx)("span",{style:(0,R.ok)(!e.user_data.file_time_show_type||e.user_data.file_time_show_type===A.KD.current),children:i("最近时间")}),v:A.KD.current},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.file_time_show_type===A.KD.time),children:i("准确时间")}),v:A.KD.time}],w=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,N.jsx)("span",{style:(0,R.ok)(!e.user_data.dir_show_type),children:i("系统默认")}),v:A.t8.defualt},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.name),children:i("名字")}),v:A.t8.name},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.time_minx_max||e.user_data.dir_show_type===A.t8.time_max_min),children:i("修改时间")}),v:!1,items:o},{r:(0,N.jsx)("span",{style:(0,R.ok)(e.user_data.dir_show_type===A.t8.size_min_max||e.user_data.dir_show_type===A.t8.size_max_min),children:i("文件大小")}),v:!1,items:a}]},{r:i("文件加载方式"),v:"",items:r},{r:i("时间展示"),v:"",items:c},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,N.jsx)("span",{style:(0,R.ok)(z),children:i("srchbln")}),v:"blank_search_mode"}]}];x?.folders?.find(e=>".git"===e.name)&&w.push({r:i("查看Git提交"),v:"git_page"}),s(A.oV.code_resource)&&w.push({r:i("add_rot"),v:"code_resource"}),s(A.oV.http_proxy)&&w.push({r:i("dl_here"),v:"http_resource"}),e?.user_data?.quick_cmd&&(0,f.LL)([...e.user_data.quick_cmd],w),n.items=w,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,_.GG)("file",(0,_.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${S.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,_.GG)("file",(0,_.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${S.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await k.ws.sendData(G.HK.file_info,{path:(0,_.GG)("file",(0,_.vX)())});return p({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/setting/customer_router/")}if("http_resource"===e){const e=await k.ws.sendData(G.HK.file_info,{path:(0,_.GG)("file",(0,_.vX)())});return p({http_download_map_path:e.context.now_absolute_path}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/proxy/http/")}if("zoom_adjust"===e)return C({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{C({show:!0,type:d.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",$({show:!0,path:(0,_.GG)("file",(0,_.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return D(!z),void C({data:void 0,overlay:!1,type:"",show:!1});if(e===A.yM.all||e===A.yM.pagination)t.is_pagination_mode=!0;else if(e===A.KD.current||e===A.KD.time)t.is_file_show_type=!0;else{if(e!==A.t8.defualt&&e!==A.t8.name&&e!==A.t8.size_max_min&&e!==A.t8.size_min_max&&e!==A.t8.time_max_min&&e!==A.t8.time_minx_max)return;t.is_dir_list_type=!0}}await l.wm.post(F.s.user_save_private_attr,{type:e,...t}),await m(),C({data:void 0,overlay:!1,type:"",show:!1}),h((0,_.vX)())},C({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:n})}}(),Qe=async()=>{const e=new j.Nd;e.dir_path=`${(0,_.GG)("file",(0,_.vX)())}`,k.ws.addMsg(G.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,f.Ys)(e);for(const e of t.failed_file_list)(0,f.V$)(e);De(new Set(t.running_file_list))}}),await k.ws.sendData(G.HK.workflow_realtime,e)},et=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,x.v7)(i.size),Ge.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,U.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,y.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0,Promise.resolve().then(()=>{Qe()})),i.name===j.SB&&(t=!0);for(const i of e.folders??[])Ge.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,U.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,y.s)(i.mtime):"",i.name===j.SB&&(t=!0);je(t)},tt=n.useRef(null),it=async e=>{if(!0===se){if(tt.current!==e){tt.current=e;try{const t=await l.$M.post("file/mount_info",{param_path:e});ae(t?.data??null)}catch(e){ae(null)}}}else ae(null)},nt=async()=>{const e=(0,_.GG)("file",(0,_.vX)());if(Ee||Ie)return;let t;if(it(e),Ge.user_data.file_list_pagination_mode===A.yM.pagination){if(V!==e){if(V=e,1!==Ne.page_num)return void Pe({page_size:Ne.page_size,page_num:1})}else if(Ne.page_num<0)return;if(t=await l.$M.post("file_get_page",{param_path:e,page_num:Ne.page_num,page_size:Ne.page_size}),t.code!==p.m.Success)return;const i=t.data;return et(i),i.files?.length?(ie(e=>{const t=(0,L.cloneDeep)(1===Ne.page_num?i.files:[...e?.files??[],...i.files]),n={...e,files:t};return(0,f.yC)(n,Ge.user_data.dir_show_type),n}),void(T=t.data)):void Pe({page_size:Ne.page_size,page_num:-1})}if(t=await l.$M.get(e),t.code!==p.m.Success)return;const i=t.data;(0,f.yC)(i,Ge.user_data.dir_show_type),et(t.data),ie(t.data),T=t.data};(0,n.useEffect)(()=>async()=>{De(new Set)},[]);const st=()=>{je(!1),(()=>{const e=Se.get("preview_file_name"),t=Se.get("preview_mode");if(!e||!t)return!1;const n=(0,_.GG)("file",(0,_.vX)());if($e.current===n+e)return!0;$e.current=n+e;const s=()=>Me(null);return"md"===t?(i({url:l.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:s}),!0):"log"===t?(m({show:!0,fileName:e,encoding:Se.get("preview_log_enc")??"utf8",wrap:Se.get("preview_log_wrap")??"wrap",close:s}),!0):"image_edit"===t?(M({path:(0,Y.IO)((0,_.vX)(),e),name:e,close:s}),!0):(Ce({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:s}),!0)})()||(t({open:!1}),q({open:!1}),i({}),m({show:!1}),M({}),z({}),D({}),P({}),I({}),X({}),nt())};(0,n.useEffect)(()=>{st()},[Q,Ne]),(0,n.useEffect)(()=>{ne>0&&nt()},[ne]);const ot=n.useRef(!1);(0,n.useEffect)(()=>{if(null!==se)return ot.current?void(!0===se?it((0,_.GG)("file",(0,_.vX)())):ae(null)):(ot.current=!0,void(!0===se&&null===oe&&it((0,_.GG)("file",(0,_.vX)()))))},[se]);const at=e=>{e.target===e.currentTarget&&(de([]),pe([]))},lt=n.useCallback((0,L.throttle)(e=>{const t=Ye.current;if(!t||!t.parentElement)return;const i=parseFloat(getComputedStyle(t).fontSize),n=t.parentElement.getBoundingClientRect(),s=n.right-e.clientX,o=Math.min(Math.max(s,320),.7*n.width);Ue(parseFloat((o/i).toFixed(2)))},32),[]),rt=()=>{Oe(!1),document.removeEventListener("pointermove",lt)},ct=(0,N.jsxs)("div",{className:"file-list-main",children:[(0,N.jsx)(s.e,{baseRoute:"file",clickFun:function(){if(de([]),pe([]),Ge.user_data.file_list_pagination_mode===A.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Pe({page_size:Ne.page_size,page_num:1})}},input_path_enter:e=>{var t;de([]),pe([]),ie({files:[],folders:[]}),!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?ee(function(e,t){let i=function(e){let t="\\";for(const i of e)if("/"===i||"\\"===i){t=i;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===i?1:0;for(let n=e.length-1-t;n>=0;n--)if(e[n]===i)return e.substring(0,n+1)}return e}return e.endsWith(i)&&t.startsWith(i)?e.slice(0,-1)+t:e.endsWith(i)||t.startsWith(i)?e+t:e+i+t}((0,_.vX)(),e)):(e=e.replace(0===(t=Ge.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),ee(e))}}),oe&&(0,N.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:oe.color},children:[(0,N.jsx)("span",{className:"material-icons",style:{color:oe.color},children:"cloud"}),(0,N.jsx)("span",{children:[oe.credential_note,oe.account_note||(B.C1.find(e=>e.value===oe.driver)?.title??oe.driver),oe.name].filter(Boolean).join(" - ")}),oe.readonly&&(0,N.jsx)("span",{className:"mount-readonly-tag",children:J("只读")})]}),Ge.user_data.file_list_pagination_mode===A.yM.pagination?(0,N.jsx)(C.$J,{handleContextMenu:Je,clickBlank:at,list:te.files}):(0,N.jsx)(C.t$,{handleContextMenu:Je,file_list:te.files,folder_list:te.folders,clickBlank:at})]});return(0,N.jsxs)(n.Fragment,{children:[(0,N.jsx)(c.aZ,{children:(0,N.jsx)(h.$Z,{handleEnterPress:async()=>{if(Ee||Ie){if(de([]),pe([]),!ue||!ue.trim())return void ie({files:[],folders:[]});const e=(0,_.GG)("file",(0,_.vX)()),t=await l.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:ue.trim()});if(t.code!==p.m.Success)return;const i=t.data;return(0,f.yC)(i,Ge.user_data.dir_show_type),et(i),ie(i),void(T=i)}if(!T)return;de([]),pe([]);const e=[],t=[];for(const t of T.files??[])t.name.includes(ue)&&e.push(t);for(const e of T.folders??[])e.name.includes(ue)&&t.push(e);ie({files:e,folders:t})},placeholder:J("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:()=>{const e=(0,_.GG)("file",(0,_.vX)());Fe({open:!0,title:J("深搜"),context_div:(0,N.jsx)(E,{base_path:e})})},handleInputChange:e=>{me(e)},max_width:"25em"})}),(0,N.jsxs)(c.aZ,{position:"right",children:[be(A.oV.ai_agent_page)&&(0,N.jsx)($.rA,{icon:"smart_toy",title:J("AI 聊天"),selected:Ke,onClick:()=>Re("chat_open",!Ke?"1":null)}),(0,N.jsx)("div",{className:"mobile-context-btn",children:(0,N.jsx)($.rA,{icon:"more_horiz",title:J("右键"),onClick:()=>{const e=ce[ce.length-1];if(void 0!==e){const t=[...te.folders??[],...te.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],n=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},s={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},o=new b.ik;o.path=(0,Y.IO)((0,_.vX)(),t.name),o.filename=t.name,o.x=s.clientX,o.y=s.clientY,o.type=t.type===u.Iw.folder?u.Iw.folder:(0,b.uL)(t.name),o.size=t.origin_size,re({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:o})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};Je(e)}}})}),(0,N.jsx)(H,{})]}),(0,N.jsxs)("div",{className:"file-list-split"+(Ke?" file-list-split--chat":""),children:[ct,Ke&&(0,N.jsxs)(n.Fragment,{children:[(0,N.jsx)("div",{className:"studio__divider studio__divider--chat",ref:Ye,onPointerDown:e=>{e.preventDefault(),Oe(!0),document.addEventListener("pointermove",lt),document.addEventListener("pointerup",rt,{once:!0})}}),(0,N.jsx)("div",{className:"studio-chat-panel",style:{width:`${Le}em`},children:(0,N.jsx)(n.Suspense,{fallback:null,children:(0,N.jsx)(W,{inline_header:!0,sync_url:!1,file_cwd_path:Te(),session_id:Ze??(dt=Te(),a.AG.get_ai_chat_session(Ve,dt)),on_session_change:e=>{We(e),((e,t)=>{qe({...Ve,[e]:t})})(Te(),e)}})})})]})]}),Be&&(0,N.jsx)("div",{className:"shell__overlay",onPointerUp:rt}),we&&(0,N.jsx)(O,{}),ge.open&&(0,N.jsx)(Z,{})]});var dt}}}]);