filecat 7.22.0 → 7.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/{3355.221b11ae8755cb58412f.js → 3355.7e565ed6c1feb0f27dee.js} +1 -1
- package/build/dist/{4598.48aad39fc631a51c30d3.js → 4598.b58b4b0ec393c55bc639.js} +1 -1
- package/build/dist/{47.423c0f43594850475f8d.js → 47.8ee00dc79aeb57176214.js} +1 -1
- package/build/dist/{6097.3b8a75477b58137301a6.js → 6097.bc46f02339159adef0cf.js} +1 -1
- package/build/dist/{7678.b2889b36fac2b90a9061.js → 7678.2bbf9698415064479bce.js} +1 -1
- package/build/dist/9202.ef8b19ff438c0cb38a91.js +1 -0
- package/build/dist/{9260.2f474cb25f7647cb995a.js → 9260.a27089cb2c89280cd27a.js} +1 -1
- package/build/dist/{9765.15869054c7b8e56ccc76.js → 9765.5882767db41e6316419b.js} +1 -1
- package/build/dist/index.html +1 -1
- package/build/dist/main.5a5517ff22ac8f748a14.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/9202.acca2abe478020a45f13.js +0 -1
- package/build/dist/main.19ecdddaf894b36f1a47.js +0 -2
- /package/build/dist/{main.19ecdddaf894b36f1a47.js.LICENSE.txt → main.5a5517ff22ac8f748a14.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9202],{77481(e,t,s){s.d(t,{S:()=>l,X:()=>a});var n=s(96540),i=s(61443),o=s(74848);function a(e){const[t,s]=n.useState([]),a=(0,n.useRef)(-1),[l,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 u=()=>{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,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let a=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(a=`${t} (${n.label})`)}return(0,o.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,o.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:a}):t},s)})})}),(0,o.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,o.jsx)("tr",{className:n?(l===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(a.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=a.current,s=c;u(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:u,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,o.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}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))})}},19202(e,t,s){s.r(t),s.d(t,{default:()=>xe});var n=s(96540),i=s(75725),o=s(23430),a=s(70447),l=s(85997),r=s(61443),c=s(14284),d=s(53459),u=s(77481),h=s(22022),p=s(82893),m=s(40505),_=s(62042),x=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,h.Bd)(),[s,o]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();o(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");o([t,...s])}}),(0,f.jsx)(l.rA,{icon:"save",title:t("保存"),onClick:async()=>{e.save&&await e.save(s)}})]}),children:(0,f.jsx)(u.X,{headers:e.headers,rows:s.map((n,i)=>{const a=[];for(let t=0;t<e.headers.length;t++)a.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,o([...s])},no_border:!0}));return a.push((0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),o([...s])})(i)}),n[0]&&(0,f.jsx)(l.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,x.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,m.lW)(e),(0,_.SK)(e)}}),n[0]&&e.need_copy&&(0,f.jsx)(l.rA,{icon:"open_in_new",title:t("打开新页面"),onClick:()=>{const e=(0,x.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);window.open(e)}})]})),a}),width:"10rem",onRowDrag:(e,t)=>{o((0,v.TI)(s,e,t))}})})})}var w=s(34843),y=s(78247),b=s(24659);function S(){const{t:e}=(0,h.Bd)(),[t,s]=(0,w.fp)(p.AG.prompt_card),o=(0,b.K)(),g=[e("路由"),e("auth"),e("备注")],[S,C]=(0,w.fp)(p.AG.editorSetting),[k,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)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("api_rt")})," ",(0,f.jsx)(l.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:"信息"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...k])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",k)).code===d.m.Success&&(0,_.SK)(e("保存成功"))}})]}),children:(0,f.jsx)(u.X,{headers:g,rows:k.map((t,s)=>{const n=[(0,f.jsx)(r.Sm,{value:t.router,handleInputChange:e=>{t.router=e,A([...k])},no_border:!0}),(0,f.jsx)(r.l6,{defaultValue:t.needAuth,onChange:e=>{t.needAuth=e,A([...k])},options:o,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e,A([...k])},no_border:!0}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{k.splice(e,1),A([...k])})(s)}),(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async t=>{if(!t.router)return void(0,_.zN)(e("路由不能为空"));const s=await c.XO.get(`jscode/${encodeURIComponent(t.router)}`);C({model:"ace/mode/javascript",open:!0,fileName:t.router,save:async s=>{const n={context:s,router:t.router};(await c.XO.post("jscode/save",n)).code===d.m.Success&&(y.xK.set_value_temp(""),C({open:!1,model:"",fileName:"",save:null}),(0,_.SK)(e("成功")))}}),y.xK.set_value_temp(s.data)})(t)}),t.router&&(0,f.jsx)(l.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,m.lW)((0,x.bi)(window.location.origin+j.m.base_url,t.router)),(0,_.SK)(e("已复制"))}})]})];return n}),width:"10rem",onRowDrag:(e,t)=>{A((0,v.TI)(k,e,t))}})})})}var C=s(23496),k=s(4412);function A(){const{t:e}=(0,h.Bd)(),[t,s]=(0,w.fp)(p.AG.prompt_card),[o,a]=(0,w.fp)(p.AG.router_jump),l=[e("路由"),e("路径"),e("过期时间(s)"),e("备注")],r=[e("路由"),e("文件路径"),"token","user id",e("备注")];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(k.aZ,{position:"right"}),(0,f.jsxs)(i.fI,{children:[(0,f.jsxs)(i.VP,{maxWidth:"50rem",children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:l,getItems:async()=>{const t=await c.XO.get(C.s.setting_customer_router);if(t.code===d.m.Success){if(o?.page_self_router_api_data){for(const s of t.data)s[1]===o?.page_self_router_api_data[1]&&(0,_.N9)(e("已经存在的页面资源路由配置目录设置"));const s={};Object.assign(s,o?.page_self_router_api_data),t.data=[s,...t.data],a({})}return t.data}return[]},save:async e=>{(await c.XO.post(C.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(C.s.setting_customer_workflow_router);return e.code===d.m.Success?e.data:[]},save:async t=>{(await c.XO.post(C.s.setting_customer_workflow_router_save,t)).code===d.m.Success&&(0,_.SK)(e("保存成功"))},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)(S,{})})]})]})}var I=s(74777),N=s(64484),V=s(18840),$=s(6960),X=s(7523);function F(){const{t:e}=(0,h.Bd)(),[,t]=(0,w.fp)(p.AG.prompt_card),[s,i]=(0,n.useState)(""),[o,m]=(0,n.useState)(5610),[x,j]=(0,n.useState)(5710);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){const t=e.data?.sys_env;i((t?.browser_proxy_allow||[]).join("\n")),m(t?.browser_proxy_port_start||5610),j(t?.browser_proxy_port_end||5710)}})()},[]);return(0,f.jsxs)(a.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("网页代理")}),(0,f.jsx)(l.rA,{icon:"info",title:e("信息"),onClick:()=>{t({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:(0,f.jsx)("div",{children:e("wbvpn_tip")})})})}})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:e("确定修改"),clickFun:async()=>{const t=s.split("\n").map(e=>e.trim()).filter(e=>!!e);(await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{browser_proxy_allow:t,browser_proxy_port_start:Number(o)||5610,browser_proxy_port_end:Number(x)||5710}})).code===d.m.Success&&(0,_.SK)(e("修改成功"))}}),children:[(0,f.jsx)("div",{children:e("wbvpn_allow")}),(0,f.jsx)(r.Z2,{style:{minHeight:"5rem",resize:"vertical"},placeholder:e("wbvpn_allow_ph"),value:s,onChange:e=>{i(e.target.value)}}),(0,f.jsx)("div",{children:e("wbvpn_port_range")}),(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.Sm,{placeholder:"5610",value:o,handleInputChange:e=>m(e)}),(0,f.jsx)("span",{style:{padding:"0 6px"},children:"-"}),(0,f.jsx)(r.Sm,{placeholder:"5710",value:x,handleInputChange:e=>j(e)})]})]})}function K(){const[e,t]=(0,n.useState)(""),[s,o]=(0,n.useState)(""),[m,x]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,b]=(0,n.useState)(!1),[S,A]=(0,n.useState)(""),[K,B]=(0,w.fp)(p.AG.prompt_card),[,z]=(0,w.fp)(p.AG.editorSetting),[P,O]=(0,n.useState)(I.aM.close),[T,E]=(0,n.useState)(!1),[M,D]=(0,n.useState)(I.Hb.independent),G=(0,N.T)(),[H,R]=(0,n.useState)(void 0),[W,q]=(0,n.useState)(""),{t:U,i18n:Z}=(0,h.Bd)(),J=[U("独立token:每次登录都签发新的token,同一账号可以在多个设备同时登录,互不影响"),U("复用token:该账号已有未过期的token时直接复用它,不会签发新的"),U("单会话:每次登录签发新的token,并让该账号此前的所有token立即失效")].join("\n"),[L,Q]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:Y}=(0,y.MH)(),{initUserInfo:ee}=(0,n.useContext)(X.F),te=async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){b(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),o(s?.logo||""),x(s?.show_login_user_info),v(s?.http_proxy||""),q(s?.control_env_str||V.CU)}const s=await c.XO.get("token");if(s.code===d.m.Success){const e=s.data;if(!e)return;e.length&&R(e.length),e.mode&&O(e.mode),void 0!==e.persist&&E(e.persist),void 0!==e.session_mode&&D(e.session_mode)}};(0,n.useEffect)(()=>{te()},[]);return(0,f.jsxs)("div",{children:[(0,f.jsx)(k.aZ,{children:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("span",{className:"credits",children:[U("系统运行于"),": ",(0,$.s)(L.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.22.2",null!=L.latest_version&&"7.22.2"!==L.latest_version?` -> ${L.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:U("官网地址"),target:"_blank",children:`filecat ${U("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[U("安装方式")," :",L.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)(a.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:U("通用设置")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{B({open:!0,title:U("信息"),context_div:(0,f.jsx)("div",{children:(0,f.jsx)("div",{children:U("sys_env_setting_tip")})})})},title:U("信息")})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:U("确定修改"),clickFun:async()=>{(await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{web_site_title:e,show_login_user_info:m,http_proxy:j,logo:s}})).code===d.m.Success&&((0,_.SK)(U("修改成功")),ee())}}),rightTopCom:(0,f.jsx)(l.rA,{icon:"tune",title:U("环境控制"),onClick:()=>{y.xK.set_value_temp(W||V.CU),z({model:"ace/mode/yaml",open:!0,fileName:"",not_auto_save:!0,save:async e=>{const t=await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.sys_env,value:{control_env_str:e}});t.code===d.m.Success?(q(e),(0,_.SK)(U("修改成功")),te()):(0,_.zN)(`${t.message??U("保存失败")}`)}})}}),children:[U("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),U("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:U("lclorur"),value:s,handleInputChange:e=>{o(e)}}),U("lgn_usr"),(0,f.jsx)("input",{type:"checkbox",checked:m,onChange:()=>{x(!m)}})]}),(0,f.jsx)(F,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(a.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:U("文件回收站")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{B({open:!0,title:U("信息"),context_div:(0,f.jsx)("div",{children:U("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:U("信息")})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:U("确定修改"),clickFun:async()=>{if(g&&!S)return void(0,_.zN)(U("目录不能为空"));(await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:S,open:g})).code===d.m.Success&&(0,_.SK)(U("修改成功"))}}),children:[(0,f.jsx)(r.Sm,{placeholder:U("目录"),value:S,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{b(e)},options:[{title:U("开启"),value:!0},{title:U("关闭"),value:!1}]})]}),(0,f.jsxs)(a.Zp,{title:U("tk_exp"),rightBottomCom:(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(l.C3,{text:U("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,_.SK)(U("清理完成,重新登录"))}}),(0,f.jsx)(l.C3,{text:U("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=P,e.persist=T,e.session_mode=M,I.aM.length!==e.mode||H||(0,_.zN)(U("秒数不能为空")),e.length=parseInt(H);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,_.SK)(U("保存成功"))}})]}),children:[(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:U("关闭"),selected:P===I.aM.close,onchange:()=>{O(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:U("指定时间"),selected:P===I.aM.length,onchange:()=>{O(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:U("永不过期"),selected:P===I.aM.forver,onchange:()=>{O(I.aM.forver)}})]}),P===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:U("秒"),value:H,handleInputChange:e=>{R(e)}}),(0,f.jsx)("div",{className:"form_row",children:(0,f.jsx)(r.GL,{context:U("持久化"),selected:T,onchange:()=>E(!T)})}),(0,f.jsxs)("div",{className:"form_row",children:[(0,f.jsx)(u.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:I.Hb.independent,context:U("独立token"),selected:M===I.Hb.independent,onchange:()=>D(I.Hb.independent)}),(0,f.jsx)(r.U6,{value:I.Hb.reuse,context:U("复用token"),selected:M===I.Hb.reuse,onchange:()=>D(I.Hb.reuse)}),(0,f.jsx)(r.U6,{value:I.Hb.single,context:U("单会话"),selected:M===I.Hb.single,onchange:()=>D(I.Hb.single)})]}),(0,f.jsx)(l.rA,{icon:"info",title:U("登录会话"),onClick:()=>G(J)})]})]})]})]})})]})}var B=s(92350),z=s(69675),P=s(32361);const O=[{key:"second",min:0,max:59,label:"秒"},{key:"minute",min:0,max:59,label:"分"},{key:"hour",min:0,max:23,label:"时"},{key:"day",min:1,max:31,label:"日"},{key:"month",min:1,max:12,label:"月"},{key:"week",min:0,max:7,label:"星期"}];function T(e){switch(e.mode){case"step":return`*/${e.step??1}`;case"range":return`${e.from??0}-${e.to??0}`;case"list":return(e.values??[]).join(",");default:return"*"}}function E(e){return[T(e.second),T(e.minute),T(e.hour),T(e.day),T(e.month),T(e.week)].join(" ")}function M(e,t,s){const n=(e??"").trim();if(!n)return null;if("*"===n)return{mode:"every"};if(n.startsWith("*/")){const e=Number(n.slice(2));return!Number.isInteger(e)||e<=0?null:{mode:"step",step:e}}if(n.includes("-")&&!n.includes(",")){const[e,i]=n.split("-").map(Number);return Number.isInteger(e)&&Number.isInteger(i)?e<t||i>s||e>i?null:{mode:"range",from:e,to:i}:null}const i=n.split(","),o=[];for(const e of i){const n=Number(e.trim());if(!Number.isInteger(n)||n<t||n>s)return null;o.push(n)}return 0===o.length?null:{mode:"list",values:o}}function D(e){const t=(e??"").trim().split(/\s+/);if(6!==t.length)return null;const s={};for(let e=0;e<6;e++){const n=O[e],i=M(t[e],n.min,n.max);if(!i)return null;s[n.key]=i}return s}function G(e){return e<10?`0${e}`:`${e}`}function H(e,t,s){switch(e.mode){case"step":return`每 ${e.step} ${t}`;case"range":return`${e.from} 到 ${e.to} ${t}`;case"list":return`${(e.values??[]).slice().sort((e,t)=>e-t).join("、")} ${t}`;default:return null}}function R(e){const{second:t,minute:s,hour:n,day:i,month:o,week:a}=e,l=(e,t)=>"list"===e.mode&&1===(e.values??[]).length&&e.values[0]===t,r=[];if("list"===n.mode&&"list"===s.mode&&l(t,0)){const e=(n.values??[]).slice().sort((e,t)=>e-t),t=(s.values??[]).slice().sort((e,t)=>e-t);e.length===t.length&&e.length>1&&t.length>1?r.push(e.map((e,s)=>`${G(e)}:${G(t[s])}`).join("、")):1===e.length&&1===t.length?r.push(`${G(e[0])}:${G(t[0])}`):r.push(`${e.map(G).join("、")} 时 ${t.join("、")} 分`)}else if("list"===n.mode&&"step"===s.mode&&l(t,0))r.push(`${(n.values??[]).map(G).join("、")} 时内每 ${s.step} 分钟`);else if("every"===n.mode&&"list"===s.mode&&l(t,0))r.push(`每小时的 ${(s.values??[]).join("、")} 分`);else if("every"===n.mode&&"step"===s.mode&&l(t,0))r.push(`每 ${s.step} 分钟`);else if("every"===n.mode&&"every"===s.mode&&l(t,0))r.push("每分钟");else if("every"===n.mode&&"every"===s.mode&&"step"===t.mode)r.push(`每 ${t.step} 秒`);else if("every"===n.mode&&"every"===s.mode&&"every"===t.mode)r.push("每秒");else if("every"===n.mode&&"every"===s.mode&&"list"===t.mode)r.push(`每分钟的第 ${(t.values??[]).join("、")} 秒`);else{const e=[],i=H(n,"时"),o=H(s,"分"),a=l(t,0)?null:H(t,"秒");i&&e.push(i),o&&e.push(o),a&&e.push(a),e.length>0&&r.push(e.join(" "))}const c="list"===i.mode&&1===(i.values??[]).length?i.values[0]:null,d="list"===o.mode&&1===(o.values??[]).length?o.values[0]:null,u="list"===a.mode&&1===(a.values??[]).length?a.values[0]:null;let h="";if(null!==d&&null!==c)h=`每年 ${d} 月 ${c} 号`;else if(null!==d)h=`每年 ${d} 月`;else if(null!==c)h=`每月 ${c} 号`;else if(null!==u)h=`每${["周日","周一","周二","周三","周四","周五","周六","周日"][u]??`星期 ${u}`}`;else{const e=[];"every"!==o.mode&&e.push(H(o,"月")),"every"!==i.mode&&e.push(H(i,"号")),"every"!==a.mode&&e.push(`星期 ${H(a,"")}`),e.length&&(h=e.join(" "))}h||(h="每天");const p=r.join(",");return/^(每|每天)/.test(p)?`${p}${"每天"===h?"":","+h} 执行`:`${h} ${p} 执行`}const W=[{label:"任意 (*)",value:"every"},{label:"每隔 (*/n)",value:"step"},{label:"区间 (a-b)",value:"range"},{label:"指定 (a,b)",value:"list"}];function q(e,t,s=!1){const n=[];for(let i=e;i<=t;i++)n.push({label:s?String(i).padStart(2,"0"):String(i),value:i});return n}const U=({label:e,field:t,min:s,max:i,pad:o,week_label:a,onChange:l})=>{const c=(0,n.useMemo)(()=>q(s,i,o),[s,i,o]),d=(0,n.useMemo)(()=>{if(!a)return c;const e=["周日","周一","周二","周三","周四","周五","周六","周日"];return c.map(t=>({value:t.value,label:`${t.value} (${e[t.value]})`}))},[c,a]);return(0,f.jsxs)("div",{className:"cron-field",children:[(0,f.jsx)("span",{className:"cron-field__label",children:e}),(0,f.jsx)(r.l6,{value:t.mode,onChange:e=>{l("every"===e?{mode:"every"}:"step"===e?{mode:"step",step:t.step??1}:"range"===e?{mode:"range",from:t.from??s,to:t.to??i}:{mode:"list",values:t.values??[s]})},options:W,no_border:!0,width:"7.5rem"}),"step"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param",children:[(0,f.jsx)("span",{children:"每"}),(0,f.jsx)(r.l6,{value:t.step??1,onChange:e=>l({mode:"step",step:e}),options:q(1,i),no_border:!0,width:"4.5rem"}),(0,f.jsx)("span",{children:e})]}),"range"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param",children:[(0,f.jsx)(r.l6,{value:t.from??s,onChange:e=>l({mode:"range",from:e,to:t.to??i}),options:d,no_border:!0,width:"6.5rem"}),(0,f.jsx)("span",{children:"到"}),(0,f.jsx)(r.l6,{value:t.to??i,onChange:e=>l({mode:"range",from:t.from??s,to:e}),options:d,no_border:!0,width:"6.5rem"})]}),"list"===t.mode&&(0,f.jsxs)("div",{className:"cron-field__param cron-field__param--list",children:[(t.values??[]).map((e,s)=>(0,f.jsxs)("span",{className:"cron-tag",children:[(0,f.jsx)(r.l6,{value:e,onChange:e=>((e,s)=>{const n=[...t.values??[]];n[e]=s,l({mode:"list",values:n})})(s,e),options:d,no_border:!0,width:"6.5rem"}),(0,f.jsx)("i",{className:"material-icons cron-tag__del",onClick:()=>(e=>{const s=(t.values??[]).filter((t,s)=>s!==e);l(s.length?{mode:"list",values:s}:{mode:"every"})})(s),children:"close"})]},s)),(0,f.jsx)("i",{className:"material-icons cron-tag__add",onClick:()=>{const e=[...t.values??[]],n=new Set(e);let o=s;for(;n.has(o)&&o<i;)o++;l({mode:"list",values:[...e,o]})},children:"add"})]})]})};const Z=[{label:"每分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},second:{mode:"list",values:[0]}})},{label:"每 5 分钟",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"step",step:5},second:{mode:"list",values:[0]}})},{label:"每小时",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每天 8 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[8]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]}})},{label:"每周一 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},week:{mode:"list",values:[1]}})},{label:"每月 1 号 0 点",make:()=>({second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"},hour:{mode:"list",values:[0]},minute:{mode:"list",values:[0]},second:{mode:"list",values:[0]},day:{mode:"list",values:[1]}})}],J=({value:e,onChange:t,no_border:s})=>{const[i,o]=(0,n.useState)(!1),a=(0,n.useRef)(null),l=(0,n.useRef)(null),r=(0,n.useMemo)(()=>D(e??"")??{second:{mode:"every"},minute:{mode:"every"},hour:{mode:"every"},day:{mode:"every"},month:{mode:"every"},week:{mode:"every"}},[e]),c=!!e&&!D(e??""),d=(0,P.r)({active:i,trigger_ref:a,floating_ref:l,width:384,max_height:26});(0,z.$)(i,[a,l],()=>o(!1));const u=e=>{t(E(e))};return(0,f.jsxs)("div",{className:"cron-input "+(i?"cron-input--open":""),children:[(0,f.jsxs)("div",{ref:a,className:"cron-input__display "+(s?"cron-input__display--no-border":""),title:c?"表达式格式不正确":`${e||""} ${R(r)}`.trim(),onClick:()=>o(!i),children:[(0,f.jsx)("span",{className:"cron-input__expr "+(c?"cron-input__expr--invalid":""),children:e||"(未设置)"}),!s&&(0,f.jsx)("span",{className:"cron-input__desc",children:c?"表达式格式不正确":R(r)}),(0,f.jsx)("i",{className:"material-icons cron-input__arrow",children:"arrow_drop_down"})]}),i&&(0,f.jsxs)("div",{ref:l,className:"cron-editor",style:{left:d.left,top:d.top,...d.css_vars,visibility:d.ready?"visible":"hidden"},children:[(0,f.jsxs)("div",{className:"cron-editor__scroll",children:[(0,f.jsxs)("div",{className:"cron-editor__row",children:[(0,f.jsx)("span",{className:"cron-editor__title",children:"常用"}),(0,f.jsx)("div",{className:"cron-editor__presets",children:Z.map(e=>(0,f.jsx)("button",{className:"cron-preset",onClick:()=>u(e.make()),children:e.label},e.label))})]}),(0,f.jsx)("div",{className:"cron-editor__fields",children:O.map(e=>(0,f.jsx)(U,{label:e.label,field:r[e.key],min:e.min,max:e.max,pad:"day"!==e.key&&"month"!==e.key&&"week"!==e.key,week_label:"week"===e.key,onChange:t=>{return s=e.key,n=t,void u({...r,[s]:n});var s,n}},e.key))})]}),(0,f.jsxs)("div",{className:"cron-editor__footer",children:[(0,f.jsx)("span",{className:"cron-editor__preview",children:E(r)}),(0,f.jsx)("button",{className:"cron-editor__done",onClick:()=>o(!1),children:"完成"})]})]})]})};function L(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:o}=(0,n.useContext)(X.F),[m,x]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[S,C]=(0,w.fp)(p.AG.prompt_card),[,k]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[N,V]=(0,n.useState)([]),[$,F]=(0,n.useState)([]),[K,z]=(0,n.useState)([]),[P,O]=(0,n.useState)(""),[T,E]=(0,n.useState)([]),M=(0,b.K)(),D=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],H=[e("编号"),e("路径"),e("是否开启"),e("备注")],R=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("cron表达式"),e("用户id"),e("备注")],W=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("big_res"),e("big_sz"),e("大文件并发数量"),e("big_ck"),e("备注")],q=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:U}=(0,y.MH)(),Z=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&&z(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&&O(t.data),Z(),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&&V(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&E(i.data??[])})()},[]);const Q=(0,B.Q)(),Y=async()=>{await c.XO.post("plugin/list/save",T)};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("up_conc")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...N,{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)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(const e of N)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)(N,e=>e.index??0);(await c.XO.post("dir_upload_max_num/save",N)).code===d.m.Success&&((0,_.SK)(e("保存成功")),o())}})]}),children:(0,f.jsx)(u.X,{headers:W,rows:N.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,V([...N])},options:M,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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),V([...N])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{V((0,v.TI)(N,e,t))}})})}),(0,f.jsx)(i.J,{widthPer:100,maxWidth:"100rem",children:(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{z([...K,{open:!1}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",K)).code===d.m.Success&&((0,_.SK)("ok"),L())}})]}),children:(0,f.jsx)(u.X,{headers:R,rows:K.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,z([...K])},options:M,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,z([...K])},options:M,no_border:!0}),(0,f.jsx)(J,{value:t.cron_str,onChange:e=>{t.cron_str=e,z([...K])},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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{K.splice(e,1),z([...K])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{z((0,v.TI)(K,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)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"list",title:e("查看"),onClick:async()=>{const t=await c.XO.get("env/process/view");t.code===d.m.Success?C({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)(l.rA,{icon:"edit",title:e("编辑"),onClick:async()=>{const t=await c.XO.get("env/process/get");t.code===d.m.Success?(y.xK.set_value_temp(t.data??""),k({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{await c.XO.post("env/process/save",{text:e})}})):(0,_.zN)(e("获取失败"))}}),(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{F([...$,{path:"",note:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:$})).code===d.m.Success&&((0,_.SK)(e("保存成功")),Z(),s())}})]}),children:(0,f.jsx)(u.X,{headers:H,rows:$.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([...$])},options:M,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{$.splice(e,1),F([...$])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{F((0,v.TI)($,e,t))}})}),(0,f.jsx)(a.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(l.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:P})).code===d.m.Success&&((0,_.SK)(e("保存成功")),o())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:P,handleInputChange:e=>{O(e)}})}),(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{E([...T,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:Y})]}),children:(0,f.jsx)(u.X,{headers:q,rows:T.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,E([...T])},options:M,no_border:!0}),(0,f.jsx)(l.mu,{icon:"edit",value:t.params,save:async e=>{t.params=e,await Y()},title:""}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{T.splice(e,1),E([...T])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{E((0,v.TI)(T,e,t))}})})]})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"50rem",children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,_.SK)(e("保存成功")),o())}})]}),children:(0,f.jsx)(u.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)(l.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)(a.uF,{title:e("外部软件"),rightTopCom:(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,_.SK)(e("保存成功")),s())}}),children:(0,f.jsx)(u.X,{headers:D,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(a.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)(l.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function Q(e){const{t,i18n:s}=(0,h.Bd)(),[i,a]=(0,w.fp)(p.AG.user_base_info),l=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:o.oV.user_manage},{title:t("角色管理"),permission:o.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:o.oV.all_sys},{title:t("系统进程关闭"),permission:o.oV.sys_process_close},{title:t("dc_ctdl"),permission:o.oV.docker_container_update},{title:t("dc_idl"),permission:o.oV.docker_images_delete},{title:t("systemd管理"),permission:o.oV.systemd},{title:t("防火墙管理"),permission:o.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:o.oV.vir_net},{title:t("内网穿透"),permission:o.oV.tcp_proxy},{title:"ddns",permission:o.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:o.oV.ai_agent_setting},{title:t("ai_page"),permission:o.oV.ai_agent_page},{title:t("sw_mdl"),permission:o.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("log_del"),permission:o.oV.filecat_file_delete_cut_rename},{title:t("log_wr"),permission:o.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:o.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:o.oV.recycle_file_save},{title:t("文件分享"),permission:o.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:o.oV.sys_setting_page},{title:t("tk_time"),permission:o.oV.token_update},{title:t("修改密码"),permission:o.oV.update_password},{title:t("磁盘挂载"),permission:o.oV.sys_disk_mount},{title:t("通用设置"),permission:o.oV.sys_env_setting_key},{title:t("md_set"),permission:o.oV.md_editor_setting},{title:t("目录挂载"),permission:o.oV.file_mount}]},{title:t("系统环境设置"),list:[{title:t("sys_env"),permission:o.oV.sys_env_page},{title:t("up_lim"),permission:o.oV.dir_upload_max_num},{title:t("path_md"),permission:o.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:o.oV.pty_cmd_update},{title:"workflow job",permission:o.oV.workflow_job},{title:t("path_up"),permission:o.oV.sys_protection_dir},{title:t("外部软件路径"),permission:o.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:o.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:o.oV.auth_router_page},{title:t("wf_api"),permission:o.oV.workflow_api},{title:t("自定义资源路由"),permission:o.oV.code_resource},{title:t("api_rt"),permission:o.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:o.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:o.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:o.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:o.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:o.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:o.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:o.oV.ssh_proxy},{title:t("http代理"),permission:o.oV.http_proxy},{title:t("pxy_off"),permission:o.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:o.oV.browser_proxy},{title:t("浏览器代理编辑"),permission:o.oV.browser_proxy_edit},{title:t("rdp代理"),permission:o.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("wf_run"),permission:o.oV.workflow_exe},{title:t("wf_user"),permission:o.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:o.oV.wol_proxy},{title:t("端口扫描"),permission:o.oV.port_scan},{title:t("rtsp播放器"),permission:o.oV.rtsp_proxy},{title:t("ssh_sv"),permission:o.oV.crypto_ssh_file},{title:t("cmd_rst"),permission:o.oV.shell_cmd_filecat_restart},{title:t("cmd_upg"),permission:o.oV.shell_cmd_filecat_upgrade},{title:t("cmd_dwn"),permission:o.oV.shell_cmd_filecat_kill_self},{title:t("cmd_ai"),permission:o.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:l.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 Y=new Map;function ee(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:m}=(0,n.useContext)(X.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[y,b]=(0,n.useState)([]),[S,C]=(0,w.fp)(p.AG.prompt_card),[k,A]=(0,n.useState)(!1),[I,N]=(0,n.useState)(!1),[V,$]=(0,w.fp)(p.AG.confirm),[F,K]=(0,n.useState)(""),[z,P]=(0,n.useState)(""),[O,T]=(0,n.useState)(""),[E,M]=(0,n.useState)([]),[D,G]=(0,n.useState)([]),[H,R]=(0,n.useState)([]),[W,q]=(0,n.useState)(""),[U,Z]=(0,n.useState)(""),[J,L]=(0,n.useState)("en"),[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)([]),[ie,oe]=(0,n.useState)(""),[ae,le]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,ue]=(0,n.useState)(""),[he,pe]=(0,n.useState)({}),me=(0,B.o)(),[_e,xe]=(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);b(e)}else b(t)}const t=await c.wm.get("all_roles");if(t.code===d.m.Success){xe(t.data),Y.clear();for(const e of t.data)Y.set(e.role_id,e)}},we=e=>{K(e?.username??""),P(e?.password??""),T(e?.cwd??""),M(e?.access_dirs??[]),G(e?.not_access_dirs??[]),R(e?.only_read_dirs??[]),q(e?.access_cmd??""),Z(e?.not_access_cmd??""),L(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),oe(e?.note??""),le(e?.is_root??!1),ce(e?.id??""),e?.bind_role_id?ye(e.bind_role_id,e.auth_list??[]):(ue(""),pe({}))};(0,n.useEffect)(()=>{ge()},[]);const ye=(e,t=[])=>{if(!e)return ue(""),void pe({});const s=Y.get(e);if(s){if(s.cwd&&T(s.cwd),s.access_dirs&&s.access_dirs.length>0&&M(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&G(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&R(s.only_read_dirs),s.access_cmd&&q(s.access_cmd),s.not_access_cmd&&Z(s.not_access_cmd),s.language&&L(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))}ue(e),pe(s)}},be=()=>{if(!F)return void(0,_.zN)("username not empty");if((0,x.CB)(F))return void(0,_.zN)("username not empty char");if(!O)return void(0,_.zN)("cwd not empty");const e=new o.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=F,e.password=z,e.not_access_dirs=D,e.only_read_dirs=H,e.cwd=O,e.note=ie,e.access_cmd=W,e.not_access_cmd=U,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)(a.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("用户")})}),rightTopCom:(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)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{A(!0),N(!1),we(void 0)}})]}),children:(0,f.jsx)(u.X,{headers:fe,rows:y.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.id}),(0,f.jsx)(a.xP,{children:t.username}),(0,f.jsx)(a.xP,{children:t.cwd}),(0,f.jsx)(a.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),N(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{$({open:!0,title:e("确定删除吗"),handle:async()=>{const s=new o.E0;s.username=t,(await c.wm.post("delete_user",s)).code===d.m.Success&&((0,_.SK)(e("删除完成")),ge(),$({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(k||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(a.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(k?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),N(!1),we(void 0)}}),k&&(0,f.jsx)(l.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!z)return void(0,_.zN)("password not empty");if((0,x.CB)(z))return void(0,_.zN)("username not empty char");const t=be(),s=await c.wm.post("create_user",t);ge(),s.code===d.m.Success&&((0,_.SK)(e("创建完成")),ge(),A(!1),N(!1),we(void 0))}}),I&&(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=be();if(!t)return;t.id=re;(await c.wm.post("save_user",t)).code===d.m.Success&&((0,_.SK)(e("保存完成")),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:F,handleInputChange:e=>K(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:z,handleInputChange:e=>P(e)}),(0,f.jsxs)("label",{children:[!he?.access_dirs?.length&&(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{M([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==he.cwd&&void 0!==he.cwd,value:O,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!==he?.access_dirs?.length&&void 0!==he?.access_dirs?.length,value:t,handleInputChange:e=>{E[s]=e,M([...E])}})}),0===he?.access_dirs?.length||void 0===he?.access_dirs?.length&&(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{E.splice(s,1),M([...E])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!he?.not_access_dirs?.length&&(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{G([...D,""])},title:e("添加")}),e("禁止目录范围")]}),(D??[]).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!==he?.not_access_dirs?.length&&void 0!==he?.not_access_dirs?.length,value:t,handleInputChange:e=>{D[s]=e,G([...D])}})}),0===he?.not_access_dirs?.length||void 0===he?.not_access_dirs?.length&&(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{D.splice(s,1),G([...D])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!he?.only_read_dirs?.length&&(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{R([...H,""])},title:e("添加")}),e("只读目录范围")]}),(H??[]).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!==he?.only_read_dirs?.length&&void 0!==he?.only_read_dirs?.length,value:t,handleInputChange:e=>{H[s]=e,R([...H])}})}),0===he?.only_read_dirs?.length||void 0===he?.only_read_dirs?.length&&(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{H.splice(s,1),R([...H])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==he.access_cmd&&void 0!==he.access_cmd,value:W,placeholder:"use blank split",handleInputChange:e=>q(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==he.not_access_cmd&&void 0!==he.not_access_cmd,value:U,placeholder:"use blank split",handleInputChange:e=>Z(e)}),!ae&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("label",{children:e("角色")}),(0,f.jsx)(r.l6,{value:de,onChange:e=>{ye(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:""!==he.language&&void 0!==he.language,value:J,onChange:e=>{L(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:""!==he.theme&&void 0!==he.theme,value:ee,onChange:e=>{te(e)},options:me}),(0,f.jsx)(Q,{is_disable:e=>{if(!0===ae)return!0;if(de){const t=Y.get(de);if(t)return(t.auth_list??[]).includes(e)}return!1},is_selected:(e,t)=>!t&&!0===ae||void 0!==se?.find(t=>t===e),select_auth:e=>{se?se.includes(e)?((0,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=>oe(e)})]})})})]})}function te(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s}=(0,n.useContext)(X.F),[m,x]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[y,b]=(0,n.useState)(!1),[S,C]=(0,n.useState)(!1),[k,A]=(0,w.fp)(p.AG.confirm),[I,N]=(0,n.useState)(""),[V,$]=(0,n.useState)(""),[F,K]=(0,n.useState)([]),[z,P]=(0,n.useState)([]),[O,T]=(0,n.useState)([]),[E,M]=(0,n.useState)(""),[D,G]=(0,n.useState)(""),[H,R]=(0,n.useState)(""),[W,q]=(0,n.useState)(""),[U,Z]=(0,n.useState)([]),[J,L]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,B.o)(),se=[e("角色id"),e("角色名"),e("备注")],ne=async()=>{const e=await c.wm.get("all_roles");e.code===d.m.Success&&x(e.data)},ie=e=>{N(e?.role_name??""),$(e?.cwd??""),K(e?.access_dirs??[]),P(e?.not_access_dirs??[]),T(e?.only_read_dirs??[]),M(e?.access_cmd??""),G(e?.not_access_cmd??""),R(e?.language??""),q(e?.theme??""),Z(e?.auth_list??[]),L(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const oe=()=>{if(!I)return void(0,_.zN)("role_name not empty");const e=new o.E0;return e.language=H,e.theme=W,e.access_dirs=F,e.role_name=I,e.not_access_dirs=z,e.only_read_dirs=O,e.cwd=V,e.access_cmd=E,e.not_access_cmd=D,e.auth_list=U,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)(a.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("角色")})}),rightTopCom:(0,f.jsx)("div",{children:(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{b(!0),C(!1),ie(void 0)}})}),children:(0,f.jsx)(u.X,{headers:se,rows:m.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(a.xP,{children:t.role_name}),(0,f.jsx)(a.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{b(!1),C(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const s=new o.E0;s.role_id=t,(await c.wm.post("delete_role",s)).code===d.m.Success&&((0,_.SK)(e("删除完成")),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"40rem",children:(y||S)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(a.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e(""+(y?"添加":"编辑"))})," "]}),rightBottomCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"cancel",title:e("取消"),onClick:()=>{b(!1),C(!1),ie(void 0)}}),y&&(0,f.jsx)(l.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const t=oe();if(!t)return;const s=await c.wm.post("create_role",t);ne(),s.code===d.m.Success&&((0,_.SK)(e("创建完成")),ne(),b(!1),C(!1),ie(void 0))}}),S&&(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=oe();if(!t)return;t.role_id=J;(await c.wm.post("save_role",t)).code===d.m.Success&&((0,_.SK)(e("保存完成")),ne())}})]}),children:[(0,f.jsx)("label",{children:e("角色名")}),(0,f.jsx)(r.Sm,{value:I,handleInputChange:e=>N(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)(l.rA,{icon:"add",onClick:()=>{K([...F,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:V,handleInputChange:e=>$(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,K([...F])}})}),(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{F.splice(t,1),K([...F])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{P([...z,""])},title:"添加"}),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,{value:t,handleInputChange:e=>{z[s]=e,P([...z])}})}),(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{z.splice(s,1),P([...z])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(l.rA,{icon:"add",onClick:()=>{T([...O,""])},title:e("添加")}),e("只读目录范围")]}),(O??[]).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=>{O[t]=e,T([...O])}})}),(0,f.jsx)(l.rA,{icon:"delete",onClick:()=>{O.splice(t,1),T([...O])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:E,placeholder:"use blank split",handleInputChange:e=>M(e)}),(0,f.jsx)("label",{children:e("禁止执行的命令")}),(0,f.jsx)(r.Sm,{value:D,placeholder:"use blank split",handleInputChange:e=>G(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:H,onChange:e=>{R(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:W,onChange:e=>{q(e)},options:te}),(0,f.jsx)(Q,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==U?.find(t=>t===e),select_auth:e=>{U?(U.find(t=>t==e)?(0,v.I)(U,t=>t===e):U.push(e),Z([...U])):Z([e])}})]})})})]})}var se=s(93245);function ne(e){const{t}=(0,h.Bd)(),[s,i]=(0,n.useState)((e.children_list??[]).map(e=>({path:e.path,note:e.note}))),o=[t("编号"),t("目录"),t("备注")],c=()=>{i([...s,{path:"",note:""}])};(0,n.useEffect)(()=>{s?.length||c()});return(0,f.jsx)(a.uF,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:t("sub_dir")})}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:t("添加"),onClick:c}),(0,f.jsx)(l.rA,{icon:"save",title:t("保存"),onClick:()=>{e.on_confirm(s.filter(e=>e.path))}}),(0,f.jsx)(l.rA,{icon:"close",title:t("取消"),onClick:e.on_cancel})]}),children:(0,f.jsx)(u.X,{headers:o,rows:s.map((e,n)=>[(0,f.jsx)("span",{children:n}),(0,f.jsx)(r.Sm,{value:e.path,handleInputChange:t=>{e.path=t},no_border:!0}),(0,f.jsx)(r.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,f.jsx)("div",{children:(0,f.jsx)(l.rA,{icon:"delete",title:t("删除"),onClick:()=>{i(s.filter((e,t)=>t!==n))}})})]),width:"10rem"})})}function ie(){const{t:e,i18n:t}=(0,h.Bd)(),{initUserInfo:s,reloadUserInfo:m}=(0,n.useContext)(X.F),[x,j]=(0,n.useState)([]),[g,y]=(0,w.fp)(p.AG.prompt_card),[S,k]=(0,n.useState)([]),[A,N]=(0,n.useState)([]),[V,$]=(0,n.useState)([]),[F,K]=(0,w.fp)(p.AG.user_base_info),z=(0,b.K)(),P=(0,B.o)(),O=[e("编号"),e("路径"),e("是否默认"),e("备注"),e("sub_dir")],T=[e("编号"),e("路径"),e("备注")],E=[e("编号"),e("命令"),e("父编号"),e("备注")],M=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[D,G]=(0,n.useState)(""),[H,R]=(0,n.useState)(""),[W,q]=(0,n.useState)(""),[U,Z]=(0,n.useState)(!1),[J,L]=(0,n.useState)(""),[Q,Y]=(0,n.useState)(""),[ee,te]=(0,n.useState)(""),[ie,oe]=(0,n.useState)(!1),[ae,le]=(0,n.useState)(""),[re,ce]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("filesSetting");e.code===d.m.Success&&(j(e.data.dirs),N(e.data.quick_cmd),$(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&k(t.data??[])})(),L(F?.user_data?.language),Y(F?.user_data?.theme),te(F?.user_data?.upload_file_ignore);const e=F?.user_data?.editor_auto_save;oe(!!e?.enable),le(null!=e?.interval?String(e.interval):""),ce(e?.editors??[])},[]);const de=(0,B.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)(a.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(l.C3,{text:e("确定修改"),clickFun:async()=>{if(!D||!H)return void(0,_.zN)(e("账号密码不能为空"));if(H!==W)return void(0,_.zN)(e("两次密码不一样"));const t=new o.tl;t.username=D,t.password=H,t.confirm_password=W,t.user_id=F.user_data.id;(await c.wm.post("updatePassword",t)).code===d.m.Success&&(0,_.SK)(e("修改成功"))}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:D,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{R(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{q(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(a.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(l.C3,{text:e("确定修改"),clickFun:async()=>{(await c.XO.post(C.s.setting_sys_option_status_save,{type:I.Mu.private_sys_env,value:{language:J,theme:Q,upload_file_ignore:ee}})).code===d.m.Success&&((0,_.SK)(e("修改成功")),s())}}),children:[e("语言"),(0,f.jsx)(r.l6,{value:J,onChange:e=>{L(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:Q,onChange:e=>{Y(e)},options:P}),(0,f.jsx)(r.Sm,{value:ee,handleInputChange:e=>{te(e)},placeholderOut:e("拖拽文件上传忽略列表"),placeholder:"node_modules *.js",no_border:!0})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(a.Zp,{title:e("编辑器自动保存"),rightBottomCom:(0,f.jsx)(l.C3,{text:e("确定修改"),clickFun:async()=>{const t=parseInt(String(ae),10);if(isNaN(t)||t<1)return void(0,_.zN)(e("请输入不小于 1 的整数(秒)"));(await c.wm.post(C.s.user_save_private_attr,{is_editor_auto_save:!0,editor_auto_save:{enable:ie,interval:t,editors:re}})).code===d.m.Success&&((0,_.SK)(e("修改成功")),s())}}),children:[(0,f.jsx)(r.BC,{label:e("开启"),children:(0,f.jsx)(r.l6,{value:ie,onChange:e=>{oe(e)},options:z,no_border:!0})}),(0,f.jsx)(r.BC,{label:e("自动保存间隔(秒)"),children:(0,f.jsx)(r.Sm,{type:"number",value:ae,handleInputChange:e=>{le(e)},placeholder:"30",no_border:!0})}),(0,f.jsx)("h3",{children:e("编辑器")}),se.d.map(t=>(0,f.jsxs)("div",{children:[(0,f.jsx)("input",{type:"checkbox",checked:re.includes(t.id),onChange:e=>{const s=e.target.checked;ce(s?[...re,t.id]:re.filter(e=>e!==t.id))}}),e(t.label)]},t.id))]})})]}),(0,f.jsxs)(i.VP,{children:[(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{de("文件夹路径")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...x,{note:"",default:!1,path:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<x.length;e++)x[e].index=e;(await c.XO.post("filesSetting/save",{dirs:x})).code===d.m.Success&&((0,_.SK)(e("保存成功")),m(),s())}})]}),children:(0,f.jsx)(u.X,{headers:O,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.default,onChange:e=>{((e,t,s)=>{const n=[];for(let e=0;e<x.length;e++)x[e].default=e===s&&t,n.push(x[e]);j(n)})(0,e,s)},options:z,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)("span",{children:t.children?.length??0}),0!==s&&(0,f.jsx)(l.rA,{icon:"folder_open",title:e("sub_dir"),onClick:()=>(e=>{y({open:!0,main_context_div:(0,f.jsx)(ne,{children_list:e.children,on_cancel:()=>{y({open:!1})},on_confirm:t=>{e.children=t,j([...x]),y({open:!1})}})})})(t)})]}),(0,f.jsx)("div",{children:0!==s&&(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{x.splice(e,1),j([...x])})(s)})})];return n}),width:"10rem",onRowDrag:(e,t)=>{0!==e&&0!==t&&j((0,v.TI)(x,e,t))}})}),(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{de("保护目录")},title:e("信息")})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...S,{path:"",note:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",S)).code===d.m.Success&&((0,_.SK)(e("保存成功")),m())}})]}),children:(0,f.jsx)(u.X,{headers:T,rows:S.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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{S.splice(e,1),k([...S])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{k((0,v.TI)(S,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{de("目录快捷命令")},title:"info"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...A,{cmd:"",note:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:A})).code===d.m.Success&&((0,_.SK)(e("保存成功")),s())}})]}),children:(0,f.jsx)(u.X,{headers:E,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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{A.splice(e,1),N([...A])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{N((0,v.TI)(A,e,t))}})}),(0,f.jsx)(a.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(l.rA,{icon:"info",onClick:()=>{de("文件快捷命令")},title:"info"})]}),rightTopCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...V,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:V})).code===d.m.Success&&((0,_.SK)(e("保存成功")),s())}})]}),children:(0,f.jsx)(u.X,{headers:M,rows:V.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)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),$([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{$((0,v.TI)(V,e,t))}})})]})]})]})})}var oe=s(45907),ae=s(17903);const le=["password","private_key","secret_key"],re="webdav",ce="@authorize",de="@tcp_account",ue={smb:[{keys:["server","username","password"],on_next:"load_shares"},{keys:["share"]}],baidu:[{keys:["app_id","app_key","secret_key"],on_next:"save_app"},{keys:[ce]}],tcp_proxy:[{keys:["client_num_id"],on_next:"save_app"},{keys:[de]}]};function he(){const{t:e}=(0,h.Bd)(),t=(0,oe.y)(),[,s]=(0,w.fp)(p.AG.prompt_card),[i,o]=(0,n.useState)([]),[d,m]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[y,b]=(0,n.useState)(re),[S,C]=(0,n.useState)(""),[k,A]=(0,n.useState)({}),[I,N]=(0,n.useState)(1),[V,$]=(0,n.useState)([]),[X,F]=(0,n.useState)({}),[K,B]=(0,n.useState)("oob"),[z,P]=(0,n.useState)(""),[O,T]=(0,n.useState)(null),[E,M]=(0,n.useState)(!0),D=async()=>{try{const[e,t]=await Promise.all([c.I2.post("credential/list",{}),c.I2.post("credential/meta",{})]);o(Array.isArray(e?.data)?e.data:[]),m(Array.isArray(t?.data)?t.data:[])}catch(e){}};(0,n.useEffect)(()=>{D()},[]);const G=d.find(e=>e.type===y)?.fields??[],H=ue[y],R=H?.length??1,W=()=>{j(!1),g(""),b(re),C(""),A({}),N(1),$([]),P(""),M(!0)},q=async e=>{const t=Array.from(new Set(e.map(e=>e.options_source).filter(e=>Boolean(e)))),s={};for(const e of t){const t=await c.I2.post("credential/options",{source:e});s[e]=(t?.data??[]).map(e=>({label:e.label,value:e.value}))}F(s)},U=t=>{if(!S.trim())return e("请填写备注");for(const s of G){if(!1===t.includes(s.key))continue;const n=String(k[s.key]??"").trim()||v&&le.includes(s.key);if(s.required&&!n)return e(s.label)}},Z=async()=>{try{const e=await c.I2.post("baidu/authorize_url",{id:v,mode:K});e?.data&&window.open(e.data,"_blank","noopener,noreferrer")}catch(e){}},J=async()=>{if(z.trim())try{const t=await c.I2.post("baidu/exchange",{id:v,code:z.trim(),mode:K});(0,_.SK)(`${e("授权成功")}:${t?.data?.baidu_name??""}`),P(""),await D()}catch(e){}else(0,_.zN)(e("请填写授权码"))},L=async()=>{if(O)if(O.account_name.trim())try{await c.I2.post("credential/account_save",{credential_id:v,account_id:O.id,note:O.note,account_name:O.account_name,password:O.password}),(0,_.SK)(e("已保存")),T(null),await D()}catch(e){}else(0,_.zN)(e("请填写对端账号"))},Q=H?.[I-1]?.keys??G.map(e=>e.key),Y=Q.includes(ce),ee=Q.includes(de),te=I===R,se=R>1;return(0,f.jsxs)(a.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("凭证管理")}),(0,f.jsx)(l.rA,{icon:"info",title:e("信息"),onClick:()=>{s({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("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")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"SMB"}),":",e("prt_smb")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:"百度网盘"}),":",e("prt_bd")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)("b",{children:e("本地目录")}),":",e("prt_local")]})]})]})})}})]}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{W(),j(!0)}}),x&&(0,f.jsxs)(f.Fragment,{children:[se&&I>1&&(0,f.jsx)(l.rA,{icon:"arrow_back",title:e("上一步"),onClick:()=>N(I-1)}),se&&!te&&(0,f.jsx)(l.rA,{icon:"arrow_forward",title:e("下一步"),onClick:async()=>{const t=U(H?.[I-1]?.keys??[]);if(t)return void(0,_.zN)(`${e("请填写")}${t}`);const s=H?.[I-1]?.on_next;try{if("load_shares"===s&&!await(async()=>{const t=await c.I2.post("share/list",{driver:y,id:v||void 0,config:{server:k.server,username:k.username,password:k.password}}),s=t?.data??[];return s.length?($(s.map(e=>({label:e.name,value:e.name}))),!0):((0,_.zN)(e("没有找到共享")),!1)})())return;if("save_app"===s&&!await(async()=>{try{const e=await c.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:y,note:S,config:k,enabled:E});return!v&&e?.data?.id&&g(e.data.id),!0}catch(e){return!1}})())return;N(I+1)}catch(e){}}}),(!se||te)&&(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{const t=U(G.map(e=>e.key));if(t)(0,_.zN)(`${e("请填写")}${t}`);else try{await c.I2.post(v?"credential/update":"credential/add",{id:v||void 0,type:y,note:S,config:k,enabled:E}),(0,_.SK)(e("保存成功")),W(),await D()}catch(e){}}}),(0,f.jsx)(l.rA,{icon:"cancel",title:e("取消"),onClick:W})]})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.Sm,{placeholder:e("备注"),value:S,handleInputChange:C}),(0,f.jsx)(r.l6,{value:y,options:d.map(e=>({title:e.name,value:e.type})),onChange:e=>{b(e),A({}),$([]),F({}),N(1),P("");const t=d.find(t=>t.type===e)?.fields??[];t.some(e=>e.options_source)&&q(t)}}),Y?(()=>{const s=i.find(e=>e.id===v)?.accounts??[];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("授权方式"),label_width:"6rem",children:(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"one_click",context:e("一键授权"),selected:"one_click"===K,onchange:()=>B("one_click")}),(0,f.jsx)(r.U6,{name:"baidu_auth_mode",value:"oob",context:e("outh_ob"),selected:"oob"===K,onchange:()=>B("oob")})]})}),"oob"===K&&(0,f.jsx)(r.BC,{label:e("授权码"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("粘贴授权码 code"),value:z,handleInputChange:P})}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(l.rA,{icon:"open_in_new",title:e("去授权"),onClick:Z}),"oob"===K&&(0,f.jsx)(l.rA,{icon:"check",title:e("完成授权"),onClick:J})]}),s.length>0&&(0,f.jsx)(u.X,{headers:[e("账号名"),e("百度账号"),e("授权状态"),e("使用"),e("授权时间"),e("操作")],rows:s.map(s=>[(0,f.jsx)(a.xP,{context:s.note||s.account_name||s.id}),(0,f.jsx)(a.xP,{context:s.account_name||s.id}),(0,f.jsx)(a.xP,{context:s.authorized?e("已授权"):e("未授权")}),(0,f.jsx)(a.xP,{context:!1===s.enabled?e("停用"):e("启用")}),(0,f.jsx)("p",{children:s.obtained_at?(0,ae.eK)(s.obtained_at):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"network_check",title:e("授权检测"),onClick:()=>(async(t,s)=>{try{const n=await c.I2.post("baidu/verify",{id:t,account_id:s}),i=n?.data??{};i.valid?(0,_.SK)(e("账号可用")):(0,_.zN)(`${e("账号不可用")}:${i.error??""}`),await D()}catch(e){}})(v,s.id)}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>((s,n)=>{t({title:e("确认删除"),sub_title:n.note||n.account_name||n.id,confirm_fun:async()=>{try{await c.I2.post("baidu/deauthorize",{id:s,account_id:n.id}),(0,_.SK)(e("已删除")),await D()}catch(e){}}})})(v,s)})]})])})]},ce)})():ee?(()=>{const s=i.find(e=>e.id===v)?.accounts??[];return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)("div",{className:"div-row",children:(0,f.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("便于辨认的名字"),value:O?.note??"",handleInputChange:e=>T({...O??{note:"",account_name:"",password:""},note:e})})})}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(r.BC,{label:e("对端账号"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("对端 FileCat 登录名"),value:O?.account_name??"",handleInputChange:e=>T({...O??{note:"",account_name:"",password:""},account_name:e})})}),(0,f.jsx)(r.BC,{label:e("对端密码"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("留空表示不修改"),value:O?.password??"",handleInputChange:e=>T({...O??{note:"",account_name:"",password:""},password:e})})})]}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(l.rA,{icon:"save",title:e("保存账号"),onClick:L}),O&&(0,f.jsx)(l.rA,{icon:"close",title:e("取消"),onClick:()=>T(null)})]}),s.length>0&&(0,f.jsx)(u.X,{headers:[e("备注"),e("对端账号"),e("密码"),e("操作")],rows:s.map(s=>[(0,f.jsx)(a.xP,{context:s.note||s.account_name||s.id}),(0,f.jsx)(a.xP,{context:s.account_name||s.id}),(0,f.jsx)(a.xP,{context:s.has_password?e("已设置"):e("未设置")}),(0,f.jsxs)("div",{className:"div-row",children:[(0,f.jsx)(l.rA,{icon:"network_check",title:e("验证登录"),onClick:()=>(async t=>{const s=O?.id===t.id;try{const n=await c.I2.post("credential/account_verify",{credential_id:v,account_id:t.id,account_name:s?O.account_name:t.account_name,password:s?O.password:void 0}),i=n?.data??{};i.ok?(0,_.SK)(e("账号可用")):(0,_.zN)(`${e("账号不可用")}:${i.error??""}`)}catch(e){}})(s)}),(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>T({id:s.id,note:s.note??"",account_name:s.account_name??"",password:""})}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(s=>{t({title:e("确认删除"),sub_title:s.note||s.account_name||s.id,confirm_fun:async()=>{try{await c.I2.post("credential/account_remove",{credential_id:v,account_id:s.id}),(0,_.SK)(e("已删除")),await D()}catch(e){}}})})(s)})]})])})]},de)})():G.filter(e=>Q.includes(e.key)).map(t=>{if(t.options_source)return(0,f.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:k[t.key]??"",options:X[t.options_source]??[],onChange:e=>A({...k,[t.key]:e})})},t.key);if("share"===t.key&&"smb"===y)return(0,f.jsx)(r.BC,{label:e(t.label),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:k[t.key]??"",options:V,onChange:e=>A({...k,[t.key]:e})})},t.key);const s="password"===t.type;return(0,f.jsx)(n.Fragment,{children:(0,f.jsx)(r.Sm,{type:s?"password":"text",placeholder:t.label,value:k[t.key]??"",handleInputChange:e=>A({...k,[t.key]:e})})},t.key)})]}),!x&&(0,f.jsx)(u.X,{headers:[e("备注"),e("类型"),e("操作")],rows:i.map(s=>{return[(0,f.jsx)(a.xP,{context:s.note}),(0,f.jsx)(a.xP,{context:(n=s.type,d.find(e=>e.type===n)?.name??n)}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),b(e.type),C(e.note??""),A({...e.config??{}}),P(""),M(!1!==e.enabled),N(ue[e.type]?.length??1),"smb"===e.type&&c.I2.post("share/list",{driver:"smb",id:e.id,config:e.config??{}}).then(e=>{$((e?.data??[]).map(e=>({label:e.name,value:e.name})))}).catch(()=>{});const t=d.find(t=>t.type===e.type)?.fields??[];t.some(e=>e.options_source)&&q(t).catch(()=>{})})(s)}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.note,confirm_fun:async()=>{try{await c.I2.post("credential/delete",{id:s.id}),(0,_.SK)(e("已删除")),await D()}catch(e){}}})})(s)})]})];var n})})]})}function pe(){const{t:e}=(0,h.Bd)(),t=(0,oe.y)(),[s,i]=(0,n.useState)([]),[o,d]=(0,n.useState)([]),[p,m]=(0,n.useState)([]),[x,j]=(0,n.useState)(!1),[v,g]=(0,n.useState)(""),[w,y]=(0,n.useState)("webdav"),[b,S]=(0,n.useState)(""),[C,k]=(0,n.useState)(""),[A,I]=(0,n.useState)(""),[N,V]=(0,n.useState)(""),[$,X]=(0,n.useState)(""),[F,K]=(0,n.useState)(!1),B=async()=>{try{const[e,t,s]=await Promise.all([c.I2.post("list",{}),c.I2.post("credential/list",{}),c.I2.post("driver/list",{})]);i(Array.isArray(e?.data)?e.data:[]),d(Array.isArray(t?.data)?t.data:[]),m(Array.isArray(s?.data)?s.data:[])}catch(e){}};(0,n.useEffect)(()=>{B()},[]);const z=(0,ae.p_)(C,o),P=z.length>0,O=()=>{j(!1),g(""),y("webdav"),S(""),k(""),I(""),V(""),X(""),K(!1)};return(0,f.jsxs)(a.Zp,{self_title:(0,f.jsx)("span",{className:" div-row ",children:(0,f.jsx)("h2",{children:e("挂载列表")})}),rightBottomCom:(0,f.jsxs)("div",{children:[!x&&(0,f.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{O(),j(!0)}}),x&&(0,f.jsx)(l.rA,{icon:"network_check",title:e("测试连接"),onClick:async()=>{if(C)try{const t=await c.I2.post("test",{id:v||void 0,driver:w,credential_id:C,account_id:A,root_dir:N}),s=t?.data;s?.ok?(0,_.SK)(`${e("连接成功")}(${s.count??0})`):(0,_.zN)(`${e("连接失败")}:${s?.error??""}`)}catch(e){}else(0,_.zN)(e("请选择凭据"))}}),x&&(0,f.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{if(C)if(!P||A)if(b.trim())try{await c.I2.post(v?"update":"add",{id:v||void 0,driver:w,mount_path:b,credential_id:C,account_id:P?A:void 0,root_dir:N,note:$,color:ae.OT,readonly:!1,enabled:!0,forward_to_remote:F}),(0,_.SK)(e("保存成功")),O(),await B()}catch(e){}else(0,_.zN)(e("munt_rq"));else(0,_.zN)(e("请选择账号"));else(0,_.zN)(e("请选择凭据"))}}),x&&(0,f.jsx)(l.rA,{icon:"cancel",title:e("取消"),onClick:O})]}),children:[x&&(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(r.BC,{label:e("挂载类型"),label_width:"6rem",children:(0,f.jsx)(r.l6,{value:w,options:p.map(e=>({title:e.name,value:e.type})),onChange:e=>{y(e),k(""),I("")}})}),(0,f.jsx)(r.BC,{label:e("凭据"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:C,options:(T=w,(0,ae.XT)(T,o)),onChange:e=>{k(e),I("")}})}),P&&(0,f.jsx)(r.BC,{label:e("账号"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.l6,{value:A,options:z,onChange:I})}),(0,f.jsx)(r.BC,{label:e("本地目录"),label_width:"6rem",required:!0,children:(0,f.jsx)(r.Sm,{placeholder:e("被挂载的本地绝对路径"),value:b,handleInputChange:S})}),(0,f.jsx)(r.BC,{label:e("strtdrt"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("远端目录"),value:N,handleInputChange:V})}),(0,f.jsx)(r.BC,{label:e("备注"),label_width:"6rem",children:(0,f.jsx)(r.Sm,{placeholder:e("列表显示的名称"),value:$,handleInputChange:X})}),"tcp_proxy"===w&&(0,f.jsx)(r.BC,{label:e("ftr2rmt"),label_width:"6rem",children:(0,f.jsx)(l.Ay,{checked:F,onChange:K,title:e("ftr2rmt_tip")})})]}),!x&&(0,f.jsx)(u.X,{headers:[e("备注"),e("挂载类型"),e("凭据"),e("账号"),e("操作")],rows:s.map(s=>{const n=o.find(e=>e.id===s.credential_id),i=(n?.accounts??[]).find(e=>e.id===s.account_id);return[(0,f.jsx)("p",{children:s.note}),(0,f.jsx)("p",{children:(a=s.driver,p.find(e=>e.type===a)?.name??a)}),(0,f.jsx)("p",{children:n?n.note:e("凭据已丢失")}),(0,f.jsx)("p",{children:s.account_id?i?i.note||i.account_name||i.nickname||i.id:e("账号已丢失"):"-"}),(0,f.jsxs)("div",{children:[(0,f.jsx)(l.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{j(!0),g(e.id),y(e.driver),S(e.mount_path??""),k(e.credential_id??""),I(e.account_id??""),V(e.root_dir??""),X(e.note??""),K(Boolean(e.forward_to_remote))})(s)}),(0,f.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(async s=>{t({title:e("确认删除"),sub_title:s.mount_path,confirm_fun:async()=>{try{await c.I2.post("delete",{id:s.id}),(0,_.SK)(e("已删除")),await B()}catch(e){}}})})(s)})]})];var a})})]});var T}function me(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)(),s=t(o.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)(k.aZ,{position:"right",children:[(0,f.jsx)("span",{className:"header-label",children:e("总开关")}),(0,f.jsx)(l.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.jsx)(i.xh,{children:(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(he,{})}),(0,f.jsx)(i.VP,{widthPer:50,maxWidth:"60rem",children:(0,f.jsx)(pe,{})})]})})]}):(0,f.jsx)(i.fI,{children:(0,f.jsx)(i.VP,{children:(0,f.jsx)(a.Zp,{self_title:(0,f.jsx)("h2",{children:e("网盘挂载")}),children:(0,f.jsx)("p",{children:e("nmuntpr")})})})})}var _e=s(87361);function xe(){const{t:e}=(0,h.Bd)(),{check_user_auth:t}=(0,y.MH)(),s=[{index:2,name:`${e("个人环境")}`,rto:"private_env_setting",component:(0,f.jsx)(ie,{})}];return t(o.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(K,{})}),t(o.oV.sys_env_page)&&s.push({index:3,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(L,{})}),t(o.oV.auth_router_page)&&s.push({index:4,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(o.oV.file_mount)&&s.push({index:5,name:e("网盘挂载"),rto:"mount_setting/",component:(0,f.jsx)(me,{})}),t(o.oV.user_manage)&&s.push({index:6,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)(ee,{})}),t(o.oV.role_manage)&&s.push({index:7,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(te,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:_e.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>u,o:()=>p});var n=s(34843),i=s(82893),o=s(74777),a=s(96540),l=s(22022),r=s(23430),c=s(14284),d=s(74848);function u(){const[e,t]=(0,n.fp)(i.AG.prompt_card),{t:s,i18n:a}=(0,l.Bd)();return e=>{let n;e===o.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===o.jk.smartmontools?n=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,d.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:n})})}}let h=r.Ky;function p(){const[e,t]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(async()=>{try{const e=await c.XO.get("themes");if(0===e.code){const s=e.data||[];h=[...r.Ky,...s],t(h)}else console.warn("获取主题列表失败,使用默认列表"),t(h)}catch(e){t(h)}})()},[]),e}},6960(e,t,s){s.d(t,{s:()=>a});var n=s(72635);const i=1440,o=525600;function a(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<o?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/o).toFixed(0)} ${n.Ay.t("年前")}`}},93245(e,t,s){s.d(t,{a:()=>r,d:()=>l});var n=s(96540),i=s(34843),o=s(82893),a=s(23430);const l=[{id:a.nE.ace,label:"文本编辑器(ace)"},{id:a.nE.md,label:"md编辑器"},{id:a.nE.mind,label:"思维导图编辑器"},{id:a.nE.draw,label:"draw编辑器"},{id:a.nE.timeline,label:"时间线编辑器"},{id:a.nE.image,label:"图片编辑器"},{id:a.nE.excel,label:"excel编辑器"}];function r(e,t,s,a=!1){const[l]=(0,i.fp)(o.AG.user_base_info),r=l?.user_data?.editor_auto_save,c=(0,n.useRef)(r);c.current=r;const d=(0,n.useRef)(t);d.current=t;const u=(0,n.useRef)(s);u.current=s,(0,n.useEffect)(()=>{if(a)return;const t=c.current;if(!t?.enable||t.interval<=0||!t.editors?.includes(e))return;const s=setInterval(()=>{d.current()&&u.current(!0)},1e3*t.interval);return()=>clearInterval(s)},[r,e,a])}},24659(e,t,s){s.d(t,{K:()=>i});var n=s(22022);const i=()=>{const{t:e}=(0,n.Bd)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}}}]);
|