filecat 7.2.0 → 7.3.1
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/1142.2a57e7124b6e3720c759.js +1 -0
- package/build/dist/{2502.6a0501313a1fe1b8208a.js → 2502.f8b13f3430edb99be86f.js} +1 -1
- package/build/dist/{3328.2d65fbe893d02787f48a.js → 3328.94946a89fd1612eaf80a.js} +1 -1
- package/build/dist/{9878.39d098f7cdb90f45bbfd.js → 3426.b4464d74998fb12ec5ac.js} +1 -1
- package/build/dist/4903.72481ee04812f34d5e96.js +1 -0
- package/build/dist/5272.c6b01ba9d9321b267296.js +1 -0
- package/build/dist/5308.42feb31305850d55b34c.js +1 -0
- package/build/dist/7873.71457d99f7439b66d15b.js +1 -0
- package/build/dist/8765.5f32a55b3f56992efb32.js +1 -0
- package/build/dist/9299.456797c412d569e123ea.js +1 -0
- package/build/dist/9877.5bed2ede178cba58843b.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.d9a1e3c9792ebea88038.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/1149.e3a538a30556fbad25dd.js +0 -1
- package/build/dist/2091.5bc71c19b26140f00a48.js +0 -1
- package/build/dist/4476.bd49273fea4a2679f45e.js +0 -1
- package/build/dist/4903.bf39a395daf5bc283e4a.js +0 -1
- package/build/dist/5308.bff6efb3c9335ad227da.js +0 -1
- package/build/dist/7200.d4aa731754f2359a4f7b.js +0 -1
- package/build/dist/8765.ca9ec23eec760dab2bec.js +0 -1
- package/build/dist/9299.4ee1fc7465badad59aa6.js +0 -1
- package/build/dist/main.b8e4dd383adfa223d84e.js +0 -2
- /package/build/dist/{main.b8e4dd383adfa223d84e.js.LICENSE.txt → main.d9a1e3c9792ebea88038.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1142],{71142(e,t,n){n.r(t),n.d(t,{default:()=>ae});var r=n(96540),s=n(7523),o=n(34843),c=n(82893),i=n(78247),a=n(23430),l=n(85997),u=n(57952),d=n(62042),m=n(53459),f=n(14284),v=n(57889),_=n(23496),h=n(86149),p=n(86504),g=n(67951),w=n(74848);function x(e){const{t}=(0,h.B)(),n=(0,r.useRef)(null),[s,o]=(0,r.useState)({marks:[],block:{name:"paragraph"}}),[c,i]=(0,r.useState)(null),a=(0,r.useCallback)(()=>{const t=e.get_view();if(!t)return;const n=t.state.selection,r=t.state.storedMarks??n.$from.marks();if(o({marks:r.map(e=>e.type.name),block:k(n.$from)}),n.empty)return void i(null);const s=t.coordsAtPos(n.from),c=t.coordsAtPos(n.to),a=(Math.min(s.left,c.left)+Math.max(s.right,c.right))/2,l=Math.min(s.top,c.top),u=Math.max(s.bottom,c.bottom);i({top:l,bottom:u,left:a})},[e.get_view]);(0,r.useEffect)(()=>{a();const t=e.get_view();if(!t)return;const n=()=>a();t.dom.addEventListener("keyup",n),t.dom.addEventListener("mouseup",n),document.addEventListener("selectionchange",n);const r=t.dom.closest(".md-editor-context");return r?.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{t.dom.removeEventListener("keyup",n),t.dom.removeEventListener("mouseup",n),document.removeEventListener("selectionchange",n),r?.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[a,e.get_view,e.refresh_key]);const l=t=>{const n=e.get_view();n&&(t(n.state,n.dispatch),n.focus(),a())},u=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,f]=(0,r.useState)({w:0,h:36});if((0,r.useLayoutEffect)(()=>{if(!c||!n.current)return;const e=n.current.offsetWidth,t=n.current.offsetHeight;f(n=>n.w===e&&n.h===t?n:{w:e,h:t})},[c,e.refresh_key]),!c)return null;const v=(e,n,r,s,o=!1)=>(0,w.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(r),onMouseDown:e=>e.preventDefault(),onClick:s,children:n},e),_=m.w/2,p=_+4,x=Math.max(p,window.innerWidth-_-4),y=document.querySelector(".header")?.getBoundingClientRect().bottom??0,b=c.top-m.h-8,j=b<y+4,E={top:j?Math.min(c.bottom+8,window.innerHeight-m.h-4):b,left:Math.min(x,Math.max(p,c.left))};return(0,w.jsxs)("div",{className:"mdtb mdtb--floating"+(j?" mdtb--below":""),ref:n,style:E,children:[v("h1","H1","一级标题",()=>l((0,g.uf)("heading",{level:1})),d(1)),v("h2","H2","二级标题",()=>l((0,g.uf)("heading",{level:2})),d(2)),v("h3","H3","三级标题",()=>l((0,g.uf)("heading",{level:3})),d(3)),(0,w.jsx)("span",{className:"mdtb__sep"}),v("b","B","加粗",()=>l((0,g.NH)("strong")),u("strong")),v("i","I","斜体",()=>l((0,g.NH)("em")),u("em")),v("s","S","删除线",()=>l((0,g.NH)("strike")),u("strike")),v("code","</>","行内代码",()=>l((0,g.NH)("code")),u("code")),(0,w.jsx)("span",{className:"mdtb__sep"}),v("ul","≔","无序列表",()=>l(g.fK)),v("ol","1.","有序列表",()=>l(g.oB)),v("quote","❝","引用",()=>l(g.Vu))]})}function k(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.name;if("heading"===n)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===n)return{name:"paragraph"}}return{name:"paragraph"}}var y=n(75725),b=n(86059);const j="cut",E="copy",S="paste",C="strong",N="em",L="strike",A="code",R="h1",H="h2",M="h3",G="paragraph",z="bullet",B="ordered",P="quote",$="code_block",F="clean",D="row_before",K="row_after",I="row_delete",T="col_before",U="col_after",W="col_delete",Y="header_toggle",X="cell_merge",q="cell_split",V="table_delete",J="table_insert",O="select_all";function Z(e){const{t}=(0,h.B)(),[n,s]=(0,r.useState)(null),o=(0,r.useRef)(e.get_view);o.current=e.get_view,(0,r.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const n=e.target;if(!n||!n.closest(".md-filecat-content"))return;e.preventDefault();const r=t.posAtCoords({left:e.clientX,top:e.clientY});if(r){const e=t.state.selection;if(r.pos<e.from||r.pos>e.to){const{TextSelection:e}=t.state.selection.constructor;try{t.dispatch(t.state.tr.setSelection(e.near(t.state.doc.resolve(r.pos))))}catch{}}}const c=!!n.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:c||(0,b.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const c=()=>s(null),i=(0,r.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),c())},[]),a=e=>{const t=o.current();t?.focus(),document.execCommand(e),c()};if(!n)return null;const l=n.in_table?[{r:t("上方插入行"),v:D},{r:t("下方插入行"),v:K},{r:t("左侧插入列"),v:T},{r:t("右侧插入列"),v:U},{r:t("删除行"),v:I},{r:t("删除列"),v:W},{r:t("切换表头行"),v:Y},{r:t("合并单元格"),v:X},{r:t("拆分单元格"),v:q},{r:t("删除表格"),v:V}]:[],u=[{r:t("剪切"),v:j},{r:t("复制"),v:E},{r:t("粘贴"),v:S},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:C},{r:t("斜体"),v:N},{r:t("删除线"),v:L},{r:t("行内代码"),v:A}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:R},{r:t("二级标题"),v:H},{r:t("三级标题"),v:M},{r:t("正文"),v:G}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:z},{r:t("有序列表"),v:B},{r:t("引用"),v:P},{r:t("代码块"),v:$},{r:t("插入表格"),v:J}]},...l.length?[{r:t("表格"),v:"table",items:l}]:[],{r:t("清除格式"),v:F},{r:t("全选"),v:O}];return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.rY,{click:c}),(0,w.jsx)(y.Pu,{x:n.x,y:n.y,items:u,click:t=>{switch(t){case j:return a("cut");case E:return a("copy");case S:return a("paste");case C:return i((0,g.NH)("strong"));case N:return i((0,g.NH)("em"));case L:return i((0,g.NH)("strike"));case A:return i((0,g.NH)("code"));case R:return i((0,g.uf)("heading",{level:1}));case H:return i((0,g.uf)("heading",{level:2}));case M:return i((0,g.uf)("heading",{level:3}));case G:return i((0,g.uf)("paragraph"));case z:return i(g.fK);case B:return i(g.oB);case P:return i(g.Vu);case $:return i((0,g.uf)("code_block"));case J:return c(),void e.on_insert_table?.();case D:return i(b.JD);case K:return i(b.gC);case T:return i(b.RC);case U:return i(b.GU);case I:return i(b.aR);case W:return i(b.gR);case Y:return i(b.uC);case X:return i(b.w7);case q:return i(b.L0);case V:return i(b.kG);case F:return i((e,t)=>{const{from:n,to:r}=e.selection;let s=e.tr;return e.doc.nodesBetween(n,r,(e,t)=>{if(e.isText)for(const n of e.marks)s=s.removeMark(t,t+e.nodeSize,n.type)}),t?.(s),!0});case O:return i((e,t)=>{const{TextSelection:n}=e.selection.constructor;return t?.(e.tr.setSelection(n.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var Q=n(64877);function ee(e){const t=[];if(!e)return t;const n=e.split(/(\n)/);let r=null,s=0;for(let e=0;e<n.length;e+=2){const o=n[e],c=s;s+=o.length+(n[e+1]?.length??0);const i=o.endsWith("\r")?o.slice(0,-1):o,a=i.trimStart(),l=/^(`{3,}|~{3,})/.exec(a);if(l){const e=l[1][0];null===r?r=e:r===e&&(r=null);continue}if(null!==r)continue;const u=/^ {0,3}(#{1,6})\s+(.*)$/.exec(i);if(!u)continue;const d=u[1].length,m=u[2].replace(/\s+#+\s*$/,"").trim();t.push({level:d,text:m,pos:c})}return t}var te=n(69918),ne=n(96763),re=n(40505);function se(e){const{t}=(0,h.B)(),[n,s]=(0,r.useState)(!1),[i,a]=(0,r.useState)({x:0,y:0}),[u,d]=(0,r.useState)([]),[m]=(0,o.fp)(c.AG.user_base_info);(0,r.useEffect)(()=>{if(!n)return;let e=!1;return(0,ne.Kz)().then(t=>{e||d(t)}),()=>{e=!0}},[n]);const f=(e,t)=>(0,w.jsx)("div",{style:{...(0,re.ok)(t===m?.user_data?.md_editor_theme)},children:e});return(0,w.jsxs)(r.Fragment,{children:[(0,w.jsx)(l.rA,{icon:"palette",title:t("主题"),onClick:e=>{a({x:e.clientX,y:e.clientY}),s(!0)}}),n&&(0,w.jsx)(y.rY,{click:()=>s(!1),children:(0,w.jsx)(y.Pu,{x:i.x,y:i.y,items:[{r:f(t("follow_sys"),""),v:""},...u.map(e=>({r:f(e.id,e.id),v:e.id}))],click:t=>{s(!1),e.on_change(t)}})})]})}var oe=n(2543),ce=n(86090),ie=n(87361);function ae(){const{t:e}=(0,h.B)(),t=(0,ce.Zp)(),{check_user_auth:n}=(0,i.MH)(),g=n(a.oV.md_editor_setting),[k,y]=(0,o.fp)(c.AG.md_editor),b=(0,o.fp)(c.AG.md_editor_last_context)[1],j=(0,r.useRef)(null),[E,S]=(0,r.useState)(null),[C,N]=(0,r.useState)(!1),[L,A]=(0,r.useState)(!1),[R,H]=(0,r.useState)(0),M=(0,r.useRef)(null),[G,z]=(0,r.useState)([]),[B,P]=(0,r.useState)(-1),[$,F]=(0,r.useState)(15),[D,K]=(0,r.useState)(!1),I=(0,r.useRef)(null),T=(0,r.useRef)(null),[U,W]=(0,o.fp)(c.AG.md_editor_show_outline),[Y,X]=(0,o.fp)(c.AG.md_editor_mode),q=(0,r.useCallback)(()=>{const e="wysiwyg"===Y?"source":"wysiwyg",t=M.current;t&&("source"===e?t.enter_source_mode():t.exit_source_mode(),X(e))},[Y]),[V]=(0,o.fp)(c.AG.md_editor_setting),[J,O]=(0,o.fp)(c.AG.md_theme_css),[re]=(0,o.fp)(c.AG.user_base_info),{initUserInfo:ae}=(0,r.useContext)(s.F),le=(0,r.useRef)(null),ue=(0,r.useRef)(null);(0,r.useEffect)(()=>{ue.current},[re]),(0,r.useEffect)(()=>{(0,te.Ce)(le.current,V)},[V]);(0,r.useEffect)(()=>{(0,ne.bN)("editor",J)},[J]),(0,r.useEffect)(()=>{const e=()=>{(0,ne.sO)().then(O)};return window.addEventListener(ne.o3,e),()=>window.removeEventListener(ne.o3,e)},[]);const de=(0,r.useRef)([]),me=(0,r.useCallback)(()=>{const e=M.current;if(!e)return;const t=e.is_source_mode()?ee(e.get_markdown()):e.get_headings();de.current=t,z(t)},[]),fe=(0,r.useCallback)(()=>{const e=M.current,t=e?.get_view();if(!e||!t)return;const n=e.is_source_mode()?t.state.selection.from-1:t.state.selection.from;let r=-1;for(const e of de.current){if(!(e.pos<=n))break;r=e.pos}P(r)},[]);(0,r.useEffect)(()=>{let t=!1;if(k?.url)return A(!1),N(!0),v.l.get(k.url).then(e=>{if(t)return;S(e??"")}).catch(()=>{t||((0,d.zN)(e("打开失败")),S(""))}).finally(()=>{t||N(!1)}),()=>{t=!0};S(null)},[k?.url]),(0,r.useEffect)(()=>{const e=()=>H(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]);const ve=(0,r.useRef)(q);ve.current=q,(0,r.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"/"===e.key&&(e.preventDefault(),e.stopPropagation(),ve.current())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[]),(0,r.useEffect)(()=>{me(),fe()},[R,Y,me,fe]);const _e=(0,r.useCallback)(oe.throttle(e=>{if(!I.current||!T.current)return;const t=parseFloat(getComputedStyle(I.current).fontSize),n=e.clientX/t,r=window.innerWidth/t-4,s=2.25+T.current.offsetWidth/t;n<=r&&n>=s&&F(parseFloat(n.toFixed(2)))},32),[]),he=()=>{K(!1),I.current?.removeEventListener("pointermove",_e)},pe=async(t=!1)=>{if(!k?.name||!k?.path)return;const n=M.current?.get_markdown();if(void 0===n)return;const r=k.path.slice(0,k.path.length-k.name.length),s=`${encodeURIComponent(r)}${k.name}`;(await f.$M.post(`save/${s}`,{context:n})).code===m.m.Success?(A(!1),t||(0,d.SK)(e("保存成功"))):(0,d.zN)(e("保存失败"))},ge=(0,r.useRef)(pe);ge.current=pe;const we=(0,r.useRef)(L);we.current=L;const xe=V?.auto_save_interval??0;(0,r.useEffect)(()=>{if(xe<=0)return;const e=setInterval(()=>{we.current&&ge.current(!0)},1e3*xe);return()=>clearInterval(e)},[xe]);const ke=()=>{y({}),A(!1),S(null),M.current=null,k?.close?.()},ye=(0,r.useMemo)(()=>k?.url??"md_editor",[k?.url]);return k?.name?(0,w.jsxs)("div",{id:"md-editor-container",ref:le,children:[(0,w.jsx)(u.A,{ignore_tags:!0,left_children:[(0,w.jsx)(l.rA,{title:e("关闭"),icon:"close",onClick:ke},1),(0,w.jsx)("div",{className:"md-editor-title",children:k.name},3),...L?[(0,w.jsx)(l.rA,{title:e("保存"),icon:"save",onClick:pe},2)]:[],(0,w.jsx)(l.rA,{title:e("大纲"),icon:"list",onClick:()=>W(e=>!e),selected:U},4),(0,w.jsx)(l.rA,{title:e("wysiwyg"===Y?"源码模式":"实时编辑模式"),icon:"wysiwyg"===Y?"code":"edit",onClick:q},5),(0,w.jsx)(se,{on_change:async t=>{const n=await f.wm.post(_.s.user_save_private_attr,{is_md_theme:!0,md_editor_theme:t});n?.code===m.m.Success?(ue.current=t,await ae(),(0,d.SK)(e("保存成功"))):(0,d.zN)(e("保存失败"))}},8),(0,w.jsx)(l.rA,{title:e("导出PDF"),icon:"print",onClick:()=>{window.print()}},7),...g?[(0,w.jsx)(l.rA,{title:e("编辑器设置"),icon:"settings",onClick:()=>{ke(),t(ie.o.md_editor_setting_page)}},6)]:[]]}),(0,w.jsxs)("div",{className:"md-editor-context",ref:I,children:[C&&(0,w.jsxs)("div",{className:"common-box common-box-center",children:[e("加载中"),"..."]}),!C&&null!==E&&(0,w.jsxs)(r.Fragment,{children:[U&&(0,w.jsx)("div",{className:"md-outline-panel",style:{width:`${$}em`},children:(0,w.jsx)(Q.A,{items:G,active_pos:B,on_click:e=>{const t=M.current;t&&(t.scroll_to_pos(t.is_source_mode()?e.pos+1:e.pos),P(e.pos))}})}),U&&(0,w.jsx)("div",{className:"md-editor-divider",ref:T,onPointerDown:()=>{K(!0),I.current?.addEventListener("pointermove",_e)},onPointerUp:he}),D&&(0,w.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:he}),(0,w.jsx)("div",{className:"md-editor-scroll",children:(0,w.jsxs)("div",{className:"md-editor-sheet",children:["wysiwyg"===Y&&(0,w.jsx)(x,{get_view:()=>M.current?.get_view()??null,refresh_key:R}),(0,w.jsx)(p.A,{value:E,ref:M,initial_source_mode:"source"===Y,on_ready:e=>{const t=e.is_source_mode()?ee(e.get_markdown()):e.get_headings();de.current=t,z(t),P(-1)},on_change:()=>{L||A(!0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{const e=M.current?.get_markdown()??"";e&&b(e)},800)},on_save:()=>ge.current(),on_selection_change:()=>H(e=>e+1),on_source_mode_change:e=>{X(e?"source":"wysiwyg"),H(e=>e+1)}},ye),"wysiwyg"===Y&&(0,w.jsx)(Z,{get_view:()=>M.current?.get_view()??null,on_insert_table:()=>{M.current?.insert_table(3,3),A(!0)}})]})})]})]})]}):null}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2502],{2502(t,e,n){n.r(e),n.d(e,{default:()=>A});var i=n(96540),o=n(92275),s=n(14944),r=n(34843),l=n(82893),c=n(57952),a=n(85997),_=n(47022),h=n(34289),p=n(62042),x=n(61443),d=n(86149),f=n(64694),g=n(70447),u=n(74848);const w=300;let v=!1,m=0,y=!0;var k,b=[],j=-1,C=[];function A(t){const[e,n]=(0,r.fp)(l.AG.log_viewer),A=(0,i.useRef)(null),[H,T]=(0,i.useState)(0),[S,z]=(0,i.useState)(100),[I,K]=(0,i.useState)(!1),[M,$]=(0,i.useState)(""),[E,L]=(0,i.useState)(0),[N,D]=(0,i.useState)(0),[q,G]=(0,i.useState)(0),{t:R}=(0,d.B)(),B=(t,n,i,o=!1,s)=>{const r=document.createElement("div");return-1===j?r.textContent=t:r.innerHTML=t,"wrap"===e.wrap?(r.style.whiteSpace="pre-wrap",r.style.overflowWrap="break-word"):r.style.whiteSpace="nowrap",r.setAttribute("position",`${n}`),r.setAttribute("start_position",`${i}`),o?(A.current.insertBefore(r,s),b.unshift(r)):(A.current.appendChild(r),b.push(r)),r},F=t=>{const e=(0,f.I)(b,e=>e===t);e&&A.current.removeChild(e)},W=(t,e,n,i=!1)=>{if(!t)return;const o=Array.isArray(t)?t:t.split("\n");if(i){let t;for(let i=0;i<o.length;i++)t=B(o[i],e[i],n[i],!0,0===i?A.current.firstChild:t);if(b.length>w){let t=b.length-1;for(;t>=w;)F(b[b.length-1]),t--}}else{for(let t=0;t<o.length;t++)B(o[t],e[t],n[t]);if(b.length>w){let t=b.length-w;for(;t>0;)F(b[0]),t--}}},X=async()=>{k.encoding=e.encoding,k.context="";const t=await s.ws.sendData(o.HK.log_viewer,k);if(t){const e=t.context;if(k=e,e.find_back_enter_index&&e.context_list.length>0)for(let t=0;t<e.context_list.length;t++){const n=new RegExp(e.query_text,"g");e.context_list[t]=e.context_list[t].replace(n,`<span style="color: blue;">${e.query_text}</span>`)}k.find_back_enter_index=!1,W(e.context_list,e.context_position_list,e.context_start_position_list,k.back),k.context_list.length>0&&(k.back&&b.length>0?(k.context_list.length>b.length?T(Math.floor(100*parseInt(b[k.context_list.length-b.length].getAttribute("position"))/k.max_size)):T(Math.floor(100*parseInt(b[b.length-k.context_list.length].getAttribute("position"))/k.max_size)),y=!1):T(Math.floor(100*(k.context_position_list[k.context_position_list.length-1]??0)/k.max_size)))}},Y=t=>{v||(v=!0,T(100),s.ws.addMsg(o.HK.log_viewer_watch,t=>{const e=t.context;e&&(k=e,W(e.context_list,e.context_position_list,e.context_start_position_list,!1),A.current.scrollTop=A.current.scrollHeight)}),k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.position=t,s.ws.sendData(o.HK.log_viewer_watch,k),K(!0))},Z=async()=>{A.current&&A.current.remove(),b=[]};if((0,i.useEffect)(()=>{e.show?(async()=>{A.current.addEventListener("scroll",async()=>{const t=A.current;if(t){if(v)return void(m=t.scrollTop);if(m<t.scrollTop&&b.length>0&&t.scrollTop+t.clientHeight+500>=t.scrollHeight){const t=parseInt(b[b.length-1].getAttribute("position"));if(t>=k.max_size)return void Y(t);k.line=20,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.back=!1,k.position=t,await X()}else if(m>t.scrollTop&&b.length>0&&t.scrollTop-300<=0){const e=parseInt(b[0].getAttribute("start_position"));if(e<=0)return y||(y=!0,(0,p.N9)("到达顶部")),void(m=t.scrollTop);k.line=10,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.back=!0,k.position=e,await X()}m=t.scrollTop}}),A.current.addEventListener("wheel",t=>{const e=A.current;if(e){t.preventDefault();const n=20;t.deltaY>0?e.scrollTop+=n:e.scrollTop-=n}},{passive:!1}),K(!1),L(0),D(0),$(""),v=!1,G(0),m=0,C=[],j=-1,b=[],(k=new _.d2).line=w,k.path=`${(0,h.GG)("file",(0,h.vX)())}${e.fileName}`,k.token=localStorage.getItem("token"),await X(),s.ws.addMsg(o.HK.search_file_progress,t=>{try{L(parseInt(t.context))}catch(t){(0,p.zN)(t.message)}}),s.ws.addMsg(o.HK.search_file_index,t=>{try{C.push(...t.context),G(t.context.length)}catch(t){(0,p.zN)(t.message)}})})():Z()},[e]),(0,i.useEffect)(()=>()=>{Z()},[]),!e.show)return;return(0,u.jsxs)("div",{id:"editor-container",children:[(0,u.jsxs)(c.A,{ignore_tags:!0,left_children:[(0,u.jsx)(a.rA,{title:R("取消"),icon:"close",onClick:()=>{n({show:!1})}},1),(0,u.jsx)("div",{style:{width:"4rem"},children:(0,u.jsx)(g.WA,{context:e.fileName})},2),(0,u.jsxs)(i.Fragment,{children:[" ",(0,u.jsx)(x.$Z,{handleEnterPress:async()=>{M&&(L(.1),D(0),G(0),j=-1,C=[],k.query_text=M,k.encoding=e.encoding,s.ws.sendData(o.HK.search_file,k))},placeholder:R("回车搜索整个文件"),icon:"search",value:M,handleInputChange:t=>{$(t)},max_width:"25em"})]},3),M&&(0,u.jsx)("div",{style:{paddingLeft:"1.5rem",cursor:"pointer"},onClick:async()=>{if(0===C.length)return;k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[];const t=j+1>=C.length?0:j+1;D(t+1),j=t,k.find_back_enter_index=!0,k.back=!1,k.position=C[j],await X()},children:"↓"},5),M&&(0,u.jsx)("div",{style:{paddingLeft:"1.5rem",cursor:"pointer"},onClick:async()=>{if(0===C.length)return;k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[];const t=j-1<0?C.length-1:j-1;D(t+1),j=t,k.back=!1,k.find_back_enter_index=!0,k.position=C[j],await X()},children:"↑"},6),M&&(0,u.jsxs)("div",{style:{paddingLeft:"1.5rem"},children:[N,"/",C.length]},7),M&&(0,u.jsxs)("div",{style:{paddingLeft:"1.5rem"},children:["搜索进度$",E,"%"]},8),0!==E&&100!==E&&(0,u.jsx)(a.rA,{title:R("取消"),icon:"cancel",onClick:()=>{s.ws.sendData(o.HK.search_file_cancel,{}),$(""),L(0)}},4)],children:[(0,u.jsx)("span",{style:{paddingRight:".5rem"},children:e.encoding}),I&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{style:{color:"var(--icon-green)",whiteSpace:"pre"},children:"正在实时监听 "}),(0,u.jsx)(a.rA,{icon:"close",title:R("关闭实时"),onClick:()=>{v&&(v=!1,K(!1),s.ws.sendData(o.HK.log_viewer_watch_cancel,k))}})]}),(0,u.jsxs)("span",{children:["当前加载进度",H]}),(0,u.jsx)(x.$Z,{max_width:"10rem",placeholder:R("跳转进度"),icon:"percent",value:S,handleInputChange:t=>{z(t)}}),(0,u.jsx)(a.rA,{icon:"play_arrow",title:R("跳转进度"),onClick:async()=>{k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];let t=0;try{if(t=parseInt(S),t>100||t<0)throw(0,p.zN)("范围在0-100"),"超过最大范围";for(const t of b)A.current.removeChild(t);b=[]}catch(t){return void(0,p.N9)(t)}k.back=t>=100,k.position=Math.floor(k.max_size*(t/100)),await X()}}),(0,u.jsx)(a.rA,{icon:"text_rotate_vertical",title:R("滑动到文件最底部,实时输出"),onClick:async()=>{if(!v){k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[],k.back=!0,k.position=k.max_size,await X(),A.current.scrollTop=A.current.scrollHeight,Y(k.max_size)}}})]}),(0,u.jsx)("div",{style:{height:"100%"},children:(0,u.jsx)("div",{ref:A,style:{overflowY:"auto",overflowX:"auto",height:"100%"}})})]})}}}]);
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2502],{2502(t,e,n){n.r(e),n.d(e,{default:()=>A});var i=n(96540),o=n(92275),s=n(14944),r=n(34843),l=n(82893),c=n(57952),a=n(85997),_=n(47022),h=n(34289),p=n(62042),x=n(61443),d=n(86149),f=n(64694),g=n(70447),u=n(74848);const w=300;let v=!1,m=0,y=!0;var k,b=[],j=-1,C=[];function A(t){const[e,n]=(0,r.fp)(l.AG.log_viewer),A=(0,i.useRef)(null),[H,T]=(0,i.useState)(0),[S,z]=(0,i.useState)(100),[I,K]=(0,i.useState)(!1),[M,$]=(0,i.useState)(""),[E,L]=(0,i.useState)(0),[N,D]=(0,i.useState)(0),[q,G]=(0,i.useState)(0),{t:R}=(0,d.B)(),B=(t,n,i,o=!1,s)=>{const r=document.createElement("div");return-1===j?r.textContent=t:r.innerHTML=t,"wrap"===e.wrap?(r.style.whiteSpace="pre-wrap",r.style.overflowWrap="break-word"):r.style.whiteSpace="nowrap",r.setAttribute("position",`${n}`),r.setAttribute("start_position",`${i}`),o?(A.current.insertBefore(r,s),b.unshift(r)):(A.current.appendChild(r),b.push(r)),r},F=t=>{const e=(0,f.I)(b,e=>e===t);e&&A.current.removeChild(e)},W=(t,e,n,i=!1)=>{if(!t)return;const o=Array.isArray(t)?t:t.split("\n");if(i){let t;for(let i=0;i<o.length;i++)t=B(o[i],e[i],n[i],!0,0===i?A.current.firstChild:t);if(b.length>w){let t=b.length-1;for(;t>=w;)F(b[b.length-1]),t--}}else{for(let t=0;t<o.length;t++)B(o[t],e[t],n[t]);if(b.length>w){let t=b.length-w;for(;t>0;)F(b[0]),t--}}},X=async()=>{k.encoding=e.encoding,k.context="";const t=await s.ws.sendData(o.HK.log_viewer,k);if(t){const e=t.context;if(k=e,e.find_back_enter_index&&e.context_list.length>0)for(let t=0;t<e.context_list.length;t++){const n=new RegExp(e.query_text,"g");e.context_list[t]=e.context_list[t].replace(n,`<span style="color: blue;">${e.query_text}</span>`)}k.find_back_enter_index=!1,W(e.context_list,e.context_position_list,e.context_start_position_list,k.back),k.context_list.length>0&&(k.back&&b.length>0?(k.context_list.length>b.length?T(Math.floor(100*parseInt(b[k.context_list.length-b.length].getAttribute("position"))/k.max_size)):T(Math.floor(100*parseInt(b[b.length-k.context_list.length].getAttribute("position"))/k.max_size)),y=!1):T(Math.floor(100*(k.context_position_list[k.context_position_list.length-1]??0)/k.max_size)))}},Y=t=>{v||(v=!0,T(100),s.ws.addMsg(o.HK.log_viewer_watch,t=>{const e=t.context;e&&(k=e,W(e.context_list,e.context_position_list,e.context_start_position_list,!1),A.current.scrollTop=A.current.scrollHeight)}),k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.position=t,s.ws.sendData(o.HK.log_viewer_watch,k),K(!0))},Z=async()=>{A.current&&A.current.remove(),b=[]};if((0,i.useEffect)(()=>{e.show?(async()=>{A.current.addEventListener("scroll",async()=>{const t=A.current;if(t){if(v)return void(m=t.scrollTop);if(m<t.scrollTop&&b.length>0&&t.scrollTop+t.clientHeight+500>=t.scrollHeight){const t=parseInt(b[b.length-1].getAttribute("position"));if(t>=k.max_size)return void Y(t);k.line=20,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.back=!1,k.position=t,await X()}else if(m>t.scrollTop&&b.length>0&&t.scrollTop-300<=0){const e=parseInt(b[0].getAttribute("start_position"));if(e<=0)return y||(y=!0,(0,p.N9)("到达顶部")),void(m=t.scrollTop);k.line=10,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[],k.back=!0,k.position=e,await X()}m=t.scrollTop}}),A.current.addEventListener("wheel",t=>{const e=A.current;if(e){t.preventDefault();const n=20;t.deltaY>0?e.scrollTop+=n:e.scrollTop-=n}},{passive:!1}),K(!1),L(0),D(0),$(""),v=!1,G(0),m=0,C=[],j=-1,b=[],(k=new _.d2).line=w,k.path=`${(0,h.GG)("file",(0,h.vX)())}${e.fileName}`,k.token=localStorage.getItem("token"),await X(),s.ws.addMsg(o.HK.search_file_progress,t=>{try{L(parseInt(t.context))}catch(t){(0,p.zN)(t.message)}}),s.ws.addMsg(o.HK.search_file_index,t=>{try{C.push(...t.context),G(t.context.length)}catch(t){(0,p.zN)(t.message)}})})():Z()},[e]),(0,i.useEffect)(()=>()=>{Z()},[]),!e.show)return;return(0,u.jsxs)("div",{id:"editor-container",children:[(0,u.jsxs)(c.A,{ignore_tags:!0,left_children:[(0,u.jsx)(a.rA,{title:R("取消"),icon:"close",onClick:()=>{const t=e.close;n({show:!1}),t?.()}},1),(0,u.jsx)("div",{style:{width:"4rem"},children:(0,u.jsx)(g.WA,{context:e.fileName})},2),(0,u.jsxs)(i.Fragment,{children:[" ",(0,u.jsx)(x.$Z,{handleEnterPress:async()=>{M&&(L(.1),D(0),G(0),j=-1,C=[],k.query_text=M,k.encoding=e.encoding,s.ws.sendData(o.HK.search_file,k))},placeholder:R("回车搜索整个文件"),icon:"search",value:M,handleInputChange:t=>{$(t)},max_width:"25em"})]},3),M&&(0,u.jsx)("div",{style:{paddingLeft:"1.5rem",cursor:"pointer"},onClick:async()=>{if(0===C.length)return;k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[];const t=j+1>=C.length?0:j+1;D(t+1),j=t,k.find_back_enter_index=!0,k.back=!1,k.position=C[j],await X()},children:"↓"},5),M&&(0,u.jsx)("div",{style:{paddingLeft:"1.5rem",cursor:"pointer"},onClick:async()=>{if(0===C.length)return;k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[];const t=j-1<0?C.length-1:j-1;D(t+1),j=t,k.back=!1,k.find_back_enter_index=!0,k.position=C[j],await X()},children:"↑"},6),M&&(0,u.jsxs)("div",{style:{paddingLeft:"1.5rem"},children:[N,"/",C.length]},7),M&&(0,u.jsxs)("div",{style:{paddingLeft:"1.5rem"},children:["搜索进度$",E,"%"]},8),0!==E&&100!==E&&(0,u.jsx)(a.rA,{title:R("取消"),icon:"cancel",onClick:()=>{s.ws.sendData(o.HK.search_file_cancel,{}),$(""),L(0)}},4)],children:[(0,u.jsx)("span",{style:{paddingRight:".5rem"},children:e.encoding}),I&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{style:{color:"var(--icon-green)",whiteSpace:"pre"},children:"正在实时监听 "}),(0,u.jsx)(a.rA,{icon:"close",title:R("关闭实时"),onClick:()=>{v&&(v=!1,K(!1),s.ws.sendData(o.HK.log_viewer_watch_cancel,k))}})]}),(0,u.jsxs)("span",{children:["当前加载进度",H]}),(0,u.jsx)(x.$Z,{max_width:"10rem",placeholder:R("跳转进度"),icon:"percent",value:S,handleInputChange:t=>{z(t)}}),(0,u.jsx)(a.rA,{icon:"play_arrow",title:R("跳转进度"),onClick:async()=>{k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];let t=0;try{if(t=parseInt(S),t>100||t<0)throw(0,p.zN)("范围在0-100"),"超过最大范围";for(const t of b)A.current.removeChild(t);b=[]}catch(t){return void(0,p.N9)(t)}k.back=t>=100,k.position=Math.floor(k.max_size*(t/100)),await X()}}),(0,u.jsx)(a.rA,{icon:"text_rotate_vertical",title:R("滑动到文件最底部,实时输出"),onClick:async()=>{if(!v){k.line=w,k.context="",k.context_list=[],k.context_position_list=[],k.context_start_position_list=[];for(const t of b)A.current.removeChild(t);b=[],k.back=!0,k.position=k.max_size,await X(),A.current.scrollTop=A.current.scrollHeight,Y(k.max_size)}}})]}),(0,u.jsx)("div",{style:{height:"100%"},children:(0,u.jsx)("div",{ref:A,style:{overflowY:"auto",overflowX:"auto",height:"100%"}})})]})}}}]);
|
|
@@ -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.2.0",null!=U.latest_version&&"7.2.0"!==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.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"}]}])}}]);
|