filecat 7.3.1 → 7.3.3

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([[3328],{77481(e,t,s){s.d(t,{S:()=>o,X:()=>l});var n=s(96540),i=s(61443),a=s(74848);function l(e){const[t,s]=n.useState([]),l=(0,n.useRef)(-1),[o,r]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const h=()=>{l.current=-1,r(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let l=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(l=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(o===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(l.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=l.current,s=c;h(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:h,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},53328(e,t,s){s.r(t),s.d(t,{default:()=>U});var n=s(96540),i=s(75725),a=s(23430),l=s(70447),o=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(86149),p=s(82893),x=s(40505),_=s(62042),m=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,u.B)(),[s,a]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();a(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");a([t,...s])}}),(0,f.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(h.X,{headers:e.headers,rows:s.map((n,i)=>{const l=[];for(let t=0;t<e.headers.length;t++)l.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,a([...s])},no_border:!0}));return l.push((0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),a([...s])})(i)}),n[0]&&(0,f.jsx)(o.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,x.lW)(e),(0,_.SK)(e)}}),n[0]&&e.need_copy&&(0,f.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)}})]})),l}),width:"10rem",onRowDrag:(e,t)=>{a((0,v.TI)(s,e,t))}})})})}var w=s(34843),S=s(78247),y=s(24659);function C(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),a=(0,y.K)(),g=[e("路由"),e("auth"),e("备注")],[C,k]=(0,w.fp)(p.AG.editorSetting),[b,A]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("api/customer_router");e.code===d.m.Success&&A(e.data)})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...b])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",b)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:(0,f.jsx)(h.X,{headers:g,rows:b.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...b])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...b])},options:a,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...b])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,_.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);k({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&&(S.xK.set_value_temp(""),k({open:!1,model:"",fileName:"",save:null}),(0,_.SK)("成功"))}}),S.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(o.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,x.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,_.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(b,e,t))}})})})}var k=s(23496),b=s(4412);function A(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),[a,l]=(0,w.fp)(p.AG.router_jump),o=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(b.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{maxWidth:"50rem",children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:o,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_router);if(e.code===d.m.Success){if(a?.page_self_router_api_data){for(const t of e.data)t[1]===a?.page_self_router_api_data[1]&&(0,_.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,a?.page_self_router_api_data),e.data=[t,...e.data],l({})}return e.data}return[]},save:async e=>{(await c.XO.post(k.s.setting_customer_router_save,e)).code===d.m.Success&&(0,_.SK)("success")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})},need_copy:!0}),(0,f.jsx)(g,{title:e("wf_rt"),headers:r,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(k.s.setting_customer_workflow_router_save,e)).code===d.m.Success&&(0,_.SK)("保存成功")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})}})]}),(0,f.jsx)(i.VP,{maxWidth:"50rem",children:(0,f.jsx)(C,{})})]})]})}var I=s(74777),V=s(6960),N=s(7523);function K(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),[s,i]=(0,n.useState)(!1),[h,x]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[v,g]=(0,n.useState)(180),[y,C]=(0,n.useState)(!1),[k,b]=(0,w.fp)(p.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),x(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),g(t.check_interval_seconds||180)}})()},[]);return t(a.oV.sys_setting_page)?(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{b({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,_.zN)(e("ver_req"));if(s&&(!v||v<10))return void(0,_.zN)(e("chk_10s"));const t=new I.Mm;t.open=s,t.version_check_url=h,t.exe_download_url=m,t.check_interval_seconds=v;(await c.XO.post("auto_upgrade_setting/save",t)).code===d.m.Success&&(0,_.SK)(e("保存成功"))}}),children:[(0,f.jsx)("div",{children:e("ver_url")}),(0,f.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:h,handleInputChange:e=>{x(e)}}),(0,f.jsx)(r.l6,{value:s,onChange:e=>{i(e)},options:[{title:e("开启"),value:!0},{title:e("关闭"),value:!1}]}),s&&(0,f.jsxs)(f.Fragment,{children:[!1,(0,f.jsx)("div",{children:e("检测频率(秒)")}),(0,f.jsx)(r.Sm,{placeholder:e("def_180"),value:v,handleInputChange:e=>{g(Number(e)||180)}}),(0,f.jsx)("div",{style:{marginTop:"12px"},children:(0,f.jsx)(o.C3,{text:e(y?"升级检测中...":"立即升级"),clickFun:async()=>{C(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,_.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,_.zN)(e("触发升级失败"))}finally{C(!1)}}})})]})]}):null}function X(){const[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)(""),[x,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),[C,A]=(0,n.useState)(""),[X,z]=(0,w.fp)(p.AG.prompt_card),[F,O]=(0,n.useState)(!1),[P,$]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[M,T]=(0,n.useState)(I.aM.close),[E,G]=(0,n.useState)(!1),[q,W]=(0,n.useState)(void 0),{t:Z,i18n:R}=(0,u.B)(),[U,H]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:L}=(0,S.MH)(),{initUserInfo:Q}=(0,n.useContext)(N.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){y(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),a(s?.logo||""),m(s?.show_login_user_info),v(s?.http_proxy||"");const n=e.data.https_setting;n&&(O(n.open),$(n.cert_path||""),D(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&&T(e.mode),void 0!==e.persist&&G(e.persist)}})()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(b.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[Z("系统运行于"),": ",(0,V.s)(U.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:7.3.1",null!=U.latest_version&&"7.3.1"!==U.latest_version?` -> ${U.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:Z("官网地址"),target:"_blank",children:`filecat ${Z("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[Z("安装方式")," :",U.process_env_run_env]})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:Z("通用设置")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{z({open:!0,title:Z("信息"),context_div:(0,f.jsx)("div",{children:Z("pxy_tip")})})},title:Z("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:x,http_proxy:j,logo:s}})).code===d.m.Success&&((0,_.SK)("修改成功"),Q())}}),children:[Z("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),Z("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:Z("lclorur"),value:s,handleInputChange:e=>{a(e)}}),(0,f.jsx)("div",{children:Z("pxy_url")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),Z("lgn_usr"),(0,f.jsx)("input",{type:"checkbox",checked:x,onChange:()=>{m(!x)}})]}),(0,f.jsxs)(l.Zp,{title:Z("https_s"),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{if(F){if(!P)return void(0,_.zN)("证书路径不能为空");if(!B)return void(0,_.zN)("私钥路径不能为空")}const e=new I.CH;e.open=F,e.cert_path=P,e.key_path=B;(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:F})).code===d.m.Success&&(0,_.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,f.jsx)(r.l6,{value:F,onChange:e=>{O(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]}),F&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{children:Z("ssl_crt")}),(0,f.jsx)(r.Sm,{placeholder:Z("crt_pth"),value:P,handleInputChange:e=>{$(e)}}),(0,f.jsx)("div",{children:Z("ssl_key")}),(0,f.jsx)(r.Sm,{placeholder:Z("ky_pth"),value:B,handleInputChange:e=>{D(e)}})]})]}),(0,f.jsx)(K,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:Z("文件回收站")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{z({open:!0,title:Z("信息"),context_div:(0,f.jsx)("div",{children:Z("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:Z("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{if(g&&!C)return void(0,_.zN)("目录不能为空");(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:C,open:g})).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:Z("目录"),value:C,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{y(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]})]}),(0,f.jsxs)(l.Zp,{title:Z("tk_exp"),rightBottomCom:(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(o.C3,{text:Z("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,_.SK)("清理完成,重新登录")}}),(0,f.jsx)(o.C3,{text:Z("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=M,e.persist=E,I.aM.length!==e.mode||q||(0,_.zN)("秒数不能为空"),e.length=parseInt(q);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:[(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:Z("关闭"),selected:M===I.aM.close,onchange:()=>{T(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:Z("指定时间"),selected:M===I.aM.length,onchange:()=>{T(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:Z("永不过期"),selected:M===I.aM.forver,onchange:()=>{T(I.aM.forver)}})]}),M===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:Z("秒"),value:q,handleInputChange:e=>{W(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:E,onChange:()=>G(!E)}),Z("持久化")]})]})]})]})})]})}var z=s(92350);function F(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:a}=(0,n.useContext)(N.F),[x,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[C,k]=(0,w.fp)(p.AG.prompt_card),[,b]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[V,K]=(0,n.useState)([]),[X,F]=(0,n.useState)([]),[O,P]=(0,n.useState)([]),[$,B]=(0,n.useState)(""),[D,M]=(0,n.useState)([]),T=(0,y.K)(),E=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],q=[e("编号"),e("路径"),e("是否开启"),e("备注")],W=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],R=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:U}=(0,S.MH)(),H=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&F(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),H(),L();const s=await c.XO.get("protection_dir/sys");s.code===d.m.Success&&I(s.data??[]);const n=await c.XO.get("dir_upload_max_num");n.code===d.m.Success&&K(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&M(i.data??[])})()},[]);const Q=(0,z.Q)(),J=async()=>{(await c.XO.post("plugin/list/save",D)).code===d.m.Success&&(0,_.SK)(e("保存成功"))};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...V,{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,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of V)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,_.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,_.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,_.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,v.di)(V,e=>e.index??0);(await c.XO.post("dir_upload_max_num/save",V)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:Z,rows:V.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,K([...V])},options:T,no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),K([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{K((0,v.TI)(V,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?k({open:!0,title:e("进程环境变量"),context_div:(0,f.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60vh",overflow:"auto",margin:0,fontSize:"0.85rem",lineHeight:"1.5"},children:t.data})}):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(S.xK.set_value_temp(t.data??""),b({model:"ace/mode/ini",open:!0,fileName:"",save:async t=>{(await c.XO.post("env/process/save",{text:t})).code===d.m.Success?(0,_.SK)(e("保存成功")):(0,_.zN)(e("保存失败")),S.xK.set_value_temp("")}})):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...X,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:X})).code===d.m.Success&&((0,_.SK)("保存成功"),H(),s())}})]}),children:(0,f.jsx)(h.X,{headers:q,rows:X.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,F([...X])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{X.splice(e,1),F([...X])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{F((0,v.TI)(X,e,t))}})}),(0,f.jsx)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:$})).code===d.m.Success&&((0,_.SK)("保存成功"),a())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:$,handleInputChange:e=>{B(e)}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",O)).code===d.m.Success&&((0,_.SK)("ok"),L())}})]}),children:(0,f.jsx)(h.X,{headers:W,rows:O.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cron_str,handleInputChange:e=>{t.cron_str=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),P([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,v.TI)(O,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...D,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,f.jsx)(h.X,{headers:R,rows:D.map((t,s)=>{const n=[s,(0,f.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,M([...D])},options:T,no_border:!0}),(0,f.jsx)(o.mu,{icon:"edit",save:async e=>{t.params=e,await J()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{D.splice(e,1),M([...D])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{M((0,v.TI)(D,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:G,rows:A.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{I((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{title:e("外部软件"),titleCom:(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,_.SK)("保存成功"),s())}}),children:(0,f.jsx)(h.X,{headers:E,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(l.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("use_env")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function O(e){const{t,i18n:s}=(0,u.B)(),[i,l]=(0,w.fp)(p.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:a.oV.user_manage},{title:t("角色管理"),permission:a.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:a.oV.all_sys},{title:t("系统进程关闭"),permission:a.oV.sys_process_close},{title:t("dc_ctdl"),permission:a.oV.docker_container_update},{title:t("dc_idl"),permission:a.oV.docker_images_delete},{title:t("systemd管理"),permission:a.oV.systemd},{title:t("防火墙管理"),permission:a.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:a.oV.vir_net},{title:t("内网穿透"),permission:a.oV.tcp_proxy},{title:"ddns",permission:a.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:a.oV.ai_agent_setting},{title:t("ai_page"),permission:a.oV.ai_agent_page},{title:t("sw_mdl"),permission:a.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:a.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:a.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:a.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:a.oV.recycle_file_save},{title:t("文件分享"),permission:a.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:a.oV.sys_setting_page},{title:t("htts"),permission:a.oV.https_file},{title:t("tk_time"),permission:a.oV.token_update},{title:t("修改密码"),permission:a.oV.update_password},{title:t("磁盘挂载"),permission:a.oV.sys_disk_mount},{title:t("通用设置"),permission:a.oV.sys_env_setting_key},{title:t("md_set"),permission:a.oV.md_editor_setting},{title:t("目录挂载"),permission:a.oV.file_mount}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:a.oV.sys_env_page},{title:t("up_lim"),permission:a.oV.dir_upload_max_num},{title:t("path_md"),permission:a.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:a.oV.pty_cmd_update},{title:"workflow job",permission:a.oV.workflow_job},{title:t("path_up"),permission:a.oV.sys_protection_dir},{title:t("外部软件路径"),permission:a.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:a.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:a.oV.auth_router_page},{title:t("wf_api"),permission:a.oV.workflow_api},{title:t("自定义资源路由"),permission:a.oV.code_resource},{title:t("api_rt"),permission:a.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:a.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:a.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:a.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:a.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy},{title:t("http代理"),permission:a.oV.http_proxy},{title:t("pxy_off"),permission:a.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:a.oV.browser_proxy},{title:t("rdp代理"),permission:a.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:a.oV.workflow_exe},{title:t("wf_user"),permission:a.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:a.oV.wol_proxy},{title:t("端口扫描"),permission:a.oV.port_scan},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy},{title:t("ssh_sv"),permission:a.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:a.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:a.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:a.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:a.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:o.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.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 P=new Map;function $(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(N.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[S,y]=(0,n.useState)([]),[C,k]=(0,w.fp)(p.AG.prompt_card),[b,A]=(0,n.useState)(!1),[I,V]=(0,n.useState)(!1),[K,X]=(0,w.fp)(p.AG.confirm),[F,$]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[M,T]=(0,n.useState)(""),[E,G]=(0,n.useState)([]),[q,W]=(0,n.useState)([]),[Z,R]=(0,n.useState)([]),[U,H]=(0,n.useState)(""),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,ae]=(0,n.useState)(""),[le,oe]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),xe=(0,z.o)(),[_e,me]=(0,n.useState)([]),[je,ve]=(0,n.useState)(void 0),fe=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ge=async()=>{const e=await c.wm.get("all_users");if(e.code===d.m.Success){const t=e.data??[];if(je){const e=[];for(const s of t)`${s.id}${s.username}${s.cwd}${s.note}`.includes(je)&&e.push(s);y(e)}else y(t)}const t=await c.wm.get("all_roles");if(t.code===d.m.Success){me(t.data),P.clear();for(const e of t.data)P.set(e.role_id,e)}},we=e=>{$(e?.username??""),D(e?.password??""),T(e?.cwd??""),G(e?.access_dirs??[]),W(e?.not_access_dirs??[]),R(e?.only_read_dirs??[]),H(e?.access_cmd??""),Q(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),ae(e?.note??""),oe(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?Se(e.bind_role_id,e.auth_list??[]):(he(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const Se=(e,t=[])=>{if(!e)return he(""),void pe({});const s=P.get(e);if(s){if(s.cwd&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&G(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&W(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&R(s.only_read_dirs),s.access_cmd&&H(s.access_cmd),s.not_access_cmd&&Q(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))}he(e),pe(s)}},ye=()=>{if(!F)return void(0,_.zN)("username not empty");if((0,m.CB)(F))return void(0,_.zN)("username not empty char");if(!M)return void(0,_.zN)("cwd not empty");const e=new a.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=F,e.password=B,e.not_access_dirs=q,e.only_read_dirs=Z,e.cwd=M,e.note=ie,e.access_cmd=U,e.not_access_cmd=L,e.auth_list=se,e.bind_role_id=de,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),titleCom:(0,f.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,f.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ge()}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),V(!1),we(void 0)}})]}),children:(0,f.jsx)(h.X,{headers:fe,rows:S.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(l.xP,{children:t.username}),(0,f.jsx)(l.xP,{children:t.cwd}),(0,f.jsx)(l.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),V(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{X({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,_.SK)("删除完成"),ge(),X({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(b||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(b?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),V(!1),we(void 0)}}),b&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!B)return void(0,_.zN)("password not empty");if((0,m.CB)(B))return void(0,_.zN)("username not empty char");const e=ye(),t=await c.wm.post("create_user",e);ge(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ge(),A(!1),V(!1),we(void 0))}}),I&&(0,f.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,_.SK)("保存完成"),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:F,handleInputChange:e=>$(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:B,handleInputChange:e=>D(e)}),(0,f.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{G([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:M,handleInputChange:e=>T(e)}),(E??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.access_dirs?.length&&void 0!==ue?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,G([...E])}})}),0===ue?.access_dirs?.length||void 0===ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{E.splice(s,1),G([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{W([...q,""])},title:e("添加")}),e("禁止目录范围")]}),(q??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,W([...q])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{q.splice(s,1),W([...q])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{R([...Z,""])},title:e("添加")}),e("只读目录范围")]}),(Z??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{Z[s]=e,R([...Z])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{Z.splice(s,1),R([...Z])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:U,placeholder:"use blank split",handleInputChange:e=>H(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:L,placeholder:"use blank split",handleInputChange:e=>Q(e)}),!le&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{Se(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of _e)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{disabled:""!==ue.language&&void 0!==ue.language,value:J,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{disabled:""!==ue.theme&&void 0!==ue.theme,value:ee,onChange:e=>{te(e)},options:xe}),(0,f.jsx)(O,{is_disable:e=>{if(!0===le)return!0;if(de){const t=P.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===le||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,v.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,f.jsx)("label",{children:e("备注")}),(0,f.jsx)(r.Sm,{value:ie,handleInputChange:e=>ae(e)})]})})})]})}function B(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s}=(0,n.useContext)(N.F),[x,m]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[S,y]=(0,n.useState)(!1),[C,k]=(0,n.useState)(!1),[b,A]=(0,w.fp)(p.AG.confirm),[I,V]=(0,n.useState)(""),[K,X]=(0,n.useState)(""),[F,P]=(0,n.useState)([]),[$,B]=(0,n.useState)([]),[D,M]=(0,n.useState)([]),[T,E]=(0,n.useState)(""),[G,q]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[R,U]=(0,n.useState)(""),[H,L]=(0,n.useState)([]),[Q,J]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,z.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=>{V(e?.role_name??""),X(e?.cwd??""),P(e?.access_dirs??[]),B(e?.not_access_dirs??[]),M(e?.only_read_dirs??[]),E(e?.access_cmd??""),q(e?.not_access_cmd??""),Z(e?.language??""),U(e?.theme??""),L(e?.auth_list??[]),J(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const ae=()=>{if(!I)return void(0,_.zN)("role_name not empty");const e=new a.E0;return e.language=W,e.theme=R,e.access_dirs=F,e.role_name=I,e.not_access_dirs=$,e.only_read_dirs=D,e.cwd=K,e.access_cmd=T,e.not_access_cmd=G,e.auth_list=H,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),titleCom:(0,f.jsx)("div",{children:(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{y(!0),k(!1),ie(void 0)}})}),children:(0,f.jsx)(h.X,{headers:se,rows:x.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(l.xP,{children:t.role_name}),(0,f.jsx)(l.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{y(!1),k(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,_.SK)("删除完成"),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(S||C)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(S?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{y(!1),k(!1),ie(void 0)}}),S&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=ae();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ne(),y(!1),k(!1),ie(void 0))}}),C&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ae();if(!e)return;e.role_id=Q;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,_.SK)("保存完成"),ne())}})]}),children:[(0,f.jsx)("label",{children:e("角色名")}),(0,f.jsx)(r.Sm,{value:I,handleInputChange:e=>V(e)}),(0,f.jsx)("label",{children:e("角色备注")}),(0,f.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{P([...F,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:K,handleInputChange:e=>X(e)}),(F??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{F[t]=e,P([...F])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{F.splice(t,1),P([...F])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{B([...$,""])},title:"添加"}),e("禁止目录范围")]}),($??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:t,handleInputChange:e=>{$[s]=e,B([...$])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{$.splice(s,1),B([...$])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{M([...D,""])},title:e("添加")}),e("只读目录范围")]}),(D??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{D[t]=e,M([...D])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{D.splice(t,1),M([...D])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:T,placeholder:"use blank split",handleInputChange:e=>E(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:G,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:W,onChange:e=>{Z(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{value:R,onChange:e=>{U(e)},options:te}),(0,f.jsx)(O,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==H?.find(t=>t===e),select_auth:e=>{H?(H.find(t=>t==e)?(0,v.I)(H,t=>t===e):H.push(e),L([...H])):L([e])}})]})})})]})}function D(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(N.F),[m,j]=(0,n.useState)([]),[g,S]=(0,w.fp)(p.AG.prompt_card),[C,b]=(0,n.useState)([]),[A,V]=(0,n.useState)([]),[K,X]=(0,n.useState)([]),[F,O]=(0,w.fp)(p.AG.user_base_info),P=(0,y.K)(),$=(0,z.o)(),B=[e("编号"),e("路径"),e("是否默认"),e("备注")],D=[e("编号"),e("路径"),e("备注")],M=[e("编号"),e("命令"),e("父编号"),e("备注")],T=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,G]=(0,n.useState)(""),[q,W]=(0,n.useState)(""),[Z,R]=(0,n.useState)(""),[U,H]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),V(e.data.quick_cmd),X(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&b(t.data??[])})(),Q(F?.user_data?.language),Y(F?.user_data?.theme),te(F?.user_data?.upload_file_ignore)},[]);const se=(0,z.Q)();return(0,f.jsx)(n.Fragment,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!q)return void(0,_.zN)("账号密码不能为空");if(q!==Z)return void(0,_.zN)("两次密码不一样");const e=new a.tl;e.username=E,e.password=q,e.confirm_password=Z,e.user_id=F.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:E,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{W(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{R(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:ee}})).code===d.m.Success&&((0,_.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.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,f.jsx)(r.l6,{value:J,onChange:e=>{Y(e)},options:$}),(0,f.jsx)(r.Sm,{value:ee,handleInputChange:e=>{te(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})})]}),(0,f.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件夹路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,f.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,_.SK)("保存成功"),x(),s())}})]}),children:(0,f.jsx)(h.X,{headers:B,rows:m.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{m.splice(e,1),j([...m])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(m,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...C,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",C)).code===d.m.Success&&((0,_.SK)("保存成功"),x())}})]}),children:(0,f.jsx)(h.X,{headers:D,rows:C.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),b([...C])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{b((0,v.TI)(C,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("目录快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...A,{cmd:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:A})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:M,rows:A.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),V([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...K,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:K})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:T,rows:K.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),X([...K])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{X((0,v.TI)(K,e,t))}})})]})]})]})})}const M=["password","private_key","secret_key"],T="webdav";function E(){const{t:e}=(0,u.B)(),[,t]=(0,w.fp)(p.AG.prompt_card),[s,i]=(0,n.useState)([]),[a,d]=(0,n.useState)([]),[x,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,S]=(0,n.useState)(T),[y,C]=(0,n.useState)(""),[k,b]=(0,n.useState)({}),[A,I]=(0,n.useState)(!1),V=async()=>{try{const[e,t]=await Promise.all([c.I2.post("credential/list",{}),c.I2.post("credential/meta",{})]);i(Array.isArray(e?.data)?e.data:[]),d(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{V()},[]);const N=a.find(e=>e.type===g)?.fields??[],K=()=>{m(!1),v(""),S(T),C(""),b({}),I(!1)};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("普通凭据管理")}),(0,f.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,f.jsxs)("div",{children:[(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:e("crd_tp")}),(0,f.jsx)("li",{children:e("bidacct")}),(0,f.jsx)("li",{children:e("pwdkept")}),(0,f.jsx)("li",{children:e("tstbfrs")})]}),(0,f.jsxs)("ul",{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"WebDAV"}),":",e("prtwbdv")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SSH / SFTP"}),":",e("prtsftp")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"S3 兼容对象存储"}),":",e("prt_s3")]})]})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K(),m(!0)}}),x&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{try{const t=await c.I2.post("credential/test",{id:j||void 0,type:g,config:k}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}}}),x&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(y.trim()){for(const t of N){const s=String(k[t.key]??"").trim()||j&&M.includes(t.key);if(t.required&&!s)return void(0,_.zN)(`${e("请填写")}${e(t.label)}`)}try{await c.I2.post(j?"credential/update":"credential/add",{id:j||void 0,type:g,name:y,config:k,enabled:!0}),(0,_.SK)(e("保存成功")),K(),await V()}catch(e){}}else(0,_.zN)(e("请填写名称"))}}),x&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:K})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("名称"),value:y,handleInputChange:C}),(0,f.jsx)(r.l6,{value:g,options:a.map(e=>({title:e.name,value:e.type})),onChange:e=>{S(e),b({})}}),N.map(t=>(0,f.jsx)(n.Fragment,{children:(0,f.jsx)(r.Sm,{type:M.includes(t.key)?"password":"text",placeholder:M.includes(t.key)&&A?e("留空表示不修改"):t.label,value:k[t.key]??"",handleInputChange:e=>b({...k,[t.key]:e})})},t.key))]}),!x&&(0,f.jsx)(h.X,{headers:[e("名称"),e("类型"),e("操作")],rows:s.map(t=>{return[(0,f.jsx)(l.xP,{context:t.name}),(0,f.jsx)(l.xP,{context:(s=t.type,a.find(e=>e.type===s)?.name??s)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{m(!0),v(e.id),S(e.type),C(e.name??""),b({...e.config??{}}),I(Boolean(e.has_password))})(t)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{try{await c.I2.post("credential/delete",{id:t.id}),(0,_.SK)(e("已删除")),await V()}catch(e){}})(t)})]})];var s})})]})}var G=s(17903);function q(){const{t:e}=(0,u.B)(),[t,s]=(0,n.useState)([]),[i,a]=(0,n.useState)([]),[d,p]=(0,n.useState)([]),[x,m]=(0,n.useState)([]),[j,v]=(0,n.useState)(!1),[g,w]=(0,n.useState)(""),[S,y]=(0,n.useState)("webdav"),[C,k]=(0,n.useState)(""),[b,A]=(0,n.useState)(""),[I,V]=(0,n.useState)(""),[N,K]=(0,n.useState)(""),X=async()=>{try{const[e,t,n,i]=await Promise.all([c.I2.post("list",{}),c.I2.post("credential/list",{}),c.I2.post("driver/list",{}),c.I2.post("baidu/app/get",{})]);s(Array.isArray(e?.data)?e.data:[]),a(Array.isArray(t?.data)?t.data:[]),p(Array.isArray(n?.data)?n.data:[]),m(Array.isArray(i?.data?.accounts)?i.data.accounts:[])}catch(e){}};(0,n.useEffect)(()=>{X()},[]);const z=()=>{v(!1),w(""),y("webdav"),k(""),A(""),V(""),K("")};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!j&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{z(),v(!0)}}),j&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(b)try{const t=await c.I2.post("test",{id:g||void 0,driver:S,credential_id:b,root_dir:I}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,_.zN)(e("请选择凭据"))}}),j&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(b)if(C.trim())try{await c.I2.post(g?"update":"add",{id:g||void 0,driver:S,mount_path:C,credential_id:b,root_dir:I,name:N,color:G.OT,readonly:!1,enabled:!0}),(0,_.SK)(e("保存成功")),z(),await X()}catch(e){}else(0,_.zN)(e("munt_rq"));else(0,_.zN)(e("请选择凭据"))}}),j&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:z})]}),children:[j&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:S,options:d.map(e=>({title:e.name,value:e.type})),onChange:e=>{y(e),A("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:b,options:(e=>{if("baidu"===e)return x.map(e=>({title:e.name||e.baidu_name||String(e.uk),value:String(e.uk)}));const t=G.UW[e];return i.filter(e=>!t||e.type===t).map(e=>({title:e.name,value:e.id}))})(S),onChange:A})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:C,handleInputChange:k})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:I,handleInputChange:V})}),(0,f.jsx)(r.BC,{label:e("dspnmtp"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:N,handleInputChange:K})})]}),!j&&(0,f.jsx)(h.X,{headers:[e("名称"),e("挂载类型"),e("凭据"),e("操作")],rows:t.map(t=>{const s=i.find(e=>e.id===t.credential_id),n="baidu"===t.driver?x.find(e=>String(e.uk)===String(t.credential_id)):void 0;return[(0,f.jsx)("p",{children:t.name}),(0,f.jsx)("p",{children:(a=t.driver,d.find(e=>e.type===a)?.name??a)}),(0,f.jsx)("p",{children:n?n.name||n.baidu_name||String(n.uk):s?s.name:e("凭据已丢失")}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{v(!0),w(e.id),y(e.driver),k(e.mount_path??""),A(e.credential_id??""),V(e.root_dir??""),K(e.name??"")})(t)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{try{await c.I2.post("delete",{id:t.id}),(0,_.SK)(e("已删除")),await X()}catch(e){}})(t)})]})];var a})})]})}function W({on_credential_change:e}){const{t}=(0,u.B)(),[,s]=(0,w.fp)(p.AG.prompt_card),[i,a]=(0,n.useState)(null),[d,x]=(0,n.useState)([]),[m,j]=(0,n.useState)("百度网盘"),[v,g]=(0,n.useState)(""),[S,y]=(0,n.useState)(""),[C,k]=(0,n.useState)(""),[b,A]=(0,n.useState)("oob"),[I,V]=(0,n.useState)(!0),[N,K]=(0,n.useState)(!0),X="oob"===b,[z,F]=(0,n.useState)(!1),[O,P]=(0,n.useState)(!1),[$,B]=(0,n.useState)(""),D=async()=>{try{const e=await c.I2.post("baidu/app/get",{}),t=e?.data?.app??null;a(t),x(e?.data?.accounts??[]),j(t?.name??"百度网盘"),g(t?.app_id??""),y(t?.app_key??""),A("one_click"===t?.auth_mode?"one_click":"oob"),V(!1!==t?.enabled),K(!1!==t?.auto_refresh)}catch(e){}};(0,n.useEffect)(()=>{D();const s=new URLSearchParams(window.location.search),n=s.get("baidu_auth");"success"===n?((0,_.SK)(`${t("授权成功")}:${s.get("name")??""}`),e()):"failed"===n&&(0,_.zN)(`${t("授权失败")}:${s.get("reason")??""}`),n&&window.history.replaceState({},"",window.location.pathname)},[]);return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:t("百度网盘")}),(0,f.jsx)(o.rA,{icon:"info",title:t("信息"),onClick:()=>{s({open:!0,title:t("信息"),context_div:(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:t("atathtp")}),(0,f.jsx)("li",{children:t("atathnt")}),(0,f.jsx)("li",{children:t("pstatht")})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!z&&(0,f.jsx)(o.rA,{icon:"apps",title:t("应用配置"),onClick:()=>F(!0)}),z&&(0,f.jsx)(o.rA,{icon:"save",title:t("保存应用配置"),onClick:async()=>{if(S.trim())if(i?.configured||C.trim())try{await c.I2.post("baidu/app/save",{name:m,app_id:v,app_key:S,secret_key:C,auth_mode:b,remark:i?.remark??"",enabled:I,auto_refresh:N}),(0,_.SK)(t("保存成功")),k(""),F(!1),await D()}catch(e){}else(0,_.zN)(t("rq_scrt"));else(0,_.zN)(t("rqappky"))}}),z&&(0,f.jsx)(o.rA,{icon:"cancel",title:t("取消"),onClick:()=>F(!1)}),!z&&(0,f.jsx)(o.rA,{icon:"key",title:t("授权"),onClick:()=>P(!0)}),(0,f.jsx)(o.rA,{icon:"refresh",title:t("授权检测/刷新"),onClick:async()=>{try{await c.I2.post("baidu/verify/all",{}),(0,_.SK)(t("检测完成")),await D()}catch(e){}}})]}),children:[z&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:t("名称"),value:m,handleInputChange:j}),(0,f.jsx)(r.Sm,{placeholder:"AppID",value:v,handleInputChange:g}),(0,f.jsx)(r.Sm,{placeholder:"AppKey",value:S,handleInputChange:y}),(0,f.jsx)(r.Sm,{type:"password",placeholder:i?.configured?t("scrtkep"):"SecretKey",value:C,handleInputChange:k}),(0,f.jsx)(r.BC,{label:t("授权方式"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:b,options:(0,G.K1)(t),onChange:e=>A("one_click"===e?"one_click":"oob")})}),(0,f.jsx)(r.BC,{label:t("网盘使用"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:I,options:(0,G.Dd)(t),onChange:V})}),(0,f.jsx)(r.BC,{label:t("atrfrsh"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:N,options:(0,G.Dd)(t),onChange:K})})]}),O&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:t("授权方式"),label_width:"6rem",children:(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.U6,{value:"one_click",context:t("一键授权"),name:"baidu_auth_mode",selected:"one_click"===b,onchange:()=>A("one_click")}),(0,f.jsx)(r.U6,{value:"oob",context:t("outh_ob"),name:"baidu_auth_mode",selected:"oob"===b,onchange:()=>A("oob")})]})}),X&&(0,f.jsx)(r.Sm,{placeholder:t("pst_cd"),value:$,handleInputChange:B}),(0,f.jsxs)("div",{className:"div-row mount-actions",children:[(0,f.jsx)(o.C3,{text:t(X?"去授权(手动)":"去授权(一键)"),clickFun:async()=>{if(i?.configured)try{const e=await c.I2.post("baidu/authorize_url",{mode:b});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}else(0,_.zN)(t("svappfr"))}}),X&&(0,f.jsx)(o.C3,{text:t("完成授权"),clickFun:async()=>{if($.trim())try{const s=await c.I2.post("baidu/exchange",{code:$.trim(),mode:b});(0,_.SK)(`${t("授权成功")}:${s?.data?.baidu_name??""}`),B(""),P(!1),await D(),e()}catch(e){}else(0,_.zN)(t("请填写授权码"))}}),(0,f.jsx)(o.C3,{text:t("取消"),clickFun:()=>P(!1)})]})]}),!z&&!O&&(0,f.jsx)(h.X,{headers:[t("账号名"),t("百度账号"),t("授权状态"),t("使用"),t("授权时间"),t("操作")],rows:d.map(s=>{return[(0,f.jsx)(r.Sm,{value:s.name,no_border:!0,handleInputChange:t=>(async(t,s)=>{try{await c.I2.post("baidu/account/update",{uk:t.uk,name:s}),e()}catch(e){}})(s,t)}),(0,f.jsx)(l.xP,{context:s.baidu_name||"-"}),(0,f.jsx)(l.xP,{context:(n=s,n.authorized?n.expired?t("已过期"):t("已授权"):t("未授权"))}),(0,f.jsx)(r.l6,{value:s.enabled,no_border:!0,options:(0,G.Dd)(t),onChange:()=>(async t=>{try{await c.I2.post("baidu/account/update",{uk:t.uk,enabled:!t.enabled}),await D(),e()}catch(e){}})(s)}),(0,f.jsx)("p",{children:(0,G.eK)(s.created_at)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"network_check",title:t("授权检测"),onClick:()=>(async e=>{try{const s=await c.I2.post("baidu/verify",{uk:e.uk});s?.data?.valid?(0,_.SK)(t("账号可用")):(0,_.zN)(`${t("账号不可用")}:${s?.data?.error??""}`),await D()}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"link_off",title:t("取消授权"),onClick:()=>(async e=>{try{await c.I2.post("baidu/deauthorize",{uk:e.uk}),(0,_.SK)(t("已取消授权")),await D()}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(async s=>{try{await c.I2.post("baidu/delete",{uk:s.uk}),(0,_.SK)(t("已删除")),await D(),e()}catch(e){}})(s)})]})];var n})})]})}function Z(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=t(a.oV.file_mount),[r,d]=(0,w.fp)(p.AG.mount_enabled);(0,n.useEffect)(()=>{s&&(async()=>{try{const e=await c.I2.post("enabled/get",{});d(!0===e?.data)}catch(e){d(!1)}})()},[s]);return s?(0,f.jsxs)(n.Fragment,{children:[(0,f.jsxs)(b.aZ,{position:"right",children:[(0,f.jsx)("span",{className:"header-label",children:e("总开关")}),(0,f.jsx)(o.rA,{icon:!0===r?"cloud_done":"cloud_off",title:e(!0===r?"muntont":"muntoff"),selected:!0===r,onClick:async()=>{const t=!r;try{const s=await c.I2.post("enabled/set",{enabled:t}),n=!0===s?.data;d(n),(0,_.SK)(e(n?"挂载已启用":"挂载已停用"))}catch(e){}}})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,f.jsx)(E,{})}),(0,f.jsx)(i.VP,{widthPer:60,maxWidth:"60rem",children:(0,f.jsx)(W,{on_credential_change:()=>window.location.reload()})})]}),(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(q,{})})})]})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(l.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}var R=s(87361);function U(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(D,{})}];return t(a.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(X,{})}),t(a.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(F,{})}),t(a.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(a.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)($,{})}),t(a.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(B,{})}),t(a.oV.file_mount)&&s.push({index:1,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(Z,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:R.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),a=s(74777),l=s(96540),o=s(86149),r=s(23430),c=s(14284),d=s(74848);function h(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:l}=(0,o.B)();return e=>{let n;e===a.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===a.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 u=r.Ky;function p(){const[e,t]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const s=e.data||[];u=[...r.Ky,...s],t(u)}else console.warn("获取主题列表失败,使用默认列表"),t(u)}catch(e){t(u)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>l});var n=s(72635);const i=1440,a=525600;function l(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<a?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/a).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){var n=s(86149);s.d(t,["K",0,()=>{const{t:e}=(0,n.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3328],{77481(e,t,s){s.d(t,{S:()=>o,X:()=>l});var n=s(96540),i=s(61443),a=s(74848);function l(e){const[t,s]=n.useState([]),l=(0,n.useRef)(-1),[o,r]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const h=()=>{l.current=-1,r(-1),d(-1)};return(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let l=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(l=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:l}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(o===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(l.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=l.current,s=c;h(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:h,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function o(e){return(0,a.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,a.jsx)("div",{children:e},t))})}},53328(e,t,s){s.r(t),s.d(t,{default:()=>U});var n=s(96540),i=s(75725),a=s(23430),l=s(70447),o=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(86149),p=s(82893),x=s(40505),_=s(62042),m=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,u.B)(),[s,a]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();a(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");a([t,...s])}}),(0,f.jsx)(o.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(h.X,{headers:e.headers,rows:s.map((n,i)=>{const l=[];for(let t=0;t<e.headers.length;t++)l.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,a([...s])},no_border:!0}));return l.push((0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),a([...s])})(i)}),n[0]&&(0,f.jsx)(o.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,x.lW)(e),(0,_.SK)(e)}}),n[0]&&e.need_copy&&(0,f.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)}})]})),l}),width:"10rem",onRowDrag:(e,t)=>{a((0,v.TI)(s,e,t))}})})})}var w=s(34843),S=s(78247),y=s(24659);function C(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),a=(0,y.K)(),g=[e("路由"),e("auth"),e("备注")],[C,k]=(0,w.fp)(p.AG.editorSetting),[b,A]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("api/customer_router");e.code===d.m.Success&&A(e.data)})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{(()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})})()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...b])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",b)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:(0,f.jsx)(h.X,{headers:g,rows:b.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...b])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...b])},options:a,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...b])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,_.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);k({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&&(S.xK.set_value_temp(""),k({open:!1,model:"",fileName:"",save:null}),(0,_.SK)("成功"))}}),S.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(o.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,x.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,_.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(b,e,t))}})})})}var k=s(23496),b=s(4412);function A(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),[a,l]=(0,w.fp)(p.AG.router_jump),o=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(b.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{maxWidth:"50rem",children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:o,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_router);if(e.code===d.m.Success){if(a?.page_self_router_api_data){for(const t of e.data)t[1]===a?.page_self_router_api_data[1]&&(0,_.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,a?.page_self_router_api_data),e.data=[t,...e.data],l({})}return e.data}return[]},save:async e=>{(await c.XO.post(k.s.setting_customer_router_save,e)).code===d.m.Success&&(0,_.SK)("success")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,会自动识别地址,将页面转到对应结果。路径支持文件路径(如果是文件夹路径的最后最后一个名字将会成为资源实际地址,整个目录将会变成一个http目录),http地址。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})},need_copy:!0}),(0,f.jsx)(g,{title:e("wf_rt"),headers:r,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async e=>{(await c.XO.post(k.s.setting_customer_workflow_router_save,e)).code===d.m.Success&&(0,_.SK)("保存成功")},info_click:()=>{let e=(0,f.jsx)("div",{children:'默认需要以 "/api" 开头的路由,文件路径是有效的workflow路径。token也可以是文件绝对路径,请求的时候请设置同样的authorization请求头字段。'});s({open:!0,title:"信息",context_div:(0,f.jsx)("div",{children:e})})}})]}),(0,f.jsx)(i.VP,{maxWidth:"50rem",children:(0,f.jsx)(C,{})})]})]})}var I=s(74777),V=s(6960),N=s(7523);function K(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),[s,i]=(0,n.useState)(!1),[h,x]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[v,g]=(0,n.useState)(180),[y,C]=(0,n.useState)(!1),[k,b]=(0,w.fp)(p.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),x(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),g(t.check_interval_seconds||180)}})()},[]);return t(a.oV.sys_setting_page)?(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{b({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,_.zN)(e("ver_req"));if(s&&(!v||v<10))return void(0,_.zN)(e("chk_10s"));const t=new I.Mm;t.open=s,t.version_check_url=h,t.exe_download_url=m,t.check_interval_seconds=v;(await c.XO.post("auto_upgrade_setting/save",t)).code===d.m.Success&&(0,_.SK)(e("保存成功"))}}),children:[(0,f.jsx)("div",{children:e("ver_url")}),(0,f.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:h,handleInputChange:e=>{x(e)}}),(0,f.jsx)(r.l6,{value:s,onChange:e=>{i(e)},options:[{title:e("开启"),value:!0},{title:e("关闭"),value:!1}]}),s&&(0,f.jsxs)(f.Fragment,{children:[!1,(0,f.jsx)("div",{children:e("检测频率(秒)")}),(0,f.jsx)(r.Sm,{placeholder:e("def_180"),value:v,handleInputChange:e=>{g(Number(e)||180)}}),(0,f.jsx)("div",{style:{marginTop:"12px"},children:(0,f.jsx)(o.C3,{text:e(y?"升级检测中...":"立即升级"),clickFun:async()=>{C(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,_.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,_.zN)(e("触发升级失败"))}finally{C(!1)}}})})]})]}):null}function X(){const[e,t]=(0,n.useState)(""),[s,a]=(0,n.useState)(""),[x,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),[C,A]=(0,n.useState)(""),[X,z]=(0,w.fp)(p.AG.prompt_card),[F,O]=(0,n.useState)(!1),[P,$]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[M,T]=(0,n.useState)(I.aM.close),[E,G]=(0,n.useState)(!1),[q,W]=(0,n.useState)(void 0),{t:Z,i18n:R}=(0,u.B)(),[U,H]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:L}=(0,S.MH)(),{initUserInfo:Q}=(0,n.useContext)(N.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){y(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),a(s?.logo||""),m(s?.show_login_user_info),v(s?.http_proxy||"");const n=e.data.https_setting;n&&(O(n.open),$(n.cert_path||""),D(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&&T(e.mode),void 0!==e.persist&&G(e.persist)}})()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(b.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[Z("系统运行于"),": ",(0,V.s)(U.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:7.3.3",null!=U.latest_version&&"7.3.3"!==U.latest_version?` -> ${U.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:Z("官网地址"),target:"_blank",children:`filecat ${Z("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[Z("安装方式")," :",U.process_env_run_env]})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:Z("通用设置")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{z({open:!0,title:Z("信息"),context_div:(0,f.jsx)("div",{children:Z("pxy_tip")})})},title:Z("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:x,http_proxy:j,logo:s}})).code===d.m.Success&&((0,_.SK)("修改成功"),Q())}}),children:[Z("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),Z("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:Z("lclorur"),value:s,handleInputChange:e=>{a(e)}}),(0,f.jsx)("div",{children:Z("pxy_url")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),Z("lgn_usr"),(0,f.jsx)("input",{type:"checkbox",checked:x,onChange:()=>{m(!x)}})]}),(0,f.jsxs)(l.Zp,{title:Z("https_s"),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{if(F){if(!P)return void(0,_.zN)("证书路径不能为空");if(!B)return void(0,_.zN)("私钥路径不能为空")}const e=new I.CH;e.open=F,e.cert_path=P,e.key_path=B;(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:F})).code===d.m.Success&&(0,_.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,f.jsx)(r.l6,{value:F,onChange:e=>{O(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]}),F&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{children:Z("ssl_crt")}),(0,f.jsx)(r.Sm,{placeholder:Z("crt_pth"),value:P,handleInputChange:e=>{$(e)}}),(0,f.jsx)("div",{children:Z("ssl_key")}),(0,f.jsx)(r.Sm,{placeholder:Z("ky_pth"),value:B,handleInputChange:e=>{D(e)}})]})]}),(0,f.jsx)(K,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:Z("文件回收站")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{z({open:!0,title:Z("信息"),context_div:(0,f.jsx)("div",{children:Z("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:Z("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:Z("确定修改"),clickFun:async()=>{if(g&&!C)return void(0,_.zN)("目录不能为空");(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:C,open:g})).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:Z("目录"),value:C,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{y(e)},options:[{title:Z("开启"),value:!0},{title:Z("关闭"),value:!1}]})]}),(0,f.jsxs)(l.Zp,{title:Z("tk_exp"),rightBottomCom:(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(o.C3,{text:Z("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,_.SK)("清理完成,重新登录")}}),(0,f.jsx)(o.C3,{text:Z("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=M,e.persist=E,I.aM.length!==e.mode||q||(0,_.zN)("秒数不能为空"),e.length=parseInt(q);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,_.SK)("保存成功")}})]}),children:[(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:Z("关闭"),selected:M===I.aM.close,onchange:()=>{T(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:Z("指定时间"),selected:M===I.aM.length,onchange:()=>{T(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:Z("永不过期"),selected:M===I.aM.forver,onchange:()=>{T(I.aM.forver)}})]}),M===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:Z("秒"),value:q,handleInputChange:e=>{W(e)}}),(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:6,marginTop:8,whiteSpace:"nowrap"},children:[(0,f.jsx)("input",{type:"checkbox",checked:E,onChange:()=>G(!E)}),Z("持久化")]})]})]})]})})]})}var z=s(92350);function F(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:a}=(0,n.useContext)(N.F),[x,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[C,k]=(0,w.fp)(p.AG.prompt_card),[,b]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[V,K]=(0,n.useState)([]),[X,F]=(0,n.useState)([]),[O,P]=(0,n.useState)([]),[$,B]=(0,n.useState)(""),[D,M]=(0,n.useState)([]),T=(0,y.K)(),E=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],q=[e("编号"),e("路径"),e("是否开启"),e("备注")],W=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],Z=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],R=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:U}=(0,S.MH)(),H=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&F(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),H(),L();const s=await c.XO.get("protection_dir/sys");s.code===d.m.Success&&I(s.data??[]);const n=await c.XO.get("dir_upload_max_num");n.code===d.m.Success&&K(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&M(i.data??[])})()},[]);const Q=(0,z.Q)(),J=async()=>{(await c.XO.post("plugin/list/save",D)).code===d.m.Success&&(0,_.SK)(e("保存成功"))};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...V,{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,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of V)if(e.open_ws_file){if("number"!=typeof e.ws_file_block_mb_size)return void(0,_.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,_.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,_.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,v.di)(V,e=>e.index??0);(await c.XO.post("dir_upload_max_num/save",V)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:Z,rows:V.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,placeholder:s,handleInputChange:e=>{t.index=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_upload_num,handleInputChange:e=>{t.user_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.sys_upload_num,handleInputChange:e=>{t.sys_upload_num=parseInt(e)},no_border:!0}),(0,f.jsx)(r.l6,{value:!0===t.open_ws_file,onChange:e=>{t.open_ws_file=e,K([...V])},options:T,no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.ws_file_parallel_num,handleInputChange:e=>{t.ws_file_parallel_num=parseInt(e)},no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),K([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{K((0,v.TI)(V,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?k({open:!0,title:e("进程环境变量"),context_div:(0,f.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:"60vh",overflow:"auto",margin:0,fontSize:"0.85rem",lineHeight:"1.5"},children:t.data})}):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(S.xK.set_value_temp(t.data??""),b({model:"ace/mode/ini",open:!0,fileName:"",save:async t=>{(await c.XO.post("env/process/save",{text:t})).code===d.m.Success?(0,_.SK)(e("保存成功")):(0,_.zN)(e("保存失败")),S.xK.set_value_temp("")}})):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...X,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:X})).code===d.m.Success&&((0,_.SK)("保存成功"),H(),s())}})]}),children:(0,f.jsx)(h.X,{headers:q,rows:X.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,F([...X])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{X.splice(e,1),F([...X])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{F((0,v.TI)(X,e,t))}})}),(0,f.jsx)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(o.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:$})).code===d.m.Success&&((0,_.SK)("保存成功"),a())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:$,handleInputChange:e=>{B(e)}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...O,{open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",O)).code===d.m.Success&&((0,_.SK)("ok"),L())}})]}),children:(0,f.jsx)(h.X,{headers:W,rows:O.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.file_path,handleInputChange:e=>{t.file_path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...O])},options:T,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cron_str,handleInputChange:e=>{t.cron_str=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.user_id,handleInputChange:e=>{t.user_id=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),P([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,v.TI)(O,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...D,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,f.jsx)(h.X,{headers:R,rows:D.map((t,s)=>{const n=[s,(0,f.jsx)(r.Sm,{value:t.name,handleInputChange:e=>{t.name=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.open,onChange:e=>{t.open=e,M([...D])},options:T,no_border:!0}),(0,f.jsx)(o.mu,{icon:"edit",save:async e=>{t.params=e,await J()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{D.splice(e,1),M([...D])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{M((0,v.TI)(D,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,_.SK)("保存成功"),a())}})]}),children:(0,f.jsx)(h.X,{headers:G,rows:A.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),I([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{I((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{title:e("外部软件"),titleCom:(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,_.SK)("保存成功"),s())}}),children:(0,f.jsx)(h.X,{headers:E,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(l.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("use_env")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function O(e){const{t,i18n:s}=(0,u.B)(),[i,l]=(0,w.fp)(p.AG.user_base_info),o=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:a.oV.user_manage},{title:t("角色管理"),permission:a.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:a.oV.all_sys},{title:t("系统进程关闭"),permission:a.oV.sys_process_close},{title:t("dc_ctdl"),permission:a.oV.docker_container_update},{title:t("dc_idl"),permission:a.oV.docker_images_delete},{title:t("systemd管理"),permission:a.oV.systemd},{title:t("防火墙管理"),permission:a.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:a.oV.vir_net},{title:t("内网穿透"),permission:a.oV.tcp_proxy},{title:"ddns",permission:a.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:a.oV.ai_agent_setting},{title:t("ai_page"),permission:a.oV.ai_agent_page},{title:t("sw_mdl"),permission:a.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:a.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:a.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:a.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:a.oV.recycle_file_save},{title:t("文件分享"),permission:a.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:a.oV.sys_setting_page},{title:t("htts"),permission:a.oV.https_file},{title:t("tk_time"),permission:a.oV.token_update},{title:t("修改密码"),permission:a.oV.update_password},{title:t("磁盘挂载"),permission:a.oV.sys_disk_mount},{title:t("通用设置"),permission:a.oV.sys_env_setting_key},{title:t("md_set"),permission:a.oV.md_editor_setting},{title:t("目录挂载"),permission:a.oV.file_mount}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:a.oV.sys_env_page},{title:t("up_lim"),permission:a.oV.dir_upload_max_num},{title:t("path_md"),permission:a.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:a.oV.pty_cmd_update},{title:"workflow job",permission:a.oV.workflow_job},{title:t("path_up"),permission:a.oV.sys_protection_dir},{title:t("外部软件路径"),permission:a.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:a.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:a.oV.auth_router_page},{title:t("wf_api"),permission:a.oV.workflow_api},{title:t("自定义资源路由"),permission:a.oV.code_resource},{title:t("api_rt"),permission:a.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:a.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:a.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:a.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:a.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:a.oV.ssh_proxy},{title:t("http代理"),permission:a.oV.http_proxy},{title:t("pxy_off"),permission:a.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:a.oV.browser_proxy},{title:t("rdp代理"),permission:a.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:a.oV.workflow_exe},{title:t("wf_user"),permission:a.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:a.oV.wol_proxy},{title:t("端口扫描"),permission:a.oV.port_scan},{title:t("rtsp播放器"),permission:a.oV.rtsp_proxy},{title:t("ssh_sv"),permission:a.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:a.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:a.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:a.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:a.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:o.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.jsx)("h3",{children:t.title}),t.list.map((t,s)=>(0,f.jsxs)("div",{children:[(0,f.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 P=new Map;function $(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(N.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[S,y]=(0,n.useState)([]),[C,k]=(0,w.fp)(p.AG.prompt_card),[b,A]=(0,n.useState)(!1),[I,V]=(0,n.useState)(!1),[K,X]=(0,w.fp)(p.AG.confirm),[F,$]=(0,n.useState)(""),[B,D]=(0,n.useState)(""),[M,T]=(0,n.useState)(""),[E,G]=(0,n.useState)([]),[q,W]=(0,n.useState)([]),[Z,R]=(0,n.useState)([]),[U,H]=(0,n.useState)(""),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,ae]=(0,n.useState)(""),[le,oe]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),xe=(0,z.o)(),[_e,me]=(0,n.useState)([]),[je,ve]=(0,n.useState)(void 0),fe=[e("用户id"),e("用户名"),e("目录范围"),e("备注")],ge=async()=>{const e=await c.wm.get("all_users");if(e.code===d.m.Success){const t=e.data??[];if(je){const e=[];for(const s of t)`${s.id}${s.username}${s.cwd}${s.note}`.includes(je)&&e.push(s);y(e)}else y(t)}const t=await c.wm.get("all_roles");if(t.code===d.m.Success){me(t.data),P.clear();for(const e of t.data)P.set(e.role_id,e)}},we=e=>{$(e?.username??""),D(e?.password??""),T(e?.cwd??""),G(e?.access_dirs??[]),W(e?.not_access_dirs??[]),R(e?.only_read_dirs??[]),H(e?.access_cmd??""),Q(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),ae(e?.note??""),oe(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?Se(e.bind_role_id,e.auth_list??[]):(he(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const Se=(e,t=[])=>{if(!e)return he(""),void pe({});const s=P.get(e);if(s){if(s.cwd&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&G(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&W(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&R(s.only_read_dirs),s.access_cmd&&H(s.access_cmd),s.not_access_cmd&&Q(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))}he(e),pe(s)}},ye=()=>{if(!F)return void(0,_.zN)("username not empty");if((0,m.CB)(F))return void(0,_.zN)("username not empty char");if(!M)return void(0,_.zN)("cwd not empty");const e=new a.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=F,e.password=B,e.not_access_dirs=q,e.only_read_dirs=Z,e.cwd=M,e.note=ie,e.access_cmd=U,e.not_access_cmd=L,e.auth_list=se,e.bind_role_id=de,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),titleCom:(0,f.jsxs)("div",{className:"div-row",style:{gap:"0.5rem"},children:[(0,f.jsx)(r.Sm,{placeholder:e("过滤"),value:je,handleInputChange:e=>{ve(e)},handlerEnter:()=>{ge()}}),(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),V(!1),we(void 0)}})]}),children:(0,f.jsx)(h.X,{headers:fe,rows:S.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(l.xP,{children:t.username}),(0,f.jsx)(l.xP,{children:t.cwd}),(0,f.jsx)(l.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),V(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{X({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,_.SK)("删除完成"),ge(),X({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(b||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(b?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),V(!1),we(void 0)}}),b&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!B)return void(0,_.zN)("password not empty");if((0,m.CB)(B))return void(0,_.zN)("username not empty char");const e=ye(),t=await c.wm.post("create_user",e);ge(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ge(),A(!1),V(!1),we(void 0))}}),I&&(0,f.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,_.SK)("保存完成"),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:F,handleInputChange:e=>$(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:B,handleInputChange:e=>D(e)}),(0,f.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{G([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:M,handleInputChange:e=>T(e)}),(E??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.access_dirs?.length&&void 0!==ue?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,G([...E])}})}),0===ue?.access_dirs?.length||void 0===ue?.access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{E.splice(s,1),G([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{W([...q,""])},title:e("添加")}),e("禁止目录范围")]}),(q??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,W([...q])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{q.splice(s,1),W([...q])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{R([...Z,""])},title:e("添加")}),e("只读目录范围")]}),(Z??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{Z[s]=e,R([...Z])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{Z.splice(s,1),R([...Z])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:U,placeholder:"use blank split",handleInputChange:e=>H(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.not_access_cmd&&void 0!==ue.not_access_cmd,value:L,placeholder:"use blank split",handleInputChange:e=>Q(e)}),!le&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{Se(e)},options:(()=>{const e=[];e.push({title:"NOT",value:""});for(let t of _e)e.push({title:t.role_name,value:t.role_id});return e})()})]}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{disabled:""!==ue.language&&void 0!==ue.language,value:J,onChange:e=>{Y(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{disabled:""!==ue.theme&&void 0!==ue.theme,value:ee,onChange:e=>{te(e)},options:xe}),(0,f.jsx)(O,{is_disable:e=>{if(!0===le)return!0;if(de){const t=P.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===le||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,v.I)(se,t=>t===e),ne([...se])):ne([...se,e]):ne([e])}}),(0,f.jsx)("label",{children:e("备注")}),(0,f.jsx)(r.Sm,{value:ie,handleInputChange:e=>ae(e)})]})})})]})}function B(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s}=(0,n.useContext)(N.F),[x,m]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[S,y]=(0,n.useState)(!1),[C,k]=(0,n.useState)(!1),[b,A]=(0,w.fp)(p.AG.confirm),[I,V]=(0,n.useState)(""),[K,X]=(0,n.useState)(""),[F,P]=(0,n.useState)([]),[$,B]=(0,n.useState)([]),[D,M]=(0,n.useState)([]),[T,E]=(0,n.useState)(""),[G,q]=(0,n.useState)(""),[W,Z]=(0,n.useState)(""),[R,U]=(0,n.useState)(""),[H,L]=(0,n.useState)([]),[Q,J]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,z.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=>{V(e?.role_name??""),X(e?.cwd??""),P(e?.access_dirs??[]),B(e?.not_access_dirs??[]),M(e?.only_read_dirs??[]),E(e?.access_cmd??""),q(e?.not_access_cmd??""),Z(e?.language??""),U(e?.theme??""),L(e?.auth_list??[]),J(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const ae=()=>{if(!I)return void(0,_.zN)("role_name not empty");const e=new a.E0;return e.language=W,e.theme=R,e.access_dirs=F,e.role_name=I,e.not_access_dirs=$,e.only_read_dirs=D,e.cwd=K,e.access_cmd=T,e.not_access_cmd=G,e.auth_list=H,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(l.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),titleCom:(0,f.jsx)("div",{children:(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{y(!0),k(!1),ie(void 0)}})}),children:(0,f.jsx)(h.X,{headers:se,rows:x.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(l.xP,{children:t.role_name}),(0,f.jsx)(l.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{y(!1),k(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new a.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,_.SK)("删除完成"),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(S||C)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(S?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:()=>{y(!1),k(!1),ie(void 0)}}),S&&(0,f.jsx)(o.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=ae();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,_.SK)("创建完成"),ne(),y(!1),k(!1),ie(void 0))}}),C&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=ae();if(!e)return;e.role_id=Q;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,_.SK)("保存完成"),ne())}})]}),children:[(0,f.jsx)("label",{children:e("角色名")}),(0,f.jsx)(r.Sm,{value:I,handleInputChange:e=>V(e)}),(0,f.jsx)("label",{children:e("角色备注")}),(0,f.jsx)(r.Sm,{value:Y,handleInputChange:e=>ee(e)}),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{P([...F,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:K,handleInputChange:e=>X(e)}),(F??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{F[t]=e,P([...F])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{F.splice(t,1),P([...F])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{B([...$,""])},title:"添加"}),e("禁止目录范围")]}),($??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:t,handleInputChange:e=>{$[s]=e,B([...$])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{$.splice(s,1),B([...$])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(o.rA,{icon:"add",onClick:()=>{M([...D,""])},title:e("添加")}),e("只读目录范围")]}),(D??[]).map((e,t)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{D[t]=e,M([...D])}})}),(0,f.jsx)(o.rA,{icon:"delete",onClick:()=>{D.splice(t,1),M([...D])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:T,placeholder:"use blank split",handleInputChange:e=>E(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:G,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:W,onChange:e=>{Z(e)},options:[{title:e("跟随系统"),value:"sys"},{title:"NOT",value:""},{title:"English",value:"en"},{title:"中文",value:"zh"}]}),(0,f.jsx)("label",{children:e("主题")}),(0,f.jsx)(r.l6,{value:R,onChange:e=>{U(e)},options:te}),(0,f.jsx)(O,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==H?.find(t=>t===e),select_auth:e=>{H?(H.find(t=>t==e)?(0,v.I)(H,t=>t===e):H.push(e),L([...H])):L([e])}})]})})})]})}function D(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:x}=(0,n.useContext)(N.F),[m,j]=(0,n.useState)([]),[g,S]=(0,w.fp)(p.AG.prompt_card),[C,b]=(0,n.useState)([]),[A,V]=(0,n.useState)([]),[K,X]=(0,n.useState)([]),[F,O]=(0,w.fp)(p.AG.user_base_info),P=(0,y.K)(),$=(0,z.o)(),B=[e("编号"),e("路径"),e("是否默认"),e("备注")],D=[e("编号"),e("路径"),e("备注")],M=[e("编号"),e("命令"),e("父编号"),e("备注")],T=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,G]=(0,n.useState)(""),[q,W]=(0,n.useState)(""),[Z,R]=(0,n.useState)(""),[U,H]=(0,n.useState)(!1),[L,Q]=(0,n.useState)(""),[J,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),V(e.data.quick_cmd),X(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&b(t.data??[])})(),Q(F?.user_data?.language),Y(F?.user_data?.theme),te(F?.user_data?.upload_file_ignore)},[]);const se=(0,z.Q)();return(0,f.jsx)(n.Fragment,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!q)return void(0,_.zN)("账号密码不能为空");if(q!==Z)return void(0,_.zN)("两次密码不一样");const e=new a.tl;e.username=E,e.password=q,e.confirm_password=Z,e.user_id=F.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,_.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:E,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{W(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{R(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(l.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(o.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:L,theme:J,upload_file_ignore:ee}})).code===d.m.Success&&((0,_.SK)("修改成功"),s())}}),children:[e("语言"),(0,f.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,f.jsx)(r.l6,{value:J,onChange:e=>{Y(e)},options:$}),(0,f.jsx)(r.Sm,{value:ee,handleInputChange:e=>{te(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})})]}),(0,f.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件夹路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,f.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,_.SK)("保存成功"),x(),s())}})]}),children:(0,f.jsx)(h.X,{headers:B,rows:m.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.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,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{m.splice(e,1),j([...m])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(m,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...C,{path:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",C)).code===d.m.Success&&((0,_.SK)("保存成功"),x())}})]}),children:(0,f.jsx)(h.X,{headers:D,rows:C.map((t,s)=>{const n=[(0,f.jsx)("div",{children:s}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{C.splice(e,1),b([...C])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{b((0,v.TI)(C,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("目录快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...A,{cmd:"",note:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:A})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:M,rows:A.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.index,handleInputChange:e=>{t.index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.father_index,handleInputChange:e=>{t.father_index=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),V([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(A,e,t))}})}),(0,f.jsx)(l.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(o.rA,{icon:"info",onClick:()=>{se("文件快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{X([...K,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:K})).code===d.m.Success&&((0,_.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:T,rows:K.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.file_suffix,handleInputChange:e=>{t.file_suffix=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.cmd,handleInputChange:e=>{t.cmd=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.params,handleInputChange:e=>{t.params=e},no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),X([...K])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{X((0,v.TI)(K,e,t))}})})]})]})]})})}const M=["password","private_key","secret_key"],T="webdav";function E(){const{t:e}=(0,u.B)(),[,t]=(0,w.fp)(p.AG.prompt_card),[s,i]=(0,n.useState)([]),[a,d]=(0,n.useState)([]),[x,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,S]=(0,n.useState)(T),[y,C]=(0,n.useState)(""),[k,b]=(0,n.useState)({}),[A,I]=(0,n.useState)(!1),V=async()=>{try{const[e,t]=await Promise.all([c.I2.post("credential/list",{}),c.I2.post("credential/meta",{})]);i(Array.isArray(e?.data)?e.data:[]),d(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{V()},[]);const N=a.find(e=>e.type===g)?.fields??[],K=()=>{m(!1),v(""),S(T),C(""),b({}),I(!1)};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("普通凭据管理")}),(0,f.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,f.jsxs)("div",{children:[(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:e("crd_tp")}),(0,f.jsx)("li",{children:e("bidacct")}),(0,f.jsx)("li",{children:e("pwdkept")}),(0,f.jsx)("li",{children:e("tstbfrs")})]}),(0,f.jsxs)("ul",{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"WebDAV"}),":",e("prtwbdv")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SSH / SFTP"}),":",e("prtsftp")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"S3 兼容对象存储"}),":",e("prt_s3")]})]})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{K(),m(!0)}}),x&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{try{const t=await c.I2.post("credential/test",{id:j||void 0,type:g,config:k}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}}}),x&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(y.trim()){for(const t of N){const s=String(k[t.key]??"").trim()||j&&M.includes(t.key);if(t.required&&!s)return void(0,_.zN)(`${e("请填写")}${e(t.label)}`)}try{await c.I2.post(j?"credential/update":"credential/add",{id:j||void 0,type:g,name:y,config:k,enabled:!0}),(0,_.SK)(e("保存成功")),K(),await V()}catch(e){}}else(0,_.zN)(e("请填写名称"))}}),x&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:K})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("名称"),value:y,handleInputChange:C}),(0,f.jsx)(r.l6,{value:g,options:a.map(e=>({title:e.name,value:e.type})),onChange:e=>{S(e),b({})}}),N.map(t=>(0,f.jsx)(n.Fragment,{children:(0,f.jsx)(r.Sm,{type:M.includes(t.key)?"password":"text",placeholder:M.includes(t.key)&&A?e("留空表示不修改"):t.label,value:k[t.key]??"",handleInputChange:e=>b({...k,[t.key]:e})})},t.key))]}),!x&&(0,f.jsx)(h.X,{headers:[e("名称"),e("类型"),e("操作")],rows:s.map(t=>{return[(0,f.jsx)(l.xP,{context:t.name}),(0,f.jsx)(l.xP,{context:(s=t.type,a.find(e=>e.type===s)?.name??s)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{m(!0),v(e.id),S(e.type),C(e.name??""),b({...e.config??{}}),I(Boolean(e.has_password))})(t)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{try{await c.I2.post("credential/delete",{id:t.id}),(0,_.SK)(e("已删除")),await V()}catch(e){}})(t)})]})];var s})})]})}var G=s(17903);function q(){const{t:e}=(0,u.B)(),[t,s]=(0,n.useState)([]),[i,a]=(0,n.useState)([]),[d,p]=(0,n.useState)([]),[x,m]=(0,n.useState)([]),[j,v]=(0,n.useState)(!1),[g,w]=(0,n.useState)(""),[S,y]=(0,n.useState)("webdav"),[C,k]=(0,n.useState)(""),[b,A]=(0,n.useState)(""),[I,V]=(0,n.useState)(""),[N,K]=(0,n.useState)(""),X=async()=>{try{const[e,t,n,i]=await Promise.all([c.I2.post("list",{}),c.I2.post("credential/list",{}),c.I2.post("driver/list",{}),c.I2.post("baidu/app/get",{})]);s(Array.isArray(e?.data)?e.data:[]),a(Array.isArray(t?.data)?t.data:[]),p(Array.isArray(n?.data)?n.data:[]),m(Array.isArray(i?.data?.accounts)?i.data.accounts:[])}catch(e){}};(0,n.useEffect)(()=>{X()},[]);const z=()=>{v(!1),w(""),y("webdav"),k(""),A(""),V(""),K("")};return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!j&&(0,f.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:()=>{z(),v(!0)}}),j&&(0,f.jsx)(o.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(b)try{const t=await c.I2.post("test",{id:g||void 0,driver:S,credential_id:b,root_dir:I}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,_.zN)(e("请选择凭据"))}}),j&&(0,f.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(b)if(C.trim())try{await c.I2.post(g?"update":"add",{id:g||void 0,driver:S,mount_path:C,credential_id:b,root_dir:I,name:N,color:G.OT,readonly:!1,enabled:!0}),(0,_.SK)(e("保存成功")),z(),await X()}catch(e){}else(0,_.zN)(e("munt_rq"));else(0,_.zN)(e("请选择凭据"))}}),j&&(0,f.jsx)(o.rA,{icon:"cancel",title:e("取消"),onClick:z})]}),children:[j&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:S,options:d.map(e=>({title:e.name,value:e.type})),onChange:e=>{y(e),A("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:b,options:(e=>{if("baidu"===e)return x.map(e=>({title:e.name||e.baidu_name||String(e.uk),value:String(e.uk)}));const t=G.UW[e];return i.filter(e=>!t||e.type===t).map(e=>({title:e.name,value:e.id}))})(S),onChange:A})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:C,handleInputChange:k})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:I,handleInputChange:V})}),(0,f.jsx)(r.BC,{label:e("dspnmtp"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:N,handleInputChange:K})})]}),!j&&(0,f.jsx)(h.X,{headers:[e("名称"),e("挂载类型"),e("凭据"),e("操作")],rows:t.map(t=>{const s=i.find(e=>e.id===t.credential_id),n="baidu"===t.driver?x.find(e=>String(e.uk)===String(t.credential_id)):void 0;return[(0,f.jsx)("p",{children:t.name}),(0,f.jsx)("p",{children:(a=t.driver,d.find(e=>e.type===a)?.name??a)}),(0,f.jsx)("p",{children:n?n.name||n.baidu_name||String(n.uk):s?s.name:e("凭据已丢失")}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{v(!0),w(e.id),y(e.driver),k(e.mount_path??""),A(e.credential_id??""),V(e.root_dir??""),K(e.name??"")})(t)}),(0,f.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{try{await c.I2.post("delete",{id:t.id}),(0,_.SK)(e("已删除")),await X()}catch(e){}})(t)})]})];var a})})]})}function W({on_credential_change:e}){const{t}=(0,u.B)(),[,s]=(0,w.fp)(p.AG.prompt_card),[i,a]=(0,n.useState)(null),[d,x]=(0,n.useState)([]),[m,j]=(0,n.useState)("百度网盘"),[v,g]=(0,n.useState)(""),[S,y]=(0,n.useState)(""),[C,k]=(0,n.useState)(""),[b,A]=(0,n.useState)("oob"),[I,V]=(0,n.useState)(!0),[N,K]=(0,n.useState)(!0),X="oob"===b,[z,F]=(0,n.useState)(!1),[O,P]=(0,n.useState)(!1),[$,B]=(0,n.useState)(""),D=async()=>{try{const e=await c.I2.post("baidu/app/get",{}),t=e?.data?.app??null;a(t),x(e?.data?.accounts??[]),j(t?.name??"百度网盘"),g(t?.app_id??""),y(t?.app_key??""),A("one_click"===t?.auth_mode?"one_click":"oob"),V(!1!==t?.enabled),K(!1!==t?.auto_refresh)}catch(e){}};(0,n.useEffect)(()=>{D();const s=new URLSearchParams(window.location.search),n=s.get("baidu_auth");"success"===n?((0,_.SK)(`${t("授权成功")}:${s.get("name")??""}`),e()):"failed"===n&&(0,_.zN)(`${t("授权失败")}:${s.get("reason")??""}`),n&&window.history.replaceState({},"",window.location.pathname)},[]);return(0,f.jsxs)(l.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:t("百度网盘")}),(0,f.jsx)(o.rA,{icon:"info",title:t("信息"),onClick:()=>{s({open:!0,title:t("信息"),context_div:(0,f.jsxs)("ul",{children:[(0,f.jsx)("li",{children:t("atathtp")}),(0,f.jsx)("li",{children:t("atathnt")}),(0,f.jsx)("li",{children:t("pstatht")})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!z&&(0,f.jsx)(o.rA,{icon:"apps",title:t("应用配置"),onClick:()=>F(!0)}),z&&(0,f.jsx)(o.rA,{icon:"save",title:t("保存应用配置"),onClick:async()=>{if(S.trim())if(i?.configured||C.trim())try{await c.I2.post("baidu/app/save",{name:m,app_id:v,app_key:S,secret_key:C,auth_mode:b,remark:i?.remark??"",enabled:I,auto_refresh:N}),(0,_.SK)(t("保存成功")),k(""),F(!1),await D()}catch(e){}else(0,_.zN)(t("rq_scrt"));else(0,_.zN)(t("rqappky"))}}),z&&(0,f.jsx)(o.rA,{icon:"cancel",title:t("取消"),onClick:()=>F(!1)}),!z&&(0,f.jsx)(o.rA,{icon:"key",title:t("授权"),onClick:()=>P(!0)}),(0,f.jsx)(o.rA,{icon:"refresh",title:t("授权检测/刷新"),onClick:async()=>{try{await c.I2.post("baidu/verify/all",{}),(0,_.SK)(t("检测完成")),await D()}catch(e){}}})]}),children:[z&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:t("名称"),value:m,handleInputChange:j}),(0,f.jsx)(r.Sm,{placeholder:"AppID",value:v,handleInputChange:g}),(0,f.jsx)(r.Sm,{placeholder:"AppKey",value:S,handleInputChange:y}),(0,f.jsx)(r.Sm,{type:"password",placeholder:i?.configured?t("scrtkep"):"SecretKey",value:C,handleInputChange:k}),(0,f.jsx)(r.BC,{label:t("授权方式"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:b,options:(0,G.K1)(t),onChange:e=>A("one_click"===e?"one_click":"oob")})}),(0,f.jsx)(r.BC,{label:t("网盘使用"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:I,options:(0,G.Dd)(t),onChange:V})}),(0,f.jsx)(r.BC,{label:t("atrfrsh"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:N,options:(0,G.Dd)(t),onChange:K})})]}),O&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:t("授权方式"),label_width:"6rem",children:(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.U6,{value:"one_click",context:t("一键授权"),name:"baidu_auth_mode",selected:"one_click"===b,onchange:()=>A("one_click")}),(0,f.jsx)(r.U6,{value:"oob",context:t("outh_ob"),name:"baidu_auth_mode",selected:"oob"===b,onchange:()=>A("oob")})]})}),X&&(0,f.jsx)(r.Sm,{placeholder:t("pst_cd"),value:$,handleInputChange:B}),(0,f.jsxs)("div",{className:"div-row mount-actions",children:[(0,f.jsx)(o.C3,{text:t(X?"去授权(手动)":"去授权(一键)"),clickFun:async()=>{if(i?.configured)try{const e=await c.I2.post("baidu/authorize_url",{mode:b});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}else(0,_.zN)(t("svappfr"))}}),X&&(0,f.jsx)(o.C3,{text:t("完成授权"),clickFun:async()=>{if($.trim())try{const s=await c.I2.post("baidu/exchange",{code:$.trim(),mode:b});(0,_.SK)(`${t("授权成功")}:${s?.data?.baidu_name??""}`),B(""),P(!1),await D(),e()}catch(e){}else(0,_.zN)(t("请填写授权码"))}}),(0,f.jsx)(o.C3,{text:t("取消"),clickFun:()=>P(!1)})]})]}),!z&&!O&&(0,f.jsx)(h.X,{headers:[t("账号名"),t("百度账号"),t("授权状态"),t("使用"),t("授权时间"),t("操作")],rows:d.map(s=>{return[(0,f.jsx)(r.Sm,{value:s.name,no_border:!0,handleInputChange:t=>(async(t,s)=>{try{await c.I2.post("baidu/account/update",{uk:t.uk,name:s}),e()}catch(e){}})(s,t)}),(0,f.jsx)(l.xP,{context:s.baidu_name||"-"}),(0,f.jsx)(l.xP,{context:(n=s,n.authorized?n.expired?t("已过期"):t("已授权"):t("未授权"))}),(0,f.jsx)(r.l6,{value:s.enabled,no_border:!0,options:(0,G.Dd)(t),onChange:()=>(async t=>{try{await c.I2.post("baidu/account/update",{uk:t.uk,enabled:!t.enabled}),await D(),e()}catch(e){}})(s)}),(0,f.jsx)("p",{children:(0,G.eK)(s.created_at)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(o.rA,{icon:"network_check",title:t("授权检测"),onClick:()=>(async e=>{try{const s=await c.I2.post("baidu/verify",{uk:e.uk});s?.data?.valid?(0,_.SK)(t("账号可用")):(0,_.zN)(`${t("账号不可用")}:${s?.data?.error??""}`),await D()}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"link_off",title:t("取消授权"),onClick:()=>(async e=>{try{await c.I2.post("baidu/deauthorize",{uk:e.uk}),(0,_.SK)(t("已取消授权")),await D()}catch(e){}})(s)}),(0,f.jsx)(o.rA,{icon:"delete",title:t("删除"),onClick:()=>(async s=>{try{await c.I2.post("baidu/delete",{uk:s.uk}),(0,_.SK)(t("已删除")),await D(),e()}catch(e){}})(s)})]})];var n})})]})}function Z(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=t(a.oV.file_mount),[r,d]=(0,w.fp)(p.AG.mount_enabled);(0,n.useEffect)(()=>{s&&(async()=>{try{const e=await c.I2.post("enabled/get",{});d(!0===e?.data)}catch(e){d(!1)}})()},[s]);return s?(0,f.jsxs)(n.Fragment,{children:[(0,f.jsxs)(b.aZ,{position:"right",children:[(0,f.jsx)("span",{className:"header-label",children:e("总开关")}),(0,f.jsx)(o.rA,{icon:!0===r?"cloud_done":"cloud_off",title:e(!0===r?"muntont":"muntoff"),selected:!0===r,onClick:async()=>{const t=!r;try{const s=await c.I2.post("enabled/set",{enabled:t}),n=!0===s?.data;d(n),(0,_.SK)(e(n?"挂载已启用":"挂载已停用"))}catch(e){}}})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,f.jsx)(E,{})}),(0,f.jsx)(i.VP,{widthPer:60,maxWidth:"60rem",children:(0,f.jsx)(W,{on_credential_change:()=>window.location.reload()})})]}),(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(q,{})})})]})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(l.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}var R=s(87361);function U(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),s=[{index:1,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(D,{})}];return t(a.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(X,{})}),t(a.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(F,{})}),t(a.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(a.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)($,{})}),t(a.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(B,{})}),t(a.oV.file_mount)&&s.push({index:1,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(Z,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:R.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),a=s(74777),l=s(96540),o=s(86149),r=s(23430),c=s(14284),d=s(74848);function h(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:l}=(0,o.B)();return e=>{let n;e===a.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===a.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 u=r.Ky;function p(){const[e,t]=(0,l.useState)([]);return(0,l.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const s=e.data||[];u=[...r.Ky,...s],t(u)}else console.warn("获取主题列表失败,使用默认列表"),t(u)}catch(e){t(u)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>l});var n=s(72635);const i=1440,a=525600;function l(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<a?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/a).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){var n=s(86149);s.d(t,["K",0,()=>{const{t:e}=(0,n.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9299],{47374(e,t,i){i.d(t,{e:()=>f});var n=i(96540),s=i(86090),o=i(64694),a=i(34289),l=i(61443),r=i(75725),c=i(86149),d=i(85997),_=i(74848);function f(e){let t=(0,s.zy)();const[i,f]=(0,n.useState)([]),[p,h]=(0,n.useState)("/"),[u,m]=(0,n.useState)(void 0),{t:w,i18n:g}=(0,c.B)();n.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const n=i.indexOf(e.baseRoute),s=[];if(-1!=n){t=(0,o.IO)(i.slice(0,n),e.baseRoute);const a=i.slice(n+1);for(let e=0;e<a.length;e++){const i=a[e];s.push({value:i,href:0===e?`${t}${i}/`:(0,o.IO)(s[e-1].href,i)})}h(t),f(s)}},[t]);const v=t=>{t.stopPropagation(),e.clickFun(t)};return(0,_.jsx)("div",{className:"breadcrumbs",onClick:e=>{m(void 0!==u?void 0:"")},children:(0,_.jsx)(n.Fragment,{children:void 0===u?(0,_.jsxs)(n.Fragment,{children:[(0,_.jsx)("span",{className:"chevron",children:(0,_.jsx)(s.N_,{to:p,onClick:v,children:(0,_.jsx)(d.In,{icon:"home"})})}),i.map((e,t)=>(0,_.jsxs)("span",{className:"chevron",children:[(0,_.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,_.jsx)(s.N_,{to:e.href,onClick:v,children:decodeURIComponent(e.value)})]},t))]}):(0,_.jsx)(r.QM,{click:()=>{m(void 0)},children:(0,_.jsx)(l.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),m(void 0)}})})})})}},77481(e,t,i){i.d(t,{S:()=>l,X:()=>a});var n=i(96540),s=i(61443),o=i(74848);function a(e){const[t,i]=n.useState([]),a=(0,n.useRef)(-1),[l,r]=(0,n.useState)(-1),[c,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?i(Array.isArray(e.children)?e.children:[e.children]):i(e.rows)},[e.rows,e.children]);const _=()=>{a.current=-1,r(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,i)=>{const n=!!e.filter&&(e.filter.column??0)===i;let a=t;if(n){const i=e.filter,n=i.options.find(e=>e.value===i.value);null!=i.value&&n&&(a=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(s.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},i)})})}),(0,o.jsx)("tbody",{children:t.map((t,i)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(l===i?"row-dragging":"")+(c===i?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(a.current=i,r(i),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(i))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=a.current,i=c;_(),t<0||i<0||t===i||e.onRowDrag?.(t,i)})())},onDragEnd:_,children:t.map((i,n)=>{const s=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:s,style:{width:e.width??"auto"},children:i},n)})},i)})})]})}function l(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},19299(e,t,i){i.r(t),i.d(t,{default:()=>q});var n=i(96540),s=i(47374),o=i(34843),a=i(82893),l=i(14284),r=i(86090),c=i(4412),d=i(83529),_=i(34289),f=i(53459),p=i(99214),h=i(61443),u=i(47022),m=i(62042),w=i(86149),g=i(7523),v=i(78247),x=i(88815),y=i(6960),j=i(47071),k=i(14944),G=i(92275),A=i(23430);var b=i(34251),C=i(60096),$=i(87361),M=i(76559),z=i(85997),S=i(77481),D=i(70447),P=i(74848);const I=500;function N(e){const{t}=(0,w.B)(),i=(0,r.Zp)(),[,s]=(0,o.fp)(a.AG.prompt_card),[l,c]=(0,n.useState)(""),[d,_]=(0,n.useState)(!1),[f,p]=(0,n.useState)([]),[u,m]=(0,n.useState)(0),[g,v]=(0,n.useState)(!1),x=(0,n.useMemo)(()=>new M.I(window.location.host,"file_deep_search"),[]),y=(0,n.useRef)(!1),j=decodeURIComponent(e.base_path);(0,n.useEffect)(()=>{let e=[],t=null;const i=()=>{if(t=null,y.current||!e.length)return;const i=e;e=[],m(e=>e+i.length),p(e=>e.length>=I?e:[...e,...i].slice(0,I))},n=()=>{y.current||_(!1)};return x.addMsg(G.HK.file_deep_search_data,n=>{y.current||(e.push(...n.context??[]),null===t&&(t=setTimeout(i,100)))}),x.addMsg(G.HK.file_deep_search_end,()=>{y.current||(i(),_(!1))}),x.on_message("close",n),()=>{y.current=!0,clearTimeout(t),x.sendData(G.HK.file_deep_search_cancel,{}).catch(()=>{}),x.off_message("close",n),x.close()}},[]);const k=()=>{const t=l.trim();if(!t||d)return;p([]),m(0),v(!0),_(!0);const i={param_path:e.base_path,keyword:t};x.sendData(G.HK.file_deep_search,i).catch(()=>{})},A=e=>{let t=e.is_dir?e.path:e.path.slice(0,e.path.lastIndexOf("/")+1);t.endsWith("/")||(t+="/"),s({open:!1}),i($.o.file+t.split("/").map(encodeURIComponent).join("/"))};return(0,P.jsxs)("div",{className:"file-deep-search",children:[(0,P.jsxs)("div",{className:"file-deep-search__bar",children:[(0,P.jsx)(h.$Z,{icon:"search",value:l,placeholder:t("搜文件名"),handleInputChange:e=>c(e),handleEnterPress:k}),(0,P.jsx)("button",{className:"button button--flat",onClick:d?()=>{x.sendData(G.HK.file_deep_search_cancel,{}).catch(()=>{}),_(!1)}:k,children:t(d?"取消":"搜索")})]}),(0,P.jsxs)("div",{className:"file-deep-search__hint",children:[(0,P.jsxs)("span",{children:[t("范围"),":",j]}),u>0&&(0,P.jsx)("span",{className:"file-deep-search__count",children:u>I?`${t("已显示")} 500 / ${u}`:`${u}`})]}),(0,P.jsxs)("div",{className:"file-deep-search__body",children:[f.length>0&&(0,P.jsx)(S.X,{headers:[t("名称"),t("路径"),""],rows:f.map(e=>{const i=e.path.slice(0,e.path.lastIndexOf("/")+1);return[e.is_dir?(0,P.jsx)("span",{className:"file-deep-search__dir",children:e.name}):e.name,(0,P.jsx)(D.xP,{context:i}),(0,P.jsx)(z.rA,{icon:"folder_open",title:t("打开所在目录"),onClick:()=>A(e)})]})}),d&&(0,P.jsxs)("div",{className:"file-deep-search__empty",children:[(0,P.jsx)("span",{className:"chat-session-running",title:t("搜索中")}),t("搜索中")]}),!d&&u>I&&(0,P.jsx)("div",{className:"file-deep-search__more",children:t("结果过多")}),!d&&0===f.length&&(0,P.jsx)("div",{className:"file-deep-search__empty",children:t(g?"无匹配":"输入后搜")})]})]})}var F=i(23496),X=i(12730),E=i(75725),K=i(40505);let R={};function H(){const{t:e}=(0,w.B)();let t=(0,r.zy)();const i=(0,r.Zp)(),{check_user_auth:s}=(0,v.MH)(),[c,f]=(0,o.fp)(a.AG.nowFileList),[h,x]=(0,o.fp)(a.AG.uploadFiles),[y,j]=(0,o.fp)(a.AG.showPrompt),[C,M]=(0,o.fp)(a.AG.selectedFileList),[S,I]=(0,o.fp)(a.AG.copyedFileList),[N,F]=(0,o.fp)(a.AG.cutedFileList),[K,H]=(0,o.fp)(a.AG.selectedFileList),[L,U]=(0,o.fp)(a.AG.clickFileList),[Y,O]=(0,o.fp)(a.AG.fileShellShow),[Z]=(0,o.fp)(a.AG.current_mount),[B,W]=(0,o.fp)(a.AG.file_root_list),[T,q]=(0,o.fp)(a.AG.file_root_index),[V,J]=(0,n.useState)(void 0),[Q,ee]=(0,n.useState)(""),[te,ie]=(0,o.fp)(a.AG.workflow_show),[ne,se]=(0,o.fp)(a.AG.workflow_realtime_show),[oe,ae]=(0,o.fp)(a.AG.work_flow_show),{initUserInfo:le}=(0,n.useContext)(g.F),[re,ce]=(0,o.fp)(a.AG.user_base_info),{click_file:de}=(0,p.kZ)(),[_e,fe]=(0,o.fp)(a.AG.prompt_card),pe=(0,n.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type!==u.Iw.folder?1:0),0),[c]),he=(0,n.useMemo)(()=>c.files.reduce((e,t)=>e+(t.type===u.Iw.folder?1:0),0)+(c.folders?.length??0),[c]);function ue(e){(0,m.SK)(e)}(0,n.useEffect)(()=>{R={}},[t]),(0,n.useEffect)(()=>()=>{O({show:!1,path:""})},[]);const me=(0,p.Vs)(),we=t=>{fe({open:!0,title:e("信息"),context_div:(0,P.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,P.jsx)(E.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,P.jsx)(E.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,P.jsx)(E.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,P.jsx)(E.Yh,{left:`${e("文件夹数")}`,right:he}),(0,P.jsx)(E.Yh,{left:`${e("文件数")}`,right:pe}),(0,P.jsx)(E.Yh,{left:`${e("当前位置")}`,right:(0,P.jsx)(D.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{k.ws.removeMsg(G.HK.file_info)}})};return(0,P.jsxs)(n.Fragment,{children:[C.length>0&&(0,P.jsx)(z.rA,{icon:"delete",title:e("删除"),onClick:()=>{j({show:!0,type:d.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),C.length>0&&(0,P.jsx)(z.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,p.ib)(c,C);I(e.map(e=>(0,p.Ok)(e.name))),F([]),ue("已复制")}}),C.length>0&&(0,P.jsx)(z.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,p.ib)(c,C);F(e.map(e=>(0,p.Ok)(e.name))),I([]),ue("已剪切")}}),(S.length>0||N.length>0)&&(0,P.jsx)(z.rA,{onClick:function(){j({show:!0,type:d.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:S.length+N.length}),C.length>0&&(0,P.jsx)(z.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,p.ib)(c,C);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,p.Ok)(i.name))}const t=l.$M.getDownloadUrl(e);window.open(t)}}),C.length>0&&(0,P.jsx)(z.rA,{icon:"compress",title:e("压缩"),onClick:function(){const e=(0,p.ib)(c,C);for(let t=0;t<e.length;t++){const i=e[t];e[t]=(0,p.Ok)(i.name)}e&&0!==e.length?j({show:!0,type:d.PromptEnum.Compress,overlay:!0,data:{files:e}}):(0,m.zN)("没有选中")}}),1===C.length&&(0,P.jsx)(z.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){j({show:!0,type:d.PromptEnum.FileRename,overlay:!0,data:{}})}}),oe&&(0,P.jsx)(z.rA,{icon:"api",title:"workflow",onClick:()=>{ie(!te)}}),!Z&&(0,P.jsx)(z.rA,{icon:"terminal",title:"shell",onClick:function(){Y.show?O({show:!1,path:""}):O({show:!0,path:(0,_.GG)("file",(0,_.vX)())})}}),s(A.oV.share_file)&&(0,P.jsx)(z.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`${$.o.share_list_setting_page}`)}}),(0,P.jsx)(z.rA,{icon:"grid_view",title:e("切换样式"),onClick:me}),(0,P.jsx)(z.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){j({show:!0,type:d.PromptEnum.DirNew,overlay:!0,data:{dir:(0,_.GG)("file",(0,_.vX)())}})}}),(0,P.jsx)(z.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){j({show:!0,type:d.PromptEnum.FileNew,overlay:!0,data:{dir:(0,_.GG)("file",(0,_.vX)())}})}}),(0,P.jsx)(z.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{j({show:!0,type:d.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const n=[],s=new Set;for(let e=0;e<t.length;e++){const o=t[e],a=i?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=a,i&&s.add((0,X.S)(a)),n.push(o)}const o=[];if(i)for(const e of s)o.push({isDir:!0,fullPath:e,name:e});o.push(...n),x(o),j({show:!0,type:d.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,P.jsx)(z.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!R.now_absolute_path){k.ws.addMsg(G.HK.file_info,t=>{const i=t.context;e&&(R={...R,...i},k.ws.removeMsg(G.HK.file_info),we(R))});const t=await k.ws.sendData(G.HK.file_info,{type:u.Iw.folder,path:(0,_.GG)("file",(0,_.vX)())});e=t.context,R=e,we(R)}we(R)}}),(0,P.jsx)(z.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const n=new b.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory,n.items=B,n.item_pre_value=T,n.textClick=async t=>{if(-1===t)return i(`${$.o.setting_private_env_setting}`),j({data:void 0,overlay:!1,type:"",show:!1}),void(0,m.N9)(e("请配置 文件夹路径"));(async e=>{q(e),await l.$M.post("base_switch",{root_index:e}),await le(),i("/file/"),H([]),U([])})(t),j({data:void 0,overlay:!1,type:"",show:!1})},j({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:n})}})]})}var L=i(2543),U=i(21499),Y=i(64694),O=i(17903);const Z=n.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(()=>i(63659))),B=n.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(()=>i(81636)));let W,T="";function q(){const[e,t]=(0,o.fp)(a.AG.editorSetting),[,i]=(0,o.fp)(a.AG.md_editor),[,m]=(0,o.fp)(a.AG.log_viewer),[,M]=(0,o.fp)(a.AG.image_editor),[,S]=(0,o.fp)(a.AG.markdown),[,D]=(0,o.fp)(a.AG.excalidraw_editor),[I,X]=(0,o.fp)(a.AG.file_preview),{t:E}=(0,w.B)();let R=(0,r.zy)();const q=(0,r.Zp)(),[V,J]=(0,o.fp)(a.AG.nowFileList),[Q]=(0,o.fp)(a.AG.file_list_refresh),[ee]=(0,o.fp)(a.AG.mount_enabled),[te,ie]=(0,o.fp)(a.AG.current_mount),[ne,se]=(0,o.fp)(a.AG.showPrompt),[oe,ae]=(0,o.fp)(a.AG.selectedFileList),[le,re]=(0,o.fp)(a.AG.clickFileList),[ce,de]=(0,o.fp)(a.AG.fileShellShow),[_e,fe]=(0,n.useState)(""),[pe,he]=(0,o.fp)(a.AG.workflow_show),[ue,me]=(0,o.fp)(a.AG.workflow_realtime_show),[we,ge]=(0,o.fp)(a.AG.work_flow_show),{initUserInfo:ve}=(0,n.useContext)(g.F),[xe,ye]=(0,o.fp)(a.AG.user_base_info),{click_file:je}=(0,p.kZ)(),[ke]=(0,r.ok)(),Ge=(0,p._A)(),Ae=n.useRef(null),[be,Ce]=(0,o.fp)(a.AG.to_running_files),[$e,Me]=(0,o.fp)(a.AG.file_page),[ze]=(0,o.fp)(a.AG.blank_search_mode),[,Se]=(0,o.fp)(a.AG.prompt_card),[De,Pe]=(0,o.fp)(a.AG.blank_search_mode_for_temp),Ie=function(){const[e,t]=(0,o.fp)(a.AG.user_base_info),{t:i}=(0,w.B)(),{check_user_auth:s}=(0,v.MH)(),[c,f]=(0,o.fp)(a.AG.router_jump),h=(0,r.Zp)(),{initUserInfo:m}=(0,n.useContext)(g.F),[x,y]=(0,o.fp)(a.AG.nowFileList),[j,C]=(0,o.fp)(a.AG.showPrompt),[M,z]=(0,o.fp)(a.AG.fileShellShow),[S,D]=(0,o.fp)(a.AG.blank_search_mode);return t=>{t.preventDefault(),t.stopPropagation();const n=new b.ik;n.x=t.clientX,n.y=t.clientY,n.type=u.Iw.directory;const o=[{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.time_minx_max),children:i("时间逆序")}),v:A.t8.time_minx_max},{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.time_max_min),children:i("时间顺序")}),v:A.t8.time_max_min}],a=[{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.size_min_max),children:i("大小顺序")}),v:A.t8.size_min_max},{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.size_max_min),children:i("大小逆序")}),v:A.t8.size_max_min}],r=[{r:(0,P.jsx)("span",{style:(0,K.ok)(!e.user_data.file_list_pagination_mode||e.user_data.file_list_pagination_mode===A.yM.all),children:i("全部加载文件")}),v:A.yM.all},{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.file_list_pagination_mode===A.yM.pagination),children:i("scrll_l")}),v:A.yM.pagination}],c=[{r:(0,P.jsx)("span",{style:(0,K.ok)(!e.user_data.file_time_show_type||e.user_data.file_time_show_type===A.KD.current),children:i("最近时间")}),v:A.KD.current},{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.file_time_show_type===A.KD.time),children:i("准确时间")}),v:A.KD.time}],w=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,P.jsx)("span",{style:(0,K.ok)(!e.user_data.dir_show_type),children:i("系统默认")}),v:A.t8.defualt},{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.name),children:i("名字")}),v:A.t8.name},{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.time_minx_max||e.user_data.dir_show_type===A.t8.time_max_min),children:i("修改时间")}),v:!1,items:o},{r:(0,P.jsx)("span",{style:(0,K.ok)(e.user_data.dir_show_type===A.t8.size_min_max||e.user_data.dir_show_type===A.t8.size_max_min),children:i("文件大小")}),v:!1,items:a}]},{r:i("文件加载方式"),v:"",items:r},{r:i("时间展示"),v:"",items:c},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,P.jsx)("span",{style:(0,K.ok)(S),children:i("srchbln")}),v:"blank_search_mode"}]},{r:i("以配置表方式打开目录"),v:"gcfg_dir_config"}];x?.folders?.find(e=>".git"===e.name)&&w.push({r:i("查看Git提交"),v:"git_page"}),s(A.oV.code_resource)&&w.push({r:i("add_rot"),v:"code_resource"}),s(A.oV.http_proxy)&&w.push({r:i("dl_here"),v:"http_resource"}),e?.user_data?.quick_cmd&&(0,p.LL)([...e.user_data.quick_cmd],w),n.items=w,n.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,_.GG)("file",(0,_.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${$.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,_.GG)("file",(0,_.vX)());return C({data:void 0,overlay:!1,type:"",show:!1}),void h(`${$.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await k.ws.sendData(G.HK.file_info,{path:(0,_.GG)("file",(0,_.vX)())});return f({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/setting/customer_router/")}if("http_resource"===e){const e=await k.ws.sendData(G.HK.file_info,{path:(0,_.GG)("file",(0,_.vX)())});return f({http_download_map_path:e.context.now_absolute_path}),C({data:void 0,overlay:!1,type:"",show:!1}),void h("/proxy/http/")}if("zoom_adjust"===e)return C({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{C({show:!0,type:d.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",z({show:!0,path:(0,_.GG)("file",(0,_.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return D(!S),void C({data:void 0,overlay:!1,type:"",show:!1});if(e===A.yM.all||e===A.yM.pagination)t.is_pagination_mode=!0;else if(e===A.KD.current||e===A.KD.time)t.is_file_show_type=!0;else{if(e!==A.t8.defualt&&e!==A.t8.name&&e!==A.t8.size_max_min&&e!==A.t8.size_min_max&&e!==A.t8.time_max_min&&e!==A.t8.time_minx_max)return;t.is_dir_list_type=!0}}await l.wm.post(F.s.user_save_private_attr,{type:e,...t}),await m(),C({data:void 0,overlay:!1,type:"",show:!1}),h((0,_.vX)())},C({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:n})}}(),Ne=async()=>{const e=new j.Nd;e.dir_path=`${(0,_.GG)("file",(0,_.vX)())}`,k.ws.addMsg(G.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,p.Ys)(e);for(const e of t.failed_file_list)(0,p.V$)(e);Ce(new Set(t.running_file_list))}}),await k.ws.sendData(G.HK.workflow_realtime,e)},Fe=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,x.v7)(i.size),xe.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,U.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,y.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0,Promise.resolve().then(()=>{Ne()})),i.name===j.SB&&(t=!0);for(const i of e.folders??[])xe.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,U.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,y.s)(i.mtime):"",i.name===j.SB&&(t=!0);ge(t)},Xe=n.useRef(null),Ee=async e=>{if(!0===ee){if(Xe.current!==e){Xe.current=e;try{const t=await l.$M.post("file/mount_info",{param_path:e});ie(t?.data??null)}catch(e){ie(null)}}}else ie(null)},Ke=async()=>{const e=(0,_.GG)("file",(0,_.vX)());if(ze||De)return;let t;if(Ee(e),xe.user_data.file_list_pagination_mode===A.yM.pagination){if(T!==e){if(T=e,1!==$e.page_num)return void Me({page_size:$e.page_size,page_num:1})}else if($e.page_num<0)return;if(t=await l.$M.post("file_get_page",{param_path:e,page_num:$e.page_num,page_size:$e.page_size}),t.code!==f.m.Success)return;const i=t.data;return Fe(i),i.files?.length?(J(e=>{const t=(0,L.cloneDeep)(1===$e.page_num?i.files:[...e?.files??[],...i.files]),n={...e,files:t};return(0,p.yC)(n,xe.user_data.dir_show_type),n}),void(W=t.data)):void Me({page_size:$e.page_size,page_num:-1})}if(t=await l.$M.get(e),t.code!==f.m.Success)return;const i=t.data;(0,p.yC)(i,xe.user_data.dir_show_type),Fe(t.data),J(t.data),W=t.data};(0,n.useEffect)(()=>async()=>{Ce(new Set)},[]);const Re=()=>{ge(!1),(()=>{const e=ke.get("preview_file_name"),t=ke.get("preview_mode");if(!e||!t)return!1;const n=(0,_.GG)("file",(0,_.vX)());if(Ae.current===n+e)return!0;Ae.current=n+e;const s=()=>Ge(null);return"md"===t?(i({url:l.$M.getDownloadUrl(`${encodeURIComponent(n)}${e}`),path:`${n}${e}`,name:e,close:s}),!0):"log"===t?(m({show:!0,fileName:e,encoding:ke.get("preview_log_enc")??"utf8",wrap:ke.get("preview_log_wrap")??"wrap",close:s}),!0):"image_edit"===t?(M({path:(0,Y.IO)((0,_.vX)(),e),name:e,close:s}),!0):(je({name:e,opt_shell:!0,..."text"===t?{model:"text"}:{},close:s}),!0)})()||(t({open:!1}),X({open:!1}),i({}),m({show:!1}),M({}),S({}),D({}),Ke())};(0,n.useEffect)(()=>{Re()},[R,$e]),(0,n.useEffect)(()=>{Q>0&&Ke()},[Q]);const He=n.useRef(!1);(0,n.useEffect)(()=>{if(null!==ee)return He.current?void(!0===ee?Ee((0,_.GG)("file",(0,_.vX)())):ie(null)):(He.current=!0,void(!0===ee&&null===te&&Ee((0,_.GG)("file",(0,_.vX)()))))},[ee]);const Le=e=>{e.target===e.currentTarget&&(ae([]),re([]))};return(0,P.jsxs)(n.Fragment,{children:[(0,P.jsx)(c.aZ,{children:(0,P.jsx)(h.$Z,{handleEnterPress:async()=>{if(ze||De){if(ae([]),re([]),!_e||!_e.trim())return void J({files:[],folders:[]});const e=(0,_.GG)("file",(0,_.vX)()),t=await l.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:_e.trim()});if(t.code!==f.m.Success)return;const i=t.data;return(0,p.yC)(i,xe.user_data.dir_show_type),Fe(i),J(i),void(W=i)}if(!W)return;ae([]),re([]);const e=[],t=[];for(const t of W.files??[])t.name.includes(_e)&&e.push(t);for(const e of W.folders??[])e.name.includes(_e)&&t.push(e);J({files:e,folders:t})},placeholder:E("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleIconClick:()=>{const e=(0,_.GG)("file",(0,_.vX)());Se({open:!0,title:E("深搜"),context_div:(0,P.jsx)(N,{base_path:e})})},handleInputChange:e=>{fe(e)},max_width:"25em"})}),(0,P.jsxs)(c.aZ,{position:"right",children:[(0,P.jsx)("div",{className:"mobile-context-btn",children:(0,P.jsx)(z.rA,{icon:"more_horiz",title:E("右键"),onClick:()=>{const e=oe[oe.length-1];if(void 0!==e){const t=[...V.folders??[],...V.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],n=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},s={preventDefault:()=>{},stopPropagation:()=>{},clientX:n.left+10,clientY:n.bottom??100},o=new b.ik;o.path=(0,Y.IO)((0,_.vX)(),t.name),o.filename=t.name,o.x=s.clientX,o.y=s.clientY,o.type=t.type===u.Iw.folder?u.Iw.folder:(0,b.uL)(t.name),o.size=t.origin_size,se({show:!0,type:d.PromptEnum.FileMenu,overlay:!1,data:o})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};Ie(e)}}})}),(0,P.jsx)(H,{})]}),(0,P.jsx)(s.e,{baseRoute:"file",clickFun:function(){if(ae([]),re([]),xe.user_data.file_list_pagination_mode===A.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),Me({page_size:$e.page_size,page_num:1})}},input_path_enter:e=>{var t;ae([]),re([]),J({files:[],folders:[]}),!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?q(function(e,t){let i=function(e){let t="\\";for(const i of e)if("/"===i||"\\"===i){t=i;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===i?1:0;for(let n=e.length-1-t;n>=0;n--)if(e[n]===i)return e.substring(0,n+1)}return e}return e.endsWith(i)&&t.startsWith(i)?e.slice(0,-1)+t:e.endsWith(i)||t.startsWith(i)?e+t:e+i+t}((0,_.vX)(),e)):(e=e.replace(0===(t=xe.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),q(e))}}),te&&(0,P.jsxs)("div",{className:"mount-tip-bar",style:{borderLeftColor:te.color},children:[(0,P.jsx)("span",{className:"material-icons",style:{color:te.color},children:"cloud"}),(0,P.jsxs)("span",{children:[E("当前为挂载目录"),":",te.name]}),(0,P.jsx)("span",{className:"mount-driver-tag",children:O.C1.find(e=>e.value===te.driver)?.title??te.driver}),te.readonly&&(0,P.jsx)("span",{className:"mount-readonly-tag",children:E("只读")})]}),xe.user_data.file_list_pagination_mode===A.yM.pagination?(0,P.jsx)(C.$J,{handleContextMenu:Ie,clickBlank:Le,list:V.files}):(0,P.jsx)(C.t$,{handleContextMenu:Ie,file_list:V.files,folder_list:V.folders,clickBlank:Le}),pe&&(0,P.jsx)(Z,{}),ue.open&&(0,P.jsx)(B,{})]})}}}]);
@@ -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" href="{{{logo_favicon}}}"/><script defer="defer" src="main.d9a1e3c9792ebea88038.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" href="{{{logo_favicon}}}"/><script defer="defer" src="main.62150e46f9d1c96fa5bf.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>