filecat 6.43.5 → 6.44.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.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1472],{75897(e,t,s){s.d(t,{L:()=>i});let n=function(e){return e.username="username",e.password="password",e.password_hash="password_hash",e.navindex_remote_ssh_key="navindex_remote_ssh_key",e.user_id_name_mapping="user_id_name_mapping",e.user_id_info_data_mapping="user_id_info_data_mapping",e.user_unique_id_num="user_unique_id_num",e.role_unique_id_num="role_unique_id_num",e.sys_all_roles="sys_all_roles",e.ddns_http_url_key="ddns_http_url_key",e.ddns_tx_key="tengxun_ddns_key",e.ddns_dnspod_key="ddns_dnspod",e.ddns_ali_key="ali_ddns_key",e.navindex_net_key_list="navindex_net_key_list",e.navindex_wol_key="navindex_wol_key",e.customer_router_key="customer_router_key",e.customer_workflow_router_key="customer_workflow_router_key",e.customer_api_router_key="customer_api_router_key",e.token_setting="token_setting",e.sys_software="sys_software",e.protection_directory="sys_protection_directory",e.dir_upload_max_num="dir_upload_max_num",e.self_auth_jscode="self_auth_jscode",e.navindex_video_key="navindex_video_tag_key",e.systemd_key="systemd_key",e.vir_server_data_key="vir_server_net_data_key",e.vir_client_data_key="vir_client_net_data_key",e.vir_data_client_hash_key="vir_data_client_hash_key",e.vir_data_server_hash_key="vir_data_server_hash_key",e.language="user_language",e.navindex_rdp_key="navindex_rdp_tag_key",e.navindex_key="navindex_key_list",e.http_tag_key="http_tag_key",e.self_shell_cmd_check_open_status="self_shell_cmd_check_open_status",e.self_shell_cmd_jscode="self_shell_cmd_jscode",e.extra_env_path_list_key="extra_env_path_list_key",e.cmd_use_pty_key="cmd_use_pty_key",e.recycle_bin_key="recycle_bin_key",e.recycle_bin_status="recycle_bin_status",e.guid_key="guid_key",e.tcp_proxy_key="tcp_proxy_key",e.sys_env_key="sys_env_key",e.http_server_key="http_server_key",e.proxy_server_code_prefix="proxy_server_code_prefix",e.ai_agent_model_setting="ai_agent_model_setting",e.ai_agent_mcp_setting="ai_agent_mcp_setting",e.ai_agent_docs_setting="ai_agent_docs_setting",e.ai_agent_chat_session_store="ai_agent_chat_session_store",e.share_file_list_key="share_file_list_key",e.share_file_list_key_download_statics="share_file_list_key_download_statics",e.tcp_proxy_server_base="tcp_proxy_server_base",e.tcp_proxy_server_client_list="tcp_proxy_server_client_list",e.tcp_proxy_client_fig="tcp_proxy_client_fig",e.tcp_proxy_client_all_fig="tcp_proxy_client_all_fig",e.tcp_proxy_sync_task_list="tcp_proxy_sync_task_list",e.workflow_setting_item_list="workflow_setting_item_list",e.server_bridge_config_list="server_bridge_config_list",e.ai_agent_status="ai_agent_status",e.ai_system_prompts="ai_system_prompts",e.filecat_plugin_list="filecat_plugin_list",e.https_setting="https_setting",e.ai_rebot_setting="ai_rebot_setting",e.token_cache="token_cache",e.auto_upgrade_setting="auto_upgrade_setting",e.ai_long_term_memory_setting="ai_long_term_memory_setting",e}({});const i=n.self_auth_jscode},77481(e,t,s){s.d(t,{S:()=>a,X:()=>l});var n=s(96540),i=s(74848);function l(e){const[t,s]=n.useState([]);return(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]),(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((e,t)=>(0,i.jsx)("th",{children:e},t))})}),(0,i.jsx)("tbody",{children:t.map((t,s)=>(0,i.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((s,n)=>(0,i.jsx)("td",{style:{width:e.width??"auto"},className:n===t.length-1?"small":"",children:s},n))},s))})]})}function a(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))})}},61472(e,t,s){s.r(t),s.d(t,{default:()=>E});var n=s(96540),i=s(75725),l=s(23430),a=s(70447),o=s(85997),r=s(61443),c=s(14284),d=s(53459),_=s(77481),h=s(22022),u=s(82893),p=s(40505),x=s(62042),m=s(21499),j=s(21469),v=s(74848);function g(e){const{t}=(0,h.Bd)(),[s,l]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();l(t)}})()},[]);return(0,v.jsx)(i.xh,{children:(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e.title}),e.info_click&&(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");l([t,...s])}}),(0,v.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,v.jsx)(_.X,{headers:e.headers,rows:s.map((n,i)=>{const a=[];for(let t=0;t<e.headers.length;t++)a.push((0,v.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,l([...s])},no_border:!0}));return a.push((0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),l([...s])})(i)}),n[0]&&(0,v.jsx)(o.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,p.lW)(e),(0,x.SK)(e)}}),n[0]&&e.need_copy&&(0,v.jsx)(o.rA,{icon:"open_in_new",title:t("打开新页面"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);window.open(e)}})]})),a}),width:"10rem"})})})}var f=s(34843),y=s(78247),w=s(24659);function k(){const{t:e}=(0,h.Bd)(),[t,s]=(0,f.fp)(u.AG.prompt_card),l=(0,w.K)(),g=[e("路由"),e("auth"),e("备注")],[k,S]=(0,f.fp)(u.AG.editorSetting),[C,b]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("api/customer_router");e.code===d.m.Success&&b(e.data)})()},[]);return(0,v.jsx)(i.xh,{children:(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("自定义api路由")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b([{note:"",needAuth:!1,router:""},...C])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",C)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:(0,v.jsx)(_.X,{headers:g,rows:C.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,b([...C])},no_border:!0}),(0,v.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,b([...C])},options:l,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,b([...C])},no_border:!0}),(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),b([...C])})(s)}),(0,v.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,x.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);S({model:"ace/mode/javascript",open:!0,fileName:e.router,save:async t=>{const s={context:t,router:e.router};(await c.XO.post("jscode/save",s)).code===d.m.Success&&(y.xK.set_value_temp(""),S({open:!1,model:"",fileName:"",save:null}),(0,x.SK)("成功"))}}),y.xK.set_value_temp(t.data)})(t)}),t.router&&(0,v.jsx)(o.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,p.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,x.SK)(e("已复制"))}})]})];return n}),width:"10rem"})})})}var S=s(23496),C=s(57952);function b(){const{t:e}=(0,h.Bd)(),[t,s]=(0,f.fp)(u.AG.prompt_card),[l,a]=(0,f.fp)(u.AG.router_jump),o=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)(C.A,{}),(0,v.jsxs)(i.fI,{children:[(0,v.jsxs)(i.VP,{children:[(0,v.jsx)(g,{title:e("页面资源路由"),headers:o,getItems:async()=>{const e=await c.XO.get(S.s.setting_customer_router);if(e.code===d.m.Success){if(l?.page_self_router_api_data){for(const t of e.data)t[1]===l?.page_self_router_api_data[1]&&(0,x.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,l?.page_self_router_api_data),e.data=[t,...e.data],a({})}return e.data}return[]},save:async e=>{(await c.XO.post(S.s.setting_customer_router_save,e)).code===d.m.Success&&(0,x.SK)("success")},info_click:()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})},need_copy:!0}),(0,v.jsx)(g,{title:e("workflow触发路由"),headers:r,getItems:async()=>{const e=await c.XO.get(S.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(S.s.setting_customer_workflow_router_save,e)).code===d.m.Success&&(0,x.SK)("保存成功")},info_click:()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})}})]}),(0,v.jsx)(i.VP,{children:(0,v.jsx)(k,{})})]})]})}var A=s(75897),I=s(74777),V=s(6960),X=s(7523);function N(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)(),[s,i]=(0,n.useState)(!1),[_,p]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[g,w]=(0,n.useState)(180),[k,S]=(0,n.useState)(!1),[C,b]=(0,f.fp)(u.AG.prompt_card);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("auto_upgrade_setting");if(e.code===d.m.Success){const t=e.data;i(t.open||!1),p(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),w(t.check_interval_seconds||180)}})()},[]);return t(l.oV.sys_setting_page)?(0,v.jsxs)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("自动升级")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{b({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:"信息"})]}),rightBottomCom:(0,v.jsx)(o.C3,{text:e("保存"),clickFun:async()=>{if(!_)return void(0,x.zN)(e("版本检测地址不能为空"));if(s&&(!g||g<10))return void(0,x.zN)(e("检测间隔不能小于10秒"));const t=new I.Mm;t.open=s,t.version_check_url=_,t.exe_download_url=m,t.check_interval_seconds=g;(await c.XO.post("auto_upgrade_setting/save",t)).code===d.m.Success&&(0,x.SK)(e("保存成功"))}}),children:[(0,v.jsx)("div",{children:e("系统版本检测地址")}),(0,v.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:_,handleInputChange:e=>{p(e)}}),(0,v.jsx)(r.l6,{value:s,onChange:e=>{i(e)},options:[{title:e("开启"),value:!0},{title:e("关闭"),value:!1}]}),s&&(0,v.jsxs)(v.Fragment,{children:[!1,(0,v.jsx)("div",{children:e("检测频率(秒)")}),(0,v.jsx)(r.Sm,{placeholder:e("默认180秒(3分钟)"),value:g,handleInputChange:e=>{w(Number(e)||180)}}),(0,v.jsx)("div",{style:{marginTop:"12px"},children:(0,v.jsx)(o.C3,{text:e(k?"升级检测中...":"立即升级"),clickFun:async()=>{S(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,x.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,x.zN)(e("触发升级失败"))}finally{S(!1)}}})})]})]}):null}function O(){const[e,t]=(0,n.useState)(""),[s,l]=(0,n.useState)(!1),[p,m]=(0,n.useState)(!1),[j,g]=(0,n.useState)(!1),[w,k]=(0,n.useState)(!1),[b,O]=(0,n.useState)(""),[F,K]=(0,f.fp)(u.AG.prompt_card),[P,z]=(0,n.useState)(!1),[B,M]=(0,n.useState)(""),[$,G]=(0,n.useState)(""),[q,E]=(0,f.fp)(u.AG.editorSetting),[T,U]=(0,n.useState)(I.aM.close),[Z,H]=(0,n.useState)(!1),[D,W]=(0,n.useState)(void 0),{t:L,i18n:Q}=(0,h.Bd)(),[J,R]=(0,f.fp)(u.AG.user_base_info),{check_user_auth:Y}=(0,y.MH)(),{initUserInfo:ee}=(0,n.useContext)(X.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){m(e.data.self_auth_open),g(e.data.shell_cmd_check_open),k(e.data.recycle_open),O(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),l(s?.show_login_user_info);const n=e.data.https_setting;n&&(z(n.open),M(n.cert_path||""),G(n.key_path||""))}const s=await c.XO.get("token");if(s.code===d.m.Success){const e=s.data;if(!e)return;e.length&&W(e.length),e.mode&&U(e.mode),void 0!==e.persist&&H(e.persist)}})()},[]);return(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:30,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.Zp,{title:L("自定义登录auth"),rightBottomCom:(0,v.jsx)(o.C3,{text:L("保存"),clickFun:async()=>{(await c.XO.post("self_auth_open/save",{open:p})).code===d.m.Success&&(0,x.SK)("修改成功")}}),titleCom:(0,v.jsx)(o.rA,{icon:"edit",title:L("代码修改"),onClick:async()=>{const e=await c.XO.get("self_auth_open/jscode");E({model:"ace/mode/javascript",open:!0,fileName:"",save:async e=>{const t={context:e,router:A.L};0===(await c.XO.post("jscode/save",t)).code&&(y.xK.set_value_temp(""),E({open:!1,model:"",fileName:"",save:null}))}}),y.xK.set_value_temp(e.data)}}),children:(0,v.jsx)(r.l6,{value:p,onChange:e=>{m(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]})}),(0,v.jsx)(a.Zp,{title:L("自定义shell命令校验"),rightBottomCom:(0,v.jsx)(o.C3,{text:L("保存"),clickFun:async()=>{(await c.XO.post("shell_cmd_check_open/save",{open:j})).code===d.m.Success&&(0,x.SK)("修改成功")}}),titleCom:(0,v.jsx)(o.rA,{icon:"edit",title:L("代码修改"),onClick:async()=>{const e=await c.XO.get("shell_cmd_check_open/jscode");E({model:"ace/mode/javascript",open:!0,fileName:"",save:async e=>{const t={context:e};0===(await c.XO.post("shell_cmd_check_open/jscode/save",t)).code&&(y.xK.set_value_temp(""),E({open:!1,model:"",fileName:"",save:null}))}}),y.xK.set_value_temp(e.data)}}),children:(0,v.jsx)(r.l6,{value:j,onChange:e=>{g(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]})})]})}),(0,v.jsx)(i.VP,{widthPer:30,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsxs)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:L("文件回收站")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{K({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:L("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:"信息"})]}),rightBottomCom:(0,v.jsx)(o.C3,{text:L("确定修改"),clickFun:async()=>{if(w&&!b)return void(0,x.zN)("目录不能为空");(await c.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:b,open:w})).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,v.jsx)(r.Sm,{placeholder:L("目录"),value:b,handleInputChange:e=>{O(e)}}),(0,v.jsx)(r.l6,{value:w,onChange:e=>{k(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]})]}),(0,v.jsxs)(a.Zp,{title:L("token过期时间"),rightBottomCom:(0,v.jsx)(_.S,{isFlex:!0,columns:[(0,v.jsx)(o.C3,{text:L("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,x.SK)("清理完成,重新登录")}}),(0,v.jsx)(o.C3,{text:L("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=T,e.persist=Z,I.aM.length!==e.mode||D||(0,x.zN)("秒数不能为空"),e.length=parseInt(D);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:[(0,v.jsx)(_.S,{isFlex:!0,columns:[(0,v.jsx)(r.U6,{value:1,context:L("关闭"),selected:T===I.aM.close,onchange:()=>{U(I.aM.close)}}),(0,v.jsx)(r.U6,{value:1,context:L("指定时间"),selected:T===I.aM.length,onchange:()=>{U(I.aM.length)}}),(0,v.jsx)(r.U6,{value:1,context:L("永不过期"),selected:T===I.aM.forver,onchange:()=>{U(I.aM.forver)}})]}),T===I.aM.length&&(0,v.jsx)(r.Sm,{placeholder:L("秒"),value:D,handleInputChange:e=>{W(e)}}),(0,v.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,v.jsx)("input",{type:"checkbox",checked:Z,onChange:()=>H(!Z)}),L("持久化")]})]})]})}),(0,v.jsx)(i.VP,{widthPer:40,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsxs)(a.Zp,{title:L("通用设置"),rightBottomCom:(0,v.jsx)(o.C3,{text:L("确定修改"),clickFun:async()=>{(await c.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:s}})).code===d.m.Success&&((0,x.SK)("修改成功"),ee())}}),children:[L("网站标题"),(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),L("登陆展示用户信息"),(0,v.jsx)("input",{type:"checkbox",checked:s,onChange:()=>{l(!s)}})]}),(0,v.jsxs)(a.Zp,{title:L("HTTPS 设置"),rightBottomCom:(0,v.jsx)(o.C3,{text:L("确定修改"),clickFun:async()=>{if(P){if(!B)return void(0,x.zN)("证书路径不能为空");if(!$)return void(0,x.zN)("私钥路径不能为空")}const e=new I.CH;e.open=P,e.cert_path=B,e.key_path=$;(await c.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:P})).code===d.m.Success&&(0,x.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,v.jsx)(r.l6,{value:P,onChange:e=>{z(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]}),P&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:L("SSL 证书路径")}),(0,v.jsx)(r.Sm,{placeholder:L("证书文件路径(cert.pem/fullchain.pem)"),value:B,handleInputChange:e=>{M(e)}}),(0,v.jsx)("div",{children:L("SSL 私钥路径")}),(0,v.jsx)(r.Sm,{placeholder:L("私钥文件路径(privkey.pem)"),value:$,handleInputChange:e=>{G(e)}})]})]}),(0,v.jsx)(N,{})]})}),(0,v.jsx)(C.A,{left_children:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("span",{className:"credits",children:[L("系统运行于"),": ",(0,V.s)(J.runing_time_length)]}),(0,v.jsx)("span",{className:"credits",children:(0,v.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:6.43.5",null!=J.latest_version&&"6.43.5"!==J.latest_version?` -> ${J.latest_version}`:""]})}),(0,v.jsx)("span",{className:"credits",children:(0,v.jsx)("a",{href:L("官网地址"),target:"_blank",children:`filecat ${L("功能文档")}`})}),(0,v.jsxs)("span",{className:"credits",children:[L("安装方式")," :",J.process_env_run_env]})]})})]})}var F=s(64694),K=s(92350);function P(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:l}=(0,n.useContext)(X.F),[p,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[k,S]=(0,f.fp)(u.AG.prompt_card),[C,b]=(0,n.useState)([]),[A,I]=(0,n.useState)([]),[V,N]=(0,n.useState)([]),[O,P]=(0,n.useState)([]),[z,B]=(0,n.useState)(""),[M,$]=(0,n.useState)([]),G=(0,w.K)(),q=[e("软件"),e("是否安装"),e("路径")],E=[e("编号"),e("路径"),e("备注")],T=[e("编号"),e("路径"),e("是否开启"),e("备注")],U=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("是否开启大文件断点"),e("大文件判断大小MB"),e("大文件并发数量"),e("大文件分块大小MB"),e("备注")],H=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:D}=(0,y.MH)(),W=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&N(e.data)},L=async()=>{const e=await c.XO.get("workflow_setting_get");e.code===d.m.Success&&P(e.data)};(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("outside/software/get");e.code===d.m.Success&&g(e.data);const t=await c.XO.get("pty_cmd");t.code===d.m.Success&&B(t.data),W(),L();const s=await c.XO.get("protection_dir/sys");s.code===d.m.Success&&b(s.data??[]);const n=await c.XO.get("dir_upload_max_num");n.code===d.m.Success&&I(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&$(i.data??[])})()},[]);const Q=(0,K.Q)(),J=async()=>{(await c.XO.post("plugin/list/save",M)).code===d.m.Success&&(0,x.SK)(e("保存成功"))};return(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)(i.J,{widthPer:100,children:(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件上传最大并发限制")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:"",user_upload_num:2,sys_upload_num:6,ws_file_standard_size:52428800,ws_file_parallel_num:2,ws_file_block_mb_size:524288}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of A)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,x.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,x.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,x.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,F.di)(A,e=>e.index);(await c.XO.post("dir_upload_max_num/save",A)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),children:(0,v.jsx)(_.X,{headers:Z,rows:A.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,I([...A])},options:G,no_border:!0}),(0,v.jsx)(r.Sm,{value:"number"==typeof t.ws_file_standard_size?t.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:"number"==typeof t.ws_file_block_mb_size?t.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem"})})}),(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("PATH")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...V,{path:"",note:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:V})).code===d.m.Success&&((0,x.SK)("保存成功"),W(),s())}})]}),children:(0,v.jsx)(_.X,{headers:T,rows:V.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,N([...V])},options:G,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),N([...V])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("PTY CMD")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:"信息"})]}),rightBottomCom:(0,v.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:z})).code===d.m.Success&&((0,x.SK)("保存成功"),l())}}),children:(0,v.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:z,handleInputChange:e=>{B(e)}})}),(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("Workflow Job")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{open:!1}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",O)).code===d.m.Success&&((0,x.SK)("ok"),L())}})]}),children:(0,v.jsx)(_.X,{headers:U,rows:O.map((t,s)=>[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...O])},options:G,no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...O])},options:G,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cron_str,handleInputChange:e=>{t.cron_str=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>()=>{P([...O.splice(s,1)])}})]),width:"10rem"})}),(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("插件配置")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...M,{name:"",path:"",note:"",open:!1}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,v.jsx)(_.X,{headers:H,rows:M.map((t,s)=>{const n=[s,(0,v.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,$([...M])},options:G,no_border:!0}),(0,v.jsx)(o.mu,{icon:"edit",save:async e=>{t.params=e,await J()},title:""}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{M.splice(e,1),$([...M])})(s)})];return n}),width:"10rem"})})]})}),(0,v.jsx)(i.VP,{children:(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("系统保护路径")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...C,{path:"",note:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",C)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),children:(0,v.jsx)(_.X,{headers:E,rows:C.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),b([...C])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(a.uF,{title:e("外部软件"),titleCom:(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,x.SK)("保存成功"),s())}}),children:(0,v.jsx)(_.X,{headers:q,rows:j.map((t,s)=>[(0,v.jsx)("div",{children:t.id}),(0,v.jsx)(a.fq,{ok:t.installed}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("默认使用环境变量")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q(t.id)},title:"信息"})]),width:"10rem"})})]})})]})]})}function z(e){const{t,i18n:s}=(0,h.Bd)(),[i,a]=(0,f.fp)(u.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:l.oV.user_manage},{title:t("角色管理"),permission:l.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:l.oV.all_sys},{title:t("系统进程关闭"),permission:l.oV.sys_process_close},{title:t("docker容器停止、删除"),permission:l.oV.docker_container_update},{title:t("docker镜像删除"),permission:l.oV.docker_images_delete},{title:t("systemd删除、添加管理"),permission:l.oV.systemd_update}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:l.oV.vir_net},{title:t("内网穿透"),permission:l.oV.tcp_proxy},{title:"ddns",permission:l.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:l.oV.ai_agent_setting},{title:t("Ai Chat Page"),permission:l.oV.ai_agent_page}]},{title:t("文件权限"),list:[{title:t("文件删除、剪切、重命名"),permission:l.oV.filecat_file_delete_cut_rename},{title:t("文件创建、上传、内容更新、解压缩"),permission:l.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:l.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:l.oV.recycle_file_save},{title:t("文件分享"),permission:l.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:l.oV.sys_setting_page},{title:t("htts"),permission:l.oV.https_file},{title:t("token时间修改"),permission:l.oV.token_update},{title:t("自定义auth"),permission:l.oV.code_auth},{title:t("修改密码"),permission:l.oV.update_password},{title:t("磁盘挂载"),permission:l.oV.sys_disk_mount},{title:t("通用设置"),permission:l.oV.sys_env_setting_key},{title:t("shell命令检测"),permission:l.oV.shell_cmd_check}]},{title:t("系统环境设置"),list:[{title:t("系统环境设置页面"),permission:l.oV.sys_env_page},{title:t("目录文件上传数量限制修改"),permission:l.oV.dir_upload_max_num},{title:t("PATH路径修改"),permission:l.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:l.oV.pty_cmd_update},{title:"workflow job",permission:l.oV.workflow_job},{title:t("系统保护路径更新"),permission:l.oV.sys_protection_dir},{title:t("外部软件路径"),permission:l.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:l.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:l.oV.auth_router_page},{title:t("workflow触发api 修改"),permission:l.oV.workflow_api},{title:t("自定义资源路由"),permission:l.oV.code_resource},{title:t("自定义api路由"),permission:l.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("网址导航"),permission:l.oV.net_site_tag_update},{title:t("ssh代理"),permission:l.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:l.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:l.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:l.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:l.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy},{title:t("http代理"),permission:l.oV.http_proxy},{title:t("http代理下载关闭"),permission:l.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:l.oV.browser_proxy},{title:t("rdp代理"),permission:l.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("workflow 执行"),permission:l.oV.workflow_exe},{title:t("workflow 执行用户"),permission:l.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:l.oV.wol_proxy},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy},{title:t("ssh密钥保存到磁盘"),permission:l.oV.crypto_ssh_file},{title:t("网址导航"),permission:l.oV.nav_net_tag},{title:t("filecat-restart重启命令"),permission:l.oV.shell_cmd_filecat_restart},{title:t("filecat-upgrade升级命令"),permission:l.oV.shell_cmd_filecat_upgrade},{title:t("filecat-down关闭主进程命令"),permission:l.oV.shell_cmd_filecat_kill_self},{title:t("ai 命令(Ai 聊天)"),permission:l.oV.ai_chat_cmd}]}];return(0,v.jsx)(n.Fragment,{children:o.map((t,s)=>(0,v.jsxs)("div",{children:[(0,v.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,v.jsxs)("div",{children:[(0,v.jsx)("input",{type:"checkbox",disabled:!t.noDisable&&e.is_disable(t.permission),checked:e.is_selected(t.permission,t.noDisable),onChange:()=>{e.select_auth(t.permission)}}),t.title]},s))]},s))})}const B=new Map;function M(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:p}=(0,n.useContext)(X.F),[j,g]=(0,f.fp)(u.AG.user_base_info),[y,w]=(0,n.useState)([]),[k,S]=(0,f.fp)(u.AG.prompt_card),[C,b]=(0,n.useState)(!1),[A,I]=(0,n.useState)(!1),[V,N]=(0,f.fp)(u.AG.confirm),[O,P]=(0,n.useState)(""),[M,$]=(0,n.useState)(""),[G,q]=(0,n.useState)(""),[E,T]=(0,n.useState)([]),[U,Z]=(0,n.useState)([]),[H,D]=(0,n.useState)([]),[W,L]=(0,n.useState)(""),[Q,J]=(0,n.useState)(""),[R,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,le]=(0,n.useState)(""),[ae,oe]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,_e]=(0,n.useState)(""),[he,ue]=(0,n.useState)({}),pe=(0,K.o)(),[xe,me]=(0,n.useState)([]),je=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ve=async()=>{const e=await c.wm.get("all_users");e.code===d.m.Success&&w(e.data);const t=await c.wm.get("all_roles");if(t.code===d.m.Success){me(t.data),B.clear();for(const e of t.data)B.set(e.role_id,e)}},ge=e=>{P(e?.username??""),$(e?.password??""),q(e?.cwd??""),T(e?.access_dirs??[]),Z(e?.not_access_dirs??[]),D(e?.only_read_dirs??[]),L(e?.access_cmd??""),J(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),le(e?.note??""),oe(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?fe(e.bind_role_id,e.auth_list??[]):(_e(""),ue({}))};(0,n.useEffect)(()=>{ve()},[]);const fe=(e,t=[])=>{if(!e)return _e(""),void ue({});const s=B.get(e);if(s){if(s.cwd&&q(s.cwd),s.access_dirs&&s.access_dirs.length>0&&T(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&Z(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&D(s.only_read_dirs),s.access_cmd&&L(s.access_cmd),s.not_access_cmd&&J(s.not_access_cmd),s.language&&Y(s.language),s.theme&&te(s.theme),s.auth_list&&s.auth_list.length>0){const e=new Set(s.auth_list);for(const s of t)e.add(s);ne(Array.from(e))}_e(e),ue(s)}},ye=()=>{if(!O)return void(0,x.zN)("username not empty");if((0,m.CB)(O))return void(0,x.zN)("username not empty char");if(!G)return void(0,x.zN)("cwd not empty");const e=new l.E0;return e.language=R,e.theme=ee,e.access_dirs=E,e.username=O,e.password=M,e.not_access_dirs=U,e.only_read_dirs=H,e.cwd=G,e.note=ie,e.access_cmd=W,e.not_access_cmd=Q,e.auth_list=se,e.bind_role_id=de,e};return(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsx)(i.xh,{children:(0,v.jsx)(a.uF,{self_title:(0,v.jsx)("span",{className:" div-row ",children:(0,v.jsx)("h2",{children:e("用户")})}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b(!0),I(!1),ge(void 0)}})}),children:(0,v.jsx)(_.X,{headers:je,rows:y.map((t,s)=>{const n=[(0,v.jsx)("p",{children:t.id}),(0,v.jsx)(a.xP,{children:t.username}),(0,v.jsx)(a.xP,{children:t.cwd}),(0,v.jsx)(a.xP,{children:t.note}),(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{b(!1),I(!0),ge(e)})(t)}),!t.is_root&&(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{N({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ve(),N({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,v.jsx)(i.VP,{widthPer:50,children:(C||A)&&(0,v.jsx)(i.xh,{children:(0,v.jsxs)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e(""+(C?"添加":"编辑"))})," "]}),rightBottomCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{b(!1),I(!1),ge(void 0)}}),C&&(0,v.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!M)return void(0,x.zN)("password not empty");if((0,m.CB)(M))return void(0,x.zN)("username not empty char");const e=ye(),t=await c.wm.post("create_user",e);ve(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ve(),b(!1),I(!1),ge(void 0))}}),A&&(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ye();if(!e)return;e.id=re;(await c.wm.post("save_user",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ve())}})]}),children:[(0,v.jsx)("label",{children:e("用户名")}),(0,v.jsx)(r.Sm,{value:O,handleInputChange:e=>P(e)}),(0,v.jsx)("label",{children:e("密码")}),(0,v.jsx)(r.Sm,{type:"password",value:M,handleInputChange:e=>$(e)}),(0,v.jsxs)("label",{children:[!he?.access_dirs?.length&&(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{T([...E,""])},title:"添加"}),e("目录范围")]}),(0,v.jsx)(r.Sm,{disabled:""!==he.cwd&&void 0!==he.cwd,value:G,handleInputChange:e=>q(e)}),(E??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==he?.access_dirs?.length&&void 0!==he?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,T([...E])}})}),0===he?.access_dirs?.length||void 0===he?.access_dirs?.length&&(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{E.splice(s,1),T([...E])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[!he?.not_access_dirs?.length&&(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{Z([...U,""])},title:e("添加")}),e("禁止目录范围")]}),(U??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==he?.not_access_dirs?.length&&void 0!==he?.not_access_dirs?.length,value:t,handleInputChange:e=>{U[s]=e,Z([...U])}})}),0===he?.not_access_dirs?.length||void 0===he?.not_access_dirs?.length&&(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{U.splice(s,1),Z([...U])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[!he?.only_read_dirs?.length&&(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{D([...H,""])},title:e("添加")}),e("只读目录范围")]}),(H??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==he?.only_read_dirs?.length&&void 0!==he?.only_read_dirs?.length,value:t,handleInputChange:e=>{H[s]=e,D([...H])}})}),0===he?.only_read_dirs?.length||void 0===he?.only_read_dirs?.length&&(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{H.splice(s,1),D([...H])},title:e("删除")})]},s)),(0,v.jsx)("label",{children:e("可执行的命令")}),(0,v.jsx)(r.Sm,{disabled:""!==he.access_cmd&&void 0!==he.access_cmd,value:W,placeholder:"use blank split",handleInputChange:e=>L(e)}),(0,v.jsx)("label",{children:e("禁止执行的命令")}),(0,v.jsx)(r.Sm,{disabled:""!==he.not_access_cmd&&void 0!==he.not_access_cmd,value:Q,placeholder:"use blank split",handleInputChange:e=>J(e)}),!ae&&(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)("label",{children:e("角色")}),(0,v.jsx)(r.l6,{value:de,onChange:e=>{fe(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of xe)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,v.jsx)("label",{children:e("语言")}),(0,v.jsx)(r.l6,{disabled:""!==he.language&&void 0!==he.language,value:R,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,v.jsx)("label",{children:e("主题")}),(0,v.jsx)(r.l6,{disabled:""!==he.theme&&void 0!==he.theme,value:ee,onChange:e=>{te(e)},options:pe}),(0,v.jsx)(z,{is_disable:e=>{if(!0===ae)return!0;if(de){const t=B.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===ae||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,F.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,v.jsx)("label",{children:e("备注")}),(0,v.jsx)(r.Sm,{value:ie,handleInputChange:e=>le(e)})]})})})]})}function $(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s}=(0,n.useContext)(X.F),[p,m]=(0,n.useState)([]),[j,g]=(0,f.fp)(u.AG.prompt_card),[y,w]=(0,n.useState)(!1),[k,S]=(0,n.useState)(!1),[C,b]=(0,f.fp)(u.AG.confirm),[A,I]=(0,n.useState)(""),[V,N]=(0,n.useState)(""),[O,P]=(0,n.useState)([]),[B,M]=(0,n.useState)([]),[$,G]=(0,n.useState)([]),[q,E]=(0,n.useState)(""),[T,U]=(0,n.useState)(""),[Z,H]=(0,n.useState)(""),[D,W]=(0,n.useState)(""),[L,Q]=(0,n.useState)([]),[J,R]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,K.o)(),se=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await c.wm.get("all_roles");e.code===d.m.Success&&m(e.data)},ie=e=>{I(e?.role_name??""),N(e?.cwd??""),P(e?.access_dirs??[]),M(e?.not_access_dirs??[]),G(e?.only_read_dirs??[]),E(e?.access_cmd??""),U(e?.not_access_cmd??""),H(e?.language??""),W(e?.theme??""),Q(e?.auth_list??[]),R(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const le=()=>{if(!A)return void(0,x.zN)("role_name not empty");const e=new l.E0;return e.language=Z,e.theme=D,e.access_dirs=O,e.role_name=A,e.not_access_dirs=B,e.only_read_dirs=$,e.cwd=V,e.access_cmd=q,e.not_access_cmd=T,e.auth_list=L,e.role_note=Y,e};return(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsx)(i.xh,{children:(0,v.jsx)(a.uF,{self_title:(0,v.jsx)("span",{className:" div-row ",children:(0,v.jsx)("h2",{children:e("角色")})}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{w(!0),S(!1),ie(void 0)}})}),children:(0,v.jsx)(_.X,{headers:se,rows:p.map((t,s)=>{const n=[(0,v.jsx)("p",{children:t.role_id}),(0,v.jsx)(a.xP,{children:t.role_name}),(0,v.jsx)(a.xP,{children:t.role_note}),(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{w(!1),S(!0),ie(e)})(t)}),!t.is_root&&(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{b({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ne(),b({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,v.jsx)(i.VP,{widthPer:50,children:(y||k)&&(0,v.jsx)(i.xh,{children:(0,v.jsxs)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e(""+(y?"添加":"编辑"))})," "]}),rightBottomCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{w(!1),S(!1),ie(void 0)}}),y&&(0,v.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=le();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ne(),w(!1),S(!1),ie(void 0))}}),k&&(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=le();if(!e)return;e.role_id=J;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ne())}})]}),children:[(0,v.jsx)("label",{children:e("角色名")}),(0,v.jsx)(r.Sm,{value:A,handleInputChange:e=>I(e)}),(0,v.jsx)("label",{children:e("角色备注")}),(0,v.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,v.jsxs)("label",{children:[(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{P([...O,""])},title:"添加"}),e("目录范围")]}),(0,v.jsx)(r.Sm,{value:V,handleInputChange:e=>N(e)}),(O??[]).map((e,t)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{O[t]=e,P([...O])}})}),(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{O.splice(t,1),P([...O])},title:"删除"})]},t)),(0,v.jsxs)("label",{children:[(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{M([...B,""])},title:"添加"}),e("禁止目录范围")]}),(B??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:t,handleInputChange:e=>{B[s]=e,M([...B])}})}),(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{B.splice(s,1),M([...B])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{G([...$,""])},title:e("添加")}),e("只读目录范围")]}),($??[]).map((e,t)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{$[t]=e,G([...$])}})}),(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{$.splice(t,1),G([...$])},title:"删除"})]},t)),(0,v.jsx)("label",{children:e("可执行的命令")}),(0,v.jsx)(r.Sm,{value:q,placeholder:"use blank split",handleInputChange:e=>E(e)}),(0,v.jsx)("label",{children:e("禁止执行的命令")}),(0,v.jsx)(r.Sm,{value:T,placeholder:"use blank split",handleInputChange:e=>U(e)}),(0,v.jsx)("label",{children:e("语言")}),(0,v.jsx)(r.l6,{value:Z,onChange:e=>{H(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,v.jsx)("label",{children:e("主题")}),(0,v.jsx)(r.l6,{value:D,onChange:e=>{W(e)},options:te}),(0,v.jsx)(z,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==L?.find(t=>t===e),select_auth:e=>{L?(L.find(t=>t==e)?(0,F.I)(L,t=>t===e):L.push(e),Q([...L])):Q([e])}})]})})})]})}function G(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:p}=(0,n.useContext)(X.F),[m,j]=(0,n.useState)([]),[g,y]=(0,f.fp)(u.AG.prompt_card),[k,C]=(0,n.useState)([]),[b,A]=(0,n.useState)([]),[V,N]=(0,n.useState)([]),[O,F]=(0,f.fp)(u.AG.user_base_info),P=(0,w.K)(),z=(0,K.o)(),B=[e("编号"),e("路径"),e("是否默认"),e("备注")],M=[e("编号"),e("路径"),e("备注")],$=[e("编号"),e("命令"),e("父编号"),e("备注")],G=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[q,E]=(0,n.useState)(""),[T,U]=(0,n.useState)(""),[Z,H]=(0,n.useState)(""),[D,W]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,R]=(0,n.useState)(""),[Y,ee]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),A(e.data.quick_cmd),N(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&C(t.data??[])})(),Q(O?.user_data?.language),R(O?.user_data?.theme),ee(O?.user_data?.upload_file_ignore)},[]);const te=(0,K.Q)();return(0,v.jsx)(n.Fragment,{children:(0,v.jsxs)(i.fI,{children:[(0,v.jsxs)(i.VP,{children:[(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件夹路径")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{te("文件夹路径")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<m.length;e++)m[e].index=e;(await c.XO.post("filesSetting/save",{dirs:m})).code===d.m.Success&&((0,x.SK)("保存成功"),p(),s())}})]}),children:(0,v.jsx)(_.X,{headers:B,rows:m.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:t.default,onChange:e=>{((e,t,s)=>{const n=[];for(let e=0;e<m.length;e++)m[e].default=e===s&&t,n.push(m[e]);j(n)})(0,e,s)},options:P,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)("div",{children:0!==s&&(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{m.splice(e,1),j([...m])})(s)})})];return n}),width:"10rem"})}),(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("个人保护路径")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{te("保护目录")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{C([...k,{path:"",note:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",k)).code===d.m.Success&&((0,x.SK)("保存成功"),p())}})]}),children:(0,v.jsx)(_.X,{headers:M,rows:k.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),C([...k])})(s)})];return n}),width:"10rem"})})]}),(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("目录快捷命令")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{te("目录快捷命令")},title:"info"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A([...b,{cmd:"",note:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:b})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,v.jsx)(_.X,{headers:$,rows:b.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件快捷命令")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{te("文件快捷命令")},title:"info"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...V,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:V})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,v.jsx)(_.X,{headers:G,rows:V.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),N([...V])})(s)})];return n}),width:"10rem"})})]})]}),(0,v.jsxs)(i.VP,{children:[(0,v.jsx)(i.xh,{children:(0,v.jsxs)(a.Zp,{title:e("修改密码"),rightBottomCom:(0,v.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!q||!T)return void(0,x.zN)("账号密码不能为空");if(T!==Z)return void(0,x.zN)("两次密码不一样");const e=new l.tl;e.username=q,e.password=T,e.confirm_password=Z,e.user_id=O.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,v.jsx)(r.Sm,{placeholder:e("新账号"),value:q,handleInputChange:e=>{E(e)}}),(0,v.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{U(e)}}),(0,v.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{H(e)}})]})}),(0,v.jsx)(i.xh,{children:(0,v.jsxs)(a.Zp,{title:e("个性化设置"),rightBottomCom:(0,v.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:Y}})).code===d.m.Success&&((0,x.SK)("修改成功"),s())}}),children:[e("语言"),(0,v.jsx)(r.l6,{value:L,onChange:e=>{Q(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"},{title:"Deutsch",value:"de"},{title:"ドイツ語",value:"ja"},{title:"독일어",value:"ko"},{title:"Немецкий язык",value:"ru"},{title:"Allemand",value:"fr"},{title:"Alemán",value:"es"}]}),e("主题"),(0,v.jsx)(r.l6,{value:J,onChange:e=>{R(e)},options:z}),(0,v.jsx)(r.Sm,{value:Y,handleInputChange:e=>{ee(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})})]})]})})}var q=s(87361);function E(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,v.jsx)(G,{})}];return t(l.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,v.jsx)(O,{})}),t(l.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,v.jsx)(P,{})}),t(l.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,v.jsx)(b,{})}),t(l.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,v.jsx)(M,{})}),t(l.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,v.jsx)($,{})}),(0,v.jsx)(i.W1,{optionList:s,father_route:q.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>_,o:()=>u});var n=s(34843),i=s(82893),l=s(74777),a=s(96540),o=s(22022),r=s(23430),c=s(14284),d=s(74848);function _(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:a}=(0,o.Bd)();return e=>{let n;e===l.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===l.jk.smartmontools?n=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,d.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:n})})}}let h=r.Ky;function u(){const[e,t]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const s=e.data||[];h=[...r.Ky,...s],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>a});var n=s(72635);const i=1440,l=525600;function a(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<l?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/l).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){var n=s(22022);s.d(t,["K",0,()=>{const{t:e}=(0,n.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1472],{75897(e,t,s){s.d(t,{L:()=>i});let n=function(e){return e.username="username",e.password="password",e.password_hash="password_hash",e.navindex_remote_ssh_key="navindex_remote_ssh_key",e.user_id_name_mapping="user_id_name_mapping",e.user_id_info_data_mapping="user_id_info_data_mapping",e.user_unique_id_num="user_unique_id_num",e.role_unique_id_num="role_unique_id_num",e.sys_all_roles="sys_all_roles",e.ddns_http_url_key="ddns_http_url_key",e.ddns_tx_key="tengxun_ddns_key",e.ddns_dnspod_key="ddns_dnspod",e.ddns_ali_key="ali_ddns_key",e.navindex_net_key_list="navindex_net_key_list",e.navindex_wol_key="navindex_wol_key",e.customer_router_key="customer_router_key",e.customer_workflow_router_key="customer_workflow_router_key",e.customer_api_router_key="customer_api_router_key",e.token_setting="token_setting",e.sys_software="sys_software",e.protection_directory="sys_protection_directory",e.dir_upload_max_num="dir_upload_max_num",e.self_auth_jscode="self_auth_jscode",e.navindex_video_key="navindex_video_tag_key",e.systemd_key="systemd_key",e.vir_server_data_key="vir_server_net_data_key",e.vir_client_data_key="vir_client_net_data_key",e.vir_data_client_hash_key="vir_data_client_hash_key",e.vir_data_server_hash_key="vir_data_server_hash_key",e.language="user_language",e.navindex_rdp_key="navindex_rdp_tag_key",e.navindex_key="navindex_key_list",e.http_tag_key="http_tag_key",e.self_shell_cmd_check_open_status="self_shell_cmd_check_open_status",e.self_shell_cmd_jscode="self_shell_cmd_jscode",e.extra_env_path_list_key="extra_env_path_list_key",e.cmd_use_pty_key="cmd_use_pty_key",e.recycle_bin_key="recycle_bin_key",e.recycle_bin_status="recycle_bin_status",e.guid_key="guid_key",e.tcp_proxy_key="tcp_proxy_key",e.sys_env_key="sys_env_key",e.http_server_key="http_server_key",e.proxy_server_code_prefix="proxy_server_code_prefix",e.ai_agent_model_setting="ai_agent_model_setting",e.ai_agent_mcp_setting="ai_agent_mcp_setting",e.ai_agent_docs_setting="ai_agent_docs_setting",e.ai_agent_chat_session_store="ai_agent_chat_session_store",e.share_file_list_key="share_file_list_key",e.share_file_list_key_download_statics="share_file_list_key_download_statics",e.tcp_proxy_server_base="tcp_proxy_server_base",e.tcp_proxy_server_client_list="tcp_proxy_server_client_list",e.tcp_proxy_client_fig="tcp_proxy_client_fig",e.tcp_proxy_client_all_fig="tcp_proxy_client_all_fig",e.tcp_proxy_sync_task_list="tcp_proxy_sync_task_list",e.workflow_setting_item_list="workflow_setting_item_list",e.server_bridge_config_list="server_bridge_config_list",e.ai_agent_status="ai_agent_status",e.ai_system_prompts="ai_system_prompts",e.filecat_plugin_list="filecat_plugin_list",e.https_setting="https_setting",e.ai_rebot_setting="ai_rebot_setting",e.token_cache="token_cache",e.auto_upgrade_setting="auto_upgrade_setting",e.ai_long_term_memory_setting="ai_long_term_memory_setting",e}({});const i=n.self_auth_jscode},77481(e,t,s){s.d(t,{S:()=>a,X:()=>l});var n=s(96540),i=s(74848);function l(e){const[t,s]=n.useState([]);return(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]),(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((e,t)=>(0,i.jsx)("th",{children:e},t))})}),(0,i.jsx)("tbody",{children:t.map((t,s)=>(0,i.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((s,n)=>(0,i.jsx)("td",{style:{width:e.width??"auto"},className:n===t.length-1?"small":"",children:s},n))},s))})]})}function a(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))})}},61472(e,t,s){s.r(t),s.d(t,{default:()=>E});var n=s(96540),i=s(75725),l=s(23430),a=s(70447),o=s(85997),r=s(61443),c=s(14284),d=s(53459),_=s(77481),h=s(22022),u=s(82893),p=s(40505),x=s(62042),m=s(21499),j=s(21469),v=s(74848);function g(e){const{t}=(0,h.Bd)(),[s,l]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();l(t)}})()},[]);return(0,v.jsx)(i.xh,{children:(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e.title}),e.info_click&&(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");l([t,...s])}}),(0,v.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,v.jsx)(_.X,{headers:e.headers,rows:s.map((n,i)=>{const a=[];for(let t=0;t<e.headers.length;t++)a.push((0,v.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,l([...s])},no_border:!0}));return a.push((0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),l([...s])})(i)}),n[0]&&(0,v.jsx)(o.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,p.lW)(e),(0,x.SK)(e)}}),n[0]&&e.need_copy&&(0,v.jsx)(o.rA,{icon:"open_in_new",title:t("打开新页面"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);window.open(e)}})]})),a}),width:"10rem"})})})}var f=s(34843),y=s(78247),w=s(24659);function k(){const{t:e}=(0,h.Bd)(),[t,s]=(0,f.fp)(u.AG.prompt_card),l=(0,w.K)(),g=[e("路由"),e("auth"),e("备注")],[k,S]=(0,f.fp)(u.AG.editorSetting),[C,b]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("api/customer_router");e.code===d.m.Success&&b(e.data)})()},[]);return(0,v.jsx)(i.xh,{children:(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("自定义api路由")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b([{note:"",needAuth:!1,router:""},...C])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",C)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:(0,v.jsx)(_.X,{headers:g,rows:C.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,b([...C])},no_border:!0}),(0,v.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,b([...C])},options:l,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,b([...C])},no_border:!0}),(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),b([...C])})(s)}),(0,v.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,x.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);S({model:"ace/mode/javascript",open:!0,fileName:e.router,save:async t=>{const s={context:t,router:e.router};(await c.XO.post("jscode/save",s)).code===d.m.Success&&(y.xK.set_value_temp(""),S({open:!1,model:"",fileName:"",save:null}),(0,x.SK)("成功"))}}),y.xK.set_value_temp(t.data)})(t)}),t.router&&(0,v.jsx)(o.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,p.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,x.SK)(e("已复制"))}})]})];return n}),width:"10rem"})})})}var S=s(23496),C=s(57952);function b(){const{t:e}=(0,h.Bd)(),[t,s]=(0,f.fp)(u.AG.prompt_card),[l,a]=(0,f.fp)(u.AG.router_jump),o=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)(C.A,{}),(0,v.jsxs)(i.fI,{children:[(0,v.jsxs)(i.VP,{children:[(0,v.jsx)(g,{title:e("页面资源路由"),headers:o,getItems:async()=>{const e=await c.XO.get(S.s.setting_customer_router);if(e.code===d.m.Success){if(l?.page_self_router_api_data){for(const t of e.data)t[1]===l?.page_self_router_api_data[1]&&(0,x.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,l?.page_self_router_api_data),e.data=[t,...e.data],a({})}return e.data}return[]},save:async e=>{(await c.XO.post(S.s.setting_customer_router_save,e)).code===d.m.Success&&(0,x.SK)("success")},info_click:()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})},need_copy:!0}),(0,v.jsx)(g,{title:e("workflow触发路由"),headers:r,getItems:async()=>{const e=await c.XO.get(S.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(S.s.setting_customer_workflow_router_save,e)).code===d.m.Success&&(0,x.SK)("保存成功")},info_click:()=>{let e=(0,v.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e})})}})]}),(0,v.jsx)(i.VP,{children:(0,v.jsx)(k,{})})]})]})}var A=s(75897),I=s(74777),V=s(6960),X=s(7523);function N(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)(),[s,i]=(0,n.useState)(!1),[_,p]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[g,w]=(0,n.useState)(180),[k,S]=(0,n.useState)(!1),[C,b]=(0,f.fp)(u.AG.prompt_card);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("auto_upgrade_setting");if(e.code===d.m.Success){const t=e.data;i(t.open||!1),p(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),w(t.check_interval_seconds||180)}})()},[]);return t(l.oV.sys_setting_page)?(0,v.jsxs)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("自动升级")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{b({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:"信息"})]}),rightBottomCom:(0,v.jsx)(o.C3,{text:e("保存"),clickFun:async()=>{if(!_)return void(0,x.zN)(e("版本检测地址不能为空"));if(s&&(!g||g<10))return void(0,x.zN)(e("检测间隔不能小于10秒"));const t=new I.Mm;t.open=s,t.version_check_url=_,t.exe_download_url=m,t.check_interval_seconds=g;(await c.XO.post("auto_upgrade_setting/save",t)).code===d.m.Success&&(0,x.SK)(e("保存成功"))}}),children:[(0,v.jsx)("div",{children:e("系统版本检测地址")}),(0,v.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:_,handleInputChange:e=>{p(e)}}),(0,v.jsx)(r.l6,{value:s,onChange:e=>{i(e)},options:[{title:e("开启"),value:!0},{title:e("关闭"),value:!1}]}),s&&(0,v.jsxs)(v.Fragment,{children:[!1,(0,v.jsx)("div",{children:e("检测频率(秒)")}),(0,v.jsx)(r.Sm,{placeholder:e("默认180秒(3分钟)"),value:g,handleInputChange:e=>{w(Number(e)||180)}}),(0,v.jsx)("div",{style:{marginTop:"12px"},children:(0,v.jsx)(o.C3,{text:e(k?"升级检测中...":"立即升级"),clickFun:async()=>{S(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,x.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,x.zN)(e("触发升级失败"))}finally{S(!1)}}})})]})]}):null}function O(){const[e,t]=(0,n.useState)(""),[s,l]=(0,n.useState)(!1),[p,m]=(0,n.useState)(!1),[j,g]=(0,n.useState)(!1),[w,k]=(0,n.useState)(!1),[b,O]=(0,n.useState)(""),[F,K]=(0,f.fp)(u.AG.prompt_card),[P,z]=(0,n.useState)(!1),[B,M]=(0,n.useState)(""),[$,G]=(0,n.useState)(""),[q,E]=(0,f.fp)(u.AG.editorSetting),[T,U]=(0,n.useState)(I.aM.close),[Z,H]=(0,n.useState)(!1),[D,W]=(0,n.useState)(void 0),{t:L,i18n:Q}=(0,h.Bd)(),[J,R]=(0,f.fp)(u.AG.user_base_info),{check_user_auth:Y}=(0,y.MH)(),{initUserInfo:ee}=(0,n.useContext)(X.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){m(e.data.self_auth_open),g(e.data.shell_cmd_check_open),k(e.data.recycle_open),O(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),l(s?.show_login_user_info);const n=e.data.https_setting;n&&(z(n.open),M(n.cert_path||""),G(n.key_path||""))}const s=await c.XO.get("token");if(s.code===d.m.Success){const e=s.data;if(!e)return;e.length&&W(e.length),e.mode&&U(e.mode),void 0!==e.persist&&H(e.persist)}})()},[]);return(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:30,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.Zp,{title:L("自定义登录auth"),rightBottomCom:(0,v.jsx)(o.C3,{text:L("保存"),clickFun:async()=>{(await c.XO.post("self_auth_open/save",{open:p})).code===d.m.Success&&(0,x.SK)("修改成功")}}),titleCom:(0,v.jsx)(o.rA,{icon:"edit",title:L("代码修改"),onClick:async()=>{const e=await c.XO.get("self_auth_open/jscode");E({model:"ace/mode/javascript",open:!0,fileName:"",save:async e=>{const t={context:e,router:A.L};0===(await c.XO.post("jscode/save",t)).code&&(y.xK.set_value_temp(""),E({open:!1,model:"",fileName:"",save:null}))}}),y.xK.set_value_temp(e.data)}}),children:(0,v.jsx)(r.l6,{value:p,onChange:e=>{m(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]})}),(0,v.jsx)(a.Zp,{title:L("自定义shell命令校验"),rightBottomCom:(0,v.jsx)(o.C3,{text:L("保存"),clickFun:async()=>{(await c.XO.post("shell_cmd_check_open/save",{open:j})).code===d.m.Success&&(0,x.SK)("修改成功")}}),titleCom:(0,v.jsx)(o.rA,{icon:"edit",title:L("代码修改"),onClick:async()=>{const e=await c.XO.get("shell_cmd_check_open/jscode");E({model:"ace/mode/javascript",open:!0,fileName:"",save:async e=>{const t={context:e};0===(await c.XO.post("shell_cmd_check_open/jscode/save",t)).code&&(y.xK.set_value_temp(""),E({open:!1,model:"",fileName:"",save:null}))}}),y.xK.set_value_temp(e.data)}}),children:(0,v.jsx)(r.l6,{value:j,onChange:e=>{g(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]})})]})}),(0,v.jsx)(i.VP,{widthPer:30,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsxs)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:L("文件回收站")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{K({open:!0,title:"信息",context_div:(0,v.jsx)("div",{children:L("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:"信息"})]}),rightBottomCom:(0,v.jsx)(o.C3,{text:L("确定修改"),clickFun:async()=>{if(w&&!b)return void(0,x.zN)("目录不能为空");(await c.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:b,open:w})).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,v.jsx)(r.Sm,{placeholder:L("目录"),value:b,handleInputChange:e=>{O(e)}}),(0,v.jsx)(r.l6,{value:w,onChange:e=>{k(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]})]}),(0,v.jsxs)(a.Zp,{title:L("token过期时间"),rightBottomCom:(0,v.jsx)(_.S,{isFlex:!0,columns:[(0,v.jsx)(o.C3,{text:L("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,x.SK)("清理完成,重新登录")}}),(0,v.jsx)(o.C3,{text:L("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=T,e.persist=Z,I.aM.length!==e.mode||D||(0,x.zN)("秒数不能为空"),e.length=parseInt(D);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:[(0,v.jsx)(_.S,{isFlex:!0,columns:[(0,v.jsx)(r.U6,{value:1,context:L("关闭"),selected:T===I.aM.close,onchange:()=>{U(I.aM.close)}}),(0,v.jsx)(r.U6,{value:1,context:L("指定时间"),selected:T===I.aM.length,onchange:()=>{U(I.aM.length)}}),(0,v.jsx)(r.U6,{value:1,context:L("永不过期"),selected:T===I.aM.forver,onchange:()=>{U(I.aM.forver)}})]}),T===I.aM.length&&(0,v.jsx)(r.Sm,{placeholder:L("秒"),value:D,handleInputChange:e=>{W(e)}}),(0,v.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,v.jsx)("input",{type:"checkbox",checked:Z,onChange:()=>H(!Z)}),L("持久化")]})]})]})}),(0,v.jsx)(i.VP,{widthPer:40,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsxs)(a.Zp,{title:L("通用设置"),rightBottomCom:(0,v.jsx)(o.C3,{text:L("确定修改"),clickFun:async()=>{(await c.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:s}})).code===d.m.Success&&((0,x.SK)("修改成功"),ee())}}),children:[L("网站标题"),(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),L("登陆展示用户信息"),(0,v.jsx)("input",{type:"checkbox",checked:s,onChange:()=>{l(!s)}})]}),(0,v.jsxs)(a.Zp,{title:L("HTTPS 设置"),rightBottomCom:(0,v.jsx)(o.C3,{text:L("确定修改"),clickFun:async()=>{if(P){if(!B)return void(0,x.zN)("证书路径不能为空");if(!$)return void(0,x.zN)("私钥路径不能为空")}const e=new I.CH;e.open=P,e.cert_path=B,e.key_path=$;(await c.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:P})).code===d.m.Success&&(0,x.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,v.jsx)(r.l6,{value:P,onChange:e=>{z(e)},options:[{title:L("开启"),value:!0},{title:L("关闭"),value:!1}]}),P&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:L("SSL 证书路径")}),(0,v.jsx)(r.Sm,{placeholder:L("证书文件路径(cert.pem/fullchain.pem)"),value:B,handleInputChange:e=>{M(e)}}),(0,v.jsx)("div",{children:L("SSL 私钥路径")}),(0,v.jsx)(r.Sm,{placeholder:L("私钥文件路径(privkey.pem)"),value:$,handleInputChange:e=>{G(e)}})]})]}),(0,v.jsx)(N,{})]})}),(0,v.jsx)(C.A,{left_children:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("span",{className:"credits",children:[L("系统运行于"),": ",(0,V.s)(J.runing_time_length)]}),(0,v.jsx)("span",{className:"credits",children:(0,v.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:6.44.0",null!=J.latest_version&&"6.44.0"!==J.latest_version?` -> ${J.latest_version}`:""]})}),(0,v.jsx)("span",{className:"credits",children:(0,v.jsx)("a",{href:L("官网地址"),target:"_blank",children:`filecat ${L("功能文档")}`})}),(0,v.jsxs)("span",{className:"credits",children:[L("安装方式")," :",J.process_env_run_env]})]})})]})}var F=s(64694),K=s(92350);function P(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:l}=(0,n.useContext)(X.F),[p,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[k,S]=(0,f.fp)(u.AG.prompt_card),[C,b]=(0,n.useState)([]),[A,I]=(0,n.useState)([]),[V,N]=(0,n.useState)([]),[O,P]=(0,n.useState)([]),[z,B]=(0,n.useState)(""),[M,$]=(0,n.useState)([]),G=(0,w.K)(),q=[e("软件"),e("是否安装"),e("路径")],E=[e("编号"),e("路径"),e("备注")],T=[e("编号"),e("路径"),e("是否开启"),e("备注")],U=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("是否开启大文件断点"),e("大文件判断大小MB"),e("大文件并发数量"),e("大文件分块大小MB"),e("备注")],H=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:D}=(0,y.MH)(),W=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&N(e.data)},L=async()=>{const e=await c.XO.get("workflow_setting_get");e.code===d.m.Success&&P(e.data)};(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("outside/software/get");e.code===d.m.Success&&g(e.data);const t=await c.XO.get("pty_cmd");t.code===d.m.Success&&B(t.data),W(),L();const s=await c.XO.get("protection_dir/sys");s.code===d.m.Success&&b(s.data??[]);const n=await c.XO.get("dir_upload_max_num");n.code===d.m.Success&&I(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&$(i.data??[])})()},[]);const Q=(0,K.Q)(),J=async()=>{(await c.XO.post("plugin/list/save",M)).code===d.m.Success&&(0,x.SK)(e("保存成功"))};return(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)(i.J,{widthPer:100,children:(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件上传最大并发限制")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:"",user_upload_num:2,sys_upload_num:6,ws_file_standard_size:52428800,ws_file_parallel_num:2,ws_file_block_mb_size:524288}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of A)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,x.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,x.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,x.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,F.di)(A,e=>e.index);(await c.XO.post("dir_upload_max_num/save",A)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),children:(0,v.jsx)(_.X,{headers:Z,rows:A.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,I([...A])},options:G,no_border:!0}),(0,v.jsx)(r.Sm,{value:"number"==typeof t.ws_file_standard_size?t.ws_file_standard_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_standard_size=1024*parseInt(e)*1024},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,v.jsx)(r.Sm,{value:"number"==typeof t.ws_file_block_mb_size?t.ws_file_block_mb_size/1024/1024:void 0,handleInputChange:e=>{t.ws_file_block_mb_size=1024*parseInt(e)*1024},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem"})})}),(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("PATH")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...V,{path:"",note:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:V})).code===d.m.Success&&((0,x.SK)("保存成功"),W(),s())}})]}),children:(0,v.jsx)(_.X,{headers:T,rows:V.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,N([...V])},options:G,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),N([...V])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("PTY CMD")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:"信息"})]}),rightBottomCom:(0,v.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:z})).code===d.m.Success&&((0,x.SK)("保存成功"),l())}}),children:(0,v.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:z,handleInputChange:e=>{B(e)}})}),(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("Workflow Job")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{open:!1}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",O)).code===d.m.Success&&((0,x.SK)("ok"),L())}})]}),children:(0,v.jsx)(_.X,{headers:U,rows:O.map((t,s)=>[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...O])},options:G,no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...O])},options:G,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cron_str,handleInputChange:e=>{t.cron_str=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>()=>{P([...O.splice(s,1)])}})]),width:"10rem"})}),(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("插件配置")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...M,{name:"",path:"",note:"",open:!1}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,v.jsx)(_.X,{headers:H,rows:M.map((t,s)=>{const n=[s,(0,v.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,$([...M])},options:G,no_border:!0}),(0,v.jsx)(o.mu,{icon:"edit",save:async e=>{t.params=e,await J()},title:""}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{M.splice(e,1),$([...M])})(s)})];return n}),width:"10rem"})})]})}),(0,v.jsx)(i.VP,{children:(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("系统保护路径")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...C,{path:"",note:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",C)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),children:(0,v.jsx)(_.X,{headers:E,rows:C.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),b([...C])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(a.uF,{title:e("外部软件"),titleCom:(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,x.SK)("保存成功"),s())}}),children:(0,v.jsx)(_.X,{headers:q,rows:j.map((t,s)=>[(0,v.jsx)("div",{children:t.id}),(0,v.jsx)(a.fq,{ok:t.installed}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("默认使用环境变量")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{Q(t.id)},title:"信息"})]),width:"10rem"})})]})})]})]})}function z(e){const{t,i18n:s}=(0,h.Bd)(),[i,a]=(0,f.fp)(u.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:l.oV.user_manage},{title:t("角色管理"),permission:l.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:l.oV.all_sys},{title:t("系统进程关闭"),permission:l.oV.sys_process_close},{title:t("docker容器停止、删除"),permission:l.oV.docker_container_update},{title:t("docker镜像删除"),permission:l.oV.docker_images_delete},{title:t("systemd删除、添加管理"),permission:l.oV.systemd_update}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:l.oV.vir_net},{title:t("内网穿透"),permission:l.oV.tcp_proxy},{title:"ddns",permission:l.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:l.oV.ai_agent_setting},{title:t("Ai Chat Page"),permission:l.oV.ai_agent_page}]},{title:t("文件权限"),list:[{title:t("文件删除、剪切、重命名"),permission:l.oV.filecat_file_delete_cut_rename},{title:t("文件创建、上传、内容更新、解压缩"),permission:l.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:l.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:l.oV.recycle_file_save},{title:t("文件分享"),permission:l.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:l.oV.sys_setting_page},{title:t("htts"),permission:l.oV.https_file},{title:t("token时间修改"),permission:l.oV.token_update},{title:t("自定义auth"),permission:l.oV.code_auth},{title:t("修改密码"),permission:l.oV.update_password},{title:t("磁盘挂载"),permission:l.oV.sys_disk_mount},{title:t("通用设置"),permission:l.oV.sys_env_setting_key},{title:t("shell命令检测"),permission:l.oV.shell_cmd_check}]},{title:t("系统环境设置"),list:[{title:t("系统环境设置页面"),permission:l.oV.sys_env_page},{title:t("目录文件上传数量限制修改"),permission:l.oV.dir_upload_max_num},{title:t("PATH路径修改"),permission:l.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:l.oV.pty_cmd_update},{title:"workflow job",permission:l.oV.workflow_job},{title:t("系统保护路径更新"),permission:l.oV.sys_protection_dir},{title:t("外部软件路径"),permission:l.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:l.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:l.oV.auth_router_page},{title:t("workflow触发api 修改"),permission:l.oV.workflow_api},{title:t("自定义资源路由"),permission:l.oV.code_resource},{title:t("自定义api路由"),permission:l.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("网址导航"),permission:l.oV.net_site_tag_update},{title:t("ssh代理"),permission:l.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:l.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:l.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:l.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:l.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy},{title:t("http代理"),permission:l.oV.http_proxy},{title:t("http代理下载关闭"),permission:l.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:l.oV.browser_proxy},{title:t("rdp代理"),permission:l.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("workflow 执行"),permission:l.oV.workflow_exe},{title:t("workflow 执行用户"),permission:l.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:l.oV.wol_proxy},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy},{title:t("ssh密钥保存到磁盘"),permission:l.oV.crypto_ssh_file},{title:t("网址导航"),permission:l.oV.nav_net_tag},{title:t("filecat-restart重启命令"),permission:l.oV.shell_cmd_filecat_restart},{title:t("filecat-upgrade升级命令"),permission:l.oV.shell_cmd_filecat_upgrade},{title:t("filecat-down关闭主进程命令"),permission:l.oV.shell_cmd_filecat_kill_self},{title:t("ai 命令(Ai 聊天)"),permission:l.oV.ai_chat_cmd}]}];return(0,v.jsx)(n.Fragment,{children:o.map((t,s)=>(0,v.jsxs)("div",{children:[(0,v.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,v.jsxs)("div",{children:[(0,v.jsx)("input",{type:"checkbox",disabled:!t.noDisable&&e.is_disable(t.permission),checked:e.is_selected(t.permission,t.noDisable),onChange:()=>{e.select_auth(t.permission)}}),t.title]},s))]},s))})}const B=new Map;function M(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:p}=(0,n.useContext)(X.F),[j,g]=(0,f.fp)(u.AG.user_base_info),[y,w]=(0,n.useState)([]),[k,S]=(0,f.fp)(u.AG.prompt_card),[C,b]=(0,n.useState)(!1),[A,I]=(0,n.useState)(!1),[V,N]=(0,f.fp)(u.AG.confirm),[O,P]=(0,n.useState)(""),[M,$]=(0,n.useState)(""),[G,q]=(0,n.useState)(""),[E,T]=(0,n.useState)([]),[U,Z]=(0,n.useState)([]),[H,D]=(0,n.useState)([]),[W,L]=(0,n.useState)(""),[Q,J]=(0,n.useState)(""),[R,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,le]=(0,n.useState)(""),[ae,oe]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,_e]=(0,n.useState)(""),[he,ue]=(0,n.useState)({}),pe=(0,K.o)(),[xe,me]=(0,n.useState)([]),je=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ve=async()=>{const e=await c.wm.get("all_users");e.code===d.m.Success&&w(e.data);const t=await c.wm.get("all_roles");if(t.code===d.m.Success){me(t.data),B.clear();for(const e of t.data)B.set(e.role_id,e)}},ge=e=>{P(e?.username??""),$(e?.password??""),q(e?.cwd??""),T(e?.access_dirs??[]),Z(e?.not_access_dirs??[]),D(e?.only_read_dirs??[]),L(e?.access_cmd??""),J(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),le(e?.note??""),oe(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?fe(e.bind_role_id,e.auth_list??[]):(_e(""),ue({}))};(0,n.useEffect)(()=>{ve()},[]);const fe=(e,t=[])=>{if(!e)return _e(""),void ue({});const s=B.get(e);if(s){if(s.cwd&&q(s.cwd),s.access_dirs&&s.access_dirs.length>0&&T(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&Z(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&D(s.only_read_dirs),s.access_cmd&&L(s.access_cmd),s.not_access_cmd&&J(s.not_access_cmd),s.language&&Y(s.language),s.theme&&te(s.theme),s.auth_list&&s.auth_list.length>0){const e=new Set(s.auth_list);for(const s of t)e.add(s);ne(Array.from(e))}_e(e),ue(s)}},ye=()=>{if(!O)return void(0,x.zN)("username not empty");if((0,m.CB)(O))return void(0,x.zN)("username not empty char");if(!G)return void(0,x.zN)("cwd not empty");const e=new l.E0;return e.language=R,e.theme=ee,e.access_dirs=E,e.username=O,e.password=M,e.not_access_dirs=U,e.only_read_dirs=H,e.cwd=G,e.note=ie,e.access_cmd=W,e.not_access_cmd=Q,e.auth_list=se,e.bind_role_id=de,e};return(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsx)(i.xh,{children:(0,v.jsx)(a.uF,{self_title:(0,v.jsx)("span",{className:" div-row ",children:(0,v.jsx)("h2",{children:e("用户")})}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b(!0),I(!1),ge(void 0)}})}),children:(0,v.jsx)(_.X,{headers:je,rows:y.map((t,s)=>{const n=[(0,v.jsx)("p",{children:t.id}),(0,v.jsx)(a.xP,{children:t.username}),(0,v.jsx)(a.xP,{children:t.cwd}),(0,v.jsx)(a.xP,{children:t.note}),(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{b(!1),I(!0),ge(e)})(t)}),!t.is_root&&(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{N({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ve(),N({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,v.jsx)(i.VP,{widthPer:50,children:(C||A)&&(0,v.jsx)(i.xh,{children:(0,v.jsxs)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e(""+(C?"添加":"编辑"))})," "]}),rightBottomCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{b(!1),I(!1),ge(void 0)}}),C&&(0,v.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!M)return void(0,x.zN)("password not empty");if((0,m.CB)(M))return void(0,x.zN)("username not empty char");const e=ye(),t=await c.wm.post("create_user",e);ve(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ve(),b(!1),I(!1),ge(void 0))}}),A&&(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ye();if(!e)return;e.id=re;(await c.wm.post("save_user",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ve())}})]}),children:[(0,v.jsx)("label",{children:e("用户名")}),(0,v.jsx)(r.Sm,{value:O,handleInputChange:e=>P(e)}),(0,v.jsx)("label",{children:e("密码")}),(0,v.jsx)(r.Sm,{type:"password",value:M,handleInputChange:e=>$(e)}),(0,v.jsxs)("label",{children:[!he?.access_dirs?.length&&(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{T([...E,""])},title:"添加"}),e("目录范围")]}),(0,v.jsx)(r.Sm,{disabled:""!==he.cwd&&void 0!==he.cwd,value:G,handleInputChange:e=>q(e)}),(E??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==he?.access_dirs?.length&&void 0!==he?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,T([...E])}})}),0===he?.access_dirs?.length||void 0===he?.access_dirs?.length&&(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{E.splice(s,1),T([...E])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[!he?.not_access_dirs?.length&&(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{Z([...U,""])},title:e("添加")}),e("禁止目录范围")]}),(U??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==he?.not_access_dirs?.length&&void 0!==he?.not_access_dirs?.length,value:t,handleInputChange:e=>{U[s]=e,Z([...U])}})}),0===he?.not_access_dirs?.length||void 0===he?.not_access_dirs?.length&&(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{U.splice(s,1),Z([...U])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[!he?.only_read_dirs?.length&&(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{D([...H,""])},title:e("添加")}),e("只读目录范围")]}),(H??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{disabled:0!==he?.only_read_dirs?.length&&void 0!==he?.only_read_dirs?.length,value:t,handleInputChange:e=>{H[s]=e,D([...H])}})}),0===he?.only_read_dirs?.length||void 0===he?.only_read_dirs?.length&&(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{H.splice(s,1),D([...H])},title:e("删除")})]},s)),(0,v.jsx)("label",{children:e("可执行的命令")}),(0,v.jsx)(r.Sm,{disabled:""!==he.access_cmd&&void 0!==he.access_cmd,value:W,placeholder:"use blank split",handleInputChange:e=>L(e)}),(0,v.jsx)("label",{children:e("禁止执行的命令")}),(0,v.jsx)(r.Sm,{disabled:""!==he.not_access_cmd&&void 0!==he.not_access_cmd,value:Q,placeholder:"use blank split",handleInputChange:e=>J(e)}),!ae&&(0,v.jsxs)(n.Fragment,{children:[(0,v.jsx)("label",{children:e("角色")}),(0,v.jsx)(r.l6,{value:de,onChange:e=>{fe(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of xe)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,v.jsx)("label",{children:e("语言")}),(0,v.jsx)(r.l6,{disabled:""!==he.language&&void 0!==he.language,value:R,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,v.jsx)("label",{children:e("主题")}),(0,v.jsx)(r.l6,{disabled:""!==he.theme&&void 0!==he.theme,value:ee,onChange:e=>{te(e)},options:pe}),(0,v.jsx)(z,{is_disable:e=>{if(!0===ae)return!0;if(de){const t=B.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===ae||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,F.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,v.jsx)("label",{children:e("备注")}),(0,v.jsx)(r.Sm,{value:ie,handleInputChange:e=>le(e)})]})})})]})}function $(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s}=(0,n.useContext)(X.F),[p,m]=(0,n.useState)([]),[j,g]=(0,f.fp)(u.AG.prompt_card),[y,w]=(0,n.useState)(!1),[k,S]=(0,n.useState)(!1),[C,b]=(0,f.fp)(u.AG.confirm),[A,I]=(0,n.useState)(""),[V,N]=(0,n.useState)(""),[O,P]=(0,n.useState)([]),[B,M]=(0,n.useState)([]),[$,G]=(0,n.useState)([]),[q,E]=(0,n.useState)(""),[T,U]=(0,n.useState)(""),[Z,H]=(0,n.useState)(""),[D,W]=(0,n.useState)(""),[L,Q]=(0,n.useState)([]),[J,R]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,K.o)(),se=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await c.wm.get("all_roles");e.code===d.m.Success&&m(e.data)},ie=e=>{I(e?.role_name??""),N(e?.cwd??""),P(e?.access_dirs??[]),M(e?.not_access_dirs??[]),G(e?.only_read_dirs??[]),E(e?.access_cmd??""),U(e?.not_access_cmd??""),H(e?.language??""),W(e?.theme??""),Q(e?.auth_list??[]),R(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const le=()=>{if(!A)return void(0,x.zN)("role_name not empty");const e=new l.E0;return e.language=Z,e.theme=D,e.access_dirs=O,e.role_name=A,e.not_access_dirs=B,e.only_read_dirs=$,e.cwd=V,e.access_cmd=q,e.not_access_cmd=T,e.auth_list=L,e.role_note=Y,e};return(0,v.jsxs)(i.fI,{children:[(0,v.jsx)(i.VP,{widthPer:50,children:(0,v.jsx)(i.xh,{children:(0,v.jsx)(a.uF,{self_title:(0,v.jsx)("span",{className:" div-row ",children:(0,v.jsx)("h2",{children:e("角色")})}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{w(!0),S(!1),ie(void 0)}})}),children:(0,v.jsx)(_.X,{headers:se,rows:p.map((t,s)=>{const n=[(0,v.jsx)("p",{children:t.role_id}),(0,v.jsx)(a.xP,{children:t.role_name}),(0,v.jsx)(a.xP,{children:t.role_note}),(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{w(!1),S(!0),ie(e)})(t)}),!t.is_root&&(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{b({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ne(),b({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,v.jsx)(i.VP,{widthPer:50,children:(y||k)&&(0,v.jsx)(i.xh,{children:(0,v.jsxs)(a.Zp,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e(""+(y?"添加":"编辑"))})," "]}),rightBottomCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{w(!1),S(!1),ie(void 0)}}),y&&(0,v.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=le();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ne(),w(!1),S(!1),ie(void 0))}}),k&&(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=le();if(!e)return;e.role_id=J;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ne())}})]}),children:[(0,v.jsx)("label",{children:e("角色名")}),(0,v.jsx)(r.Sm,{value:A,handleInputChange:e=>I(e)}),(0,v.jsx)("label",{children:e("角色备注")}),(0,v.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,v.jsxs)("label",{children:[(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{P([...O,""])},title:"添加"}),e("目录范围")]}),(0,v.jsx)(r.Sm,{value:V,handleInputChange:e=>N(e)}),(O??[]).map((e,t)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{O[t]=e,P([...O])}})}),(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{O.splice(t,1),P([...O])},title:"删除"})]},t)),(0,v.jsxs)("label",{children:[(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{M([...B,""])},title:"添加"}),e("禁止目录范围")]}),(B??[]).map((t,s)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:t,handleInputChange:e=>{B[s]=e,M([...B])}})}),(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{B.splice(s,1),M([...B])},title:e("删除")})]},s)),(0,v.jsxs)("label",{children:[(0,v.jsx)(o.rA,{icon:"add",onClick:()=>{G([...$,""])},title:e("添加")}),e("只读目录范围")]}),($??[]).map((e,t)=>(0,v.jsxs)("div",{style:{display:"flex"},children:[(0,v.jsx)("div",{style:{width:"90%"},children:(0,v.jsx)(r.Sm,{value:e,handleInputChange:e=>{$[t]=e,G([...$])}})}),(0,v.jsx)(o.rA,{icon:"delete",onClick:()=>{$.splice(t,1),G([...$])},title:"删除"})]},t)),(0,v.jsx)("label",{children:e("可执行的命令")}),(0,v.jsx)(r.Sm,{value:q,placeholder:"use blank split",handleInputChange:e=>E(e)}),(0,v.jsx)("label",{children:e("禁止执行的命令")}),(0,v.jsx)(r.Sm,{value:T,placeholder:"use blank split",handleInputChange:e=>U(e)}),(0,v.jsx)("label",{children:e("语言")}),(0,v.jsx)(r.l6,{value:Z,onChange:e=>{H(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,v.jsx)("label",{children:e("主题")}),(0,v.jsx)(r.l6,{value:D,onChange:e=>{W(e)},options:te}),(0,v.jsx)(z,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==L?.find(t=>t===e),select_auth:e=>{L?(L.find(t=>t==e)?(0,F.I)(L,t=>t===e):L.push(e),Q([...L])):Q([e])}})]})})})]})}function G(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:p}=(0,n.useContext)(X.F),[m,j]=(0,n.useState)([]),[g,y]=(0,f.fp)(u.AG.prompt_card),[k,C]=(0,n.useState)([]),[b,A]=(0,n.useState)([]),[V,N]=(0,n.useState)([]),[O,F]=(0,f.fp)(u.AG.user_base_info),P=(0,w.K)(),z=(0,K.o)(),B=[e("编号"),e("路径"),e("是否默认"),e("备注")],M=[e("编号"),e("路径"),e("备注")],$=[e("编号"),e("命令"),e("父编号"),e("备注")],G=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[q,E]=(0,n.useState)(""),[T,U]=(0,n.useState)(""),[Z,H]=(0,n.useState)(""),[D,W]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,R]=(0,n.useState)(""),[Y,ee]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),A(e.data.quick_cmd),N(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&C(t.data??[])})(),Q(O?.user_data?.language),R(O?.user_data?.theme),ee(O?.user_data?.upload_file_ignore)},[]);const te=(0,K.Q)();return(0,v.jsx)(n.Fragment,{children:(0,v.jsxs)(i.fI,{children:[(0,v.jsxs)(i.VP,{children:[(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件夹路径")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{te("文件夹路径")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<m.length;e++)m[e].index=e;(await c.XO.post("filesSetting/save",{dirs:m})).code===d.m.Success&&((0,x.SK)("保存成功"),p(),s())}})]}),children:(0,v.jsx)(_.X,{headers:B,rows:m.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.l6,{value:t.default,onChange:e=>{((e,t,s)=>{const n=[];for(let e=0;e<m.length;e++)m[e].default=e===s&&t,n.push(m[e]);j(n)})(0,e,s)},options:P,no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)("div",{children:0!==s&&(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{m.splice(e,1),j([...m])})(s)})})];return n}),width:"10rem"})}),(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("个人保护路径")})," ",(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{te("保护目录")},title:"信息"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{C([...k,{path:"",note:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",k)).code===d.m.Success&&((0,x.SK)("保存成功"),p())}})]}),children:(0,v.jsx)(_.X,{headers:M,rows:k.map((t,s)=>{const n=[(0,v.jsx)("div",{children:s}),(0,v.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),C([...k])})(s)})];return n}),width:"10rem"})})]}),(0,v.jsxs)(i.xh,{children:[(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("目录快捷命令")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{te("目录快捷命令")},title:"info"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A([...b,{cmd:"",note:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:b})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,v.jsx)(_.X,{headers:$,rows:b.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)})];return n}),width:"10rem"})}),(0,v.jsx)(a.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e("文件快捷命令")}),(0,v.jsx)(o.rA,{icon:"info",onClick:()=>{te("文件快捷命令")},title:"info"})]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...V,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,v.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:V})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,v.jsx)(_.X,{headers:G,rows:V.map((t,s)=>{const n=[(0,v.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,v.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,v.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),N([...V])})(s)})];return n}),width:"10rem"})})]})]}),(0,v.jsxs)(i.VP,{children:[(0,v.jsx)(i.xh,{children:(0,v.jsxs)(a.Zp,{title:e("修改密码"),rightBottomCom:(0,v.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!q||!T)return void(0,x.zN)("账号密码不能为空");if(T!==Z)return void(0,x.zN)("两次密码不一样");const e=new l.tl;e.username=q,e.password=T,e.confirm_password=Z,e.user_id=O.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,v.jsx)(r.Sm,{placeholder:e("新账号"),value:q,handleInputChange:e=>{E(e)}}),(0,v.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{U(e)}}),(0,v.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{H(e)}})]})}),(0,v.jsx)(i.xh,{children:(0,v.jsxs)(a.Zp,{title:e("个性化设置"),rightBottomCom:(0,v.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(S.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:Y}})).code===d.m.Success&&((0,x.SK)("修改成功"),s())}}),children:[e("语言"),(0,v.jsx)(r.l6,{value:L,onChange:e=>{Q(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"},{title:"Deutsch",value:"de"},{title:"ドイツ語",value:"ja"},{title:"독일어",value:"ko"},{title:"Немецкий язык",value:"ru"},{title:"Allemand",value:"fr"},{title:"Alemán",value:"es"}]}),e("主题"),(0,v.jsx)(r.l6,{value:J,onChange:e=>{R(e)},options:z}),(0,v.jsx)(r.Sm,{value:Y,handleInputChange:e=>{ee(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})})]})]})})}var q=s(87361);function E(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,v.jsx)(G,{})}];return t(l.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,v.jsx)(O,{})}),t(l.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,v.jsx)(P,{})}),t(l.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,v.jsx)(b,{})}),t(l.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,v.jsx)(M,{})}),t(l.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,v.jsx)($,{})}),(0,v.jsx)(i.W1,{optionList:s,father_route:q.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>_,o:()=>u});var n=s(34843),i=s(82893),l=s(74777),a=s(96540),o=s(22022),r=s(23430),c=s(14284),d=s(74848);function _(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:a}=(0,o.Bd)();return e=>{let n;e===l.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===l.jk.smartmontools?n=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,d.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:n})})}}let h=r.Ky;function u(){const[e,t]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const s=e.data||[];h=[...r.Ky,...s],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>a});var n=s(72635);const i=1440,l=525600;function a(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<l?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/l).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){var n=s(22022);s.d(t,["K",0,()=>{const{t:e}=(0,n.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2674],{92674(e,t,n){n.r(t),n.d(t,{default:()=>j});var a=n(96540),o=n(82893),i=n(34843),s=n(85997),l=n(57952),r=n(47022),c=n(34251),d=n(74848);function p(e){{const[t,n]=(0,a.useState)(!1),[o,i]=(0,a.useState)([]),l=e=>{i(e)},h=async()=>{"folder"===e.type?(t||!e.click||o||await e.click(e,l,e.pre_path),n(!t)):e.click&&await e.click(e,l,e.pre_path)},m=async(t=!1)=>{"folder"!==e.type||t?e.fatherNowToggleExpansion&&e.fatherNowToggleExpansion():await e.click(e,l,e.pre_path)};return(0,a.useEffect)(()=>{i(e.children)},[e.children]),(0,d.jsxs)("div",{className:"studio-item",children:[(0,d.jsxs)("div",{onClick:h,onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.handleContextMenu&&e.handleContextMenu(t,e.name,e.pre_path,e.type===r.Iw.folder,m)},className:"studio-item-title",children:[(0,d.jsx)("i",{className:"material-icons studio-item-title-tag","data-icon":t?"arrow_drop_down":"arrow_right",children:"file"==e.type?"":t?"arrow_drop_down":"arrow_right"}),(0,d.jsx)("span",{className:"file-icons",children:(0,d.jsx)("span",{"data-type":(0,c.uL)(e.name),"data-dir":"folder"===e.type,"aria-label":e.name,children:(0,d.jsx)(s.In,{icon:"",aria_label:e.name})})}),(0,d.jsx)("span",{className:"studio-item-name",children:e.name})]}),t&&o&&(0,d.jsx)("div",{style:{marginLeft:20},children:o.map((t,n)=>(0,d.jsx)(a.Fragment,{children:(0,d.jsx)(p,{type:t.type,size:t.size,click:e.click,name:t.name,children:t.children,pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:m},n)},n))})]})}}n(61443);function h(e){return(0,d.jsx)("div",{children:e.list.map((t,n)=>(0,d.jsx)(p,{pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,name:t.name,type:t.type,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:e.fatherNowToggleExpansion,children:t.children,click:e.click,size:t.size},n))})}var m=n(14284),u=n(34289),f=n(53459),x=n(78247),w=(n(62042),n(2543)),y=n(27690),v=n(22022),_=n(88815),k=n(61973);const g=a.lazy(()=>Promise.all([n.e(9988),n.e(4091)]).then(n.bind(n,84091)));function j(e){const[t,n]=(0,a.useState)([]),[p,j]=(0,a.useState)(""),[C,E]=(0,a.useState)(""),[N,S]=(0,a.useState)(!1),[M,P]=(0,a.useState)({path:"",name:""}),[$,b]=(0,a.useState)(""),[G,I]=(0,i.fp)(o.AG.confirm),[z,A]=(0,a.useState)(!1),[F,D]=(0,i.fp)(o.AG.fileShellShow),[L,R]=(0,i.fp)(o.AG.file_shell_hidden),T=(0,a.useRef)(null),K=(0,a.useRef)(null),[U,B]=(0,a.useState)(!1),[W,X]=(0,a.useState)(16),[Y,Z]=(0,i.fp)(o.AG.showPrompt),{t:q}=(0,v.Bd)(),H=(0,k.Zp)();let J=(0,k.zy)().pathname.split("/").filter(Boolean).pop();J=decodeURIComponent(J);const O=async()=>{const e=(0,u.GG)("file",J);j(e);const t=await m.$M.post("studio/get/item",{path:e});if(t.code===f.m.Success){const e=[],a=[];for(const n of t.data.list)"folder"===n.type?e.push(n):"file"===n.type&&a.push(n);n([...e,...a])}};(0,a.useEffect)(()=>{E(""),P({}),A(!1),O()},[]);const Q=async(e,t)=>{const n=await m.$M.get(`${encodeURIComponent(t)}`);E(n.data),x.xK.set_value_temp(n.data),P({path:t,name:e}),b(t)},V=(e,t)=>{e.size>_.o5?I({open:!0,handle:()=>{Q(e.name,t),I({open:!1,handle:null}),A(!1)},title:"超过20MB了还要打开吗?"}):Q(e.name,t)};async function ee(){if(!z)return;const e={context:x.xK.get_editor_value()};0===(await m.$M.post(`save/${encodeURIComponent($)}`,e)).code&&A(!1)}const te=e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),z&&ee())};(0,a.useEffect)(()=>(document.addEventListener("keydown",te),()=>{document.removeEventListener("keydown",te)}),[z]);const ne=(0,a.useCallback)(w.throttle(e=>{const t=parseFloat(getComputedStyle(K.current).fontSize),n=window.innerWidth/t-4,a=e.clientX/t,o=2.25+T.current.offsetWidth/t;a<=n&&a>=o&&X(parseFloat(a.toFixed(2)))},32),[]),ae=()=>{B(!1),K.current.removeEventListener("pointermove",ne)},oe=[{r:q("创建文件"),v:"创建文件"},{r:q("创建目录"),v:"创建目录"},{r:q("重命名"),v:"重命名"},{r:q("删除"),v:"删除"}],ie=[{r:q("重命名"),v:"重命名"},{r:q("删除"),v:"删除"}],se=(e,t,n,a,o)=>{e.preventDefault();const i=new c.ik;i.path=n,i.filename=t,i.x=e.clientX,i.y=e.clientY,i.items=a?oe:ie,o===O&&(i.items=i.items.slice(0,2)),i.type=a?r.Iw.studio_folder:r.Iw.studio_file;const s=e=>{o(e)};i.textClick=e=>{switch(e){case"创建文件":Z({show:!0,type:y.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:s}});break;case"创建目录":Z({show:!0,type:y.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:s}});break;case"删除":if(z&&(M.path===n||M.path.includes(n))){const e=()=>{s(a),A(!1),P({}),E(""),x.xK.set_value_temp("")};Z({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:e,filename:t}});break}Z({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:t,call:a?()=>{s(!0)}:s}});break;case"重命名":Z({show:!0,type:y.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,u.Yp)(n),call:()=>{s(!0)},filename:t}})}},Z({show:!0,type:y.PromptEnum.FileMenu,overlay:!1,data:i})};return(0,d.jsxs)("div",{className:"studio",children:[(0,d.jsxs)(l.A,{ignore_tags:!0,left_children:[(0,d.jsx)(s.rA,{title:"取消",icon:"close",onClick:()=>{D({show:!1,path:""}),R(void 0),H(-1)}},1),(0,d.jsx)("title",{children:M.name},2)],children:[(0,c.zr)(M.name)&&(0,d.jsx)(s.rA,{title:"格式化",icon:"data_object",onClick:function(){x.xK.get_editor()?.formatCode()}}),(0,d.jsx)(s.rA,{icon:"terminal",title:"shell",onClick:function(){void 0===L?F.show?D({show:!1,path:""}):(D({show:!0,path:(0,u.GG)("file",J)}),R(!1)):R(!L)}}),z&&(0,d.jsx)(s.rA,{title:"保存",icon:"save",onClick:ee})]}),(0,d.jsxs)("div",{className:"studio-body",ref:K,children:[(0,d.jsx)("div",{className:"studio-nav",style:{width:W-1+"em"},onContextMenu:e=>{se(e,M.name,(0,u.GG)("file",J),!0,O)},children:(0,d.jsx)(h,{pre_path:p,list:t,click:async(e,t,n)=>{if("folder"===e.type){const e=await m.$M.post("studio/get/item",{path:`${n}`});if(e.code===f.m.Success){const n=[],a=[];for(const t of e.data.list)"folder"===t.type?n.push(t):"file"===t.type&&a.push(t);t([...n,...a])}}else{if(z)return void I({open:!0,handle:()=>{I({open:!1,handle:null}),A(!1),V(e,n)},title:"确定不保存就切换吗?"});V(e,n)}},handleContextMenu:se,fatherNowToggleExpansion:O})}),(0,d.jsx)("div",{className:"studio__divider",ref:T,onPointerDown:()=>{B(!0),K.current.addEventListener("pointermove",ne)},onPointerUp:ae}),U&&(0,d.jsx)("div",{className:"shell__overlay",onPointerUp:ae}),(0,d.jsx)("div",{className:"studio-editor",children:M.name&&(0,d.jsx)(g,{name:M.name,on_change:()=>{z||A(!0)}})},M.path)]})]})}}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2674],{92674(e,t,n){n.r(t),n.d(t,{default:()=>j});var a=n(96540),o=n(82893),i=n(34843),s=n(85997),l=n(57952),r=n(47022),c=n(34251),d=n(74848);function p(e){{const[t,n]=(0,a.useState)(!1),[o,i]=(0,a.useState)([]),l=e=>{i(e)},h=async()=>{"folder"===e.type?(t||!e.click||o||await e.click(e,l,e.pre_path),n(!t)):e.click&&await e.click(e,l,e.pre_path)},m=async(t=!1)=>{"folder"!==e.type||t?e.fatherNowToggleExpansion&&e.fatherNowToggleExpansion():await e.click(e,l,e.pre_path)};return(0,a.useEffect)(()=>{i(e.children)},[e.children]),(0,d.jsxs)("div",{className:"studio-item",children:[(0,d.jsxs)("div",{onClick:h,onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.handleContextMenu&&e.handleContextMenu(t,e.name,e.pre_path,e.type===r.Iw.folder,m)},className:"studio-item-title",children:[(0,d.jsx)("i",{className:"material-icons studio-item-title-tag","data-icon":t?"arrow_drop_down":"arrow_right",children:"file"==e.type?"":t?"arrow_drop_down":"arrow_right"}),(0,d.jsx)("span",{className:"file-icons",children:(0,d.jsx)("span",{"data-type":(0,c.uL)(e.name),"data-dir":"folder"===e.type,"aria-label":e.name,children:(0,d.jsx)(s.In,{icon:"",aria_label:e.name})})}),(0,d.jsx)("span",{className:"studio-item-name",children:e.name})]}),t&&o&&(0,d.jsx)("div",{style:{marginLeft:20},children:o.map((t,n)=>(0,d.jsx)(a.Fragment,{children:(0,d.jsx)(p,{type:t.type,size:t.size,click:e.click,name:t.name,children:t.children,pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:m},n)},n))})]})}}n(61443);function h(e){return(0,d.jsx)("div",{children:e.list.map((t,n)=>(0,d.jsx)(p,{pre_path:`${e.pre_path}${t.name}${t.type===r.Iw.folder?"/":""}`,name:t.name,type:t.type,handleContextMenu:e.handleContextMenu,fatherNowToggleExpansion:e.fatherNowToggleExpansion,children:t.children,click:e.click,size:t.size},n))})}var m=n(14284),u=n(34289),f=n(53459),x=n(78247),w=(n(62042),n(2543)),y=n(27690),v=n(22022),_=n(88815),k=n(61973);const g=a.lazy(()=>Promise.all([n.e(9988),n.e(4091)]).then(n.bind(n,84091)));function j(e){const[t,n]=(0,a.useState)([]),[p,j]=(0,a.useState)(""),[C,E]=(0,a.useState)(""),[N,S]=(0,a.useState)(!1),[M,P]=(0,a.useState)({path:"",name:""}),[$,b]=(0,a.useState)(""),[G,I]=(0,i.fp)(o.AG.confirm),[z,A]=(0,a.useState)(!1),[F,D]=(0,i.fp)(o.AG.fileShellShow),[L,R]=(0,i.fp)(o.AG.file_shell_hidden),T=(0,a.useRef)(null),K=(0,a.useRef)(null),[U,B]=(0,a.useState)(!1),[W,X]=(0,a.useState)(16),[Y,Z]=(0,i.fp)(o.AG.showPrompt),{t:q}=(0,v.Bd)(),H=(0,k.Zp)();let J=(0,k.zy)().pathname.split("/").filter(Boolean).pop();J=decodeURIComponent(J);const O=async()=>{const e=(0,u.GG)("file",J);j(e);const t=await m.$M.post("studio/get/item",{path:e});if(t.code===f.m.Success){const e=[],a=[];for(const n of t.data.list)"folder"===n.type?e.push(n):"file"===n.type&&a.push(n);n([...e,...a])}};(0,a.useEffect)(()=>{E(""),P({}),A(!1),O()},[]);const Q=async(e,t)=>{const n=await m.$M.get(`${encodeURIComponent(t)}`);E(n.data),x.xK.set_value_temp(n.data),P({path:t,name:e}),b(t)},V=(e,t)=>{e.size>_.o5?I({open:!0,handle:()=>{Q(e.name,t),I({open:!1,handle:null}),A(!1)},title:"超过20MB了还要打开吗?"}):Q(e.name,t)};async function ee(){if(!z)return;const e={context:x.xK.get_editor_value()};0===(await m.$M.post(`save/${encodeURIComponent($)}`,e)).code&&A(!1)}const te=e=>{e.ctrlKey&&"s"===e.key&&(e.preventDefault(),z&&ee())};(0,a.useEffect)(()=>(document.addEventListener("keydown",te),()=>{document.removeEventListener("keydown",te)}),[z]);const ne=(0,a.useCallback)(w.throttle(e=>{const t=parseFloat(getComputedStyle(K.current).fontSize),n=window.innerWidth/t-4,a=e.clientX/t,o=2.25+T.current.offsetWidth/t;a<=n&&a>=o&&X(parseFloat(a.toFixed(2)))},32),[]),ae=()=>{B(!1),K.current.removeEventListener("pointermove",ne)},oe=[{r:q("创建文件"),v:"创建文件"},{r:q("创建目录"),v:"创建目录"},{r:q("重命名"),v:"重命名"},{r:q("删除"),v:"删除"}],ie=[{r:q("重命名"),v:"重命名"},{r:q("删除"),v:"删除"}],se=(e,t,n,a,o)=>{e.preventDefault();const i=new c.ik;i.path=n,i.filename=t,i.x=e.clientX,i.y=e.clientY,i.items=a?oe:ie,o===O&&(i.items=i.items.slice(0,2)),i.type=a?r.Iw.studio_folder:r.Iw.studio_file;const s=e=>{o(e)};i.textClick=e=>{switch(e){case"创建文件":Z({show:!0,type:y.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:s}});break;case"创建目录":Z({show:!0,type:y.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:s}});break;case"删除":if(z&&(M.path===n||M.path.includes(n))){const e=()=>{s(a),A(!1),P({}),E(""),x.xK.set_value_temp("")};Z({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:e,filename:t}});break}Z({show:!0,type:y.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:t,call:a?()=>{s(!0)}:s}});break;case"重命名":Z({show:!0,type:y.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,u.Yp)(n),call:()=>{s(!0)},filename:t}})}},Z({show:!0,type:y.PromptEnum.FileMenu,overlay:!1,data:i})};return(0,d.jsxs)("div",{className:"studio",children:[(0,d.jsxs)(l.A,{ignore_tags:!0,left_children:[(0,d.jsx)(s.rA,{title:"取消",icon:"close",onClick:()=>{D({show:!1,path:""}),R(void 0),H(-1)}},1),(0,d.jsx)("title",{children:M.name},2)],children:[(0,c.zr)(M.name)&&(0,d.jsx)(s.rA,{title:"格式化",icon:"data_object",onClick:function(){x.xK.get_editor()?.formatCode()}}),(0,d.jsx)(s.rA,{icon:"terminal",title:"shell",onClick:function(){!0!==L&&!1!==L?F.show?D({show:!1,path:""}):(D({show:!0,path:(0,u.GG)("file",J)}),R(!1)):R(!L)}}),z&&(0,d.jsx)(s.rA,{title:"保存",icon:"save",onClick:ee})]}),(0,d.jsxs)("div",{className:"studio-body",ref:K,children:[(0,d.jsx)("div",{className:"studio-nav",style:{width:W-1+"em"},onContextMenu:e=>{se(e,M.name,(0,u.GG)("file",J),!0,O)},children:(0,d.jsx)(h,{pre_path:p,list:t,click:async(e,t,n)=>{if("folder"===e.type){const e=await m.$M.post("studio/get/item",{path:`${n}`});if(e.code===f.m.Success){const n=[],a=[];for(const t of e.data.list)"folder"===t.type?n.push(t):"file"===t.type&&a.push(t);t([...n,...a])}}else{if(z)return void I({open:!0,handle:()=>{I({open:!1,handle:null}),A(!1),V(e,n)},title:"确定不保存就切换吗?"});V(e,n)}},handleContextMenu:se,fatherNowToggleExpansion:O})}),(0,d.jsx)("div",{className:"studio__divider",ref:T,onPointerDown:()=>{B(!0),K.current.addEventListener("pointermove",ne)},onPointerUp:ae}),U&&(0,d.jsx)("div",{className:"shell__overlay",onPointerUp:ae}),(0,d.jsx)("div",{className:"studio-editor",children:M.name&&(0,d.jsx)(g,{name:M.name,on_change:()=>{z||A(!0)}})},M.path)]})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4273],{77481(e,n,t){t.d(n,{S:()=>r,X:()=>l});var s=t(96540),i=t(74848);function l(e){const[n,t]=s.useState([]);return(0,s.useEffect)(()=>{e.children?t(Array.isArray(e.children)?e.children:[e.children]):t(e.rows)},[e.rows,e.children]),(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((e,n)=>(0,i.jsx)("th",{children:e},n))})}),(0,i.jsx)("tbody",{children:n.map((n,t)=>(0,i.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},children:n.map((t,s)=>(0,i.jsx)("td",{style:{width:e.width??"auto"},className:s===n.length-1?"small":"",children:t},s))},t))})]})}function r(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))})}},94273(e,n,t){t.r(n),t.d(n,{default:()=>K});var s=t(96540),i=t(75725),l=t(22022),r=t(70447),c=t(85997),o=t(77481),a=t(61443),d=t(14284),_=t(53459),x=t(7523),h=t(34843),p=t(82893),u=t(62042),j=(t(23430),t(21499),t(14944)),m=t(92275),v=t(6960),f=t(40505),g=t(57952),y=t(24659),S=t(74848);let w={};function C(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:C}=(0,s.useContext)(x.F),[I,k]=(0,h.fp)(p.AG.user_base_info),[b,A]=(0,s.useState)([]),[P,$]=(0,h.fp)(p.AG.prompt_card),F=(0,y.K)(),[K,N]=(0,s.useState)(),[U,G]=(0,s.useState)(void 0),[B,X]=(0,s.useState)([]),[M,Z]=(0,s.useState)([]),E=[e("序号"),e("名称"),e("在线状态"),e("时间"),e("备注")],V=[e("序号"),e("服务端口"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],q=[e("序号"),e("服务端口"),e("转发Client名称"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],z=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=w?.[n.client_num_id]?.client_name??"";Z(e)}},L=async()=>{const e=await d.s9.get("server_client_get");if(e.code===_.m.Success){const n=e.data,t=[],s=[];w={};for(const e of n)U?`${e.index}${e.client_name}${e.note}`.includes(U)&&t.push(e):t.push(e),s.push({label:e.client_name,value:e.client_num_id}),w[e.client_num_id]=e;A(t),X(s)}};(0,s.useEffect)(()=>{j.ws.addMsg(m.HK.tcp_forward_server_load,e=>{L()}),L()},[]);return(0,S.jsxs)(s.Fragment,{children:[(0,S.jsx)(g.A,{children:K&&(0,S.jsx)("span",{children:`${K.client_name}${K.note?`(${K.note})`:""}`})}),(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:50,children:(0,S.jsx)(i.xh,{children:(0,S.jsx)(r.uF,{self_title:(0,S.jsx)("span",{className:" div-row ",children:(0,S.jsx)("h2",{children:e("客户端列表")})}),titleCom:(0,S.jsx)(a.Sm,{placeholder:e("过滤"),value:U,handleInputChange:e=>{G(e)},handlerEnter:()=>{L()}}),children:(0,S.jsx)(o.X,{headers:E,rows:b.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(r.xP,{children:n.client_name}),(0,S.jsx)(r.fq,{ok:n.status}),(0,S.jsx)(r.xP,{children:z(n.status?n.online_start_time:n.offline_time)}),(0,S.jsx)(r.xP,{children:n.note}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"edit",title:e("编辑"),onClick:()=>{N({...n}),H(n.client_num_id)}}),(0,S.jsx)(c.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,u.SK)("成功"),L())})(n.client_num_id)},context_div:(0,S.jsx)("div",{className:"card-content",children:e("确定删除这个吗客户端吗?")})})}})]})]),width:"10rem"})})})}),(0,S.jsx)(i.VP,{widthPer:50,children:K?(0,S.jsxs)(i.xh,{children:[(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:e("代理配置")})," "]}),rightBottomCom:(0,S.jsx)("div",{children:(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.s9.post("server_client_save",K)).code===_.m.Success&&(0,u.SK)("成功")}})}),children:[(0,S.jsx)(i.Yh,{left:e("远程地址"),center:K?.client_remote_address??""}),(0,S.jsx)(i.Yh,{left:e(K?.status?"在线时间":"离线时间"),center:z(K?.status?K?.online_start_time:K?.offline_time)}),(0,S.jsx)(a.Sm,{placeholder:"名称",value:K.client_name,handleInputChange:e=>{K.client_name=e,N({...K})}}),(0,S.jsxs)("form",{children:[e("filecat代理访问"),":",(0,S.jsx)(o.S,{isFlex:!0,columns:[(0,S.jsx)(a.U6,{value:1,context:e("开启"),selected:K.open_filecat,onchange:()=>{K.open_filecat=!K.open_filecat,N({...K})}}),(0,S.jsx)(a.U6,{value:1,context:e("关闭"),selected:!K.open_filecat,onchange:()=>{K.open_filecat=!K.open_filecat,N({...K})}})]})]}),K.open_filecat&&(0,S.jsxs)(s.Fragment,{children:[(0,S.jsxs)("form",{children:[e("filecat代理访问使用服务器前端"),":",(0,S.jsx)(o.S,{isFlex:!0,columns:[(0,S.jsx)(a.U6,{value:1,context:e("开启"),selected:K.filecat_use_local_page,onchange:()=>{K.filecat_use_local_page=!K.filecat_use_local_page,N({...K})}}),(0,S.jsx)(a.U6,{value:1,context:e("关闭"),selected:!K.filecat_use_local_page,onchange:()=>{K.filecat_use_local_page=!K.filecat_use_local_page,N({...K})}})]})]}),(0,S.jsx)(a.Sm,{placeholderOut:e("自定义filecat代理地址"),placeholder:"127.0.0.1:5567",value:K.filecat_proxy_host_port,handleInputChange:e=>{K.filecat_proxy_host_port=e,N({...K})}}),(0,S.jsx)(c.rA,{icon:"content_copy",title:e("复制filecat代理url"),onClick:()=>{const e=`${window.location.origin}?tcp_client_num_id=${K.client_num_id}`;(0,f.lW)(e),(0,u.SK)(e)}})]}),(0,S.jsx)(a.Sm,{placeholder:"备注",value:K.note,handleInputChange:e=>{K.note=e,N({...K})}}),(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{K.proxy_fig_list.push({open:!1}),N({...K})},title:e("添加")}),e("代理"),(0,S.jsx)(o.X,{headers:V,rows:K.proxy_fig_list.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(a.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,S.jsx)(a.Sm,{value:n.proxy_host,handleInputChange:e=>{n.proxy_host=e},no_border:!0}),(0,S.jsx)(a.Sm,{value:n.proxy_port,handleInputChange:e=>{n.proxy_port=parseInt(e)},no_border:!0}),(0,S.jsx)(a.l6,{value:!!n.open,onChange:e=>{n.open=e,N({...K})},options:F,no_border:!0}),(0,S.jsx)(a.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,S.jsx)("div",{children:(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{const e=[];for(let n=0;n<(K.proxy_fig_list.length??0);n++)n!==t&&e.push(K.proxy_fig_list[n]);K.proxy_fig_list=e,N({...K})}})})]),width:"10rem"})]}),(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:e("桥接配置")})," "]}),children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{M.push({open:!1,server_client_num_id:K.client_num_id}),Z([...M])},title:e("添加")}),e("代理"),(0,S.jsx)(o.X,{headers:q,rows:M.map((n,t)=>[(0,S.jsx)("p",{children:t}),(0,S.jsx)(a.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,S.jsx)(a.Sm,{value:n.client_name,options:B,handleInputChange:e=>{const t=(e=>B.find(n=>String(n.value)===String(e)))(e);n.client_num_id=parseInt(String(t.value)),n.client_name=t.label,Z([...M])},no_border:!0}),(0,S.jsx)(a.Sm,{value:n.client_proxy_host,handleInputChange:e=>{n.client_proxy_host=e},no_border:!0}),(0,S.jsx)(a.Sm,{value:n.client_proxy_port,handleInputChange:e=>{n.client_proxy_port=parseInt(e)},no_border:!0}),(0,S.jsx)(a.l6,{value:!!n.open,onChange:e=>{n.open=e,Z([...M])},options:F,no_border:!0}),(0,S.jsx)(a.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:async()=>{if(null==n.id){const e=[];for(let n=0;n<(M.length??0);n++)n!==t&&e.push(M[n]);Z([...e])}else await(async(e,n)=>{(await d.s9.post("server_bridge_del_fig",{id:e})).code===_.m.Success&&((0,u.SK)("成功"),H(n))})(n.id,n.server_client_num_id)}}),null==n.id?(0,S.jsx)(c.rA,{icon:"add",title:e("添加"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,u.zN)("未选择转发送 client");(await d.s9.post("server_bridge_add_fig",e)).code===_.m.Success&&((0,u.SK)("成功"),H(e.server_client_num_id))})(n)}}):(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,u.zN)("未选择转发送 client");(await d.s9.post("server_bridge_edit_fig",e)).code===_.m.Success&&((0,u.SK)("成功"),H(e.server_client_num_id))})(n)}})]})]),width:"10rem"})]})]}):(0,S.jsx)(i.xh,{})})]})]})}class I{open;key;option_keys;port}class k{client_name;client_num_id;open=!1;serverIp;serverPort;key="";note;status;is_new;index}function b(e){const{t:n}=(0,l.Bd)(),[t,x]=(0,s.useState)([]),[h,p]=(0,s.useState)([]),[v,f]=(0,s.useState)([]),[g,w]=(0,s.useState)([]),C=[n("序号"),n("服务端口"),n("转发客户端名称")],I=[n("序号"),n("原客户端"),n("目标客户端"),n("待同步文件数量")],b=[n("序号"),n("port"),n("host"),n("名称"),n("key"),n("在线"),n("开启"),n("备注")],A=(0,y.K)(),P=async()=>{const e=await d.s9.get("client_get");if(e.code===_.m.Success){const n=e.data;x(n.list)}const n=await d.s9.get("client_bridge_get_all_fig");n.code===_.m.Success&&f(n.data);const t=await d.s9.get("client_sync_task_get");t.code===_.m.Success&&w(t.data)};(0,s.useEffect)(()=>{P(),j.ws.sendData(m.HK.tcp_proxy_client_status,{}).then(()=>{j.ws.addMsg(m.HK.tcp_proxy_client_status,e=>{P()})})},[]);const $=async e=>{const n=new k;n.index=e.index,n.key=e.key,n.serverIp=e.serverIp,n.serverPort=e.serverPort,n.open=e.open,n.client_name=e.client_name,n.client_num_id=e.client_num_id;(await d.s9.post("client_save",n)).code===_.m.Success?(0,u.SK)("保存成功"):(0,u.zN)("网络错误")};return(0,S.jsx)("div",{children:(0,S.jsxs)(i.fI,{children:[(0,S.jsxs)(i.VP,{widthPer:60,children:[(0,S.jsxs)(r.Zp,{title:"",rightBottomCom:(0,S.jsx)(c.C3,{text:n("保存"),clickFun:()=>{t[0].index=0,$(t[0])}}),titleCom:(0,S.jsxs)("div",{children:[n("连接状态"),(0,S.jsx)(r.fq,{ok:!!t[0]?.status})]}),children:[(0,S.jsx)(a.Sm,{placeholder:`${n("服务器")} ip`,value:t[0]?.serverIp,handleInputChange:e=>{t[0].serverIp=e}}),(0,S.jsx)(a.Sm,{type:"number",placeholder:`${n("服务器")} port`,value:t[0]?.serverPort,handleInputChange:e=>{const n=parseInt(e);!isNaN(n)&&n>=0&&n<=65535&&(t[0].serverPort=n)}}),(0,S.jsx)(a.Sm,{placeholder:n("名称"),value:t[0]?.client_name,handleInputChange:e=>{t[0].client_name=e}}),(0,S.jsx)(a.Sm,{type:"password",placeholder:"key ",value:t[0]?.key,handleInputChange:e=>{t[0].key=e}}),(0,S.jsxs)("form",{children:[n("状态"),(0,S.jsx)(o.S,{isFlex:!0,columns:[(0,S.jsx)(a.U6,{value:1,context:n("开启"),selected:t[0]?.open,onchange:()=>{t[0].open=!t[0].open,x([...t])}}),(0,S.jsx)(a.U6,{value:1,context:n("关闭"),selected:!t[0]?.open,onchange:()=>{t[0].open=!t[0].open,x([...t])}})]})]})]}),(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:n("更多服务器")})," "]}),children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{t.push({open:!1,is_new:!0}),x([...t])},title:n("添加")}),n("代理"),(0,S.jsx)(o.X,{headers:b,rows:t.slice(1).map((e,s)=>[(0,S.jsx)("p",{children:s}),(0,S.jsx)(a.Sm,{type:"number",value:e.serverPort,handleInputChange:n=>{const t=parseInt(n);!isNaN(t)&&t>=0&&t<=65535&&(e.serverPort=t)},no_border:!0}),(0,S.jsx)(a.Sm,{value:e.serverIp,handleInputChange:n=>{e.serverIp=n},no_border:!0}),(0,S.jsx)(a.Sm,{value:e.client_name,handleInputChange:n=>{e.client_name=n},no_border:!0}),(0,S.jsx)(a.Sm,{value:e.key,handleInputChange:n=>{e.key=n},no_border:!0}),(0,S.jsx)(r.fq,{ok:!!e.status}),(0,S.jsx)(a.l6,{value:!!e.open,onChange:n=>{e.open=n,x([...t])},options:A,no_border:!0}),(0,S.jsx)(a.Sm,{value:e.note,handleInputChange:n=>{e.note=n},no_border:!0}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"delete",title:n("删除"),onClick:async()=>{if(e.is_new){const e=[];for(let n=0;n<(t.length??0);n++)n!==s&&e.push(t[n]);x([...e])}else await(async e=>{(await d.s9.post("client_del",{index:e})).code===_.m.Success?((0,u.SK)("保存成功"),P()):(0,u.zN)("网络错误")})(s+1)}}),e.is_new?(0,S.jsx)(c.rA,{icon:"add",title:n("添加"),onClick:async()=>{e.index=s+1,await $(e)}}):(0,S.jsx)(c.rA,{icon:"save",title:n("保存"),onClick:async()=>{e.index=s+1,await $(e)}})]})]),width:"10rem"})]})]}),(0,S.jsxs)(i.VP,{widthPer:40,children:[v?.length?(0,S.jsx)(r.Zp,{title:n("桥接服务端口列表"),children:(0,S.jsx)(o.X,{headers:C,rows:v.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.server_port}),(0,S.jsx)(r.xP,{children:e.client_name})]),width:"10rem"})}):(0,S.jsx)(S.Fragment,{}),g?.length?(0,S.jsx)(r.Zp,{title:n("文件同步列表"),children:(0,S.jsx)(o.X,{headers:I,rows:g.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.source_client_name}),(0,S.jsx)(r.xP,{children:e.target_client_name}),(0,S.jsx)(r.xP,{children:e.running_num})]),width:"10rem"})}):(0,S.jsx)(S.Fragment,{})]})]})})}function A(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:v}=(0,s.useContext)(x.F),[f,g]=(0,h.fp)(p.AG.user_base_info),[y,w]=(0,h.fp)(p.AG.prompt_card),[C,k]=(0,s.useState)(!1),[b,A]=(0,s.useState)([]),[P,$]=(0,s.useState)(null),[F,K]=(0,s.useState)([]),[N,U]=(0,s.useState)(void 0),[G,B]=(0,s.useState)(void 0),X=(0,s.useMemo)(()=>{const e=[...b];return null!=P?(e.sort((e,n)=>P?e.server_port-n.server_port:n.server_port-e.server_port),e):e},[b,P]),M=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)G?`${t.server_port}${t.client_name}${t.proxy_host}${t.server_port}${t.server_port_note}`.includes(G)&&n.push(t):n.push(t);A(n)}},Z=async()=>{const e=await d.s9.get("server_get");e.code===_.m.Success&&(U(e.data.port),k(!!e.data.open),K(e.data.option_keys??[])),M()};(0,s.useEffect)(()=>{j.ws.addMsg(m.HK.tcp_forward_server_load,e=>{Z()}),Z()},[]);const E=async e=>{const n=new I;n.port=N,n.open=C,n.option_keys=F;(await d.s9.post("server_save",{fig:n,notice_client:e})).code===_.m.Success&&(0,u.SK)("成功")};return(0,S.jsxs)(i.fI,{children:[(0,S.jsx)(i.VP,{widthPer:50,children:(0,S.jsx)(i.xh,{children:(0,S.jsxs)(r.Zp,{title:e("服务器配置"),rightBottomCom:(0,S.jsxs)("div",{children:[(0,S.jsx)(c.C3,{text:e("保存并通知客户端第一个key和port"),clickFun:()=>{E(!0)}}),(0,S.jsx)(c.C3,{text:e("保存"),clickFun:()=>{E(!1)}})]}),children:[(0,S.jsx)(a.Sm,{placeholder:"port",value:N,handleInputChange:e=>{U(e)}}),(0,S.jsxs)("label",{children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{K([...F,""])},title:e("添加")}),e("key")]}),(F??[]).map((n,t)=>(0,S.jsxs)("div",{style:{display:"flex"},children:[(0,S.jsx)("div",{style:{width:"90%"},children:(0,S.jsx)(a.Sm,{type:"password",value:n,handleInputChange:e=>{F[t]=e,K([...F])}})}),(0,S.jsx)(c.rA,{icon:"delete",onClick:()=>{F.splice(t,1),K([...F])},title:e("删除")})]},t)),(0,S.jsxs)("form",{children:[e("状态"),":",(0,S.jsx)(o.S,{isFlex:!0,columns:[(0,S.jsx)(a.U6,{value:1,context:e("开启"),selected:C,onchange:()=>{k(!C)}}),(0,S.jsx)(a.U6,{value:1,context:e("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]})]})})}),(0,S.jsx)(i.VP,{widthPer:50,children:(0,S.jsx)(i.xh,{children:(0,S.jsx)(r.uF,{self_title:(0,S.jsx)("span",{className:" div-row ",children:(0,S.jsx)("h2",{children:e("服务器")+e("端口映射")})}),titleCom:(0,S.jsx)(a.Sm,{placeholder:e("过滤"),value:G,handleInputChange:e=>{B(e)},handlerEnter:()=>{M()}}),children:(0,S.jsx)(o.X,{headers:[e("序号"),(0,S.jsx)(c.rA,{title:e("服务端口"),onClick:()=>{$(e=>!e)}}),e("转发ip"),e("转发端口"),"client "+e("名称"),e("开启"),e("备注")],rows:X.map((e,n)=>[(0,S.jsx)("p",{children:n}),(0,S.jsx)(r.xP,{children:e.server_port}),(0,S.jsx)(r.xP,{children:e.proxy_host}),(0,S.jsx)(r.xP,{children:e.proxy_port}),(0,S.jsx)(r.xP,{children:e.client_name}),(0,S.jsx)(r.fq,{ok:!!e.open_success}),(0,S.jsx)(r.xP,{children:e.server_port_note})]),width:"10rem"})})})})]})}var P=t(78247);function $(){const{t:e,i18n:n}=(0,l.Bd)(),{initUserInfo:t,reloadUserInfo:j}=(0,s.useContext)(x.F),[m,v]=(0,h.fp)(p.AG.user_base_info),[f,g]=(0,h.fp)(p.AG.prompt_card),[,y]=(0,h.fp)(p.AG.confirm),[w,C]=(0,h.fp)(p.AG.editorSetting),[I,k]=(0,s.useState)([]),b=[e("编号"),e("原客户端"),e("原目录"),e("目标客户端"),e("目标目录"),e("忽略目录"),e("开启"),e("双向同步"),e("全量同步"),e("备注")],[A,$]=(0,s.useState)([]);(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});$(t),await F()}})()},[]);const F=async()=>{const e=await d.s9.get("sync_task_get");e.code===_.m.Success&&k(e.data)},K=e=>A.find(n=>String(n.value)===String(e)),N=async e=>{const n=e;(await d.s9.post("sync_task_save",n)).code===_.m.Success&&((0,u.SK)("成功"),await F())};return(0,S.jsx)(i.fI,{children:(0,S.jsx)(i.VP,{widthPer:100,children:(0,S.jsx)(i.xh,{children:(0,S.jsxs)(r.Zp,{self_title:(0,S.jsxs)("span",{className:" div-row ",children:[(0,S.jsx)("h2",{children:e("客户端文件同步")}),(0,S.jsx)(c.rA,{icon:"info",onClick:()=>{g({open:!0,title:"信息",context_div:(0,S.jsx)("div",{children:(0,S.jsxs)("ul",{children:[(0,S.jsx)("li",{children:"目前只能同步较小的文件,例如配置文件,代码文件"}),(0,S.jsx)("li",{children:e("默认(没有选中全量同步)不会立即同步两个目录中的文件,而是有文件被修改或者改动后才会同步,如果开启全量同步,每次客户端一上线就会递归的同步全部的文件,如果文件非常多,这会造成很大的执行压力。")}),(0,S.jsx)("li",{children:e("如果开启了双向同步,如果两边初始化的时候各自又有很多文件,这是不太稳定的,暂时不建议这样做。")}),(0,S.jsx)("li",{children:e("同时开启全量同步和双向同步,目前性能也会很差,目前没有提供提供冲突冲突的机制。")}),(0,S.jsx)("li",{children:e("如果想用全量同步,一方的文件是空的,且文件数量比较少,几百这样的数量,效果是不错的,之后会一直走增量更新。")})]})})})},title:"信息"})]}),children:[(0,S.jsx)(c.rA,{icon:"add",onClick:()=>{I.push({open:!1,source_dir:"",target_dir:"",delete_missing:!0}),k([...I])},title:e("添加")}),(0,S.jsx)(o.X,{headers:b,rows:I.map((n,t)=>{const s=K(n.source_client_num_id),i=K(n.target_client_num_id);return[(0,S.jsx)("p",{children:t}),(0,S.jsx)(a.Sm,{value:s?.label??n.source_client_name,options:A,handleInputChange:e=>{const t=K(e);n.source_client_num_id=parseInt(String(t?.value)),n.source_client_name=t?.label,k([...I])},no_border:!0}),(0,S.jsx)(a.Sm,{value:n.source_dir,handleInputChange:e=>{n.source_dir=e},no_border:!0}),(0,S.jsx)(a.Sm,{value:i?.label??n.target_client_name,options:A,handleInputChange:e=>{const t=K(e);n.target_client_num_id=parseInt(String(t?.value)),n.target_client_name=t?.label,k([...I])},no_border:!0}),(0,S.jsx)(a.Sm,{value:n.target_dir,handleInputChange:e=>{n.target_dir=e},no_border:!0}),(0,S.jsx)(c.rA,{icon:"edit",title:"额外参数设置",onClick:()=>{P.xK.set_value_temp(n.ignore_text??"\nnode_modules\n.venv\n.gradle\n.cache\nvendor\n"),C({model:"ace/mode/gitignore",open:!0,fileName:"",save:async e=>{n.ignore_text=e,k([...I]),P.xK.set_value_temp(""),N(n)}})}}),(0,S.jsx)(a.GL,{selected:!!n.open,onchange:()=>{n.open=!n.open,k([...I])}}),(0,S.jsx)(a.GL,{selected:!!n.two_way_sync,onchange:()=>{n.two_way_sync=!n.two_way_sync,k([...I])}}),(0,S.jsx)(a.GL,{selected:!!n.full_sync,onchange:()=>{n.full_sync=!n.full_sync,k([...I])}}),(0,S.jsx)(a.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,S.jsxs)("div",{children:[(0,S.jsx)(c.rA,{icon:"save",title:e("保存"),onClick:()=>{N(n)}}),(0,S.jsx)(c.rA,{icon:"delete",title:e("删除"),onClick:()=>{n.id?y({open:!0,title:e("确定删除吗"),handle:async()=>{await(async e=>{(await d.s9.post("sync_task_del",{id:e})).code===_.m.Success&&((0,u.SK)("成功"),await F())})(n.id),(0,u.SK)("删除完成"),y({open:!1,handle:null})}}):(I.splice(t,1),k([...I]))}})]})]}),width:"10rem"})]})})})})}var F=t(87361);function K(){const{t:e}=(0,l.Bd)(),n=[{index:1,name:e("客户端"),rto:"tcp_proxy_client/",component:(0,S.jsx)(b,{})},{index:2,name:e("服务端"),rto:"tcp_proxy_server_info/",component:(0,S.jsx)(A,{})},{index:3,name:e("服务端")+"-"+e("客户端列表"),rto:"tcp_proxy_server_client/",component:(0,S.jsx)(C,{})},{index:4,name:e("服务端")+"-"+e("客户端功能"),rto:"tcp_proxy_server_client_setting/",component:(0,S.jsx)($,{})}];return(0,S.jsx)(i.W1,{optionList:n,father_route:F.o.net_proxy})}},6960(e,n,t){t.d(n,{s:()=>r});var s=t(72635);const i=1440,l=525600;function r(e){e=e>1e12?e:1e3*e;const n=Date.now(),t=Math.abs(n-e)/6e4;return t<1?s.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${s.Ay.t("分钟前")}`:t<i?`${(t/60).toFixed(0)} ${s.Ay.t("小时前")}`:t<43200?`${(t/i).toFixed(0)} ${s.Ay.t("天前")}`:t<l?`${(t/43200).toFixed(0)} ${s.Ay.t("月前")}`:`${(t/l).toFixed(0)} ${s.Ay.t("年前")}`}},24659(e,n,t){var s=t(22022);t.d(n,["K",0,()=>{const{t:e}=(0,s.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[678,6010],{83277(e,t,s){s.d(t,{$j:()=>o,Lv:()=>a,qq:()=>i});class n{options_agent_url_list;options_agent_key_list;options_agent_model_list;options_local_file_path_prompt_list}class a{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const s of t)if(s.value===e)return s.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const s of t)if(s.value===e)return!0;return!1}}class i extends n{tool_error_max=50;tool_call_max=300;allow_exec_cmd_directly=!1;proxy_url;open_pick_model;max_recent_messages=12;compress_message_count=16;max_tool_content_chars=200}const c=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function o(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}s.d(t,["CP",0,'\n\n# 工具报错最大尝试次数\ntool_error_max=50\n# 聊天循环最大次数\ntool_call_max=300\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n',"cL",0,c])},93583(e,t,s){s.r(t),s.d(t,{default:()=>Y});var n=s(96540),a=s(34843),i=s(22022),c=s(61973),o=s(92275),l=s(14284),r=s(7463),d=s(78247),u=s(40505),m=s(62042),h=s(45907),g=s(53459),p=s(72693),x=s(82893),_=s(61443),f=s(83277);function j(e){return null==e||e<0?"0":e.toLocaleString()}function v(e){const t=(0,f.$j)(e.content);if(t)return t;const s=e.content_list??[];return s.length?s.map(e=>(0,f.$j)(e.content)).filter(Boolean).join("\n\n"):""}const b=/\.(md|txt|json|js|jsx|ts|tsx|css|html?|xml|ya?ml|py|java|go|rs|c|cpp|h|hpp|sh|bat|cmd|ini|toml|csv|log|sql|env|gitignore|dockerfile)$/i;function y(e){return e.type?.startsWith("image/")?"image":e.type?.startsWith("text/")||b.test(e.name)?"text":"binary"}function w(e){return e.text()}function S(e){return new Promise((t,s)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=s,n.readAsDataURL(e)})}async function N(e){const t=[];for(const s of e){const e=y(s);let n="";if("text"===e)try{const e=await w(s),t=12e4;n=e.length>t?`${e.slice(0,t)}\n\n[内容已截断,原始长度 ${e.length} 字符]`:e}catch{n="[文本读取失败]"}else if("image"===e)try{n=await S(s)}catch{n=`[图片文件: ${s.name}]`}else n=`[二进制文件: ${s.name}]`;t.push({name:s.name,mime_type:s.type,size:s.size,kind:e,content:n})}return t}var k=s(14944);var C=s(52035),A=s(85997),I=s(34299),$=s(74848);function M(e){const t=e.attachments&&e.attachments.length>0?(0,$.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map((e,t)=>(0,$.jsxs)("div",{className:"chat-message-attachment",children:[(0,$.jsx)(A.In,{icon:"attach_file"}),(0,$.jsx)("span",{children:e.name}),(0,$.jsxs)("small",{children:[e.size," B"]})]},`${e.name}_${t}`))}):null,s=[];e.images&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(T,{images:e.images,text:e.text})},"images")),e.audio&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(R,{audio:e.audio,text:e.text})},"audio")),e.embeddings&&"bot"===e.sender&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(P,{embeddings:e.embeddings,text:e.text})},"embeddings"));const a=function(e){if("bot"!==e.sender||!e.content_list?.length)return e.text?(0,$.jsx)(I.default,{context:e.text}):null;return(0,$.jsxs)($.Fragment,{children:[e.content_list.map((e,t)=>{const s=[],a=(0,f.$j)(e.content);return a&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(I.default,{context:a})},`content-${t}`)),e.tool_call_ends?.length&&s.push((0,$.jsx)(n.Fragment,{children:(0,$.jsx)(D,{callList:e.tool_call_ends})},`tool-${t}`)),(0,$.jsx)(n.Fragment,{children:s},`part-${t}`)}),!e.content_list.some(e=>e.content)&&e.text?(0,$.jsx)(I.default,{context:e.text}):null]})}(e);return 0===s.length?(0,$.jsxs)($.Fragment,{children:[t,a]}):(0,$.jsxs)($.Fragment,{children:[s,t,a]})}function D({callList:e}){const[t,s]=n.useState(!1);if(!e?.length)return null;e.filter(e=>e.success).length;const a=e.filter(e=>!e.success).length;return(0,$.jsxs)("div",{className:"chat-message-call-list",children:[(0,$.jsxs)("div",{className:"call-list-header",onClick:()=>s(!t),children:[(0,$.jsx)(A.In,{icon:t?"expand_less":"expand_more"}),(0,$.jsxs)("span",{className:"call-list-summary",children:["工具调用 (",e.length,")",a>0&&(0,$.jsx)("span",{className:"call-list-fail",children:" 失败 "})]})]}),t&&(0,$.jsx)("div",{className:"call-list-body",children:e.map((e,t)=>(0,$.jsxs)("div",{className:"call-list-item "+(e.success?"call-success":"call-fail"),children:[(0,$.jsxs)("div",{className:"call-list-item-header",children:[(0,$.jsx)(A.In,{icon:e.success?"check_circle":"error"}),(0,$.jsx)("span",{className:"call-list-tool-name",children:e.tool_display_name||e.tool_name}),(0,$.jsxs)("span",{className:"call-list-duration",children:[e.duration_ms,"ms"]})]}),e.tool_args&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"参数"}),(0,$.jsx)("pre",{className:"call-list-pre",children:JSON.stringify(e.tool_args,null,2)})]}),!e.success&&e.error&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"错误"}),(0,$.jsx)("pre",{className:"call-list-pre call-list-error-text",children:e.error})]}),e.success&&e.tool_result&&(0,$.jsxs)("details",{className:"call-list-details",children:[(0,$.jsx)("summary",{children:"结果"}),(0,$.jsx)("pre",{className:"call-list-pre",children:e.tool_result.length>500?e.tool_result.slice(0,500)+"...":e.tool_result})]})]},t))})]})}function T({images:e,text:t}){let s=e||[];if(!s.length&&t)try{s=JSON.parse(t).data||[]}catch{}return s.length?(0,$.jsxs)("div",{className:"image-generation-result",children:[s.map((e,t)=>(0,$.jsxs)("div",{className:"image-generation-item",children:[e.url&&(0,$.jsx)("div",{className:"image-generation-image-wrapper",children:(0,$.jsx)("img",{src:e.url,alt:e.revised_prompt||`生成的图片 ${t+1}`,loading:"lazy"})}),e.b64_json&&(0,$.jsx)("div",{className:"image-generation-image-wrapper",children:(0,$.jsx)("img",{src:`data:image/png;base64,${e.b64_json}`,alt:`生成的图片 ${t+1}`})}),e.revised_prompt&&(0,$.jsx)("p",{className:"image-generation-prompt",children:(0,$.jsx)("small",{children:e.revised_prompt})})]},t)),t&&!e&&(0,$.jsx)(I.default,{context:t})]}):(0,$.jsx)(I.default,{context:t||""})}function R({audio:e,text:t}){if(e){if(e.url)return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:e.url,children:"您的浏览器不支持音频播放"})});if(e.data){const t=e.mime_type||"audio/mpeg";return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:`data:${t};base64,${e.data}`,children:"您的浏览器不支持音频播放"})})}}const s=t||"";if(s.startsWith("http://")||s.startsWith("https://"))return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:s,children:"您的浏览器不支持音频播放"})});try{const e=JSON.parse(s);if(e?.data||e?.audio_data){const t=e.data||e.audio_data;return(0,$.jsx)("div",{className:"audio-result",children:(0,$.jsx)("audio",{controls:!0,src:`data:audio/mpeg;base64,${t}`,children:"您的浏览器不支持音频播放"})})}}catch{}return(0,$.jsx)(I.default,{context:s})}function H({content:e,label:t}){const[s,a]=n.useState(!1);return(0,$.jsxs)("button",{className:"embeddings-copy-btn",onClick:()=>{(0,u.lW)(e),a(!0),setTimeout(()=>a(!1),1500)},children:[(0,$.jsx)(A.In,{icon:s?"check":"content_copy"}),s?"已复制":t||"复制"]})}function P({embeddings:e,text:t}){let s=e||null;if(!s&&t)try{s=JSON.parse(t)}catch{return(0,$.jsx)(I.default,{context:t})}if(!s)return(0,$.jsx)(I.default,{context:t||""});const n=s?.data||[],a=s?.usage,i=JSON.stringify(s,null,2);return(0,$.jsxs)("div",{className:"embeddings-result",children:[(0,$.jsxs)("div",{className:"embeddings-summary",children:[(0,$.jsx)("strong",{children:"向量嵌入结果"}),(0,$.jsxs)("span",{children:["维度: ",n[0]?.embedding?.length??"N/A"]}),(0,$.jsxs)("span",{children:["数量: ",n.length]}),a&&(0,$.jsxs)("span",{children:["使用 tokens: ",a.total_tokens??"N/A"]})]}),(0,$.jsxs)("div",{className:"embeddings-toolbar",children:[(0,$.jsx)(H,{content:i,label:"复制全部结果"}),n.length>0&&n[0]?.embedding&&(0,$.jsx)(H,{content:JSON.stringify(n[0].embedding,null,2),label:"复制第一条向量"}),n.length>0&&(0,$.jsx)(H,{content:JSON.stringify(n.map(e=>e.embedding),null,2),label:"复制所有向量数据"})]}),n.length>0&&n[0]?.embedding&&(0,$.jsx)("div",{className:"embeddings-preview",children:(0,$.jsxs)("span",{children:["向量预览: [",n[0].embedding.slice(0,5).join(", "),n[0].embedding.length>5?", ...":"","]"]})}),n.length>0&&(0,$.jsxs)("details",{children:[(0,$.jsx)("summary",{children:"查看详细数据"}),(0,$.jsx)("pre",{className:"embeddings-raw",children:i})]})]})}async function E(e,t){const s=function(){try{return(0,C.zp)().get(x.AG.ai_images_extra_params)||{}}catch{return{}}}(),n={prompt:e,n:s.n??1,size:s.size??"1024x1024",session_id:t};if(s.quality&&(n.quality=s.quality),s.style&&(n.style=s.style),s.extra_json)try{const e=JSON.parse(s.extra_json);Object.assign(n,e)}catch(e){console.warn("图片额外参数 JSON 解析失败:",e)}const a=await l.jV.post("images/generations",n);if(0!==a.code)throw new Error(a.message||"图片生成失败");const i=a.data||{},c=(i.data||[]).map(e=>({url:e.url,b64_json:e.b64_json,revised_prompt:e.revised_prompt})),o=c.map((e,t)=>`![生成图片${t+1}](${e.url||`data:image/png;base64,${e.b64_json}`})${e.revised_prompt?`\n> ${e.revised_prompt}`:""}`).join("\n\n");return{session_id:i.session_id||t,images:c,text:o||`生成了 ${c.length} 张图片`}}async function F(e,t,s,n){try{switch(e){case"images":{const e=await E(t,s);return e&&n(e.text,{images:e.images}),!0}case"audio_speech":{const e=await async function(e,t){const s={input:e,session_id:t};try{const e=localStorage.getItem("ai_audio_extra_params");if(e){const t=JSON.parse(e);t.voice&&(s.voice=t.voice),t.speed&&(s.speed=parseFloat(t.speed))}}catch{}const n=localStorage.getItem("token")||"",a=await fetch("/api/ai_agent/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(s)});if(!a.ok)throw new Error(`语音合成失败: ${a.statusText}`);const i=a.headers.get("X-Session-Id")||t,c=await a.arrayBuffer();return{session_id:i,audio:{data:btoa(String.fromCharCode(...Array.from(new Uint8Array(c)))),mime_type:a.headers.get("content-type")||"audio/mpeg"},text:`[音频文件: ${e.slice(0,50)}...]`}}(t,s);return e&&n(e.text,{audio:e.audio}),!0}case"embeddings":{const e=await async function(e,t){const s=await l.jV.post("embeddings",{input:e,session_id:t});if(0!==s.code)throw new Error(s.message||"Embeddings 请求失败");const n=s.data||{},a=n?.data??[],i=`向量维度: ${a[0]?.embedding?.length??0}, 数量: ${a.length}`;return{session_id:n.session_id||t,embeddings:n,text:`✅ Embeddings 结果 - ${i}\n\`\`\`json\n${JSON.stringify(n,null,2).slice(0,2e3)}\n\`\`\``}}(t,s);return e&&n(e.text,{embeddings:e.embeddings}),!0}default:return!1}}catch(e){return n(`请求失败: ${e?.message||JSON.stringify(e)}`),!0}}var L=s(57952),O=s(23430),V=s(87361);const q=({currentModelName:e,setCurrentModelName:t,envConfigRef:s,sysPromptList:n,batchMode:o,selectedMsgCount:r,onToggleSessionPanel:u,onCreateSession:h,onToggleBatchMode:p,onBatchDeleteMessages:f,bgProcessVisible:j,bgProcessCount:v,onToggleBgProcess:b,selectedSysPromptId:y,setSelectedSysPromptId:w})=>{const{t:S}=(0,i.Bd)(),N=(0,c.Zp)(),{check_user_auth:k}=(0,d.MH)(),[,C]=(0,a.fp)(x.AG.ai_session_collapsed);return(0,$.jsxs)(L.A,{children:[(0,$.jsx)(A.rA,{icon:"menu",title:S("会话"),onClick:u}),(0,$.jsx)(A.rA,{icon:"add",title:S("新会话"),onClick:()=>h()}),n.length>0&&(0,$.jsx)(_.l6,{value:y,options:[{title:S("选择系统提示词"),value:""},...n.map(e=>({title:e.note||e.prompt.slice(0,30),value:String(e.index)}))],onChange:e=>{w(e)},no_border:!0,width:"10rem"}),(s.current?.ai_config_env?.options_agent_model_list?.length??0)>0&&(0,$.jsx)(_.l6,{value:e,options:s.current.ai_config_env.options_agent_model_list?.map(e=>({title:e.label,value:e.value}))??[],onChange:e=>{t(e),l.jV.post("set_active_model",{model_name:e}).then(()=>{(0,m.SK)("success"),l.XO.get("ai_agent_setting/env").then(e=>{e.code===g.m.Success&&(s.current=e.data)})}).catch(console.error)},no_border:!0,width:"auto"}),o&&r>0&&(0,$.jsx)(A.rA,{icon:"delete",title:S("删除选中消息"),onClick:f}),(0,$.jsx)(A.rA,{icon:"terminal",title:S("后台进程"),onClick:b,selected:j,tip:v||null}),k(O.oV.ai_agent_setting)&&(0,$.jsx)(A.rA,{icon:"smart_toy",title:"机器人配置",onClick:()=>{N(`/${V.o.ai_rebot_setting_page}`)}}),k(O.oV.ai_agent_setting)&&(0,$.jsx)(A.rA,{icon:"settings",title:"ai setting",onClick:()=>{N(`/${V.o.ai_agent_setting_page}`)}})]})};var B=s(27690);function K({sessions:e,activeSessionId:t,onSelectSession:s,onRenameSession:c,onDeleteSession:o,onShowUsageStats:l,batchMode:r,selectedSessionIds:d,onToggleSessionSelect:u,onToggleBatchMode:m,onBatchDeleteSessions:h,onClearAllSessions:g}){const{t:p}=(0,i.Bd)(),[_,f]=(0,a.fp)(x.AG.ai_session_collapsed),[j,v]=(0,n.useState)(""),b=j.trim()?e.filter(e=>(e.title||"").toLowerCase().includes(j.toLowerCase())||(e.summary||"").toLowerCase().includes(j.toLowerCase())||(e.long_term_memory||"").toLowerCase().includes(j.toLowerCase())):e;return(0,$.jsxs)("aside",{className:`chat-session-list ${_?"active":""} ${_?"collapsed":""}`,children:[(0,$.jsx)("div",{className:"chat-session-search",children:(0,$.jsx)("input",{type:"text",className:"chat-session-search-input",placeholder:p("搜索会话"),value:j,onChange:e=>v(e.target.value)})}),(0,$.jsx)("div",{className:"chat-session-items-wrap",children:b.map(e=>{return(0,$.jsx)("div",{children:(0,$.jsxs)("button",{className:`chat-session-item ${t===e.id?"active":""} ${r?"batch-mode":""}`,onClick:()=>{r&&u?u(e.id):s(e.id)},title:e.summary||e.long_term_memory||e.title,children:[r&&(0,$.jsx)("input",{type:"checkbox",className:"chat-session-checkbox",checked:d?.has(e.id)??!1,onChange:()=>u?.(e.id),onClick:e=>e.stopPropagation()}),(0,$.jsx)("span",{children:(n=e.title,n||"新会话")}),(0,$.jsx)("small",{children:e.message_count}),"web"!==e.source&&(0,$.jsx)("em",{className:"chat-session-source",children:e.source}),!r&&(0,$.jsx)(B.MenuSelect,{list:[{name:p("重命名"),click:()=>c(e.id,e.title)},{name:p("字符消耗统计"),click:()=>l(e.id)},{name:p("删除"),click:()=>o(e.id)}],children:(0,$.jsx)(A.In,{icon:"more_horiz"})})]})},e.id);var n})}),(0,$.jsxs)("div",{className:"chat-session-actions",children:[(0,$.jsx)(A.rA,{icon:r?"check_circle":"checklist",title:p(r?"取消批量选择":"批量选择"),onClick:m}),r&&(d?.size??0)>0&&(0,$.jsx)(A.rA,{icon:"delete",title:p("删除选中会话"),onClick:h}),!r&&(0,$.jsx)(A.rA,{icon:"delete_sweep",title:p("删除全部会话"),onClick:g})]})]})}const z=({messages:e,batchMode:t,selectedMsgIds:s,sending:n,chatContainerRef:a,messagesEndRef:i,onToggleMsgSelect:c,onDelete:o,onCopy:l,onToggleBatchMode:r,t:d})=>(0,$.jsxs)("div",{className:"chat-messages",ref:a,"data-sending":n?"true":"false",children:[e.map(e=>(0,$.jsxs)("div",{className:`chat-message ${e.sender} ${t?"batch-mode":""} ${e.is_loading?"is-loading":""}`,children:[t&&(0,$.jsx)("input",{type:"checkbox",className:"chat-message-checkbox",checked:s.has(e.id),onChange:()=>c(e.id)}),e.is_loading?(0,$.jsxs)("div",{className:"ai-loading-bubble",children:[(0,$.jsxs)("div",{className:"ai-loading-dots",children:[(0,$.jsx)("span",{className:"ai-loading-dot"}),(0,$.jsx)("span",{className:"ai-loading-dot"}),(0,$.jsx)("span",{className:"ai-loading-dot"})]}),(0,$.jsx)("span",{className:"ai-loading-text",children:e.text})]}):(0,$.jsxs)($.Fragment,{children:[M(e),(0,$.jsx)("div",{className:"message-actions",children:t?(0,$.jsx)("button",{onClick:()=>c(e.id),children:s.has(e.id)?d("取消选择"):d("选择")}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("button",{onClick:()=>o(e.id),children:d("删除")}),(0,$.jsx)("button",{onClick:()=>l(e.text),children:d("复制")}),(0,$.jsx)("button",{onClick:r,children:d("多选")})]})})]})]},e.id)),(0,$.jsx)("div",{ref:i})]});function J({onClose:e}){const{t}=(0,i.Bd)(),[s,c]=(0,a.fp)(x.AG.ai_images_extra_params),[o,l]=(0,n.useState)(s.size||"1024x1024"),[r,d]=(0,n.useState)(String(s.n??1)),[u,m]=(0,n.useState)(s.quality||""),[h,g]=(0,n.useState)(s.style||""),[p,f]=(0,n.useState)(s.extra_json||"");return(0,$.jsxs)("div",{className:"card floating",children:[(0,$.jsx)("div",{className:"card-title",children:(0,$.jsx)("h2",{children:t("图片生成参数设置")})}),(0,$.jsxs)("div",{className:"card-content",children:[(0,$.jsx)(_.Sm,{placeholderOut:t("图片尺寸 (size)"),value:o,handleInputChange:l,placeholder:"1024x1024"}),(0,$.jsx)(_.Sm,{placeholderOut:t("生成数量 (n)"),value:r,handleInputChange:d,type:"number"}),(0,$.jsx)(_.Sm,{placeholderOut:t("画质 (quality)"),value:u,handleInputChange:m,placeholder:"standard / hd"}),(0,$.jsx)(_.Sm,{placeholderOut:t("风格 (style)"),value:h,handleInputChange:g,placeholder:"vivid / natural"}),(0,$.jsx)(_.Sm,{placeholderOut:t("额外参数 JSON"),value:p,handleInputChange:f,placeholder:'{"key":"value"}'})]}),(0,$.jsxs)("div",{className:"card-action",children:[(0,$.jsx)("button",{className:"button button--flat button--grey",onClick:e,children:t("取消")}),(0,$.jsx)("button",{className:"button button--flat",onClick:()=>{const t={size:o,n:parseInt(r)||1};u&&(t.quality=u),h&&(t.style=h),p&&(t.extra_json=p),c(t),e()},children:t("确定")})]})]})}function G({requestType:e}){const{t}=(0,i.Bd)(),[s,a]=(0,n.useState)(!1);return"completions"===e?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(A.rA,{icon:"tune",title:t("模型参数设置"),onClick:()=>a(!0)}),s&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("div",{className:"overlay",onClick:()=>a(!1)}),"images"===e&&(0,$.jsx)(J,{onClose:()=>a(!1)})]})]})}const W=(0,n.forwardRef)(function({placeholder:e="",disabled:t=!1,className:s,style:a,onEnter:i,onPaste:c,onChange:o},l){const r=(0,n.useRef)(null),[d,u]=(0,n.useState)(!0),[m,h]=(0,n.useState)(!1),g=(0,n.useCallback)(()=>{const e=r.current;return e?(e.textContent??"").replace(/\u00A0/g," ").trimEnd():""},[]);(0,n.useImperativeHandle)(l,()=>({getValue:()=>g(),setValue:e=>{const t=r.current;if(!t)return;t.textContent=e,u(!e);const s=document.createRange();s.selectNodeContents(t),s.collapse(!1);const n=window.getSelection();n?.removeAllRanges(),n?.addRange(s)},clear:()=>{const e=r.current;e&&(e.textContent="",u(!0))},focus:()=>r.current?.focus()})),(0,n.useEffect)(()=>{const e=r.current;if(!e)return;const t=()=>u(!e.textContent);return e.addEventListener("input",t),()=>e.removeEventListener("input",t)},[]);return(0,$.jsx)("div",{ref:r,contentEditable:!t,suppressContentEditableWarning:!0,className:"rich-textarea"+(s?" "+s:""),style:a,onKeyDown:e=>{m||"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),i?.())},onPaste:c,onInput:()=>o?.(g()),onCompositionStart:()=>h(!0),onCompositionEnd:()=>h(!1),"data-placeholder":d?e:void 0})});function Q({pendingAttachments:e,onRemove:t}){return 0===e.length?null:(0,$.jsx)("div",{className:"chat-attachment-strip",children:e.map((e,s)=>(0,$.jsxs)("div",{className:"chat-attachment-chip",children:[(0,$.jsx)(A.In,{icon:"attach_file"}),(0,$.jsx)("span",{title:e.name,children:e.name}),(0,$.jsx)("button",{type:"button",onClick:()=>t(s),children:(0,$.jsx)(A.In,{icon:"close"})})]},`${e.name}_${s}`))})}const U=(0,n.forwardRef)(({onSend:e,sending:t,onAbort:s,pendingAttachments:c,onRemoveAttachment:o,onOpenFilePicker:l,onAddFiles:r,onDrop:d,onDragOver:u,fileInputRef:m,requestType:h},g)=>{const{t:p}=(0,i.Bd)(),_=(0,n.useRef)(null),[f,j]=(0,n.useState)(!1),v=(0,n.useRef)(null),[b,y]=(0,a.fp)(x.AG.ai_chat_input_height);(0,n.useImperativeHandle)(g,()=>({getValue:()=>_.current?.getValue()??"",setValue:e=>_.current?.setValue(e),clear:()=>_.current?.clear()}));const w=(0,n.useCallback)(e=>{const t=v.current;if(!t)return;const s=t.getBoundingClientRect().bottom-e.clientY;let n=Math.round(s/21.375);n=Math.max(2,Math.min(20,n)),y(n)},[y]),S=(0,n.useCallback)(()=>j(!0),[]),N=(0,n.useCallback)(()=>j(!1),[]);(0,n.useEffect)(()=>{if(!f)return;const e=w;return window.addEventListener("pointermove",e),window.addEventListener("pointerup",N),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",N)}},[f,w,N]);const k={minHeight:`${b}em`,maxHeight:`${b}em`};return(0,$.jsxs)("div",{ref:v,className:"chat-input-area",onDrop:d,onDragOver:u,children:[(0,$.jsx)("div",{className:"chat-input-resize-handle"+(f?" dragging":""),onPointerDown:S}),(0,$.jsx)("input",{ref:m,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{e.target.files?.length&&(r(e.target.files),e.currentTarget.value="")}}),(0,$.jsxs)("div",{className:"chat-input-shell",style:k,children:[(0,$.jsx)(Q,{pendingAttachments:c,onRemove:o}),(0,$.jsx)(W,{ref:_,placeholder:p("输入消息"),onEnter:()=>e(),onPaste:e=>{const t=e.clipboardData?.files;t&&t.length>0&&(e.preventDefault(),r(t))},className:"chat-input",style:k})]}),(0,$.jsx)(A.rA,{title:p("添加文件"),icon:"attach_file",onClick:l}),(0,$.jsx)(G,{requestType:h}),t?(0,$.jsx)(A.Vi,{color:"var( --icon-red)",text:p("暂停"),clickFun:s}):(0,$.jsx)(A.Vi,{text:p("发送"),clickFun:e}),f&&(0,$.jsx)("div",{className:"chat-input-overlay",onPointerUp:N})]})}),X={},Z=function(){const{t:e}=(0,i.Bd)(),[t,s]=(0,n.useState)([]),[c,l]=(0,n.useState)(!1),[r,d]=(0,n.useState)(null),[u,h]=(0,n.useState)(null),[g,p]=(0,n.useState)(!1),[_,f]=(0,a.fp)(x.AG.ai_bg_expanded),[,j]=(0,a.fp)(x.AG.ai_session_collapsed),v=()=>{f(!1)},b=(0,n.useCallback)(async()=>{l(!0);try{const e=new o.hf(o.HK.ai_bg_process_list_req);e.context={};const t=await k.ws.send(e);t?.context?.processes&&(s(t.context.processes),X.onCountChange?.(t.context.processes.length))}catch(e){console.error("获取后台进程列表失败",e)}finally{l(!1)}},[]);X.refresh=b;const y=(0,n.useCallback)(async e=>{p(!0),d(e);try{const t=new o.hf(o.HK.ai_bg_process_output_req);t.context={pid:e};const s=await k.ws.send(t);h(s.context)}catch(e){console.error("获取进程输出失败",e),(0,m.zN)("获取进程输出失败")}finally{p(!1)}},[]),w=(0,n.useCallback)(async e=>{try{const t=new o.hf(o.HK.ai_bg_process_kill_req);t.context={pid:e};const s=await k.ws.send(t);s?.context?.success?((0,m.SK)("进程已终止"),b(),r===e&&(d(null),h(null))):(0,m.zN)(s?.context?.message||"终止失败")}catch(e){console.error("终止进程失败",e),(0,m.zN)("终止进程失败")}},[b,r]);(0,n.useEffect)(()=>{b();const e=setInterval(b,5e3);return()=>clearInterval(e)},[b]);const S=t.filter(e=>e.running),N=t.filter(e=>!e.running);return(0,$.jsxs)($.Fragment,{children:[_&&(0,$.jsx)("div",{className:"chat-session-overlay",onClick:v}),(0,$.jsxs)("aside",{className:"chat-bg-process-panel "+(_?"expanded":""),children:[(0,$.jsxs)("div",{className:"chat-bg-process-header",children:[(0,$.jsx)("span",{className:"chat-bg-process-title",children:e("后台进程")}),(0,$.jsx)(A.rA,{icon:"close",title:e("关闭"),onClick:v})]}),(0,$.jsxs)("div",{className:"chat-bg-process-toolbar",children:[(0,$.jsx)(A.rA,{icon:"refresh",title:e("刷新"),onClick:b}),(0,$.jsxs)("span",{className:"chat-bg-process-count",children:[S.length," ",e("个运行中"),N.length>0&&` / ${N.length} ${e("个已退出")}`]})]}),(0,$.jsxs)("div",{className:"chat-bg-process-list",children:[c&&0===t.length&&(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}),!c&&0===t.length&&(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("暂无后台进程")}),S.map(t=>(0,$.jsxs)("div",{className:`chat-bg-process-item ${r===t.pid?"active":""} running`,children:[(0,$.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(t.pid),children:[(0,$.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",t.pid]}),(0,$.jsx)("span",{className:"chat-bg-process-cmd",title:t.cmd,children:t.cmd.length>40?t.cmd.slice(0,40)+"...":t.cmd}),(0,$.jsx)("span",{className:"chat-bg-process-time",children:new Date(t.start_time).toLocaleTimeString()}),(0,$.jsx)("span",{className:"chat-bg-process-status running-dot",title:e("运行中"),children:"●"})]}),(0,$.jsxs)("div",{className:"chat-bg-process-item-actions",children:[(0,$.jsx)(A.rA,{icon:"terminal",title:e("查看输出"),onClick:()=>y(t.pid)}),(0,$.jsx)(A.rA,{icon:"stop",title:e("终止进程"),onClick:()=>w(t.pid)})]})]},t.pid)),N.map(e=>(0,$.jsx)("div",{className:`chat-bg-process-item ${r===e.pid?"active":""} finished`,children:(0,$.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(e.pid),children:[(0,$.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,$.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>30?e.cmd.slice(0,30)+"...":e.cmd}),(0,$.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,$.jsxs)("span",{className:"chat-bg-process-exit-code",children:["exit: ",e.exit_code]})]})},e.pid))]}),null!==r&&(0,$.jsxs)("div",{className:"chat-bg-process-output",children:[(0,$.jsxs)("div",{className:"chat-bg-process-output-header",children:[(0,$.jsxs)("span",{children:["PID: ",r," ",e("输出")]}),(0,$.jsx)(A.rA,{icon:"close",title:e("关闭"),onClick:()=>{d(null),h(null)}})]}),(0,$.jsx)("div",{className:"chat-bg-process-output-content",children:g?(0,$.jsx)("div",{className:"chat-bg-process-empty",children:e("加载中...")}):u?(0,$.jsx)("pre",{className:"chat-bg-process-output-pre",children:u.output||e("(无输出)")}):null})]})]})]})};function Y(){const{t:e}=(0,i.Bd)(),t=((0,c.Zp)(),(0,h.y)()),{check_user_auth:s}=(0,d.MH)();(0,p.w)();const[b,y]=(0,n.useState)([]),[w,S]=(0,n.useState)([]),[C,A]=(0,n.useState)(""),[I,M]=(0,n.useState)(!1),D=(0,n.useRef)(null),[T,R]=(0,n.useState)([]),[H,P]=(0,a.fp)(x.AG.ai_session_collapsed),[E,L]=(0,a.fp)(x.AG.ai_bg_expanded),[O,V]=(0,a.fp)(x.AG.prompt_card),[B,J]=(0,n.useState)(!1),[G,W]=(0,n.useState)(new Set),[Q,Y]=(0,n.useState)(new Set),[ee,te]=(0,n.useState)(""),se=(0,n.useRef)(null),ne=(0,n.useRef)(null),ae=(0,n.useRef)(null),ie=(0,n.useRef)(!0),ce=(0,n.useRef)(new f.qq),[oe,le]=(0,n.useState)([]),[re,de]=(0,n.useState)(""),[ue,me]=(0,n.useState)(0),he=()=>ce?.current?.ai_config?.request_type||"completions",ge=(0,n.useRef)((0,r.sg)(e=>{y(e),ie.current&&pe(!1)},50)).current,pe=(e=!1)=>{const t=ae.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e?"smooth":"auto"})},xe=async()=>{const e=await l.jV.get("sessions");e.code===g.m.Success&&S(e.data??[])},_e=function(e){const{getMessages:t,setMessages:s,setMessagesDebounced:a,setSending:i,getActiveSessionId:c,setActiveSessionId:l,refreshSessions:r,scrollToBottom:d,buildRequestMessages:u,getSelectedSysPromptId:m}=e,h=(0,n.useRef)([]),g=(0,n.useRef)(null),p=(e,n,c)=>{const l=[...t(),n];s(l),i(!0),g.current={abort:()=>{}};const h={id:n.id+1,sender:"bot",text:"AI思考中...",is_loading:!0};l.push(h),s([...l]);const p=new Map;let x=!0,_=h;const f=e=>{const t=e.context||{},s=t.text||"",n=t.tool_call_ends,i=t.chunk_index??0;if("[DONE]"!==s)if(x)x=!1,_.text=s,n&&(_.content_list=[{tool_call_ends:n,content:_.text,role:"assistant"}]),_.is_loading=!1,_.chunk_index=i,p.set(i,_),a([...l]);else{const e=p.get(i);if(e)e.text+=s,n&&(e.content_list=[{tool_call_ends:n,content:e.text,role:"assistant"}]),a([...l]);else{const e={id:Date.now()+Math.random(),sender:"bot",text:s,chunk_index:i};n&&(e.content_list=[{tool_call_ends:n,content:e.text,role:"assistant"}]),l.push(e),p.set(i,e),a([...l])}}},j=e=>{b(),g.current=null,i(!1),_.is_loading=!1,r(),d(!0),c()},v=e=>{b(),g.current=null,i(!1);const t=e.context||{};_.text="AI请求出错: "+(t.message||"未知错误"),_.is_loading=!1,s([...l]),c()},b=()=>{k.ws.off_message(`message_${o.HK.ai_chat_msg}`,f),k.ws.off_message(`message_${o.HK.ai_chat_end}`,j),k.ws.off_message(`message_${o.HK.ai_chat_error}`,v)};k.ws.addMsg(o.HK.ai_chat_msg,f),k.ws.addMsg(o.HK.ai_chat_end,j),k.ws.addMsg(o.HK.ai_chat_error,v),k.ws.sendData(o.HK.ai_chat_req,{messages:u(n),session_id:e,sys_prompt_id:m()})},x=()=>{const e=h.current;if(0===e.length)return;const t=e.shift();if(!t)return;s(e=>e.map(e=>"user"===e.sender&&e.text.includes("⏳(排队中...)")?{...e,text:e.text.replace(" ⏳(排队中...)","")}:e));const n={id:Date.now(),sender:"user",text:t.text,attachments:t.attachments};p(c(),n,x)};return{startChatStream:p,processPendingQueue:x,enqueueMessage:(e,t)=>{h.current.push({text:e,attachments:t})},getQueueLength:()=>h.current.length,abort:()=>{g.current&&(k.ws.sendData(o.HK.ai_chat_abort,{session_id:c()}),g.current=null,i(!1))}}}({getMessages:()=>b,setMessages:y,setMessagesDebounced:ge,setSending:M,getActiveSessionId:()=>C,setActiveSessionId:A,refreshSessions:xe,scrollToBottom:pe,buildRequestMessages:e=>{const t=(e.attachments??[]).filter(e=>"image"===e.kind);if(t.length>0){const s=[];e.text&&s.push({type:"text",text:e.text});for(const e of t)s.push({type:"image_url",image_url:{url:e.content}});return[{content:s,role:"user",attachments:e.attachments??[]}]}return[{content:e.text,role:"bot"===e.sender?"assistant":"user",attachments:e.attachments??[]}]},getSelectedSysPromptId:()=>ee}),fe=async e=>{const t=await l.jV.get("sessions");if(t.code!==g.m.Success)return;const s=t.data??[];S(s);const n=null===e?s[0]?.id??"":e||C||s[0]?.id||"";n?await je(n):(y([]),A(""))},je=async(e,t=!1)=>{const s=await l.jV.post("session/get",{session_id:e});if(s.code!==g.m.Success||!s.data)return;const n=s.data;A(n.id),y(function(e=[]){return e.filter(e=>"user"===e.role||"assistant"===e.role).map((e,t)=>({id:Date.now()+t,sender:"assistant"===e.role?"bot":"user",text:v(e),attachments:e.attachments??[],content_list:e.content_list,images:e.images,audio:e.audio,embeddings:e.embeddings}))}(n.messages)),t&&P(!1),X.refresh?.(),requestAnimationFrame(()=>pe(!1))},ve=e=>{const t=Array.from(e??[]).filter(Boolean);t.length&&R(e=>[...e,...t])},be=()=>{B&&(W(new Set),Y(new Set)),J(e=>!e)};(0,n.useEffect)(()=>((async()=>{const e=await l.XO.get("ai_agent_setting/env");if(e.code===g.m.Success){ce.current=e.data;const t=e.data.ai_config?.model||"",s=(e.data.ai_config_env?.options_agent_model_list??[]).find(e=>e.label===t);de(s?s.value:t)}await fe();const t=await l.jV.get("system_prompts");t.code===g.m.Success&&le(t.data??[])})(),requestAnimationFrame(()=>pe(!1)),X.onCountChange=me,X.refresh?.(),k.ws.addMsg(o.HK.ai_bg_process_count_notify,e=>{const t=e?.context?.count;"number"==typeof t&&me(t)}),()=>{k.ws.removeMsg(o.HK.ai_bg_process_count_notify)}),[]),(0,n.useEffect)(()=>{const e=ae.current;if(!e)return;const t=()=>{ie.current=((e,t=120)=>{const{scrollTop:s,scrollHeight:n,clientHeight:a}=e;return n-(s+a)<t})(e)};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[]),(0,n.useLayoutEffect)(()=>{ie.current&&pe(!1)},[b]);return(0,$.jsxs)(n.Fragment,{children:[(0,$.jsx)(q,{currentModelName:re,setCurrentModelName:de,envConfigRef:ce,sysPromptList:oe,batchMode:B,selectedMsgCount:G.size,onToggleSessionPanel:()=>{P(e=>!e)},onCreateSession:async e=>{const t=await l.jV.post("session",{title:"新会话"});if(t.code!==g.m.Success)return;const s=t.data;A(s.id),y([]),P(!1),await fe(s.id),requestAnimationFrame(()=>{const e=document.querySelector(".chat-input");e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")})},onBatchDeleteMessages:()=>{0!==G.size&&t({sub_title:e("确认删除选中的聊天消息吗?"),confirm_fun:async()=>{const e=[];b.forEach((t,s)=>{G.has(t.id)&&e.push(s)}),y(b.filter(e=>!G.has(e.id))),W(new Set),J(!1),C&&e.length>0&&l.jV.post("session/message/delete",{session_id:C,indices:e}).catch(console.error)}})},bgProcessVisible:E,bgProcessCount:ue,onToggleBgProcess:()=>L(e=>!e),selectedSysPromptId:ee,setSelectedSysPromptId:te}),(0,$.jsxs)("div",{className:"chat-page chat-page-with-sessions",children:[H&&(0,$.jsx)("div",{className:"chat-session-overlay",onClick:()=>P(!1)}),(0,$.jsx)(K,{sessions:w,activeSessionId:C,onSelectSession:e=>je(e,!1),onRenameSession:(e,s)=>{let n=s;t({confirm_fun:async()=>{await l.jV.post("sessions/update/meta",{id:e,title:n}),await fe(C)},context_div:(0,$.jsx)("div",{className:"card-content",children:(0,$.jsx)(_.Sm,{value:n,handleInputChange:e=>{n=e}})})})},onDeleteSession:e=>{t({sub_title:"确认删除这个会话吗?",confirm_fun:async()=>{await l.jV.post("session/delete",{session_id:e}),C===e?(A(""),await fe(null)):await fe(C)}})},onShowUsageStats:async t=>{V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-loading",children:e("加载中...")}),cancel:()=>V({open:!1})});try{const s=await l.jV.post("session/usage_stats",{session_id:t});if(s.code===g.m.Success&&s.data){const t=s.data;V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsxs)("div",{className:"usage-stats-panel",children:[[{l:e("对话轮次"),v:(t.turns??0).toString()},{l:e("AI输入Token"),v:j(t.input_tokens)},{l:e("AI输出Token"),v:j(t.output_tokens)},{l:e("AI输入Token(最近一轮)"),v:j(t.recent_input_tokens)},{l:e("AI输出Token(最近一轮)"),v:j(t.recent_output_tokens)}].map((e,t)=>(0,$.jsxs)("div",{className:"usage-stats-row",children:[(0,$.jsx)("span",{className:"usage-stats-label",children:e.l}),(0,$.jsx)("span",{className:"usage-stats-value",children:e.v})]},t)),(0,$.jsxs)("div",{className:"usage-stats-row usage-stats-total",children:[(0,$.jsx)("span",{className:"usage-stats-label",children:e("AI Token总计消耗")}),(0,$.jsx)("span",{className:"usage-stats-value",children:j((t.input_tokens||0)+(t.output_tokens||0))})]})]}),cancel:()=>V({open:!1})})}else V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>V({open:!1})})}catch{V({open:!0,title:e("Token消耗统计"),context_div:(0,$.jsx)("div",{className:"usage-stats-empty",children:e("暂无统计数据")}),cancel:()=>V({open:!1})})}},batchMode:B,selectedSessionIds:Q,onToggleSessionSelect:e=>{Y(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onToggleBatchMode:be,onBatchDeleteSessions:()=>{0!==Q.size&&t({sub_title:e("确认删除选中的会话吗?"),confirm_fun:async()=>{for(const e of Q)await l.jV.post("session/delete",{session_id:e});Y(new Set),J(!1),Q.has(C)?(A(""),await fe(null)):await fe(C)}})},onClearAllSessions:()=>{t({sub_title:e("确认删除全部聊天会话吗?"),confirm_fun:async()=>{await l.jV.post("sessions/clear",{}),A(""),y([]),await fe(null)}})}}),(0,$.jsx)(Z,{}),(0,$.jsxs)("section",{className:"chat-main",children:[0===b?.length&&(0,$.jsx)("div",{className:"chat-header",children:(0,$.jsx)("div",{children:e("询问服务器的一切")})}),(0,$.jsx)(z,{messages:b,batchMode:B,selectedMsgIds:G,sending:I,chatContainerRef:ae,messagesEndRef:ne,onToggleMsgSelect:e=>{W(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onDelete:s=>{t({sub_title:e("确认删除这条消息吗?"),confirm_fun:async()=>{const e=b.findIndex(e=>e.id===s);if(e<0)return;const t=b.filter(e=>e.id!==s);y(t),C&&l.jV.post("session/message/delete",{session_id:C,indices:[e]}).catch(console.error)}})},onCopy:async e=>{(0,u.lW)(e),(0,m.SK)("复制成功")},onToggleBatchMode:be,t:e}),(0,$.jsx)(U,{ref:D,onSend:async()=>{const e=(D.current?.getValue()??"").trim();if(!e&&0===T.length)return;if(I){const t=await N(T);_e.enqueueMessage(e,t),D.current?.clear(),R([]);const s={id:Date.now(),sender:"user",text:e+(_e.getQueueLength()>1?" ⏳(排队中...)":""),attachments:t};return void y(e=>[...e,s])}let t=C;if(!t){const s=await l.jV.post("session",{title:(e||T[0]?.name||"新会话").slice(0,28)});if(s.code!==g.m.Success)return;t=s.data.id,A(t),await fe(t)}const s=await N(T),n={id:Date.now(),sender:"user",text:e,attachments:s};D.current?.clear(),R([]);const a=he();if("completions"!==a){const s={id:n.id+1,sender:"bot",text:"处理中...",is_loading:!0},i=[...b,n,s];y(i),M(!0);return void(await F(a,e,t,async(e,t)=>{s.text=e,s.is_loading=!1,t?.images&&(s.images=t.images),t?.audio&&(s.audio=t.audio),t?.embeddings&&(s.embeddings=t.embeddings),y([...i]),M(!1),xe(),pe(!0),_e.processPendingQueue()})||(s.text=`请求类型 "${a}" 的专用处理器尚未实现,请使用 completions 类型。`,s.is_loading=!1,y([...i]),M(!1),_e.processPendingQueue()))}_e.startChatStream(t,n,()=>_e.processPendingQueue())},sending:I,onAbort:_e.abort,pendingAttachments:T,onRemoveAttachment:e=>{R(t=>t.filter((t,s)=>s!==e))},onOpenFilePicker:()=>{se.current?.click()},onAddFiles:ve,onDrop:e=>{const t=e.dataTransfer?.files;t&&t.length>0&&(e.preventDefault(),ve(t))},onDragOver:e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},fileInputRef:se,requestType:he()})]})]})]})}},72693(e,t,s){s.d(t,{w:()=>u});var n=s(96540),a=s(22022),i=s(14944),c=s(92275),o=s(34843),l=s(82893),r=s(85997),d=s(74848);function u(){const[e,t]=(0,o.fp)(l.AG.prompt_card),{t:s}=(0,a.Bd)(),u=(0,n.useRef)([]),m=(0,n.useRef)(!1),h=(0,n.useCallback)(()=>{if(m.current)return;if(0===u.current.length)return m.current=!1,void t({open:!1});m.current=!0;const e=u.current.shift();e?t({open:!0,title:s("命令确认"),cancel:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),t({open:!1}),m.current=!1,h()},context_div:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),(0,d.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,d.jsx)(r.$n,{text:s("拒绝"),color:"var(--red)",clickFun:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!1}),t({open:!1}),m.current=!1,h()}}),(0,d.jsx)(r.$n,{text:s("允许"),clickFun:()=>{i.ws.sendData(c.HK.ai_confirm_cmd,{askId:e.askId,approved:!0}),t({open:!1}),m.current=!1,h()}})]})]})}):m.current=!1},[s]),g=(0,n.useCallback)(e=>{u.current.push(e),h()},[h]);(0,n.useEffect)(()=>(i.ws.addMsg(c.HK.ai_confirm_cmd,e=>{const s=e.context||{};if(s.dismiss&&s.askId)return u.current=u.current.filter(e=>e.askId!==s.askId),void(m.current&&(m.current=!1,t({open:!1}),h()));s.askId&&s.cmd&&g({askId:s.askId,cmd:s.cmd})}),()=>{i.ws.removeMsg(c.HK.ai_confirm_cmd)}),[g]),(0,n.useEffect)(()=>()=>{u.current=[],m.current=!1},[])}},34299(e,t,s){s.r(t),s.d(t,{default:()=>p});s(96540);var n=s(73557),a=s(53995),i=s(18569),c=s(77979),o=s(8263),l=s(69428),r=s.n(l),d=(s(3775),s(21499)),u=s(99214),m=s(19878),h=(s(72411),s(74848));const g=new n.A({html:!0,highlight:function(e,t){if(t&&m.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${m.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${m.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${g.utils.escapeHtml(e)}</code></pre>`}});function p(e){return(0,u.VD)(),(0,h.jsx)("div",{dangerouslySetInnerHTML:{__html:g.render(e.context)}})}g.use(a.A).use(i.A).use(c.A).use(o.A).use(r()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,s,n,a,i)=>{const c=t[s],o=c.content.trim(),l=c.info.trim();let r="";if(l&&m.A.getLanguage(l))try{r=m.A.highlight(o,{language:l}).value}catch(t){r=e.utils.escapeHtml(o)}else try{r=m.A.highlightAuto(o).value}catch(t){r=e.utils.escapeHtml(o)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${l||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(o)}">复制</button>\n </div>\n <pre><code class="hljs ${l?`language-${l}`:""}">${r}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,s,n,a){return a.renderToken(e,t,s)};e.renderer.rules.link_open=(e,s,n,a,i)=>{const c=e[s],o=c.attrIndex("href");if(o>=0){const e=c.attrs[o][1];c.attrs[o][1]=(0,d.bi)(window.location.href,e)}return t(e,s,n,a,i)}})},45907(e,t,s){s.d(t,{y:()=>i});var n=s(34843),a=s(82893);function i(){const[e,t]=(0,n.fp)(a.AG.confirm);return({sub_title:e,confirm_fun:s,title:n,context_div:a})=>{t({open:!0,sub_title:e,handle:()=>{s(),t({open:!1,handle:null})},title:n,context_div:a})}}},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png"/><script defer="defer" src="main.f11583a8a8ed406175ad.js"></script></head><body><div id="root"></div></body><script id="pre_code" type="text/template">return {{{Windows_FileCat}}};</script><script>window.EXCALIDRAW_ASSET_PATH = "/";window.FileCat;</script></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png"/><script defer="defer" src="main.0b5d3cea9208fae2823e.js"></script></head><body><div id="root"></div></body><script id="pre_code" type="text/template">return {{{Windows_FileCat}}};</script><script>window.EXCALIDRAW_ASSET_PATH = "/";window.FileCat;</script></html>