filecat 6.67.0 → 6.67.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/1149.7da2123c4f08574dd45f.js +1 -0
- package/build/dist/1472.bdc680927c5d2c6cc4c6.js +1 -0
- package/build/dist/2851.299da14729933754cb28.js +1 -0
- package/build/dist/3345.9c2f5ecefdb4d58ac3c1.js +1 -0
- package/build/dist/6805.f2561ba5509cc4e9cadc.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.12d34c2840b242bdc2c4.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/1458.4b7f874b4895f047f85d.js +0 -1
- package/build/dist/1472.26eae5dfbe640bd95007.js +0 -1
- package/build/dist/2851.6570385ed3b21d196648.js +0 -1
- package/build/dist/4273.136e9e07974f8cf908fb.js +0 -1
- package/build/dist/main.0e7ed35ca4d77c86e560.js +0 -2
- /package/build/dist/{main.0e7ed35ca4d77c86e560.js.LICENSE.txt → main.12d34c2840b242bdc2c4.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1458],{91458(e,t,r){r.r(t),r.d(t,{default:()=>Oe});var n=r(96540),s=r(34843),o=r(82893),a=r(85997),c=r(57952),l=r(62042),i=r(53459),u=r(14284),d=r(57889),h=r(86149),m=r(42845),f=r(1575),p=r(89781),g=r(61396),v=r(46762),b=r(73337),k=r(89552),_=r(86059),w=r(58903);const y=(0,_.of)({tableGroup:"block",cellContent:"block+",cellAttributes:{}}),x={align:{default:null}},M={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",attrs:x,parseDOM:[{tag:"p"}],toDOM:e=>["p",e.attrs.align?{style:`text-align:${e.attrs.align}`}:{},0]},heading:{content:"inline*",group:"block",attrs:{level:{default:1},...x},defining:!0,parseDOM:[1,2,3,4,5,6].map(e=>({tag:`h${e}`,attrs:{level:e}})),toDOM(e){const t=e.attrs.align?{style:`text-align:${e.attrs.align}`}:{};return[`h${e.attrs.level}`,t,0]}},bullet_list:{group:"block",content:"list_item+",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},ordered_list:{group:"block",content:"list_item+",attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:e=>({order:Number(e.getAttribute("start")??1)})}],toDOM:e=>1===e.attrs.order?["ol",0]:["ol",{start:e.attrs.order},0]},list_item:{content:"paragraph block*",defining:!0,attrs:{checked:{default:null}},parseDOM:[{tag:"li",getAttrs:e=>{const t=e,r=t.querySelector("input[type=checkbox]");if(r)return{checked:r.checked};const n=t.getAttribute("data-checked");return{checked:null===n?null:"true"===n}}}],toDOM:e=>null!==e.attrs.checked?["li",{"data-checked":String(e.attrs.checked)},0]:["li",0]},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},code_block:{content:"text*",group:"block",marks:"",defining:!0,attrs:{language:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{const t=e.querySelector("code"),r=/language-([\w-]+)/.exec(t?.className??"");return{language:r?r[1]:""}}}],toDOM:e=>["pre",{"data-language":e.attrs.language},["code",0]]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["hr"]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]},image:{inline:!0,group:"inline",draggable:!0,attrs:{src:{},alt:{default:null},title:{default:null}},parseDOM:[{tag:"img[src]",getAttrs:e=>{const t=e;return{src:t.getAttribute("src"),alt:t.getAttribute("alt"),title:t.getAttribute("title")}}}],toDOM(e){const{src:t,alt:r,title:n}=e.attrs,s={src:t};return r&&(s.alt=r),n&&(s.title=n),["img",s]}},text:{group:"inline"},...y},$={strong:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight=bold"}],toDOM:()=>["strong",0]},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]},strike:{parseDOM:[{tag:"s"},{tag:"del"},{tag:"strike"}],toDOM:()=>["s",0]},code:{parseDOM:[{tag:"code",getAttrs:e=>"PRE"!==e.parentElement?.tagName&&null}],toDOM:()=>["code",0]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:e=>{const t=e;return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(e){const{href:t,title:r}=e.attrs;return["a",{href:t,title:r,rel:"noopener noreferrer",target:"_blank"},0]}}},S=new w.Sj({nodes:M,marks:$});const j=new(r(22091).A)({html:!0,linkify:!0,breaks:!1,typographer:!1});function E(e){const t=j.render(e??""),r=document.createElement("div");return r.innerHTML=t,w.S4.fromSchema(S).parse(r)}function D(e){let t="";return e.forEach(e=>{if(e.isText){let r=e.marks.some(e=>"code"===e.type.name)?e.text??"":function(e){return e.replace(/([\\`*_[\]<>])/g,"\\$1")}(e.text??"");for(const t of e.marks)switch(t.type.name){case"code":r=`\`${e.text??""}\``;break;case"strong":r=`**${r}**`;break;case"em":r=`*${r}*`;break;case"strike":r=`~~${r}~~`;break;case"link":r=`[${r}](${t.attrs.href}${t.attrs.title?` "${t.attrs.title}"`:""})`}t+=r}else if("image"===e.type.name){const{src:r,alt:n,title:s}=e.attrs;t+=``}else"hard_break"===e.type.name&&(t+=" \n")}),t}function A(e){const t=[];if(e.forEach(e=>{const r=[],n=[];e.forEach(e=>{var t;r.push((t=e.textContent,t.replace(/\|/g,"\\|").replace(/\n/g," ")).trim()),n.push("table_header"===e.type.name)}),t.push({cells:r,header_flags:n})}),0===t.length)return"";const r=Math.max(...t.map(e=>e.cells.length)),n=t[0].header_flags.some(e=>e),s=Array.from({length:r},(e,r)=>Math.max(3,...t.map(e=>O(e.cells[r]??"")))),o=e=>`| ${Array.from({length:r},(t,r)=>{return n=e[r]??"",o=s[r],n+" ".repeat(Math.max(0,o-O(n)));var n,o}).join(" | ")} |`,a=[];if(n){a.push(o(t[0].cells)),a.push(`| ${s.map(e=>"-".repeat(e)).join(" | ")} |`);for(let e=1;e<t.length;e++)a.push(o(t[e].cells))}else{a.push(o(new Array(r).fill(""))),a.push(`| ${s.map(e=>"-".repeat(e)).join(" | ")} |`);for(const e of t)a.push(o(e.cells))}return a.join("\n")}function O(e){let t=0;for(const r of e){const e=r.codePointAt(0)??0;t+=e>=4352&&e<=4447||e>=11904&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510?2:1}return t}function C(e,t=""){switch(e.type.name){case"paragraph":default:return t+D(e);case"heading":return`${t}${"#".repeat(e.attrs.level)} ${D(e)}`;case"blockquote":return L(e,"").split("\n").map(e=>`${t}> ${e}`).join("\n");case"code_block":{const r=e.attrs.language??"";return`${t}\`\`\`${r}\n${e.textContent}\n${t}\`\`\``}case"horizontal_rule":return`${t}---`;case"bullet_list":{const r=[];return e.forEach((e,n,s)=>{r.push(N(e,t,`${t}- `,`${t} `,s))}),r.join("\n")}case"ordered_list":{const r=[],n=e.attrs.order??1;return e.forEach((e,s,o)=>{r.push(N(e,t,`${t}${n+o}. `,`${t} `,o))}),r.join("\n")}case"table":return A(e).split("\n").map(e=>t+e).join("\n")}}function N(e,t,r,n,s){const o=e.attrs.checked,a=null===o?"":o?"[x] ":"[ ] ",c=[];e.forEach((e,t,r)=>{c.push(C(e,0===r?"":n))});const l=c.join("\n").split("\n");return r+a+l[0]+(l.length>1?"\n"+l.slice(1).join("\n"):"")}function L(e,t=""){const r=[];return e.forEach(e=>{r.push(C(e,t))}),r.join("\n\n")}function R(e){return L(e).trim()+"\n"}var z=r(74848);function q(e){const{t}=(0,h.B)(),[r,s]=(0,n.useState)(new Set),o=(0,n.useMemo)(()=>function(e){const t=[],r=[];for(const n of e){const e={...n,children:[]};for(;r.length>0&&r[r.length-1].level>=e.level;)r.pop();0===r.length?t.push(e):r[r.length-1].children.push(e),r.push(e)}return t}(e.items),[e.items]),a=(n,o)=>n.map(n=>{const c=n.children.length>0,l=r.has(n.pos),i=n.pos===e.active_pos;return(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:`md-outline-item md-outline-item--h${n.level}${i?" md-outline-item--active":""}`,style:{paddingLeft:.4+.75*o+"em"},title:n.text,onClick:()=>e.on_click(n),children:[(0,z.jsx)("i",{className:"material-icons md-outline-arrow"+(c?"":" md-outline-arrow--empty"),onClick:c?e=>{return t=n.pos,e.stopPropagation(),void s(e=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r});var t}:void 0,children:c?l?"arrow_right":"arrow_drop_down":""}),(0,z.jsx)("span",{className:"md-outline-text",children:n.text||t("未命名标题")})]}),c&&!l&&a(n.children,o+1)]},n.pos)});return 0===e.items.length?(0,z.jsxs)("div",{className:"md-outline md-outline--empty",children:[(0,z.jsx)("div",{className:"md-outline-header",children:t("大纲")}),(0,z.jsx)("div",{className:"md-outline-tip",children:t("正文里还没有标题")})]}):(0,z.jsxs)("div",{className:"md-outline",children:[(0,z.jsx)("div",{className:"md-outline-header",children:t("大纲")}),(0,z.jsx)("div",{className:"md-outline-list",children:a(o,0)})]})}var I=r(38341),T=r(3772);function B(){const e=S;return(0,I.sM)({rules:[(0,I.JJ)(/^(#{1,6})\s$/,e.nodes.heading,e=>({level:e[1].length})),(0,I.JJ)(/^```([\w-]*)\s$/,e.nodes.code_block,e=>({language:e[1]??""})),(0,I.tG)(/^\s*>\s$/,e.nodes.blockquote),(0,I.tG)(/^\s*([-+*])\s$/,e.nodes.bullet_list),(0,I.tG)(/^(\d+)\.\s$/,e.nodes.ordered_list,e=>({order:Number(e[1])})),...I.Fr,I.gO]})}function P(e){return(t,r)=>{const n=t.schema.marks[e];return!!n&&(0,v.wh)(n)(t,r)}}function W(e,t={}){return(r,n)=>{const s=r.schema.nodes[e];if(!s)return!1;const{$from:o,$to:a}=r.selection,c=o.blockRange(a);if(!c)return!1;const l=o.parent,i=l.type===s&&Object.entries(t).every(([e,t])=>l.attrs[e]===t),u=i?r.schema.nodes.paragraph:s,d=i?{}:t;return n&&n(r.tr.setBlockType(c.start,c.end,u,d)),!0}}const F=(e,t)=>(0,T.Sd)(e.schema.nodes.bullet_list)(e,t),G=(e,t)=>(0,T.Sd)(e.schema.nodes.ordered_list)(e,t),H=(e,t)=>{const{blockquote:r}=e.schema.nodes,{$from:n,$to:s}=e.selection,o=n.blockRange(s);if(!o)return!1;if(o.parent.type===r&&o.depth>0){const r=n.before(o.depth),s=e.tr.doc.nodeAt(r);if(s&&1===s.childCount)return t&&t(e.tr.replaceWith(r,r+s.nodeSize,s.child(0)).scrollIntoView()),!0;if(t){const r=e.tr,s=n.parent,a=n.after(o.depth);r.delete(o.start,o.end),r.insert(a,s),t(r.scrollIntoView())}return!0}return t&&t(e.tr.wrap(o,[{type:r}]).scrollIntoView()),!0},U={sink:(0,T.$B)(S.nodes.list_item),lift:(0,T.T2)(S.nodes.list_item),split:(0,T.wn)(S.nodes.list_item),wrap_bullet:F,wrap_ordered:G};r(41631),r(50576),r(70432);function V(e){return 0===e?W("paragraph"):W("heading",{level:e})}function J(e){return!(!e.ctrlKey&&!e.metaKey)}function K(e,t){return(0,_.D8)(1)(e,t)}const X=n.forwardRef(function(e,t){const r=(0,n.useRef)(null),s=(0,n.useRef)(null),o=(0,n.useRef)(e.on_change),a=(0,n.useRef)(e.on_save),c=(0,n.useRef)(e.on_selection_change);return(0,n.useEffect)(()=>{o.current=e.on_change,a.current=e.on_save,c.current=e.on_selection_change}),(0,n.useEffect)(()=>{if(!r.current)return;const n=m.$t.create({doc:E(e.value??""),plugins:[B(),(0,g.w)({"Mod-b":P("strong"),"Mod-i":P("em"),"Mod-Shift-x":P("strike"),"Mod-`":P("code"),"Mod-1":(e,t)=>V(1)(e,t),"Mod-2":(e,t)=>V(2)(e,t),"Mod-3":(e,t)=>V(3)(e,t),"Mod-0":(e,t)=>V(0)(e,t),"Mod-Shift-8":F,"Mod-Shift-9":G,"Mod-Shift-.":H,Tab:U.sink,"Shift-Tab":U.lift,"Mod-Enter":K,"Mod-s":()=>(a.current?.(),!0)}),(0,_.LF)({allowTableNodeSelection:!0}),(0,_.AL)(),(0,b.A)({color:"var(--primary, #1a73e8)",width:2}),(0,k.z)(),(0,p.b6)(),(0,g.w)({Enter:(0,v.st)(v.pC,U.split,v.Z1,v.iz,v.aw),"Shift-Enter":(e,t)=>{const{hard_break:r}=e.schema.nodes;return t&&t(e.tr.replaceSelectionWith(r.create()).scrollIntoView()),!0},"Mod-Enter":v.I$}),(0,g.w)(v.RV)]}),l=new f.Lz(r.current,{state:n,editable:()=>!1!==e.editable,handleClickOn(e,t,r,n,s){if(!J(s))return!1;const o=function(e){if(!(e instanceof Element))return null;const t=e.closest("a[href]"),r=t?.getAttribute("href");return r||null}(s.target)??function(e,t){const r=e.doc.content.size,n=Math.max(0,Math.min(t,r));let s;try{s=e.doc.resolve(n)}catch{return null}for(const t of[1,-1]){const s=1===t?n:n-1;if(!(s<0||s>=r))try{const t=e.doc.resolve(s).marks().find(e=>"link"===e.type.name);if(t?.attrs?.href)return t.attrs.href}catch{}}try{const e=s.parent.marks.find(e=>"link"===e.type.name);if(e?.attrs?.href)return e.attrs.href}catch{}return null}(e.state,t);return!!o&&(window.open(o,"_blank","noopener,noreferrer"),!0)},handleDOMEvents:{keydown:(e,t)=>(J(t)&&e.dom.classList.add("md-ctrl-down"),!1),keyup:(e,t)=>(J(t)||e.dom.classList.remove("md-ctrl-down"),!1),blur:e=>(e.dom.classList.remove("md-ctrl-down"),!1)},dispatchTransaction(e){const t=l.state.apply(e);l.updateState(t),e.docChanged&&o.current?.(R(t.doc)),(e.selectionSet||e.docChanged)&&c.current?.()},attributes:{class:"md-wysiwyg-content",spellcheck:"false"}});s.current=l;const i={get_markdown:()=>R(l.state.doc),set_markdown:e=>{const t=E(e);l.dispatch(l.state.tr.replaceWith(0,l.state.doc.content.size,t.content))},focus:()=>l.focus(),get_view:()=>s.current,in_table:()=>function(e){const{$from:t}=e.selection;for(let e=t.depth;e>0;e--){if("table"===t.node(e).type.name)return!0}return!1}(l.state),active_marks:()=>(l.state.storedMarks??l.state.selection.$from.marks()).map(e=>e.type.name),active_block:()=>{const{$from:e}=l.state.selection;for(let t=e.depth;t>0;t--){const r=e.node(t);if("heading"===r.type.name)return{name:"heading",level:r.attrs.level};if("paragraph"===r.type.name)return{name:"paragraph"}}return{name:"paragraph"}},insert_table:(e=3,t=3)=>{const r=function(e,t,r){const n=(0,_.e)(e),s=n.table,o=n.row,a=n.cell,c=n.header_cell??n.cell;if(!s||!o||!a)return null;const l=e=>o.create(null,Array.from({length:t},()=>e.createAndFill())),i=l(c),u=Array.from({length:r},()=>l(a));return s.create(null,[i,...u])}(l.state.schema,e,t);if(!r)return;const{from:n}=l.state.selection,s=l.state.doc.resolve(n);let o=n;for(let e=s.depth;e>0;e--)if("table"===s.node(e).type.name){o=s.after(e);break}const a=l.state.tr;o===n?a.replaceSelectionWith(r):a.insert(o,r),l.dispatch(a.scrollIntoView());const c=l.state.doc.resolve(Math.min(o+3,l.state.doc.content.size));try{l.dispatch(l.state.tr.setSelection(l.state.selection.constructor.near(c)))}catch{}},get_headings:()=>function(e){const t=[];return e.doc.descendants((e,r)=>("heading"!==e.type.name||t.push({level:e.attrs.level,text:e.textContent,pos:r}),!0)),t}(l.state),scroll_to_pos:e=>{const t=l.state.doc.content.size,r=Math.max(0,Math.min(e,t)),n=l.state.doc.nodeAt(r);let s;try{s=n?m.U3.near(l.state.doc.resolve(r+1),1):m.U3.near(l.state.doc.resolve(r),1)}catch{s=m.U3.near(l.state.doc.resolve(0),1)}l.dispatch(l.state.tr.setSelection(s).scrollIntoView()),l.focus()}};return"function"==typeof t?t(i):t&&(t.current=i),e.on_ready?.(i),()=>{l.destroy(),s.current=null}},[]),(0,z.jsx)("div",{className:"md-wysiwyg",ref:r})});function Y(e){const{t}=(0,h.B)(),r=(0,n.useRef)(null),[s,o]=(0,n.useState)({marks:[],block:{name:"paragraph"}}),[a,c]=(0,n.useState)(null),l=(0,n.useCallback)(()=>{const t=e.get_view();if(!t)return;const r=t.state.selection,n=t.state.storedMarks??r.$from.marks();if(o({marks:n.map(e=>e.type.name),block:Z(r.$from)}),r.empty)return void c(null);const s=t.coordsAtPos(r.from),a=t.coordsAtPos(r.to),l=(Math.min(s.left,a.left)+Math.max(s.right,a.right))/2,i=Math.min(s.top,a.top),u=Math.max(s.bottom,a.bottom);c({top:i,bottom:u,left:l})},[e.get_view]);(0,n.useEffect)(()=>{l();const t=e.get_view();if(!t)return;const r=()=>l();t.dom.addEventListener("keyup",r),t.dom.addEventListener("mouseup",r),document.addEventListener("selectionchange",r);const n=t.dom.closest(".md-editor-context");return n?.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{t.dom.removeEventListener("keyup",r),t.dom.removeEventListener("mouseup",r),document.removeEventListener("selectionchange",r),n?.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[l,e.get_view,e.refresh_key]);const i=t=>{const r=e.get_view();r&&(t(r.state,r.dispatch),r.focus(),l())},u=e=>s.marks.includes(e),d=e=>"heading"===s.block.name&&s.block.level===e,[m,f]=(0,n.useState)({w:0,h:36});if((0,n.useLayoutEffect)(()=>{if(!a||!r.current)return;const e=r.current.offsetWidth,t=r.current.offsetHeight;f(r=>r.w===e&&r.h===t?r:{w:e,h:t})},[a,e.refresh_key]),!a)return null;const p=(e,r,n,s,o=!1)=>(0,z.jsx)("button",{className:"mdtb__btn"+(o?" mdtb__btn--on":""),title:t(n),onMouseDown:e=>e.preventDefault(),onClick:s,children:r},e),g=m.w/2,v=g+4,b=Math.max(v,window.innerWidth-g-4),k=document.querySelector(".header")?.getBoundingClientRect().bottom??0,_=a.top-m.h-8,w=_<k+4,y={top:w?Math.min(a.bottom+8,window.innerHeight-m.h-4):_,left:Math.min(b,Math.max(v,a.left))};return(0,z.jsxs)("div",{className:"mdtb mdtb--floating"+(w?" mdtb--below":""),ref:r,style:y,children:[p("h1","H1","一级标题",()=>i(W("heading",{level:1})),d(1)),p("h2","H2","二级标题",()=>i(W("heading",{level:2})),d(2)),p("h3","H3","三级标题",()=>i(W("heading",{level:3})),d(3)),(0,z.jsx)("span",{className:"mdtb__sep"}),p("b","B","加粗",()=>i(P("strong")),u("strong")),p("i","I","斜体",()=>i(P("em")),u("em")),p("s","S","删除线",()=>i(P("strike")),u("strike")),p("code","</>","行内代码",()=>i(P("code")),u("code")),(0,z.jsx)("span",{className:"mdtb__sep"}),p("ul","≔","无序列表",()=>i(F)),p("ol","1.","有序列表",()=>i(G)),p("quote","❝","引用",()=>i(H))]})}function Z(e){for(let t=e.depth;t>0;t--){const r=e.node(t).type.name;if("heading"===r)return{name:"heading",level:e.node(t).attrs.level};if("paragraph"===r)return{name:"paragraph"}}return{name:"paragraph"}}var Q=r(75725);const ee="cut",te="copy",re="paste",ne="strong",se="em",oe="strike",ae="code",ce="h1",le="h2",ie="h3",ue="paragraph",de="bullet",he="ordered",me="quote",fe="code_block",pe="clean",ge="row_before",ve="row_after",be="row_delete",ke="col_before",_e="col_after",we="col_delete",ye="header_toggle",xe="cell_merge",Me="cell_split",$e="table_delete",Se="table_insert",je="select_all";function Ee(e){const{t}=(0,h.B)(),[r,s]=(0,n.useState)(null),o=(0,n.useRef)(e.get_view);o.current=e.get_view,(0,n.useEffect)(()=>{const e=e=>{const t=o.current();if(!t)return;const r=e.target;if(!r||!r.closest(".md-wysiwyg-content"))return;e.preventDefault();const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(n){const e=t.state.selection;if(n.pos<e.from||n.pos>e.to){const{TextSelection:e}=t.state.selection.constructor;try{t.dispatch(t.state.tr.setSelection(e.near(t.state.doc.resolve(n.pos))))}catch{}}}const a=!!r.closest("td, th");s({x:e.clientX,y:e.clientY,in_table:a||(0,_.aH)(t.state)})};return document.addEventListener("contextmenu",e,!0),()=>document.removeEventListener("contextmenu",e,!0)},[]);const a=()=>s(null),c=(0,n.useCallback)(e=>{const t=o.current();t&&(e(t.state,t.dispatch),t.focus(),a())},[]),l=e=>{const t=o.current();t?.focus(),document.execCommand(e),a()};if(!r)return null;const i=r.in_table?[{r:t("上方插入行"),v:ge},{r:t("下方插入行"),v:ve},{r:t("左侧插入列"),v:ke},{r:t("右侧插入列"),v:_e},{r:t("删除行"),v:be},{r:t("删除列"),v:we},{r:t("切换表头行"),v:ye},{r:t("合并单元格"),v:xe},{r:t("拆分单元格"),v:Me},{r:t("删除表格"),v:$e}]:[],u=[{r:t("剪切"),v:ee},{r:t("复制"),v:te},{r:t("粘贴"),v:re},{r:t("格式"),v:"format",items:[{r:t("加粗"),v:ne},{r:t("斜体"),v:se},{r:t("删除线"),v:oe},{r:t("行内代码"),v:ae}]},{r:t("段落"),v:"block",items:[{r:t("一级标题"),v:ce},{r:t("二级标题"),v:le},{r:t("三级标题"),v:ie},{r:t("正文"),v:ue}]},{r:t("插入"),v:"insert",items:[{r:t("无序列表"),v:de},{r:t("有序列表"),v:he},{r:t("引用"),v:me},{r:t("代码块"),v:fe},{r:t("插入表格"),v:Se}]},...i.length?[{r:t("表格"),v:"table",items:i}]:[],{r:t("清除格式"),v:pe},{r:t("全选"),v:je}];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Q.rY,{click:a}),(0,z.jsx)(Q.Pu,{x:r.x,y:r.y,items:u,click:t=>{switch(t){case ee:return l("cut");case te:return l("copy");case re:return l("paste");case ne:return c(P("strong"));case se:return c(P("em"));case oe:return c(P("strike"));case ae:return c(P("code"));case ce:return c(W("heading",{level:1}));case le:return c(W("heading",{level:2}));case ie:return c(W("heading",{level:3}));case ue:return c(W("paragraph"));case de:return c(F);case he:return c(G);case me:return c(H);case fe:return c(W("code_block"));case Se:return a(),void e.on_insert_table?.();case ge:return c(_.JD);case ve:return c(_.gC);case ke:return c(_.RC);case _e:return c(_.GU);case be:return c(_.aR);case we:return c(_.gR);case ye:return c(_.uC);case xe:return c(_.w7);case Me:return c(_.L0);case $e:return c(_.kG);case pe:return c((e,t)=>{const{from:r,to:n}=e.selection;let s=e.tr;return e.doc.nodesBetween(r,n,(e,t)=>{if(e.isText)for(const r of e.marks)s=s.removeMark(t,t+e.nodeSize,r.type)}),t?.(s),!0});case je:return c((e,t)=>{const{TextSelection:r}=e.selection.constructor;return t?.(e.tr.setSelection(r.create(e.doc,0,e.doc.content.size))),!0})}}})]})}var De=r(2543);const Ae="md_editor_show_outline";function Oe(){const{t:e}=(0,h.B)(),[t,r]=(0,s.fp)(o.AG.md_editor),[m,f]=(0,n.useState)(null),[p,g]=(0,n.useState)(!1),[v,b]=(0,n.useState)(!1),[k,_]=(0,n.useState)(0),w=(0,n.useRef)(null),[y,x]=(0,n.useState)([]),[M,$]=(0,n.useState)(-1),[S,j]=(0,n.useState)(15),[E,D]=(0,n.useState)(!1),A=(0,n.useRef)(null),O=(0,n.useRef)(null),[C,N]=(0,n.useState)(()=>{try{return"1"===localStorage.getItem(Ae)}catch(e){return!1}}),L=(0,n.useRef)([]),R=(0,n.useCallback)(()=>{const e=w.current;if(!e)return;const t=e.get_headings();L.current=t,x(t)},[]),I=(0,n.useCallback)(()=>{const e=w.current?.get_view();if(!e)return;const t=e.state.selection.from;let r=-1;for(const e of L.current){if(!(e.pos<=t))break;r=e.pos}$(r)},[]);(0,n.useEffect)(()=>{let r=!1;if(t?.url)return b(!1),g(!0),d.l.get(t.url).then(e=>{r||f(e??"")}).catch(()=>{r||((0,l.zN)(e("打开失败")),f(""))}).finally(()=>{r||g(!1)}),()=>{r=!0};f(null)},[t?.url]),(0,n.useEffect)(()=>{const e=()=>_(e=>e+1);return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[]),(0,n.useEffect)(()=>{R(),I()},[k,R,I]);const T=(0,n.useCallback)(De.throttle(e=>{if(!A.current||!O.current)return;const t=parseFloat(getComputedStyle(A.current).fontSize),r=e.clientX/t,n=window.innerWidth/t-4,s=2.25+O.current.offsetWidth/t;r<=n&&r>=s&&j(parseFloat(r.toFixed(2)))},32),[]),B=()=>{D(!1),A.current?.removeEventListener("pointermove",T)},P=async()=>{if(!t?.name||!t?.path||!w.current)return;const r=w.current.get_markdown(),n=t.path.slice(0,t.path.length-t.name.length),s=`${encodeURIComponent(n)}${t.name}`;(await u.$M.post(`save/${s}`,{context:r})).code===i.m.Success?(b(!1),(0,l.SK)(e("保存成功"))):(0,l.zN)(e("保存失败"))},W=(0,n.useRef)(P);W.current=P;const F=(0,n.useMemo)(()=>t?.url??"md_editor",[t?.url]);return t?.name?(0,z.jsxs)("div",{id:"md-editor-container",children:[(0,z.jsx)(c.A,{ignore_tags:!0,left_children:[(0,z.jsx)(a.rA,{title:e("关闭"),icon:"close",onClick:()=>{r({}),b(!1),f(null),w.current=null,t?.close?.()}},1),...v?[(0,z.jsx)(a.rA,{title:e("保存"),icon:"save",onClick:P},2)]:[],(0,z.jsx)(a.rA,{title:e("大纲"),icon:"list",onClick:()=>{N(e=>{const t=!e;try{localStorage.setItem(Ae,t?"1":"0")}catch(e){}return t})},selected:C},4),(0,z.jsx)("title",{children:t.name},3)]}),(0,z.jsxs)("div",{className:"md-editor-context",ref:A,children:[p&&(0,z.jsxs)("div",{className:"common-box common-box-center",children:[e("加载中"),"..."]}),!p&&null!==m&&(0,z.jsxs)(n.Fragment,{children:[C&&(0,z.jsx)("div",{className:"md-outline-panel",style:{width:`${S}em`},children:(0,z.jsx)(q,{items:y,active_pos:M,on_click:e=>{w.current?.scroll_to_pos(e.pos),$(e.pos)}})}),C&&(0,z.jsx)("div",{className:"md-editor-divider",ref:O,onPointerDown:()=>{D(!0),A.current?.addEventListener("pointermove",T)},onPointerUp:B}),E&&(0,z.jsx)("div",{className:"md-editor-drag-overlay",onPointerUp:B}),(0,z.jsx)("div",{className:"md-editor-scroll",children:(0,z.jsxs)("div",{className:"md-editor-sheet",children:[(0,z.jsx)(Y,{get_view:()=>w.current?.get_view()??null,refresh_key:k}),(0,z.jsx)(X,{value:m,ref:w,on_ready:e=>{const t=e.get_headings();L.current=t,x(t),$(-1)},on_change:()=>{v||b(!0)},on_save:()=>W.current(),on_selection_change:()=>_(e=>e+1)},F),(0,z.jsx)(Ee,{get_view:()=>w.current?.get_view()??null,on_insert_table:()=>{w.current?.insert_table(3,3),b(!0)}})]})})]})]})]}):null}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[1472],{77481(e,t,s){s.d(t,{S:()=>a,X:()=>o});var n=s(96540),i=s(61443),l=s(74848);function o(e){const[t,s]=n.useState([]),o=(0,n.useRef)(-1),[a,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=()=>{o.current=-1,r(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,s)=>{const n=!!e.filter&&(e.filter.column??0)===s;let o=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(o=`${t} (${n.label})`)}return(0,l.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,l.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:o}):t},s)})})}),(0,l.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,l.jsx)("tr",{className:n?(a===s?"row-dragging":"")+(c===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(o.current=s,r(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||o.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=o.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,l.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function a(e){return(0,l.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,l.jsx)("div",{children:e},t))})}},61472(e,t,s){s.r(t),s.d(t,{default:()=>D});var n=s(96540),i=s(75725),l=s(23430),o=s(70447),a=s(85997),r=s(61443),c=s(14284),d=s(53459),h=s(77481),u=s(86149),p=s(82893),_=s(40505),x=s(62042),m=s(21499),j=s(21469),v=s(64694),f=s(74848);function g(e){const{t}=(0,u.B)(),[s,l]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{if(e.getItems){const t=await e.getItems();l(t)}})()},[]);return(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e.title}),e.info_click&&(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{e.info_click()},title:"信息"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:t("添加"),onClick:()=>{const t=[];for(let s=0;s<e.headers.length-1;s++)t.push("");l([t,...s])}}),(0,f.jsx)(a.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 o=[];for(let t=0;t<e.headers.length;t++)o.push((0,f.jsx)(r.Sm,{value:n[t],handleInputChange:e=>{n[t]=e,l([...s])},no_border:!0}));return o.push((0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{s.splice(e,1),l([...s])})(i)}),n[0]&&(0,f.jsx)(a.rA,{icon:"content_copy",title:t("复制地址"),onClick:()=>{const e=(0,m.bi)(`${window.location.origin}${j.m.base_url}`,n[0]);(0,_.lW)(e),(0,x.SK)(e)}}),n[0]&&e.need_copy&&(0,f.jsx)(a.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)}})]})),o}),width:"10rem",onRowDrag:(e,t)=>{l((0,v.TI)(s,e,t))}})})})}var w=s(34843),S=s(78247),C=s(24659);function y(){const{t:e}=(0,u.B)(),[t,s]=(0,w.fp)(p.AG.prompt_card),l=(0,C.K)(),g=[e("路由"),e("auth"),e("备注")],[y,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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自定义api路由")})," ",(0,f.jsx)(a.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)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{A([{note:"",needAuth:!1,router:""},...b])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("api/customer_router/save",b)).code===d.m.Success&&(0,x.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:l,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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),A([...b])})(s)}),(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(async e=>{if(!e.router)return void(0,x.zN)("路由不能为空");const t=await c.XO.get(`jscode/${encodeURIComponent(e.router)}`);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,x.SK)("成功"))}}),S.xK.set_value_temp(t.data)})(t)}),t.router&&(0,f.jsx)(a.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{(0,_.lW)((0,m.bi)(window.location.origin+j.m.base_url,t.router)),(0,x.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),[l,o]=(0,w.fp)(p.AG.router_jump),a=[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,{children:[(0,f.jsx)(g,{title:e("页面资源路由"),headers:a,getItems:async()=>{const e=await c.XO.get(k.s.setting_customer_router);if(e.code===d.m.Success){if(l?.page_self_router_api_data){for(const t of e.data)t[1]===l?.page_self_router_api_data[1]&&(0,x.N9)("已经存在的页面资源路由配置目录设置");const t={};Object.assign(t,l?.page_self_router_api_data),e.data=[t,...e.data],o({})}return e.data}return[]},save:async e=>{(await c.XO.post(k.s.setting_customer_router_save,e)).code===d.m.Success&&(0,x.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("workflow触发路由"),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,x.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,{children:(0,f.jsx)(y,{})})]})]})}var I=s(74777),V=s(6960),X=s(7523);function N(){const{t:e}=(0,u.B)(),{check_user_auth:t}=(0,S.MH)(),[s,i]=(0,n.useState)(!1),[h,_]=(0,n.useState)("https://registry.npmjs.org"),[m,j]=(0,n.useState)(""),[v,g]=(0,n.useState)(180),[C,y]=(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),_(t.version_check_url||"https://registry.npmjs.org"),j(t.exe_download_url||""),g(t.check_interval_seconds||180)}})()},[]);return t(l.oV.sys_setting_page)?(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("自动升级")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{b({open:!0,title:e("信息"),context_div:(0,f.jsx)("div",{children:e("自动升级在 windows 下目前可能不稳定")})})},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("保存"),clickFun:async()=>{if(!h)return void(0,x.zN)(e("版本检测地址不能为空"));if(s&&(!v||v<10))return void(0,x.zN)(e("检测间隔不能小于10秒"));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,x.SK)(e("保存成功"))}}),children:[(0,f.jsx)("div",{children:e("系统版本检测地址")}),(0,f.jsx)(r.Sm,{placeholder:"https://registry.npmjs.org",value:h,handleInputChange:e=>{_(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("默认180秒(3分钟)"),value:v,handleInputChange:e=>{g(Number(e)||180)}}),(0,f.jsx)("div",{style:{marginTop:"12px"},children:(0,f.jsx)(a.C3,{text:e(C?"升级检测中...":"立即升级"),clickFun:async()=>{y(!0);try{(await c.XO.post("auto_upgrade_setting/upgrade_now",{})).code===d.m.Success&&(0,x.SK)(e("已触发升级检测,请查看服务端日志"))}catch(t){(0,x.zN)(e("触发升级失败"))}finally{y(!1)}}})})]})]}):null}function O(){const[e,t]=(0,n.useState)(""),[s,l]=(0,n.useState)(""),[_,m]=(0,n.useState)(!1),[j,v]=(0,n.useState)(""),[g,C]=(0,n.useState)(!1),[y,A]=(0,n.useState)(""),[O,F]=(0,w.fp)(p.AG.prompt_card),[K,z]=(0,n.useState)(!1),[P,B]=(0,n.useState)(""),[T,M]=(0,n.useState)(""),[$,D]=(0,n.useState)(I.aM.close),[E,G]=(0,n.useState)(!1),[H,R]=(0,n.useState)(void 0),{t:q,i18n:U}=(0,u.B)(),[Z,W]=(0,w.fp)(p.AG.user_base_info),{check_user_auth:L}=(0,S.MH)(),{initUserInfo:Q}=(0,n.useContext)(X.F);(0,n.useEffect)(()=>{(async()=>{const e=await c.XO.get("sys_option/status");if(e.code===d.m.Success){C(e.data.recycle_open),A(e.data.recycle_dir);const s=e.data.sys_env;t(s?.web_site_title),l(s?.logo||""),m(s?.show_login_user_info),v(s?.http_proxy||"");const n=e.data.https_setting;n&&(z(n.open),B(n.cert_path||""),M(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&&R(e.length),e.mode&&D(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:[q("系统运行于"),": ",(0,V.s)(Z.runing_time_length)]}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsxs)("a",{href:"https://github.com/xiaobaidadada/filecat",target:"_blank",children:["version:6.67.0",null!=Z.latest_version&&"6.67.0"!==Z.latest_version?` -> ${Z.latest_version}`:""]})}),(0,f.jsx)("span",{className:"credits",children:(0,f.jsx)("a",{href:q("官网地址"),target:"_blank",children:`filecat ${q("功能文档")}`})}),(0,f.jsxs)("span",{className:"credits",children:[q("安装方式")," :",Z.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)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:q("通用设置")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{F({open:!0,title:q("信息"),context_div:(0,f.jsx)("div",{children:q("HTTP 代理说明")})})},title:q("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),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:_,http_proxy:j,logo:s}})).code===d.m.Success&&((0,x.SK)("修改成功"),Q())}}),children:[q("网站标题"),(0,f.jsx)(r.Sm,{value:e,handleInputChange:e=>{t(e)}}),q("网站 Logo"),(0,f.jsx)(r.Sm,{placeholder:q("本地文件路径或 http(s) 图片地址"),value:s,handleInputChange:e=>{l(e)}}),(0,f.jsx)("div",{children:q("HTTP 代理地址")}),(0,f.jsx)(r.Sm,{placeholder:"http://127.0.0.1:7890",value:j,handleInputChange:e=>{v(e)}}),q("登陆展示用户信息"),(0,f.jsx)("input",{type:"checkbox",checked:_,onChange:()=>{m(!_)}})]}),(0,f.jsxs)(o.Zp,{title:q("HTTPS 设置"),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),clickFun:async()=>{if(K){if(!P)return void(0,x.zN)("证书路径不能为空");if(!T)return void(0,x.zN)("私钥路径不能为空")}const e=new I.CH;e.open=K,e.cert_path=P,e.key_path=T;(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.https,value:e,open:K})).code===d.m.Success&&(0,x.SK)("HTTPS 设置已保存,需重启服务器才能生效")}}),children:[(0,f.jsx)(r.l6,{value:K,onChange:e=>{z(e)},options:[{title:q("开启"),value:!0},{title:q("关闭"),value:!1}]}),K&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{children:q("SSL 证书路径")}),(0,f.jsx)(r.Sm,{placeholder:q("证书文件路径(cert.pem/fullchain.pem)"),value:P,handleInputChange:e=>{B(e)}}),(0,f.jsx)("div",{children:q("SSL 私钥路径")}),(0,f.jsx)(r.Sm,{placeholder:q("私钥文件路径(privkey.pem)"),value:T,handleInputChange:e=>{M(e)}})]})]}),(0,f.jsx)(N,{})]}),(0,f.jsxs)(i.VP,{widthPer:33,children:[(0,f.jsxs)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:q("文件回收站")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{F({open:!0,title:q("信息"),context_div:(0,f.jsx)("div",{children:q("格式:[被删除的文件所在父目录] 回收站目录 [; ...]")})})},title:q("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:q("确定修改"),clickFun:async()=>{if(g&&!y)return void(0,x.zN)("目录不能为空");(await c.XO.post(k.s.setting_sys_option_status_save,{type:I.Mu.cyc,value:y,open:g})).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:q("目录"),value:y,handleInputChange:e=>{A(e)}}),(0,f.jsx)(r.l6,{value:g,onChange:e=>{C(e)},options:[{title:q("开启"),value:!0},{title:q("关闭"),value:!1}]})]}),(0,f.jsxs)(o.Zp,{title:q("token过期时间"),rightBottomCom:(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(a.C3,{text:q("清空token"),clickFun:async()=>{(await c.XO.get("token/clear")).code===d.m.Success&&(0,x.SK)("清理完成,重新登录")}}),(0,f.jsx)(a.C3,{text:q("保存"),clickFun:async()=>{const e=new I.Gd;e.mode=$,e.persist=E,I.aM.length!==e.mode||H||(0,x.zN)("秒数不能为空"),e.length=parseInt(H);(await c.XO.post("token/save",e)).code===d.m.Success&&(0,x.SK)("保存成功")}})]}),children:[(0,f.jsx)(h.S,{isFlex:!0,columns:[(0,f.jsx)(r.U6,{value:1,context:q("关闭"),selected:$===I.aM.close,onchange:()=>{D(I.aM.close)}}),(0,f.jsx)(r.U6,{value:1,context:q("指定时间"),selected:$===I.aM.length,onchange:()=>{D(I.aM.length)}}),(0,f.jsx)(r.U6,{value:1,context:q("永不过期"),selected:$===I.aM.forver,onchange:()=>{D(I.aM.forver)}})]}),$===I.aM.length&&(0,f.jsx)(r.Sm,{placeholder:q("秒"),value:H,handleInputChange:e=>{R(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)}),q("持久化")]})]})]})]})})]})}var F=s(92350);function K(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:l}=(0,n.useContext)(X.F),[_,m]=(0,n.useState)([]),[j,g]=(0,n.useState)([]),[y,k]=(0,w.fp)(p.AG.prompt_card),[,b]=(0,w.fp)(p.AG.editorSetting),[A,I]=(0,n.useState)([]),[V,N]=(0,n.useState)([]),[O,K]=(0,n.useState)([]),[z,P]=(0,n.useState)([]),[B,T]=(0,n.useState)(""),[M,$]=(0,n.useState)([]),D=(0,C.K)(),E=[e("软件"),e("是否安装"),e("路径")],G=[e("编号"),e("路径"),e("备注")],H=[e("编号"),e("路径"),e("是否开启"),e("备注")],R=[e("编号"),e("文件路径"),e("是否开启"),e("系统启动执行"),e("corn表达式"),e("用户id"),e("备注")],q=[e("编号"),e("路径"),e("单用户并发数量"),e("系统并发数量"),e("是否开启大文件断点"),e("大文件判断大小MB"),e("大文件并发数量"),e("大文件分块大小MB"),e("备注")],U=[e("编号"),e("名称"),e("路径"),e("是否开启"),e("params"),e("备注")],{check_user_auth:Z}=(0,S.MH)(),W=async()=>{const e=await c.XO.get("env/path/get");e.code===d.m.Success&&K(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&&T(t.data),W(),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&&N(n.data??[]);const i=await c.XO.get("plugin/list");i.code===d.m.Success&&$(i.data??[])})()},[]);const Q=(0,F.Q)(),J=async()=>{(await c.XO.post("plugin/list/save",M)).code===d.m.Success&&(0,x.SK)(e("保存成功"))};return(0,f.jsxs)(n.Fragment,{children:[(0,f.jsx)(i.J,{widthPer:100,children:(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件上传最大并发限制")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("文件上传")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{N([...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)(a.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,x.zN)(`编号:${e.index??""} 文件块的大小设置有问题`);if("number"!=typeof e.ws_file_parallel_num)return void(0,x.zN)(`编号:${e.index??""} 并发数量设置有问题`);if("number"!=typeof e.ws_file_standard_size)return void(0,x.zN)(`编号:${e.index??""} 大文件size设置有问题`)}(0,v.di)(V,e=>e.index??0);(await c.XO.post("dir_upload_max_num/save",V)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),children:(0,f.jsx)(h.X,{headers:q,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,N([...V])},options:D,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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{V.splice(e,1),N([...V])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{N((0,v.TI)(V,e,t))}})})}),(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PATH")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("环境路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.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,x.zN)(e("获取失败"))}}),(0,f.jsx)(a.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,x.SK)(e("保存成功")):(0,x.zN)(e("保存失败")),S.xK.set_value_temp("")}})):(0,x.zN)(e("获取失败"))}}),(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...O,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("env/path/save",{paths:O})).code===d.m.Success&&((0,x.SK)("保存成功"),W(),s())}})]}),children:(0,f.jsx)(h.X,{headers:H,rows:O.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,K([...O])},options:D,no_border:!0}),(0,f.jsx)(r.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{O.splice(e,1),K([...O])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{K((0,v.TI)(O,e,t))}})}),(0,f.jsx)(o.Zp,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("PTY CMD")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("pty")},title:e("信息")})]}),rightBottomCom:(0,f.jsx)(a.C3,{text:e("更新"),clickFun:async()=>{(await c.XO.post("pty_cmd/save",{str:B})).code===d.m.Success&&((0,x.SK)("保存成功"),l())}}),children:(0,f.jsx)(r.Sm,{placeholder:e("cmd need pty env"),value:B,handleInputChange:e=>{T(e)}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("Workflow Job")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("Workflow")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{P([...z,{open:!1}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("workflow_setting_save",z)).code===d.m.Success&&((0,x.SK)("ok"),L())}})]}),children:(0,f.jsx)(h.X,{headers:R,rows:z.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([...z])},options:D,no_border:!0}),(0,f.jsx)(r.l6,{value:!!t.sys_power_on,onChange:e=>{t.sys_power_on=e,P([...z])},options:D,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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{z.splice(e,1),P([...z])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{P((0,v.TI)(z,e,t))}})}),(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("插件配置")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("插件配置")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{$([...M,{name:"",path:"",note:"",open:!1}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:J})]}),children:(0,f.jsx)(h.X,{headers:U,rows:M.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])},options:D,no_border:!0}),(0,f.jsx)(a.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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{M.splice(e,1),$([...M])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{$((0,v.TI)(M,e,t))}})})]})}),(0,f.jsx)(i.VP,{children:(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("系统保护路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{I([...A,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/sys/save",A)).code===d.m.Success&&((0,x.SK)("保存成功"),l())}})]}),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)(a.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)(o.uF,{title:e("外部软件"),titleCom:(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("outside/software/save",j)).code===d.m.Success&&((0,x.SK)("保存成功"),s())}}),children:(0,f.jsx)(h.X,{headers:E,rows:j.map((t,s)=>[(0,f.jsx)("div",{children:t.id}),(0,f.jsx)(o.fq,{ok:t.installed}),(0,f.jsx)(r.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0,placeholder:e("默认使用环境变量")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{Q(t.id)},title:e("信息")})]),width:"10rem"})})]})})]})]})}function z(e){const{t,i18n:s}=(0,u.B)(),[i,o]=(0,w.fp)(p.AG.user_base_info),a=[{title:t("用户权限"),list:[{title:t("用户管理"),permission:l.oV.user_manage},{title:t("角色管理"),permission:l.oV.role_manage}]},{title:t("系统管理权限"),list:[{title:t("系统信息"),permission:l.oV.all_sys},{title:t("系统进程关闭"),permission:l.oV.sys_process_close},{title:t("docker容器停止、删除"),permission:l.oV.docker_container_update},{title:t("docker镜像删除"),permission:l.oV.docker_images_delete},{title:t("systemd管理"),permission:l.oV.systemd},{title:t("防火墙管理"),permission:l.oV.firewall}]},{title:t("网络功能权限"),list:[{title:t("系统网络"),permission:l.oV.vir_net},{title:t("内网穿透"),permission:l.oV.tcp_proxy},{title:"ddns",permission:l.oV.ddns}]},{title:t("Ai 设置权限"),list:[{title:t("Ai 配置"),permission:l.oV.ai_agent_setting},{title:t("Ai Chat Page"),permission:l.oV.ai_agent_page},{title:t("允许切换 AI 模型"),permission:l.oV.ai_model_switch}]},{title:t("文件权限"),list:[{title:t("文件删除、剪切、重命名"),permission:l.oV.filecat_file_delete_cut_rename},{title:t("文件创建、上传、内容更新、解压缩"),permission:l.oV.filecat_file_context_update_upload_created_copy_decompression},{title:t("内容更新"),permission:l.oV.filecat_file_context_update},{title:t("文件回收站修改"),permission:l.oV.recycle_file_save},{title:t("文件分享"),permission:l.oV.share_file}]},{title:t("系统设置权限"),list:[{title:t("系统页面"),permission:l.oV.sys_setting_page},{title:t("htts"),permission:l.oV.https_file},{title:t("token时间修改"),permission:l.oV.token_update},{title:t("修改密码"),permission:l.oV.update_password},{title:t("磁盘挂载"),permission:l.oV.sys_disk_mount},{title:t("通用设置"),permission:l.oV.sys_env_setting_key}]},{title:t("系统环境设置"),list:[{title:t("系统环境设置页面"),permission:l.oV.sys_env_page},{title:t("目录文件上传数量限制修改"),permission:l.oV.dir_upload_max_num},{title:t("PATH路径修改"),permission:l.oV.env_path_update},{title:"pty cmd "+t("更新"),permission:l.oV.pty_cmd_update},{title:"workflow job",permission:l.oV.workflow_job},{title:t("系统保护路径更新"),permission:l.oV.sys_protection_dir},{title:t("外部软件路径"),permission:l.oV.outside_software_path}]},{title:t("个人环境设置"),list:[{title:t("个性化设置"),permission:l.oV.private_sys_env}]},{title:t("自定义路由"),list:[{title:t("自定义路由页面"),permission:l.oV.auth_router_page},{title:t("workflow触发api 修改"),permission:l.oV.workflow_api},{title:t("自定义资源路由"),permission:l.oV.code_resource},{title:t("自定义api路由"),permission:l.oV.code_api}]},{title:t("标签编辑权限"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy_tag_update},{title:t("http代理"),permission:l.oV.http_proxy_tag_update},{title:t("浏览器代理"),permission:l.oV.browser_proxy_tag_update},{title:t("rdp代理"),permission:l.oV.rdp_proxy_tag_update},{title:t("网络唤醒"),permission:l.oV.wol_proxy_tag_update},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy_tag_update}]},{title:t("代理功能"),list:[{title:t("ssh代理"),permission:l.oV.ssh_proxy},{title:t("http代理"),permission:l.oV.http_proxy},{title:t("http代理下载关闭"),permission:l.oV.http_proxy_download_cancel},{title:t("浏览器代理"),permission:l.oV.browser_proxy},{title:t("rdp代理"),permission:l.oV.rdp_proxy}]},{title:t("其他功能"),list:[{title:t("workflow 执行"),permission:l.oV.workflow_exe},{title:t("workflow 执行用户"),permission:l.oV.workflow_exe_user,noDisable:!0},{title:t("网络唤醒"),permission:l.oV.wol_proxy},{title:t("端口扫描"),permission:l.oV.port_scan},{title:t("rtsp播放器"),permission:l.oV.rtsp_proxy},{title:t("ssh密钥保存到磁盘"),permission:l.oV.crypto_ssh_file},{title:t("filecat-restart重启命令"),permission:l.oV.shell_cmd_filecat_restart},{title:t("filecat-upgrade升级命令"),permission:l.oV.shell_cmd_filecat_upgrade},{title:t("filecat-down关闭主进程命令"),permission:l.oV.shell_cmd_filecat_kill_self},{title:t("ai 命令(Ai 聊天)"),permission:l.oV.ai_chat_cmd}]}];return(0,f.jsx)(n.Fragment,{children:a.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 B(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(X.F),[j,g]=(0,w.fp)(p.AG.user_base_info),[S,C]=(0,n.useState)([]),[y,k]=(0,w.fp)(p.AG.prompt_card),[b,A]=(0,n.useState)(!1),[I,V]=(0,n.useState)(!1),[N,O]=(0,w.fp)(p.AG.confirm),[K,B]=(0,n.useState)(""),[T,M]=(0,n.useState)(""),[$,D]=(0,n.useState)(""),[E,G]=(0,n.useState)([]),[H,R]=(0,n.useState)([]),[q,U]=(0,n.useState)([]),[Z,W]=(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,le]=(0,n.useState)(""),[oe,ae]=(0,n.useState)(!1),[re,ce]=(0,n.useState)(""),[de,he]=(0,n.useState)(""),[ue,pe]=(0,n.useState)({}),_e=(0,F.o)(),[xe,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);C(e)}else C(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=>{B(e?.username??""),M(e?.password??""),D(e?.cwd??""),G(e?.access_dirs??[]),R(e?.not_access_dirs??[]),U(e?.only_read_dirs??[]),W(e?.access_cmd??""),Q(e?.not_access_cmd??""),Y(e?.language??""),te(e?.theme??""),ne(e?.auth_list??[]),le(e?.note??""),ae(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&&D(s.cwd),s.access_dirs&&s.access_dirs.length>0&&G(s.access_dirs),s.not_access_dirs&&s.not_access_dirs.length>0&&R(s.not_access_dirs),s.only_read_dirs&&s.only_read_dirs.length>0&&U(s.only_read_dirs),s.access_cmd&&W(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)}},Ce=()=>{if(!K)return void(0,x.zN)("username not empty");if((0,m.CB)(K))return void(0,x.zN)("username not empty char");if(!$)return void(0,x.zN)("cwd not empty");const e=new l.E0;return e.language=J,e.theme=ee,e.access_dirs=E,e.username=K,e.password=T,e.not_access_dirs=H,e.only_read_dirs=q,e.cwd=$,e.note=ie,e.access_cmd=Z,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,children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.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)(a.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)(o.xP,{children:t.username}),(0,f.jsx)(o.xP,{children:t.cwd}),(0,f.jsx)(o.xP,{children:t.note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{A(!1),V(!0),we(e)})(t)}),!t.is_root&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{O({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.username=t,(await c.wm.post("delete_user",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ge(),O({open:!1,handle:null}))}})})(t.username)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,children:(b||I)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.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)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{A(!1),V(!1),we(void 0)}}),b&&(0,f.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{if(!T)return void(0,x.zN)("password not empty");if((0,m.CB)(T))return void(0,x.zN)("username not empty char");const e=Ce(),t=await c.wm.post("create_user",e);ge(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ge(),A(!1),V(!1),we(void 0))}}),I&&(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=Ce();if(!e)return;e.id=re;(await c.wm.post("save_user",e)).code===d.m.Success&&((0,x.SK)("保存完成"),ge())}})]}),children:[(0,f.jsx)("label",{children:e("用户名")}),(0,f.jsx)(r.Sm,{value:K,handleInputChange:e=>B(e)}),(0,f.jsx)("label",{children:e("密码")}),(0,f.jsx)(r.Sm,{type:"password",value:T,handleInputChange:e=>M(e)}),(0,f.jsxs)("label",{children:[!ue?.access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{G([...E,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{disabled:""!==ue.cwd&&void 0!==ue.cwd,value:$,handleInputChange:e=>D(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)(a.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)(a.rA,{icon:"add",onClick:()=>{R([...H,""])},title:e("添加")}),e("禁止目录范围")]}),(H??[]).map((t,s)=>(0,f.jsxs)("div",{style:{display:"flex"},children:[(0,f.jsx)("div",{style:{width:"90%"},children:(0,f.jsx)(r.Sm,{disabled:0!==ue?.not_access_dirs?.length&&void 0!==ue?.not_access_dirs?.length,value:t,handleInputChange:e=>{H[s]=e,R([...H])}})}),0===ue?.not_access_dirs?.length||void 0===ue?.not_access_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{H.splice(s,1),R([...H])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[!ue?.only_read_dirs?.length&&(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{U([...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?.only_read_dirs?.length&&void 0!==ue?.only_read_dirs?.length,value:t,handleInputChange:e=>{q[s]=e,U([...q])}})}),0===ue?.only_read_dirs?.length||void 0===ue?.only_read_dirs?.length&&(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{q.splice(s,1),U([...q])},title:e("删除")})]},s)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{disabled:""!==ue.access_cmd&&void 0!==ue.access_cmd,value:Z,placeholder:"use blank split",handleInputChange:e=>W(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)}),!oe&&(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 xe)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:_e}),(0,f.jsx)(z,{is_disable:e=>{if(!0===oe)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===oe||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=>le(e)})]})})})]})}function T(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s}=(0,n.useContext)(X.F),[_,m]=(0,n.useState)([]),[j,g]=(0,w.fp)(p.AG.prompt_card),[S,C]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[b,A]=(0,w.fp)(p.AG.confirm),[I,V]=(0,n.useState)(""),[N,O]=(0,n.useState)(""),[K,P]=(0,n.useState)([]),[B,T]=(0,n.useState)([]),[M,$]=(0,n.useState)([]),[D,E]=(0,n.useState)(""),[G,H]=(0,n.useState)(""),[R,q]=(0,n.useState)(""),[U,Z]=(0,n.useState)(""),[W,L]=(0,n.useState)([]),[Q,J]=(0,n.useState)(""),[Y,ee]=(0,n.useState)(""),te=(0,F.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??""),O(e?.cwd??""),P(e?.access_dirs??[]),T(e?.not_access_dirs??[]),$(e?.only_read_dirs??[]),E(e?.access_cmd??""),H(e?.not_access_cmd??""),q(e?.language??""),Z(e?.theme??""),L(e?.auth_list??[]),J(e?.role_id??""),ee(e?.role_note??"")};(0,n.useEffect)(()=>{ne()},[]);const le=()=>{if(!I)return void(0,x.zN)("role_name not empty");const e=new l.E0;return e.language=R,e.theme=U,e.access_dirs=K,e.role_name=I,e.not_access_dirs=B,e.only_read_dirs=M,e.cwd=N,e.access_cmd=D,e.not_access_cmd=G,e.auth_list=W,e.role_note=Y,e};return(0,f.jsxs)(i.fI,{children:[(0,f.jsx)(i.VP,{widthPer:50,children:(0,f.jsx)(i.xh,{children:(0,f.jsx)(o.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)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{C(!0),k(!1),ie(void 0)}})}),children:(0,f.jsx)(h.X,{headers:se,rows:_.map((t,s)=>{const n=[(0,f.jsx)("p",{children:t.role_id}),(0,f.jsx)(o.xP,{children:t.role_name}),(0,f.jsx)(o.xP,{children:t.role_note}),(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"edit",title:e("编辑"),onClick:()=>(e=>{C(!1),k(!0),ie(e)})(t)}),!t.is_root&&(0,f.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(async t=>{A({open:!0,title:e("确定删除吗"),handle:async()=>{const e=new l.E0;e.role_id=t,(await c.wm.post("delete_role",e)).code===d.m.Success&&((0,x.SK)("删除完成"),ne(),A({open:!1,handle:null}))}})})(t.role_id)})]})];return n}),width:"10rem"})})})}),(0,f.jsx)(i.VP,{widthPer:50,children:(S||y)&&(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.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)(a.rA,{icon:"cancel",title:e("取消"),onClick:()=>{C(!1),k(!1),ie(void 0)}}),S&&(0,f.jsx)(a.rA,{icon:"add_circle",title:e("添加"),onClick:async()=>{const e=le();if(!e)return;const t=await c.wm.post("create_role",e);ne(),t.code===d.m.Success&&((0,x.SK)("创建完成"),ne(),C(!1),k(!1),ie(void 0))}}),y&&(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{const e=le();if(!e)return;e.role_id=Q;(await c.wm.post("save_role",e)).code===d.m.Success&&((0,x.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)(a.rA,{icon:"add",onClick:()=>{P([...K,""])},title:"添加"}),e("目录范围")]}),(0,f.jsx)(r.Sm,{value:N,handleInputChange:e=>O(e)}),(K??[]).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=>{K[t]=e,P([...K])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{K.splice(t,1),P([...K])},title:"删除"})]},t)),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{T([...B,""])},title:"添加"}),e("禁止目录范围")]}),(B??[]).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=>{B[s]=e,T([...B])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{B.splice(s,1),T([...B])},title:e("删除")})]},s)),(0,f.jsxs)("label",{children:[(0,f.jsx)(a.rA,{icon:"add",onClick:()=>{$([...M,""])},title:e("添加")}),e("只读目录范围")]}),(M??[]).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=>{M[t]=e,$([...M])}})}),(0,f.jsx)(a.rA,{icon:"delete",onClick:()=>{M.splice(t,1),$([...M])},title:"删除"})]},t)),(0,f.jsx)("label",{children:e("可执行的命令")}),(0,f.jsx)(r.Sm,{value:D,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=>H(e)}),(0,f.jsx)("label",{children:e("语言")}),(0,f.jsx)(r.l6,{value:R,onChange:e=>{q(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:U,onChange:e=>{Z(e)},options:te}),(0,f.jsx)(z,{is_disable:()=>!1,is_selected:(e,t)=>void 0!==W?.find(t=>t===e),select_auth:e=>{W?(W.find(t=>t==e)?(0,v.I)(W,t=>t===e):W.push(e),L([...W])):L([e])}})]})})})]})}function M(){const{t:e,i18n:t}=(0,u.B)(),{initUserInfo:s,reloadUserInfo:_}=(0,n.useContext)(X.F),[m,j]=(0,n.useState)([]),[g,S]=(0,w.fp)(p.AG.prompt_card),[y,b]=(0,n.useState)([]),[A,V]=(0,n.useState)([]),[N,O]=(0,n.useState)([]),[K,z]=(0,w.fp)(p.AG.user_base_info),P=(0,C.K)(),B=(0,F.o)(),T=[e("编号"),e("路径"),e("是否默认"),e("备注")],M=[e("编号"),e("路径"),e("备注")],$=[e("编号"),e("命令"),e("父编号"),e("备注")],D=[e("文件后缀"),e("命令"),e("其他参数"),e("备注")],[E,G]=(0,n.useState)(""),[H,R]=(0,n.useState)(""),[q,U]=(0,n.useState)(""),[Z,W]=(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),O(e.data.file_quick_cmd));const t=await c.XO.get("protection_dir");t.code===d.m.Success&&b(t.data??[])})(),Q(K?.user_data?.language),Y(K?.user_data?.theme),te(K?.user_data?.upload_file_ignore)},[]);const se=(0,F.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)(o.Zp,{title:e("修改密码"),rightBottomCom:(0,f.jsx)(a.C3,{text:e("确定修改"),clickFun:async()=>{if(!E||!H)return void(0,x.zN)("账号密码不能为空");if(H!==q)return void(0,x.zN)("两次密码不一样");const e=new l.tl;e.username=E,e.password=H,e.confirm_password=q,e.user_id=K.user_data.id;(await c.wm.post("updatePassword",e)).code===d.m.Success&&(0,x.SK)("修改成功")}}),children:[(0,f.jsx)(r.Sm,{placeholder:e("新账号"),value:E,handleInputChange:e=>{G(e)}}),(0,f.jsx)(r.cA,{placeholder:e("新密码"),handleInputChange:e=>{R(e)}}),(0,f.jsx)(r.cA,{placeholder:e("确认密码"),handleInputChange:e=>{U(e)}})]})}),(0,f.jsx)(i.xh,{children:(0,f.jsxs)(o.Zp,{title:e("个性化设置"),rightBottomCom:(0,f.jsx)(a.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,x.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:B}),(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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件夹路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("文件夹路径")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{j([...m,{note:"",default:!1,path:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{for(let e=0;e<m.length;e++)m[e].index=e;(await c.XO.post("filesSetting/save",{dirs:m})).code===d.m.Success&&((0,x.SK)("保存成功"),_(),s())}})]}),children:(0,f.jsx)(h.X,{headers:T,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)(a.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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("个人保护路径")})," ",(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("保护目录")},title:e("信息")})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{b([...y,{path:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("protection_dir/save",y)).code===d.m.Success&&((0,x.SK)("保存成功"),_())}})]}),children:(0,f.jsx)(h.X,{headers:M,rows:y.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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{y.splice(e,1),b([...y])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{b((0,v.TI)(y,e,t))}})})]}),(0,f.jsxs)(i.xh,{children:[(0,f.jsx)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("目录快捷命令")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("目录快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{V([...A,{cmd:"",note:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{quick_cmd:A})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:$,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)(a.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)(o.uF,{self_title:(0,f.jsxs)("span",{className:" div-row ",children:[(0,f.jsx)("h2",{children:e("文件快捷命令")}),(0,f.jsx)(a.rA,{icon:"info",onClick:()=>{se("文件快捷命令")},title:"info"})]}),titleCom:(0,f.jsxs)("div",{children:[(0,f.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>{O([...N,{cmd:"",note:"",file_suffix:"",params:""}])}}),(0,f.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await c.XO.post("filesSetting/save",{file_quick_cmd:N})).code===d.m.Success&&((0,x.SK)("保存成功"),s())}})]}),children:(0,f.jsx)(h.X,{headers:D,rows:N.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)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{N.splice(e,1),O([...N])})(s)})];return n}),width:"10rem",onRowDrag:(e,t)=>{O((0,v.TI)(N,e,t))}})})]})]})]})})}var $=s(87361);function D(){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)(M,{})}];return t(l.oV.sys_setting_page)&&s.unshift({index:1,name:e("系统"),rto:"password",component:(0,f.jsx)(O,{})}),t(l.oV.sys_env_page)&&s.push({index:1,name:`${e("系统环境")}`,rto:"env_setting/",component:(0,f.jsx)(K,{})}),t(l.oV.auth_router_page)&&s.push({index:1,name:e("自定义路由"),rto:"customer_router/",component:(0,f.jsx)(A,{})}),t(l.oV.user_manage)&&s.push({index:1,name:e("用户管理"),rto:"user_manager/",component:(0,f.jsx)(B,{})}),t(l.oV.role_manage)&&s.push({index:1,name:e("角色管理"),rto:"role_manager/",component:(0,f.jsx)(T,{})}),(0,f.jsx)(i.W1,{optionList:s,father_route:$.o.setting})}},92350(e,t,s){s.d(t,{Q:()=>h,o:()=>p});var n=s(34843),i=s(82893),l=s(74777),o=s(96540),a=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:o}=(0,a.B)();return e=>{let n;e===l.jk.ffmpeg?n=(0,d.jsx)("div",{children:"视频转换,rtsp播放器等媒体功能都需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置"}):e===l.jk.smartmontools?n=(0,d.jsx)("div",{children:"磁盘检查需要这个软件。linux下你可以使用apt或者yum来安装,或者直接输入软件的位置。"}):"保护目录"===e?n=(0,d.jsxs)("div",{children:["在删除的时候保护目录会拒绝删除。",(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"可以使用 /* 来表达该目录下所有文件都禁止删除"}),(0,d.jsx)("li",{children:"可以使用 /** 来表达该目录下所有子目录文件都禁止删除"})]})]}):"文件夹路径"===e?n=(0,d.jsx)("div",{children:"用于在文件夹下切换根目录"}):"环境路径"===e?n=(0,d.jsx)("div",{children:"当在不同用户环境下运行的时候由于没有执行终端去加载PATH,这里可以添加额外的PATH路径,点击这里的保存还会更新系统上的path路径"}):"pty"===e?n=(0,d.jsx)("div",{children:"一些需要Pty环境的命令"}):"文件上传"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"对于不同的目录(包括所有子目录),可能是机械或者固态硬盘,机械硬盘在处理多个小文件的时候会做随机i/o,由于一般只有一个盘头所以会影响整体效率,特别是写操作,这里提供了上传时候的最大数量限制,对于下载数量目前不做限制."}),(0,d.jsx)("li",{children:"大文件支持断点和分块并发传输,建议并发数量设置为2,分块大小设置为10MB,大文件判断为500MB,设置过大的话会上传的时候会占据较大内存"})]})}):"目录快捷命令"===e?n=(0,d.jsx)("div",{children:"右键文件夹空白处用于,打开终端快捷执行命令"}):"文件快捷命令"===e?n=(0,d.jsx)("div",{children:"用于右键特定后缀的文件,执行一些快捷命令,文件后缀可以是多个,用空格分割"}):"Workflow"===e?n=(0,d.jsx)("div",{children:(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:"在特定的时间启动系统中的workflow任务"}),(0,d.jsx)("li",{children:"cron表达式是定时器 格式为: 秒 分 时 日 月 星期"}),(0,d.jsxs)("li",{children:[(0,d.jsx)("li",{children:'1. "*"(通配符,所有值)'}),(0,d.jsx)("li",{children:'2. "," 是枚举: 0 0 1,15 * * *'}),(0,d.jsx)("li",{children:'3. "-" 是范围: 0 0 1-5 * * *'}),(0,d.jsx)("li",{children:'4. "/" 是步长,标识每隔n执行 */3 * * * * * 每隔三秒,必须配合 * 使用 ,/ 只能写一次 ,有了/就成了定时器,而不是指定时间执行'})]})]})}):"插件配置"===e?n=(0,d.jsx)("div",{children:s("路径可以是一个 js 文件也可以是一个node 项目目录")}):"机器人配置"===e&&(n=(0,d.jsxs)("div",{children:[(0,d.jsx)("dv",{children:"机器人功能用于开通各种第三方支持的机器人,让第三方机器人接入本地的 AI 模型。"}),(0,d.jsxs)("ul",{children:[(0,d.jsx)("li",{children:" 1. qq 机器人需要先在手机 app 中添加,然后在https://q.qq.com/qqbot/ 登录机器人配置页面,在开发管理中复制机器人的 appId,appSecret 到这里就完成了配置了。目前 qq 机器人不稳定,且创建后无法删除(2026.07.05)"}),(0,d.jsx)("li",{children:" 2. https://opensource.dingtalk.com/developerpedia/docs/explore/tutorials/stream/bot/nodejs/create-bot 这个是钉钉机器人开通教程,注意复制钉钉的 clientId 的是时候不要复制成appId 了。"}),(0,d.jsx)("li",{children:" 3. 企业微信机器人的开通甚至不需要 pc 操作,在通讯录中点击智能机器人,选择 api 模式,就创建完成了,手机上直接复制 id 和密钥。"}),(0,d.jsx)("li",{children:" 4. 飞书https://open.feishu.cn/document/develop-an-echo-bot/introduction?from=banner 登录这个开发者后台,按照这个地址教程创建机器人,使用的时候这个机器人是作为一个应用,可以在工作台内搜索你的这个机器人的名字。"})]})]})),t({open:!0,title:"信息",context_div:(0,d.jsx)("div",{children:n})})}}let u=r.Ky;function p(){const[e,t]=(0,o.useState)([]);return(0,o.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:()=>o});var n=s(72635);const i=1440,l=525600;function o(e){e=e>1e12?e:1e3*e;const t=Date.now(),s=Math.abs(t-e)/6e4;return s<1?n.Ay.t("小于一分钟"):s<60?`${s.toFixed(0)} ${n.Ay.t("分钟前")}`:s<i?`${(s/60).toFixed(0)} ${n.Ay.t("小时前")}`:s<43200?`${(s/i).toFixed(0)} ${n.Ay.t("天前")}`:s<l?`${(s/43200).toFixed(0)} ${n.Ay.t("月前")}`:`${(s/l).toFixed(0)} ${n.Ay.t("年前")}`}},24659(e,t,s){var n=s(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 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[2851],{8694(e,t,s){s.d(t,{$K:()=>a,RB:()=>r,l5:()=>i,qB:()=>n,vo:()=>c,vr:()=>l});class n{targetProxyUrl;proxyPort;sysProxyPort}let o=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class a{open=!1;port;key="";async_ips=[]}class c{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=o.udp}let r=function(e){return e[e.row=1]="row",e[e.json=2]="json",e[e.form=3]="form",e}({});class l{body_type;header_type;url;method;headers;data;form_data_list;local_download_path}class i{enabled;ip;port;bypass;useForLocal;type}},77481(e,t,s){s.d(t,{S:()=>r,X:()=>c});var n=s(96540),o=s(61443),a=s(74848);function c(e){const[t,s]=n.useState([]),c=(0,n.useRef)(-1),[r,l]=(0,n.useState)(-1),[i,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 p=()=>{c.current=-1,l(-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 c=t;if(n){const s=e.filter,n=s.options.find(e=>e.value===s.value);null!=s.value&&n&&(c=`${t} (${n.label})`)}return(0,a.jsx)("th",{className:n?"table-filter-col":"",children:n?(0,a.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:c}):t},s)})})}),(0,a.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,a.jsx)("tr",{className:n?(r===s?"row-dragging":"")+(i===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(c.current=s,l(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||c.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=c.current,s=i;p(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:p,children:t.map((s,n)=>{const o=n===t.length-1?"small":"";return(0,a.jsx)("td",{className:o,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function r(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))})}},42851(e,t,s){s.r(t),s.d(t,{default:()=>F});var n=s(96540),o=s(75725),a=s(14284),c=s(62042),r=s(53459),l=s(70447),i=s(61443),d=s(85997),p=s(77481),h=s(8694),u=s(14944),x=s(92275),j=s(86149),m=s(4412),v=s(74848);function g(e){const{t}=(0,j.B)(),[s,g]=(0,n.useState)(void 0),[y,f]=(0,n.useState)(!1),[S,_]=(0,n.useState)(""),[w,C]=(0,n.useState)([t(`${t("名称")}`),t(`${t("虚拟")}ip`),`${t("物理")}`,t("在线状态"),t("选择")]),[k,b]=(0,n.useState)([]),[I,A]=(0,n.useState)({}),[P,U]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=new x.hf(x.HK.vir_net_serverIno_get);u.ws.addMsg(x.HK.vir_net_serverIno_get,e=>{(e=>{for(const s of e){const e=s[s.length-1];s[s.length-1]=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(l.fq,{ok:e}),t(e?"在线":"离线")]}),s[0]=(0,v.jsx)(l.xP,{context:s[0],tip_context:s[0]}),s[2]=(0,v.jsx)(l.xP,{context:s[2],tip_context:s[2]})}})(e.context),b(e.context)}),await u.ws.send(e)})();return(async()=>{const e=await a._U.get("vir/server/get");if(e.code!==r.m.Success)return;const t=e.data;g(t.port),_(t.key),f(t.open)})(),()=>{}},[]);return(0,v.jsxs)("div",{children:[(0,v.jsxs)(m.aZ,{position:"right",children:[!!Object.keys(I).length&&I[0],!!Object.keys(I).length&&(0,v.jsx)(d.rA,{icon:"delete",title:"删除",onClick:async()=>{await a._U.post("vir/server/delete/client",{ips:Object.keys(I)}),A({})}})]}),(0,v.jsx)(o.fI,{children:(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(l.Zp,{title:"",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.$K;e.open=y,e.key=S,P&&(e.async_ips=Object.keys(I)),s&&(e.port=parseInt(s));(await a._U.post("vir/server/save",e)).code===r.m.Success?((0,c.SK)("保存成功"),U(!1)):(0,c.zN)("网络错误")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"port",value:s,handleInputChange:e=>{g(e)}}),(0,v.jsx)(i.Sm,{type:"password",placeholder:"key ",value:S,handleInputChange:e=>{_(e)}}),(0,v.jsxs)("form",{children:[t("状态"),":",(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:y,onchange:()=>{f(!y)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!y,onchange:()=>{f(!y)}})]})]}),!!Object.keys(I).length&&(0,v.jsx)(i.GL,{context:t("同步信息给选中服务器"),selected:P,onchange:()=>{U(!P)}})]}),(0,v.jsx)(l.Zp,{title:"",children:(0,v.jsx)(p.X,{headers:w,rows:k.map(e=>[...e,(0,v.jsx)(i.GL,{context:t(""),selected:I[e[1]],onchange:()=>{const t={...I};t[e[1]]?delete t[e[1]]:t[e[1]]=e,A(t)}})]),width:"10rem"})})]})})]})}function y(e){const{t}=(0,j.B)(),[s,m]=(0,n.useState)(""),[g,y]=(0,n.useState)(void 0),[f,S]=(0,n.useState)(""),[_,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(void 0),[b,I]=(0,n.useState)(!1),[A,P]=(0,n.useState)(""),[U,K]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{const e=await a._U.get("vir/client/get");if(e.code!==r.m.Success)return;const t=e.data;if(k(t.serverPort),S(t.serverIp),m(t.ip),y(t.mask),P(t.key),I(t.open),w(t.client_name),t.open){const e=new x.hf(x.HK.vir_net_client_get),t=(await u.ws.send(e)).context.state;K(t),u.ws.addMsg(x.HK.vir_net_client_get,e=>{K(e.context.state)})}})()},[]);return(0,v.jsx)("div",{children:(0,v.jsx)(o.fI,{children:(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(l.Zp,{title:"",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.vo;e.ip=s,e.mask=parseInt(g),e.key=A,e.serverIp=f,e.serverPort=parseInt(C),e.open=b,e.client_name=_;(await a._U.post("vir/client/save",e)).code===r.m.Success?(0,c.SK)("保存成功"):(0,c.zN)("网络错误")}}),titleCom:(0,v.jsxs)("div",{children:[t("连接状态"),(0,v.jsx)(l.fq,{ok:U})]}),children:[(0,v.jsx)(i.Sm,{placeholder:"ip ",value:s,handleInputChange:e=>{m(e)}}),(0,v.jsx)(i.Sm,{placeholder:"mask",value:g,handleInputChange:e=>{y(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} ip`,value:f,handleInputChange:e=>{S(e)}}),(0,v.jsx)(i.Sm,{placeholder:`${t("服务器")} part`,value:C,handleInputChange:e=>{k(e)}}),(0,v.jsx)(i.Sm,{placeholder:"名称 ",value:_,handleInputChange:e=>{w(e)}}),(0,v.jsx)(i.Sm,{type:"password",placeholder:"key ",value:A,handleInputChange:e=>{P(e)}}),(0,v.jsxs)("form",{children:[t("状态"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:b,onchange:()=>{I(!b)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!b,onchange:()=>{I(!b)}})]})]})]}),(0,v.jsxs)(l.Zp,{title:"",children:[(0,v.jsx)("div",{children:"ip: 虚拟ip, “10.0.0.0 - 10.255.255.255”和“172.16.0.0 - 172.31.255.255”和“192.168.0.0 - 192.168.255.255”这三个网段属于内网ip"}),(0,v.jsx)("div",{children:"mask: 一些常见的子网掩码网段/8:255.0.0.0;/16:255.255.0.0 ;/24:255.255.255.0"}),(0,v.jsx)("div",{children:"key:用于验证身份信息并加密的和服务器设置的一样"})]})]})})})}var f=s(34843),S=s(82893),_=s(23430),w=s(78247),C=s(21499),k=s(24659);function b(e){const{t}=(0,j.B)(),[s,u]=(0,n.useState)(""),[x,m]=(0,n.useState)(""),[g,y]=(0,n.useState)(""),[b,I]=(0,n.useState)(!1),[A,P]=(0,n.useState)(!1),[U,K]=(0,n.useState)({list:[]}),[F,$]=(0,f.fp)(S.AG.editorSetting),[H,N]=(0,f.fp)(S.AG.user_base_info),Z=[t("端口"),t("目标地址"),t("目标端口"),t("开启"),t("备注"),t("删除")],[O,B]=(0,n.useState)([]),D=[t("port"),t("ip"),t("type"),t("开启")],[E,z]=(0,n.useState)([]),V=[t("编辑"),t("开启"),t("备注"),t("删除")],M=(0,k.K)(),X=async()=>{const e=[a._U.post("vir/client/tcp_proxy/get"),a._U.post("http/proxy/server/get")];let t;H.sys===_.XM.mac?t=(async()=>{const e=await a._U.post("http/proxy/get/mac");if(e.code!==r.m.Success)return;const t=[],s=[];for(const n of e.data)"Wi-Fi"===n.name?t.push(n):s.push(n);z([...t,...s])})():H.sys===_.XM.win&&(t=(async()=>{const e=await a._U.post("http/proxy/get/win");if(e.code===r.m.Success){const t=e.data;u(t.ip),m(t.port),I(t.enabled),y(t.bypass),P(t.useForLocal)}})()),t&&e.push(t);const[s,n]=await Promise.all(e);s.code===r.m.Success&&B(s.data),n.code===r.m.Success&&K(n.data)};(0,n.useEffect)(()=>{X()},[]);return(0,v.jsx)("div",{children:(0,v.jsxs)(o.fI,{children:[H.sys===_.XM.win&&(0,v.jsx)(o.VP,{widthPer:33,children:(0,v.jsxs)(l.Zp,{title:"Http Proxy",rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{const e=new h.l5;e.port=parseInt(x),e.enabled=b,e.useForLocal=A,e.ip=s,e.bypass=g;(await a._U.post("http/proxy/set/win",e)).code===r.m.Success&&(X(),(0,c.SK)("保存成功"))}}),children:[(0,v.jsx)(i.Sm,{placeholder:"ip (default localhost) ",value:s,handleInputChange:e=>{u(e)}}),(0,v.jsx)(i.Sm,{placeholder:"port ",value:x,handleInputChange:e=>{m(e)}}),(0,v.jsx)(i.Sm,{placeholder:t("忽略ip"),value:g,handleInputChange:e=>{y(e)}}),(0,v.jsxs)("form",{children:[t("请勿将代理服务器用于本地(Intranet)地址"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:A,onchange:()=>{P(!A)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!A,onchange:()=>{P(!A)}})]})]}),(0,v.jsxs)("form",{children:[t("状态"),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:b,onchange:()=>{I(!b)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!b,onchange:()=>{I(!b)}})]})]})]})}),H.sys===_.XM.mac&&(0,v.jsx)(o.VP,{children:E.map((e,s)=>(0,v.jsxs)(l.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:e.name})," "]}),titleCom:(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:()=>{(async e=>{const t=E[e];(await a._U.post("http/proxy/set/mac",[t])).code===r.m.Success&&(X(),(0,c.SK)("保存成功"))})(s)}})}),children:[(0,v.jsx)(p.X,{headers:D,rows:e.proxies.map((e,t)=>{const n=[(0,v.jsx)(i.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.ip,handleInputChange:t=>{e.ip=t},no_border:!0}),(0,v.jsx)("div",{children:1===e.type?"http":"https"}),(0,v.jsx)(i.l6,{value:e.enabled,onChange:e=>{((e,t,s)=>{const n=[...E];n[e].proxies[t].enabled=s,z(n)})(s,t,e)},options:M,no_border:!0})];return n}),width:"10rem"}),"ignore ips",(0,v.jsx)(i.Sm,{value:e.bypass,handleInputChange:e=>{E[s].bypass=e},no_border:!0})]},s))}),(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(l.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:t("Tcp Proxy")})," "]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(d.rA,{icon:"add",title:t("添加"),onClick:()=>{B([...O,{note:"",open:!1,port:0,target_port:0,target_ip:""}])}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{const e=[];for(let t=0;t<O.length;t++)O[t].index=t,e.push(O[t]);(await a._U.post("vir/client/tcp_proxy/save",e)).code===r.m.Success&&((0,c.SK)("保存成功"),X())}})]}),children:(0,v.jsx)(p.X,{headers:Z,rows:O.map((e,s)=>{const n=[(0,v.jsx)(i.Sm,{value:e.port,handleInputChange:t=>{e.port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.target_ip,handleInputChange:t=>{e.target_ip=t},no_border:!0}),(0,v.jsx)(i.Sm,{value:e.target_port,handleInputChange:t=>{e.target_port=parseInt(t)},no_border:!0}),(0,v.jsx)(i.l6,{value:e.open,onChange:e=>{O[s].open=e,B([...O])},options:M,no_border:!0}),(0,v.jsx)(i.Sm,{value:e.note,handleInputChange:t=>{e.note=t},no_border:!0}),(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>(e=>{O.splice(e,1),B([...O])})(s)})})];return n}),width:"10rem"})}),(0,v.jsx)(l.uF,{self_title:(0,v.jsxs)("span",{className:" div-row ",children:[(0,v.jsx)("h2",{children:t("Http Proxy Server")})," "]}),titleCom:(0,v.jsxs)("div",{children:[(0,v.jsx)(d.rA,{icon:"add",title:t("添加端口实例"),onClick:()=>{U.list.push({open:!1,port:0,note:"",list:[]}),K({...U})}}),(0,v.jsx)(d.rA,{icon:"save",title:t("保存"),onClick:async()=>{(await a._U.post("http/proxy/server/save",U)).code===r.m.Success&&(0,c.SK)("保存成功")}})]}),children:U.list.map((e,s)=>(0,v.jsxs)("div",{className:"net-proxy-instance",children:[(0,v.jsxs)("div",{className:"net-proxy-instance__toolbar",children:[(0,v.jsxs)("span",{className:"net-proxy-instance__label",children:[t("端口实例")," #",s+1]}),(0,v.jsx)("span",{children:t("状态")}),(0,v.jsx)(i.l6,{value:e.open,width:"15%",onChange:t=>{e.open=t,K({...U})},options:M,no_border:!0}),(0,v.jsx)("span",{children:t("端口")}),(0,v.jsx)(i.Sm,{value:e.port||"",handleInputChange:t=>{e.port=t?parseInt(t):0,K({...U})},no_border:!0,width:"80px"}),(0,v.jsx)(d.rA,{icon:"add",title:t("添加规则"),onClick:()=>{e.list.push({note:"",open:!1}),K({...U})}}),(0,v.jsx)(d.rA,{icon:"delete",title:t("删除端口实例"),onClick:()=>{U.list.splice(s,1),K({...U})}}),(0,v.jsx)(i.Sm,{placeholder:t("备注"),width:"100%",value:e.note,handleInputChange:t=>{e.note=t,K({...U})},no_border:!0})]}),(0,v.jsx)(p.X,{headers:V,rows:e.list.map((n,o)=>{const c=[(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"edit",title:t("编辑"),onClick:()=>{(async(e,t)=>{const s=U.list[e];if(!s)return;const n=s.list[t];if(!n)return;n.random_key||(n.random_key=(0,C.hU)(),K({...U}));const o=await a._U.post("http/proxy/server/code/get",{key:n.random_key,name:n.random_key});$({model:"ace/mode/javascript",open:!0,fileName:"",can_format:!0,save:async e=>{0===(await a._U.post("http/proxy/server/code/save",{context:e,key:n.random_key})).code&&(w.xK.set_value_temp(""),$({open:!1,model:"",fileName:"",save:null}))}}),w.xK.set_value_temp(o.data)})(s,o)}})}),(0,v.jsx)(i.l6,{value:n.open,onChange:t=>{e.list[o].open=t,K({...U})},options:M,no_border:!0}),(0,v.jsx)(i.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,v.jsx)("div",{children:(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{e.list.splice(o,1),K({...U})}})})];return c}),width:"10rem"})]},s))})]})]})})}var I=s(87361),A=s(82726),P=s(18538);function U(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[u,x]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[_,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[b,I]=(0,f.fp)(S.AG.showPrompt),[U,K]=(0,f.fp)(S.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await a.ez.get("ips/dnspod");if(e.code!==r.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);h(s),x(n),t.account&&(y(t.account.id),w(t.account.token)),k(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await a.ez.post("http/del",e)).code&&(0,c.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,v.jsxs)("div",{children:[(0,v.jsx)(m.aZ,{position:"right",children:(0,v.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{I({show:!0,type:P.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(l.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,v.jsx)(l.Zp,{title:"ipv6",children:u.length>0&&u.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(l.Zp,{title:t("账号设置"),rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(C&&(!g||!_))return void(0,c.zN)("id和token都不能为空");const e=new A.yL,t=[];for(const e of[...s,...u])e.ddnsHost&&t.push(e);e.ips=t,e.account={id:g,token:_},e.isOpen=C,e.ddnsType=A.E2.dnspod;(await a.ez.post("save",e)).code===r.m.DdnsAuthFail?(0,c.zN)("鉴权失败"):(0,c.SK)("success")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"ID",value:g,handleInputChange:e=>{y(e)}}),(0,v.jsx)(i.cA,{placeholder:"TOKEN",value:_,handleInputChange:e=>{w(e)}}),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:C,onchange:()=>{k(!C)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]}),(0,v.jsx)(l.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function K(e){const{t}=(0,j.B)(),[s,h]=(0,n.useState)([]),[u,x]=(0,n.useState)([]),[g,y]=(0,n.useState)(""),[_,w]=(0,n.useState)(""),[C,k]=(0,n.useState)(!1),[b,I]=(0,f.fp)(S.AG.showPrompt),[U,K]=(0,f.fp)(S.AG.confirm);(0,n.useEffect)(()=>{(async()=>{const e=await a.ez.get("ips/tx");if(e.code!==r.m.Success)return;const t=e.data,s=[],n=[];for(const e of t.ips)e.isIPv4?s.push(e):n.push(e);h(s),x(n),t.account&&(y(t.account.secretid),w(t.account.secretkey)),k(t.isOpen)})()},[]);const F=async e=>{K({open:!0,handle:async()=>{0===(await a.ez.post("http/del",e)).code&&(0,c.SK)("删除成功,稍后请刷新"),K({open:!1,handle:null})},title:t("确定删除吗")})};return(0,v.jsxs)("div",{children:[(0,v.jsx)(m.aZ,{position:"right",children:(0,v.jsx)(d.rA,{icon:"add",title:t("添加http获取ip"),onClick:()=>{I({show:!0,type:P.PromptEnum.DdnsAddHttp,overlay:!0,data:{}})}})}),(0,v.jsxs)(o.fI,{children:[(0,v.jsxs)(o.VP,{children:[(0,v.jsx)(l.Zp,{title:"ipv4",children:s.length>0&&s.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))}),(0,v.jsx)(l.Zp,{title:"ipv6",children:u.length>0&&u.map((e,s)=>(0,v.jsxs)("div",{children:[`${e.ifaceOrWww}(${e.ip})`,(0,v.jsx)(i.Sm,{right_placeholder:(0,v.jsx)("div",{children:e.source_type===A.tC.http_get&&(0,v.jsx)(d.rA,{icon:"delete",title:t("删除"),onClick:()=>{F(e)}})}),placeholder:"a.abc.com b.abc.com ...",value:e.ddnsHost,handleInputChange:t=>{e.ddnsHost=t}})]},s))})]}),(0,v.jsxs)(o.VP,{children:[(0,v.jsxs)(l.Zp,{title:t("账号设置"),rightBottomCom:(0,v.jsx)(d.C3,{text:t("保存"),clickFun:async()=>{if(C&&(!g||!_))return void(0,c.zN)("SecretId和SecretKey都不能为空");const e=new A.yL,t=[];for(const e of[...s,...u])e.ddnsHost&&t.push(e);e.ips=t,e.account={secretid:g,secretkey:_},e.isOpen=C,e.ddnsType=A.E2.tengxun;(await a.ez.post("save",e)).code===r.m.DdnsAuthFail?(0,c.zN)("鉴权失败"):(0,c.SK)("成功")}}),children:[(0,v.jsx)(i.Sm,{placeholder:"SecretId",value:g,handleInputChange:e=>{y(e)}}),(0,v.jsx)(i.cA,{placeholder:"SecretKey",value:_,handleInputChange:e=>{w(e)}}),(0,v.jsx)(p.S,{isFlex:!0,columns:[(0,v.jsx)(i.U6,{value:1,context:t("开启"),selected:C,onchange:()=>{k(!C)}}),(0,v.jsx)(i.U6,{value:1,context:t("关闭"),selected:!C,onchange:()=>{k(!C)}})]})]}),(0,v.jsx)(l.Zp,{title:t("说明"),children:"域名如果不存在会自动创建,空子域名是@,ip6和ipv4可以互相切换。"})]})]})]})}function F(){const{t:e}=(0,j.B)(),{check_user_auth:t}=(0,w.MH)(),s=[];return t(_.oV.vir_net)&&s.push({index:1,name:e("系统代理"),rto:"proxy_sys/",component:(0,v.jsx)(b,{})},{index:2,name:"Tun proxy "+e("客户端"),rto:"client/",component:(0,v.jsx)(y,{})},{index:3,name:"Tun proxy "+e("服务端"),rto:"server/",component:(0,v.jsx)(g,{})}),t(_.oV.ddns)&&s.push({index:4,name:`ddns-dnspod(${e("腾讯")})`,rto:"dnspod/",component:(0,v.jsx)(U,{})},{index:5,name:`ddns-${e("腾讯")}${e("云")}`,rto:"tengxun/",component:(0,v.jsx)(K,{})}),(0,v.jsx)(o.W1,{optionList:s,father_route:I.o.net})}},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 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4273],{77481(e,n,t){t.d(n,{S:()=>o,X:()=>i});var s=t(96540),l=t(61443),r=t(74848);function i(e){const[n,t]=s.useState([]),i=(0,s.useRef)(-1),[o,a]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?t(Array.isArray(e.children)?e.children:[e.children]):t(e.rows)},[e.rows,e.children]);const _=()=>{i.current=-1,a(-1),d(-1)};return(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{children:e.headers?.map((n,t)=>{const s=!!e.filter&&(e.filter.column??0)===t;let i=n;if(s){const t=e.filter,s=t.options.find(e=>e.value===t.value);null!=t.value&&s&&(i=`${n} (${s.label})`)}return(0,r.jsx)("th",{className:s?"table-filter-col":"",children:s?(0,r.jsx)(l.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,bare:!0,trigger_label:i}):n},t)})})}),(0,r.jsx)("tbody",{children:n.map((n,t)=>{const s=!!e.onRowDrag;return(0,r.jsx)("tr",{className:s?(o===t?"row-dragging":"")+(c===t?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(n)},onDragStart:e=>{s&&(i.current=t,a(t),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(t))},onDrop:n=>{s&&(n.preventDefault(),(()=>{const n=i.current,t=c;_(),n<0||t<0||n===t||e.onRowDrag?.(n,t)})())},onDragEnd:_,children:n.map((t,s)=>{const l=s===n.length-1?"small":"";return(0,r.jsx)("td",{className:l,style:{width:e.width??"auto"},children:t},s)})},t)})})]})}function o(e){return(0,r.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,n)=>(0,r.jsx)("div",{children:e},n))})}},94273(e,n,t){t.r(n),t.d(n,{default:()=>N});var s=t(96540),l=t(75725),r=t(86149),i=t(70447),o=t(85997),a=t(77481),c=t(61443),d=t(14284),_=t(53459),p=t(7523),x=t(34843),u=t(82893),h=t(62042),j=(t(23430),t(21499),t(14944)),m=t(92275),v=t(6960),f=t(40505),g=t(4412),y=t(24659),w=t(74848);let S={};function C(){const{t:e,i18n:n}=(0,r.B)(),{initUserInfo:t,reloadUserInfo:C}=(0,s.useContext)(p.F),[I,b]=(0,x.fp)(u.AG.user_base_info),[k,A]=(0,s.useState)([]),[P,$]=(0,x.fp)(u.AG.prompt_card),K=(0,y.K)(),[F,N]=(0,s.useState)(),[U,G]=(0,s.useState)(void 0),[D,B]=(0,s.useState)(null),[E,M]=(0,s.useState)([]),[V,X]=(0,s.useState)([]),Z=[e("序号"),e("名称"),e("在线状态"),e("时间"),e("备注")],H=[e("序号"),e("服务端口"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],q=[e("序号"),e("服务端口"),e("转发Client名称"),e("转发ip"),e("转发端口"),e("开启"),e("备注")],z=e=>null==e?"":(0,v.s)(e),L=async e=>{const n=await d.s9.post("server_bridge_get_one_fig",{server_client_num_id:e});if(n.code===_.m.Success){const e=n.data;for(const n of e)n.client_name=S?.[n.client_num_id]?.client_name??"";X(e)}},R=async e=>{const n=void 0===e?D:e,t=await d.s9.get("server_client_get");if(t.code===_.m.Success){const e=t.data,s=[],l=[];S={};for(const t of e)null!==n&&!!t.status!==n||(U?`${t.index}${t.client_name}${t.note}`.includes(U)&&s.push(t):s.push(t),l.push({label:t.client_name,value:t.client_num_id}),S[t.client_num_id]=t);A(s),M(l)}};(0,s.useEffect)(()=>{j.ws.addMsg(m.HK.tcp_forward_server_load,e=>{R()}),R()},[]);return(0,w.jsxs)(s.Fragment,{children:[(0,w.jsx)(g.aZ,{position:"right",children:F&&(0,w.jsx)("span",{children:`${F.client_name}${F.note?`(${F.note})`:""}`})}),(0,w.jsxs)(l.fI,{children:[(0,w.jsx)(l.VP,{widthPer:50,children:(0,w.jsx)(l.xh,{children:(0,w.jsx)(i.uF,{self_title:(0,w.jsx)("span",{className:" div-row ",children:(0,w.jsx)("h2",{children:e("客户端列表")})}),titleCom:(0,w.jsx)(c.Sm,{placeholder:e("过滤"),value:U,handleInputChange:e=>{G(e)},handlerEnter:()=>{R()}}),children:(0,w.jsx)(a.X,{headers:Z,filter:{title:e("在线状态"),column:2,value:D,options:[{label:e("全部"),value:null},{label:e("在线"),value:!0},{label:e("离线"),value:!1}],onChange:e=>{B(e),R(e)}},rows:k.map((n,t)=>[(0,w.jsx)("p",{children:t}),(0,w.jsx)(i.xP,{children:n.client_name}),(0,w.jsx)(i.fq,{ok:n.status}),(0,w.jsx)(i.xP,{children:z(n.status?n.online_start_time:n.offline_time)}),(0,w.jsx)(i.xP,{children:n.note}),(0,w.jsxs)("div",{children:[(0,w.jsx)(o.rA,{icon:"edit",title:e("编辑"),onClick:()=>{N({...n}),L(n.client_num_id)}}),(0,w.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>{$({open:!0,title:"share file",confirm:async()=>{$({open:!1}),await(async e=>{(await d.s9.post("server_client_del",{client_num_id:e})).code===_.m.Success&&((0,h.SK)("成功"),R())})(n.client_num_id)},context_div:(0,w.jsx)("div",{className:"card-content",children:e("确定删除这个吗客户端吗?")})})}})]})]),width:"10rem"})})})}),(0,w.jsx)(l.VP,{widthPer:50,children:F?(0,w.jsxs)(l.xh,{children:[(0,w.jsxs)(i.Zp,{self_title:(0,w.jsxs)("span",{className:" div-row ",children:[(0,w.jsx)("h2",{children:e("代理配置")})," "]}),rightBottomCom:(0,w.jsx)("div",{children:(0,w.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.s9.post("server_client_save",F)).code===_.m.Success&&(0,h.SK)("成功")}})}),children:[(0,w.jsx)(l.Yh,{left:e("远程地址"),center:F?.client_remote_address??""}),(0,w.jsx)(l.Yh,{left:e(F?.status?"在线时间":"离线时间"),center:z(F?.status?F?.online_start_time:F?.offline_time)}),(0,w.jsx)(c.Sm,{placeholder:"名称",value:F.client_name,handleInputChange:e=>{F.client_name=e,N({...F})}}),(0,w.jsxs)("form",{children:[e("filecat代理访问"),":",(0,w.jsx)(a.S,{isFlex:!0,columns:[(0,w.jsx)(c.U6,{value:1,context:e("开启"),selected:F.open_filecat,onchange:()=>{F.open_filecat=!F.open_filecat,N({...F})}}),(0,w.jsx)(c.U6,{value:1,context:e("关闭"),selected:!F.open_filecat,onchange:()=>{F.open_filecat=!F.open_filecat,N({...F})}})]})]}),F.open_filecat&&(0,w.jsxs)(s.Fragment,{children:[(0,w.jsxs)("form",{children:[e("filecat代理访问使用服务器前端"),":",(0,w.jsx)(a.S,{isFlex:!0,columns:[(0,w.jsx)(c.U6,{value:1,context:e("开启"),selected:F.filecat_use_local_page,onchange:()=>{F.filecat_use_local_page=!F.filecat_use_local_page,N({...F})}}),(0,w.jsx)(c.U6,{value:1,context:e("关闭"),selected:!F.filecat_use_local_page,onchange:()=>{F.filecat_use_local_page=!F.filecat_use_local_page,N({...F})}})]})]}),(0,w.jsx)(c.Sm,{placeholderOut:e("自定义filecat代理地址"),placeholder:"127.0.0.1:5567",value:F.filecat_proxy_host_port,handleInputChange:e=>{F.filecat_proxy_host_port=e,N({...F})}}),(0,w.jsx)(o.rA,{icon:"content_copy",title:e("复制filecat代理url"),onClick:()=>{const e=`${window.location.origin}?tcp_client_num_id=${F.client_num_id}`;(0,f.lW)(e),(0,h.SK)(e)}})]}),(0,w.jsx)(c.Sm,{placeholder:"备注",value:F.note,handleInputChange:e=>{F.note=e,N({...F})}}),(0,w.jsx)(o.rA,{icon:"add",onClick:()=>{F.proxy_fig_list.push({open:!1}),N({...F})},title:e("添加")}),e("代理"),(0,w.jsx)(a.X,{headers:H,rows:F.proxy_fig_list.map((n,t)=>[(0,w.jsx)("p",{children:t}),(0,w.jsx)(c.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,w.jsx)(c.Sm,{value:n.proxy_host,handleInputChange:e=>{n.proxy_host=e},no_border:!0}),(0,w.jsx)(c.Sm,{value:n.proxy_port,handleInputChange:e=>{n.proxy_port=parseInt(e)},no_border:!0}),(0,w.jsx)(c.l6,{value:!!n.open,onChange:e=>{n.open=e,N({...F})},options:K,no_border:!0}),(0,w.jsx)(c.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,w.jsx)("div",{children:(0,w.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>{const e=[];for(let n=0;n<(F.proxy_fig_list.length??0);n++)n!==t&&e.push(F.proxy_fig_list[n]);F.proxy_fig_list=e,N({...F})}})})]),width:"10rem"})]}),(0,w.jsxs)(i.Zp,{self_title:(0,w.jsxs)("span",{className:" div-row ",children:[(0,w.jsx)("h2",{children:e("桥接配置")})," "]}),children:[(0,w.jsx)(o.rA,{icon:"add",onClick:()=>{V.push({open:!1,server_client_num_id:F.client_num_id}),X([...V])},title:e("添加")}),e("代理"),(0,w.jsx)(a.X,{headers:q,rows:V.map((n,t)=>[(0,w.jsx)("p",{children:t}),(0,w.jsx)(c.Sm,{value:n.server_port,handleInputChange:e=>{n.server_port=parseInt(e)},no_border:!0}),(0,w.jsx)(c.Sm,{value:n.client_name,options:E,handleInputChange:e=>{const t=(e=>E.find(n=>String(n.value)===String(e)))(e);n.client_num_id=parseInt(String(t.value)),n.client_name=t.label,X([...V])},no_border:!0}),(0,w.jsx)(c.Sm,{value:n.client_proxy_host,handleInputChange:e=>{n.client_proxy_host=e},no_border:!0}),(0,w.jsx)(c.Sm,{value:n.client_proxy_port,handleInputChange:e=>{n.client_proxy_port=parseInt(e)},no_border:!0}),(0,w.jsx)(c.l6,{value:!!n.open,onChange:e=>{n.open=e,X([...V])},options:K,no_border:!0}),(0,w.jsx)(c.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,w.jsxs)("div",{children:[(0,w.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:async()=>{if(null==n.id){const e=[];for(let n=0;n<(V.length??0);n++)n!==t&&e.push(V[n]);X([...e])}else await(async(e,n)=>{(await d.s9.post("server_bridge_del_fig",{id:e})).code===_.m.Success&&((0,h.SK)("成功"),L(n))})(n.id,n.server_client_num_id)}}),null==n.id?(0,w.jsx)(o.rA,{icon:"add",title:e("添加"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,h.zN)("未选择转发送 client");(await d.s9.post("server_bridge_add_fig",e)).code===_.m.Success&&((0,h.SK)("成功"),L(e.server_client_num_id))})(n)}}):(0,w.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:async()=>{await(async e=>{if(null==e.client_num_id)return void(0,h.zN)("未选择转发送 client");(await d.s9.post("server_bridge_edit_fig",e)).code===_.m.Success&&((0,h.SK)("成功"),L(e.server_client_num_id))})(n)}})]})]),width:"10rem"})]})]}):(0,w.jsx)(l.xh,{})})]})]})}class I{open;key;option_keys;port}class b{client_name;client_num_id;open=!1;serverIp;serverPort;key="";note;status;is_new;index}var k=t(7463);function A(e){const{t:n}=(0,r.B)(),[t,p]=(0,s.useState)([]),[x,u]=(0,s.useState)([]),[v,f]=(0,s.useState)([]),[g,S]=(0,s.useState)([]),C=[n("序号"),n("服务端口"),n("转发客户端名称")],I=[n("序号"),n("原客户端"),n("目标客户端"),n("待同步文件数量")],A=[n("序号"),n("port"),n("host"),n("名称"),n("key"),n("在线"),n("开启"),n("备注")],P=(0,y.K)(),$=async()=>{const e=await d.s9.get("client_get");if(e.code===_.m.Success){const n=e.data;p(n.list)}const n=await d.s9.get("client_bridge_get_all_fig");n.code===_.m.Success&&f(n.data);const t=await d.s9.get("client_sync_task_get");t.code===_.m.Success&&S(t.data)};(0,s.useEffect)(()=>($(),j.ws.sendData(m.HK.tcp_proxy_client_status,{}).then(()=>{const e=(0,k.sg)(()=>$(),500);j.ws.addMsg(m.HK.tcp_proxy_client_status,e)}),()=>{j.ws.removeMsg(m.HK.tcp_proxy_client_status)}),[]);const K=async e=>{const n=new b;n.index=e.index,n.key=e.key,n.serverIp=e.serverIp,n.serverPort=e.serverPort,n.open=e.open,n.client_name=e.client_name,n.client_num_id=e.client_num_id;(await d.s9.post("client_save",n)).code===_.m.Success?(0,h.SK)("保存成功"):(0,h.zN)("网络错误")};return(0,w.jsxs)("div",{children:[(0,w.jsxs)(l.fI,{children:[(0,w.jsx)(l.VP,{widthPer:33,children:(0,w.jsxs)(i.Zp,{title:"",rightBottomCom:(0,w.jsx)(o.C3,{text:n("保存"),clickFun:()=>{t[0].index=0,K(t[0])}}),titleCom:(0,w.jsxs)("div",{children:[n("连接状态"),(0,w.jsx)(i.fq,{ok:!!t[0]?.status})]}),children:[(0,w.jsx)(c.Sm,{placeholder:`${n("服务器")} ip`,value:t[0]?.serverIp,handleInputChange:e=>{t[0].serverIp=e}}),(0,w.jsx)(c.Sm,{type:"number",placeholder:`${n("服务器")} port`,value:t[0]?.serverPort,handleInputChange:e=>{const n=parseInt(e);!isNaN(n)&&n>=0&&n<=65535&&(t[0].serverPort=n)}}),(0,w.jsx)(c.Sm,{placeholder:n("名称"),value:t[0]?.client_name,handleInputChange:e=>{t[0].client_name=e}}),(0,w.jsx)(c.Sm,{type:"password",placeholder:"key ",value:t[0]?.key,handleInputChange:e=>{t[0].key=e}}),(0,w.jsxs)("form",{children:[n("状态"),(0,w.jsx)(a.S,{isFlex:!0,columns:[(0,w.jsx)(c.U6,{value:1,context:n("开启"),selected:t[0]?.open,onchange:()=>{t[0].open=!t[0].open,p([...t])}}),(0,w.jsx)(c.U6,{value:1,context:n("关闭"),selected:!t[0]?.open,onchange:()=>{t[0].open=!t[0].open,p([...t])}})]})]})]})}),(0,w.jsx)(l.VP,{widthPer:40,children:(0,w.jsxs)(i.Zp,{self_title:(0,w.jsxs)("span",{className:" div-row ",children:[(0,w.jsx)("h2",{children:n("更多服务器")})," "]}),children:[(0,w.jsx)(o.rA,{icon:"add",onClick:()=>{t.push({open:!1,is_new:!0}),p([...t])},title:n("添加")}),n("代理"),(0,w.jsx)(a.X,{headers:A,rows:t.slice(1).map((e,s)=>[(0,w.jsx)("p",{children:s}),(0,w.jsx)(c.Sm,{type:"number",value:e.serverPort,handleInputChange:n=>{const t=parseInt(n);!isNaN(t)&&t>=0&&t<=65535&&(e.serverPort=t)},no_border:!0}),(0,w.jsx)(c.Sm,{value:e.serverIp,handleInputChange:n=>{e.serverIp=n},no_border:!0}),(0,w.jsx)(c.Sm,{value:e.client_name,handleInputChange:n=>{e.client_name=n},no_border:!0}),(0,w.jsx)(c.Sm,{value:e.key,handleInputChange:n=>{e.key=n},no_border:!0}),(0,w.jsx)(i.fq,{ok:!!e.status}),(0,w.jsx)(c.l6,{value:!!e.open,onChange:n=>{e.open=n,p([...t])},options:P,no_border:!0}),(0,w.jsx)(c.Sm,{value:e.note,handleInputChange:n=>{e.note=n},no_border:!0}),(0,w.jsxs)("div",{children:[(0,w.jsx)(o.rA,{icon:"delete",title:n("删除"),onClick:async()=>{if(e.is_new){const e=[];for(let n=0;n<(t.length??0);n++)n!==s&&e.push(t[n]);p([...e])}else await(async e=>{(await d.s9.post("client_del",{index:e})).code===_.m.Success?((0,h.SK)("保存成功"),$()):(0,h.zN)("网络错误")})(s+1)}}),e.is_new?(0,w.jsx)(o.rA,{icon:"add",title:n("添加"),onClick:async()=>{e.index=s+1,await K(e)}}):(0,w.jsx)(o.rA,{icon:"save",title:n("保存"),onClick:async()=>{e.index=s+1,await K(e)}})]})]),width:"10rem"})]})})]}),(0,w.jsxs)(l.fI,{children:[!!v?.length&&(0,w.jsx)(l.VP,{widthPer:40,children:(0,w.jsx)(i.Zp,{title:n("桥接服务端口列表"),children:(0,w.jsx)(a.X,{headers:C,rows:v.map((e,n)=>[(0,w.jsx)("p",{children:n}),(0,w.jsx)(i.xP,{children:e.server_port}),(0,w.jsx)(i.xP,{children:e.client_name})]),width:"10rem"})})}),!!g?.length&&(0,w.jsx)(l.VP,{widthPer:40,children:(0,w.jsx)(i.Zp,{title:n("文件同步列表"),children:(0,w.jsx)(a.X,{headers:I,rows:g.map((e,n)=>[(0,w.jsx)("p",{children:n}),(0,w.jsx)(i.xP,{children:e.source_client_name}),(0,w.jsx)(i.xP,{children:e.target_client_name}),(0,w.jsx)(i.xP,{children:e.running_num})]),width:"10rem"})})})]})]})}function P(){const{t:e,i18n:n}=(0,r.B)(),{initUserInfo:t,reloadUserInfo:v}=(0,s.useContext)(p.F),[f,g]=(0,x.fp)(u.AG.user_base_info),[y,S]=(0,x.fp)(u.AG.prompt_card),[C,b]=(0,s.useState)(!1),[k,A]=(0,s.useState)([]),[P,$]=(0,s.useState)(null),[K,F]=(0,s.useState)([]),[N,U]=(0,s.useState)(void 0),[G,D]=(0,s.useState)(void 0),B=(0,s.useMemo)(()=>{const e=[...k];return null!=P?(e.sort((e,n)=>P?e.server_port-n.server_port:n.server_port-e.server_port),e):e},[k,P]),E=async()=>{const e=await d.s9.get("get_all_open_server_client_proxy_fig");if(e.code===_.m.Success){const n=[];for(const t of e.data)G?`${t.server_port}${t.client_name}${t.proxy_host}${t.server_port}${t.server_port_note}`.includes(G)&&n.push(t):n.push(t);A(n)}},M=async()=>{const e=await d.s9.get("server_get");e.code===_.m.Success&&(U(e.data.port),b(!!e.data.open),F(e.data.option_keys??[])),E()};(0,s.useEffect)(()=>{j.ws.addMsg(m.HK.tcp_forward_server_load,e=>{M()}),M()},[]);const V=async e=>{const n=new I;n.port=N,n.open=C,n.option_keys=K;(await d.s9.post("server_save",{fig:n,notice_client:e})).code===_.m.Success&&(0,h.SK)("成功")};return(0,w.jsxs)(l.fI,{children:[(0,w.jsx)(l.VP,{widthPer:33,children:(0,w.jsx)(l.xh,{children:(0,w.jsxs)(i.Zp,{title:e("服务器配置"),rightBottomCom:(0,w.jsxs)("div",{children:[(0,w.jsx)(o.C3,{text:e("保存并通知客户端第一个key和port"),clickFun:()=>{V(!0)}}),(0,w.jsx)(o.C3,{text:e("保存"),clickFun:()=>{V(!1)}})]}),children:[(0,w.jsx)(c.Sm,{placeholder:"port",value:N,handleInputChange:e=>{U(e)}}),(0,w.jsxs)("label",{children:[(0,w.jsx)(o.rA,{icon:"add",onClick:()=>{F([...K,""])},title:e("添加")}),e("key")]}),(K??[]).map((n,t)=>(0,w.jsxs)("div",{style:{display:"flex"},children:[(0,w.jsx)("div",{style:{width:"90%"},children:(0,w.jsx)(c.Sm,{type:"password",value:n,handleInputChange:e=>{K[t]=e,F([...K])}})}),(0,w.jsx)(o.rA,{icon:"delete",onClick:()=>{K.splice(t,1),F([...K])},title:e("删除")})]},t)),(0,w.jsxs)("form",{children:[e("状态"),":",(0,w.jsx)(a.S,{isFlex:!0,columns:[(0,w.jsx)(c.U6,{value:1,context:e("开启"),selected:C,onchange:()=>{b(!C)}}),(0,w.jsx)(c.U6,{value:1,context:e("关闭"),selected:!C,onchange:()=>{b(!C)}})]})]})]})})}),(0,w.jsx)(l.VP,{widthPer:50,children:(0,w.jsx)(l.xh,{children:(0,w.jsx)(i.uF,{self_title:(0,w.jsx)("span",{className:" div-row ",children:(0,w.jsx)("h2",{children:e("服务器")+e("端口映射")})}),titleCom:(0,w.jsx)(c.Sm,{placeholder:e("过滤"),value:G,handleInputChange:e=>{D(e)},handlerEnter:()=>{E()}}),children:(0,w.jsx)(a.X,{headers:[e("序号"),(0,w.jsx)(o.rA,{title:e("服务端口"),onClick:()=>{$(e=>!e)}}),e("转发ip"),e("转发端口"),"client "+e("名称"),e("开启"),e("备注")],rows:B.map((e,n)=>[(0,w.jsx)("p",{children:n}),(0,w.jsx)(i.xP,{children:e.server_port}),(0,w.jsx)(i.xP,{children:e.proxy_host}),(0,w.jsx)(i.xP,{children:e.proxy_port}),(0,w.jsx)(i.xP,{children:e.client_name}),(0,w.jsx)(i.fq,{ok:!!e.open_success}),(0,w.jsx)(i.xP,{children:e.server_port_note})]),width:"10rem"})})})})]})}var $=t(78247);function K(){const{t:e,i18n:n}=(0,r.B)(),{initUserInfo:t,reloadUserInfo:j}=(0,s.useContext)(p.F),[m,v]=(0,x.fp)(u.AG.user_base_info),[f,g]=(0,x.fp)(u.AG.prompt_card),[,y]=(0,x.fp)(u.AG.confirm),[S,C]=(0,x.fp)(u.AG.editorSetting),[I,b]=(0,s.useState)([]),k=[e("编号"),e("原客户端"),e("原目录"),e("目标客户端"),e("目标目录"),e("忽略目录"),e("开启"),e("双向同步"),e("全量同步"),e("备注")],[A,P]=(0,s.useState)([]);(0,s.useEffect)(()=>{(async()=>{const e=await d.s9.get("server_client_get");if(e.code===_.m.Success){const n=e.data,t=[];for(const e of n)t.push({label:e.client_name,value:e.client_num_id});P(t),await K()}})()},[]);const K=async()=>{const e=await d.s9.get("sync_task_get");e.code===_.m.Success&&b(e.data)},F=e=>A.find(n=>String(n.value)===String(e)),N=async e=>{const n=e;(await d.s9.post("sync_task_save",n)).code===_.m.Success&&((0,h.SK)("成功"),await K())};return(0,w.jsx)(l.fI,{children:(0,w.jsx)(l.VP,{widthPer:100,children:(0,w.jsx)(l.xh,{children:(0,w.jsxs)(i.Zp,{self_title:(0,w.jsxs)("span",{className:" div-row ",children:[(0,w.jsx)("h2",{children:e("客户端文件同步")}),(0,w.jsx)(o.rA,{icon:"info",onClick:()=>{g({open:!0,title:"信息",context_div:(0,w.jsx)("div",{children:(0,w.jsxs)("ul",{children:[(0,w.jsx)("li",{children:"目前只能同步较小的文件,例如配置文件,代码文件"}),(0,w.jsx)("li",{children:e("默认(没有选中全量同步)不会立即同步两个目录中的文件,而是有文件被修改或者改动后才会同步,如果开启全量同步,每次客户端一上线就会递归的同步全部的文件,如果文件非常多,这会造成很大的执行压力。")}),(0,w.jsx)("li",{children:e("如果开启了双向同步,如果两边初始化的时候各自又有很多文件,这是不太稳定的,暂时不建议这样做。")}),(0,w.jsx)("li",{children:e("同时开启全量同步和双向同步,目前性能也会很差,目前没有提供提供冲突冲突的机制。")}),(0,w.jsx)("li",{children:e("如果想用全量同步,一方的文件是空的,且文件数量比较少,几百这样的数量,效果是不错的,之后会一直走增量更新。")})]})})})},title:"信息"})]}),children:[(0,w.jsx)(o.rA,{icon:"add",onClick:()=>{I.push({open:!1,source_dir:"",target_dir:"",delete_missing:!0}),b([...I])},title:e("添加")}),(0,w.jsx)(a.X,{headers:k,rows:I.map((n,t)=>{const s=F(n.source_client_num_id),l=F(n.target_client_num_id);return[(0,w.jsx)("p",{children:t}),(0,w.jsx)(c.Sm,{value:s?.label??n.source_client_name,options:A,handleInputChange:e=>{const t=F(e);n.source_client_num_id=parseInt(String(t?.value)),n.source_client_name=t?.label,b([...I])},no_border:!0}),(0,w.jsx)(c.Sm,{value:n.source_dir,handleInputChange:e=>{n.source_dir=e},no_border:!0}),(0,w.jsx)(c.Sm,{value:l?.label??n.target_client_name,options:A,handleInputChange:e=>{const t=F(e);n.target_client_num_id=parseInt(String(t?.value)),n.target_client_name=t?.label,b([...I])},no_border:!0}),(0,w.jsx)(c.Sm,{value:n.target_dir,handleInputChange:e=>{n.target_dir=e},no_border:!0}),(0,w.jsx)(o.rA,{icon:"edit",title:"额外参数设置",onClick:()=>{$.xK.set_value_temp(n.ignore_text??"\nnode_modules\n.venv\n.gradle\n.cache\nvendor\n"),C({model:"ace/mode/gitignore",open:!0,fileName:"",save:async e=>{n.ignore_text=e,b([...I]),$.xK.set_value_temp(""),N(n)}})}}),(0,w.jsx)(c.GL,{selected:!!n.open,onchange:()=>{n.open=!n.open,b([...I])}}),(0,w.jsx)(c.GL,{selected:!!n.two_way_sync,onchange:()=>{n.two_way_sync=!n.two_way_sync,b([...I])}}),(0,w.jsx)(c.GL,{selected:!!n.full_sync,onchange:()=>{n.full_sync=!n.full_sync,b([...I])}}),(0,w.jsx)(c.Sm,{value:n.note,handleInputChange:e=>{n.note=e},no_border:!0}),(0,w.jsxs)("div",{children:[(0,w.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:()=>{N(n)}}),(0,w.jsx)(o.rA,{icon:"delete",title:e("删除"),onClick:()=>{n.id?y({open:!0,title:e("确定删除吗"),handle:async()=>{await(async e=>{(await d.s9.post("sync_task_del",{id:e})).code===_.m.Success&&((0,h.SK)("成功"),await K())})(n.id),y({open:!1,handle:null})}}):(I.splice(t,1),b([...I]))}})]})]}),width:"10rem"})]})})})})}var F=t(87361);function N(){const{t:e}=(0,r.B)(),n=[{index:1,name:e("客户端"),rto:"tcp_proxy_client/",component:(0,w.jsx)(A,{})},{index:2,name:e("服务端"),rto:"tcp_proxy_server_info/",component:(0,w.jsx)(P,{})},{index:3,name:e("服务端")+"-"+e("客户端列表"),rto:"tcp_proxy_server_client/",component:(0,w.jsx)(C,{})},{index:4,name:e("服务端")+"-"+e("客户端功能"),rto:"tcp_proxy_server_client_setting/",component:(0,w.jsx)(K,{})}];return(0,w.jsx)(l.W1,{optionList:n,father_route:F.o.net_proxy})}},6960(e,n,t){t.d(n,{s:()=>i});var s=t(72635);const l=1440,r=525600;function i(e){e=e>1e12?e:1e3*e;const n=Date.now(),t=Math.abs(n-e)/6e4;return t<1?s.Ay.t("小于一分钟"):t<60?`${t.toFixed(0)} ${s.Ay.t("分钟前")}`:t<l?`${(t/60).toFixed(0)} ${s.Ay.t("小时前")}`:t<43200?`${(t/l).toFixed(0)} ${s.Ay.t("天前")}`:t<r?`${(t/43200).toFixed(0)} ${s.Ay.t("月前")}`:`${(t/r).toFixed(0)} ${s.Ay.t("年前")}`}},24659(e,n,t){var s=t(86149);t.d(n,["K",0,()=>{const{t:e}=(0,s.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])}}]);
|