filecat 6.64.1 → 6.65.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/1448.82a3b69ae7c0fb450278.js +1 -0
- package/build/dist/1472.7d429a0e8931548d4c65.js +1 -0
- package/build/dist/1636.9bacc707d24a10ec54a7.js +1 -0
- package/build/dist/1893.602c374e4392cb4ce4e0.js +1 -0
- package/build/dist/2851.c01bf2e1b109ff793f26.js +1 -0
- package/build/dist/3659.ff38a32734bc4b554f75.js +1 -0
- package/build/dist/4273.7a89027ccab7190e4bb3.js +1 -0
- package/build/dist/5877.c3b8656d543de13651a0.js +1 -0
- package/build/dist/5937.cb255300ad4ecacbf26a.js +1 -0
- package/build/dist/6247.1924073703e9a1ac779e.js +1 -0
- package/build/dist/676.7db44f7b39bd0a3be5a6.js +1 -0
- package/build/dist/6919.423a2e831e713be54ea0.js +1 -0
- package/build/dist/7759.868061de8d33d120b740.js +1 -0
- package/build/dist/8302.905f1799092f205f27a6.js +1 -0
- package/build/dist/8319.bb6c2314a1e97312bfc4.js +1 -0
- package/build/dist/8603.5b96680516f93196c2c0.js +1 -0
- package/build/dist/8714.61080fa27707cba36835.js +1 -0
- package/build/dist/9546.44f31dcf58d9b3761677.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.1af9587a0d6db4cebacf.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/shell/config/webpack.web.config.js +1 -1
- package/build/dist/1448.232c15e7a54d5fd63ecf.js +0 -1
- package/build/dist/1472.5db284b3632a44705cde.js +0 -1
- package/build/dist/1636.d564c11eb75c71ba75e5.js +0 -1
- package/build/dist/1893.4caf367bf06a83c09adf.js +0 -1
- package/build/dist/2851.baea584c36417d65ded8.js +0 -1
- package/build/dist/3659.42ebbfa853db66b4c3b3.js +0 -1
- package/build/dist/4273.9d196861ce7907a19e13.js +0 -1
- package/build/dist/5877.803d7b1a9f6d6e1264e9.js +0 -1
- package/build/dist/5937.2505cb3d3bcf2393e063.js +0 -1
- package/build/dist/6247.f337a0766a216e034bde.js +0 -1
- package/build/dist/676.98b607bbe65d44bc5df1.js +0 -1
- package/build/dist/6919.a65dcb5e95df23edd818.js +0 -1
- package/build/dist/7759.7070cfce4ede684073a2.js +0 -1
- package/build/dist/8302.53fffbe4b9ecef206405.js +0 -1
- package/build/dist/8319.307ec20219e2828c9a47.js +0 -1
- package/build/dist/8603.72dcd1e8f1337a1b72bb.js +0 -1
- package/build/dist/8714.859f6f455bef5c6af36c.js +0 -1
- package/build/dist/9546.bd518f38fcce8f30331d.js +0 -1
- package/build/dist/main.e83a6beb323ff107165d.js +0 -2
- /package/build/dist/{main.e83a6beb323ff107165d.js.LICENSE.txt → main.1af9587a0d6db4cebacf.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[5937],{8694(e,t,a){a.d(t,{$K:()=>o,RB:()=>r,l5:()=>c,qB:()=>s,vo:()=>i,vr:()=>l});class s{targetProxyUrl;proxyPort;sysProxyPort}let n=function(e){return e[e.tcp=0]="tcp",e[e.udp=1]="udp",e}({});class o{open=!1;port;key="";async_ips=[]}class i{client_num_id;client_name;open=!1;ip;mask;serverIp;serverPort;key="";model=n.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 c{enabled;ip;port;bypass;useForLocal;type}},75007(e,t,a){a.d(t,{h:()=>o});a(96540);var s=a(85997),n=a(74848);function o(e){return(0,n.jsxs)("h2",{className:"message",children:[(0,n.jsx)(s.In,{icon:"sentiment_dissatisfied"}),(0,n.jsx)("span",{children:e.context})]})}},47374(e,t,a){a.d(t,{e:()=>p});var s=a(96540),n=a(86090),o=a(64694),i=a(34289),r=a(61443),l=a(75725),c=a(86149),d=a(85997),u=a(74848);function p(e){let t=(0,n.zy)();const[a,p]=(0,s.useState)([]),[h,m]=(0,s.useState)("/"),[f,y]=(0,s.useState)(void 0),{t:_,i18n:v}=(0,c.B)();s.useEffect(()=>{let t="",a=(0,i.vX)().split("/");a=a.filter(e=>e);const s=a.indexOf(e.baseRoute),n=[];if(-1!=s){t=(0,o.IO)(a.slice(0,s),e.baseRoute);const i=a.slice(s+1);for(let e=0;e<i.length;e++){const a=i[e];n.push({value:a,href:0===e?`${t}${a}/`:(0,o.IO)(n[e-1].href,a)})}m(t),p(n)}},[t]);const x=t=>{t.stopPropagation(),e.clickFun(t)};return(0,u.jsx)("div",{className:"breadcrumbs",onClick:e=>{y(void 0!==f?void 0:"")},children:(0,u.jsx)(s.Fragment,{children:void 0===f?(0,u.jsxs)(s.Fragment,{children:[(0,u.jsx)("span",{className:"chevron",children:(0,u.jsx)(n.N_,{to:h,onClick:x,children:(0,u.jsx)(d.In,{icon:"home"})})}),a.map((e,t)=>(0,u.jsxs)("span",{className:"chevron",children:[(0,u.jsx)(d.In,{icon:"keyboard_arrow_right"}),(0,u.jsx)(n.N_,{to:e.href,onClick:x,children:decodeURIComponent(e.value)})]},t))]}):(0,u.jsx)(l.QM,{click:()=>{y(void 0)},children:(0,u.jsx)(r.Sm,{width:"100%",placeholder:_("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),y(void 0)}})})})})}},77481(e,t,a){a.d(t,{S:()=>r,X:()=>i});var s=a(96540),n=a(61443),o=a(74848);function i(e){const[t,a]=s.useState([]),i=(0,s.useRef)(-1),[r,l]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?a(Array.isArray(e.children)?e.children:[e.children]):a(e.rows)},[e.rows,e.children]);const u=()=>{i.current=-1,l(-1),d(-1)};return(0,o.jsxs)("table",{children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:e.headers?.map((t,a)=>(0,o.jsx)("th",{children:e.filter&&(e.filter.column??0)===a?(0,o.jsxs)("div",{className:"table-th-filter",children:[(0,o.jsx)("span",{children:t}),(0,o.jsx)(n.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},a))})}),(0,o.jsx)("tbody",{children:t.map((t,a)=>{const s=!!e.onRowDrag;return(0,o.jsx)("tr",{className:s?(r===a?"row-dragging":"")+(c===a?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(i.current=a,l(a),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(a))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=i.current,a=c;u(),t<0||a<0||t===a||e.onRowDrag?.(t,a)})())},onDragEnd:u,children:t.map((a,s)=>{const n=s===t.length-1?"small":"";return(0,o.jsx)("td",{className:n,style:{width:e.width??"auto"},children:a},s)})},a)})})]})}function r(e){return(0,o.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,o.jsx)("div",{children:e},t))})}},83029(e,t,a){a.d(t,{N:()=>v});var s=a(96540),n=a(34843),o=a(82893),i=a(74848);function r(e){const[t,a]=(0,n.fp)(o.AG.user_base_info);return(0,i.jsx)("div",{children:e.div?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,i.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,i.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var l=a(64694),c=a(61443),d=a(85997),u=a(86090),p=a(86149);const h=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let m,f,y=[];const _=[];function v(e){const[t,a]=(0,s.useState)([]),[v,x]=(0,s.useState)(-1),g=(0,u.zy)(),[w,j]=(0,s.useState)(!1),[k,N]=(0,s.useState)(!1),{t:K}=(0,p.B)(),[b,S]=(0,s.useState)([]),[C,A]=(0,n.fp)(o.AG.nav_index_add_item_by_now_list),F=e=>{-1!==v?_[v]._children=e:y=e};(0,s.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();y=t,a(y)})()},[g]);(0,s.useEffect)(()=>{if(C){const e=[...t,{name:"",color:(0,l.Lr)(h),...C}];F(e),a(e),j(!0),A(void 0)}},[C]);const D=e=>{x(v+1),a(e._children),_.push(e)};return(0,i.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==v&&(0,i.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{a(0===v?y:_[v-1]._children),x(v-1),_.pop()}}),t.map((n,o)=>(0,i.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{m=t})(0,o),onDrop:e=>((e,s)=>{e.preventDefault();const n=t[m],o=t[s];if(o&&"dir"===o._type){const e=[...t];return e.splice(m,1),o._children||(o._children=[]),o._children.push(n),F(e),void a(e)}const i=[...t],r=i[m];i.splice(m,1),i.splice(s,0,r),F(i),a(i)})(e,o),style:{cursor:w?"move":"pointer"},children:[(0,i.jsx)(r,{name:n.name,item:n,...n,div:w,target:"_blank",click_dir:D,clickItem:e.clickItem}),w&&(void 0!==b.find(e=>e===o)||k)&&(0,i.jsxs)("div",{className:k?"":" site_edit ",children:["dir"===n._type?(0,i.jsxs)(s.Fragment,{children:[(0,i.jsx)(c.Sm,{value:n.name,handleInputChange:e=>{n.name=e},placeholder:K("输入类目名"),no_border:!0}),(0,i.jsx)(c.Sm,{value:n.color,handleInputChange:e=>{n.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,i.jsx)("div",{children:(0,i.jsx)(c.Sm,{value:n[e.key],handleInputChange:t=>{n[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!k&&(0,i.jsx)(d.C3,{text:K("折叠"),clickFun:()=>{S((0,l.P1)(b,o))}})]}),w&&(0,i.jsx)("div",{style:{display:"block"},children:(0,i.jsxs)("span",{className:"div-row ",children:[(0,i.jsx)(d.C3,{text:K("删除"),clickFun:()=>{(e=>{const s=[...t];s.splice(e,1),F(s),a(s)})(o)}}),(0,i.jsx)(d.C3,{text:K("编辑"),clickFun:()=>{void 0===b.find(e=>e===o)&&S([...b,o])}})]})})]},o)),w&&(0,i.jsxs)("div",{style:{display:"block"},children:[(0,i.jsx)(d.rA,{title:K("取消"),icon:"cancel",onClick:()=>{S([]),j(!1),f&&(a(f),F(f)),N(!1)}}),(0,i.jsx)(d.rA,{title:K("添加"),icon:"add",onClick:async()=>{const s=[...t,{name:"",color:(0,l.Lr)(h),...e.get_pre_add_item&&await e.get_pre_add_item()}];F(s),a(s)}}),(0,i.jsx)(d.rA,{title:K("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];F(e),a(e)}}),(0,i.jsx)(d.rA,{title:K("全部编辑"),icon:k?"unfold_less":"unfold_more",onClick:()=>{N(!k)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,i.jsx)(d.rA,{icon:w?"save":"edit",title:K(w?"保存":"编辑"),onClick:async()=>{w?e.save&&await e.save(y):f=t,j(!w)}})]})}},15937(e,t,a){a.r(t),a.d(t,{default:()=>me});var s=a(96540),n=a(70447),o=a(75725),i=a(61443),r=a(85997),l=a(4412),c=a(14284),d=a(8694),u=a(53459),p=a(83029),h=a(86149),m=a(82893),f=a(34843),y=a(78247),_=a(23430),v=a(62042),x=a(74848);function g(e){const{t}=(0,h.B)(),[a,n]=(0,f.fp)(m.AG.header_min),[g,w]=(0,s.useState)(""),[j,k]=(0,s.useState)(""),[N,K]=(0,s.useState)(void 0),[b,S]=(0,s.useState)(!1),{check_user_auth:C}=(0,y.MH)(),A=async()=>{const e=new d.qB;e.targetProxyUrl="string"==typeof g?g:j;(await c._U.post("close",e)).code===u.m.Success&&(k(""),n(!1))},F=async e=>{const t=new d.qB;if(t.targetProxyUrl="string"==typeof e?e:g,!t.targetProxyUrl.startsWith("http"))return void(0,v.zN)("must start with http[s]://");const a=await c._U.post("start",t);if(a.code!==u.m.Success)return;const s=`${window.location.protocol}//${window.location.hostname}:${a.data}`;k(s)};(0,s.useEffect)(()=>()=>{A()},[]);return(0,x.jsxs)("div",{children:[(0,x.jsxs)(l.aZ,{position:"right",children:[(0,x.jsx)(i.$Z,{placeholder:t("要代理的url"),icon:"link",value:g,handleInputChange:e=>{w(e)}}),(0,x.jsx)(r.rA,{icon:"play_arrow",title:t("开始代理"),onClick:F}),(0,x.jsx)(r.rA,{icon:"fullscreen",title:t("全屏"),onClick:()=>{S(!b),n(!b)}}),(0,x.jsx)(r.rA,{icon:"close",title:t(t("关闭")),onClick:()=>{A(),S(!1),w("")}})]}),(0,x.jsx)(o.jW,{isFull:b,children:(0,x.jsxs)("div",{id:"browser",children:[!j&&(0,x.jsx)(p.N,{have_auth_edit:C(_.oV.browser_proxy_tag_update),getItems:async()=>{const e=await c._U.get("tag");return e.code===u.m.Success?e.data:[]},save:async e=>{(await c._U.post("tag/save",e)).code!==u.m.Success&&(0,v.zN)("网络错误")},clickItem:async e=>{w(e.url),F(e.url)},items:[{key:"name",preName:t("名字")},{key:"url",preName:"url"},{key:"color",preName:"color"}]}),(0,x.jsx)("iframe",{id:"webview",src:j})]})})]})}var w=a(34289),j=(a(75007),a(97856)),k=a(92275),N=a(14944),K=a(64405);const b=s.lazy(()=>Promise.all([a.e(2543),a.e(5614)]).then(()=>a(85614)));function S(e){const[t,a]=(0,s.useState)(null),[n,o]=(0,f.fp)(m.AG.remoteShellShow),[i,r]=(0,s.useState)(!1),[l,c]=(0,f.fp)(m.AG.sshInfo),[d,u]=(0,f.fp)(m.AG.shellNowDir),[p,h]=(0,f.fp)(m.AG.user_base_info),y=p.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",_=()=>{(async()=>{t&&(t.dispose(),a(null))})()};(0,s.useEffect)(()=>()=>{_()},[]),(0,s.useEffect)(()=>{n.show?t||((async()=>{const e=new j.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:y,cursor:y,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4});let t;const s=t=>{e.write(t)};t=a=>{e.clear(),e.write(a),t=s},N.ws.addMsg(k.HK.remote_shell_getting,e=>{t(e.context)}),e.onData(async e=>{const t=new K.x;t.key=l.key,t.cmd=e;const a=new k.hf(k.HK.remote_shell_send);a.context=t,await N.ws.send(a)}),a(e)})(),r(!0)):_()},[n]);return(0,x.jsx)(b,{show:n.show,terminal:t,init:(e,a)=>{t.writeln("[38;2;29;153;243mopen shell...[0m ");const s=new k.hf(k.HK.remote_shell_open),o=new K.x;o.key=l.key,o.init_path=n.path,o.rows=e,o.cols=a,s.context=o,N.ws.send(s)}})}var C=a(47374),A=a(86090),F=a(99214),D=a(47022),L=a(88815),M=a(6960),B=a(79240),I=a(18538),P=a(12730);function R(e){const{t}=(0,h.B)();(0,A.zy)();(0,A.Zp)();const{check_user_auth:a}=(0,y.MH)(),[n,o]=(0,f.fp)(m.AG.nowFileList),[i,l]=(0,f.fp)(m.AG.uploadFiles),[c,d]=(0,f.fp)(m.AG.showPrompt),[u,p]=(0,f.fp)(m.AG.selectedFileList),[_,g]=(0,f.fp)(m.AG.enterKey),[j,k]=(0,f.fp)(m.AG.copyedFileList),[N,K]=(0,f.fp)(m.AG.cutedFileList),[b,S]=(0,f.fp)(m.AG.selectedFileList),[C,L]=(0,f.fp)(m.AG.clickFileList),[M,B]=(0,f.fp)(m.AG.remoteShellShow),[R,E]=(0,f.fp)(m.AG.sshInfo),$=(0,F.Vs)();function G(e){(0,v.SK)(e)}return(0,x.jsxs)(s.Fragment,{children:[u.length>0&&(0,x.jsx)(r.rA,{icon:"delete",title:t("删除"),onClick:()=>{d({show:!0,type:I.PromptEnum.SshDelete,overlay:!0,data:{}})}}),u.length>0&&(0,x.jsx)(r.rA,{icon:"content_copy",title:t("复制"),onClick:function(){const e=(0,F.ib)(n,u);k(e.map(e=>`/${(0,w.GG)("remoteShell",(0,w.vX)())}${e.name}`)),K([]),G("已复制")}}),u.length>0&&(0,x.jsx)(r.rA,{icon:"content_cut",title:t("剪切"),onClick:function(){const e=(0,F.ib)(n,u);K(e.map(e=>`/${(0,w.GG)("remoteShell",(0,w.vX)())}${e.name}`)),k([]),G("已剪切")}}),(j.length>0||N.length>0)&&(0,x.jsx)(r.rA,{onClick:function(){d({show:!0,type:I.PromptEnum.SshPaste,overlay:!0,data:{}})},icon:"content_paste",title:t("粘贴到此处"),tip:j.length+N.length}),1===u.length&&n.files.length>=1&&(0,F.ib)(n,u)[0].type!==D.Iw.folder&&(0,x.jsx)(r.rA,{icon:"download",title:t("下载"),onClick:function(){const e=(0,F.ib)(n,u),t=`/api/ssh/download?file=${`/${(0,w.GG)("remoteShell",(0,w.vX)())}${decodeURIComponent(e[0].name)}`}&key=${R.key}&token=${localStorage.getItem("token")}`;window.open(t)}}),1===u.length&&(0,x.jsx)(r.rA,{icon:"edit_attributes",title:t("重命名"),onClick:function(){d({show:!0,type:I.PromptEnum.SshReName,overlay:!0,data:{}})}}),(0,x.jsx)(r.rA,{icon:"terminal",title:"shell",onClick:function(){M.show?B({show:!1,path:""}):B({show:!0,path:`/${(0,w.GG)("remoteShell",(0,w.vX)())}`})}}),(0,x.jsx)(r.rA,{icon:"grid_view",title:t("切换样式"),onClick:$}),(0,x.jsx)(r.rA,{icon:"create_new_folder",title:t("创建文件夹"),onClick:function(){d({show:!0,type:I.PromptEnum.SshNewDir,overlay:!0,data:{}})}}),(0,x.jsx)(r.rA,{icon:"note_add",title:t("创建文本文件"),onClick:function(){d({show:!0,type:I.PromptEnum.SshNewFile,overlay:!0,data:{}})}}),(0,x.jsx)(r.rA,{icon:"upload_file",title:"上传",onClick:()=>{d({show:!0,type:I.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let a=!!t[0].webkitRelativePath;const s=[],n=new Set;for(let e=0;e<t.length;e++){const o=t[e],i=a?o.webkitRelativePath:`${o.webkitRelativePath}${o.name}`;o.fullPath=i,a&&n.add((0,P.S)(i)),s.push(o)}const o=[];if(a)for(const e of Array.from(n))o.push({isDir:!0,fullPath:e,name:e});o.push(...s),l(o),d({show:!0,type:I.PromptEnum.SshUpload,overlay:!1,data:{}})}}})}}),(0,x.jsx)(r.rA,{icon:"close",title:t("关闭"),onClick:()=>{e.close()}})]})}var E=a(60096),$=a(21499);let G;function O(e){const{t}=(0,h.B)(),a=(0,A.zy)(),[n,o]=(0,f.fp)(m.AG.nowFileList),[r,d]=(0,f.fp)(m.AG.selectedFileList),[p,y]=(0,f.fp)(m.AG.clickFileList),[g,j]=(0,f.fp)(m.AG.sshInfo),[k,N]=(0,s.useState)(""),b=(0,A.Zp)(),[D,I]=(0,f.fp)(m.AG.user_base_info),P=async e=>{const t=new K.x;t.key=g.key,t.dir=e||`/${(0,w.GG)("remoteShell",(0,w.vX)())}`;const a=await c.Fg.post("get/dir",t);if(a.code!==u.m.Success)return void(0,v.zN)("连接失败");const{folders:s,files:n}=a.data||{};for(const e of n??[])e.origin_size=e.size,e.size=(0,L.v7)(e.size),D.user_data.file_time_show_type===_.KD.time?e.show_mtime=e.mtime?(0,$.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,M.s)(e.mtime):"";for(const e of s??[])D.user_data.file_time_show_type===_.KD.time?e.show_mtime=e.mtime?(0,$.Yq)(e.mtime):"":e.show_mtime=e.mtime?(0,M.s)(e.mtime):"";const i={folders:s||[],files:n||[]};(0,F.yC)(i,D.user_data.dir_show_type),o(i),G=i};function O(){d([]),y([])}(0,s.useEffect)(()=>{O(),(async()=>{await P()})()},[a]);return(0,x.jsxs)(s.Fragment,{children:[(0,x.jsx)(l.aZ,{children:(0,x.jsx)(i.$Z,{handleEnterPress:()=>{if(!G)return;d([]),y([]);const e=[],t=[];for(const t of G.files??[])t.name.includes(k)&&e.push(t);for(const e of G.folders??[])e.name.includes(k)&&t.push(e);o({files:e,folders:t})},placeholder:t("搜索当前目录"),icon:"search",value:"",handleInputChange:e=>{N(e)},max_width:"25em"})}),(0,x.jsx)(l.aZ,{position:"right",children:(0,x.jsx)(R,{close:e.close})}),(0,x.jsx)(C.e,{baseRoute:"remoteShell",clickFun:O,input_path_enter:e=>{(0,B.Z1)(e)?P(e):b((0,B.Jn)((0,w.vX)(),e)),d([]),y([]),o({files:[],folders:[]})}}),(0,x.jsx)(E.Ic,{handleContextMenu:()=>{},clickBlank:e=>{e.target===e.currentTarget&&d([])},file_list:n.files,folder_list:n.folders,fileHandler:P}),(0,x.jsx)(S,{})]})}function H(e){const{t}=(0,h.B)(),a=(0,A.Zp)(),[n,o]=(0,s.useState)(""),[d,g]=(0,s.useState)(""),[w,j]=(0,s.useState)(""),[k,N]=(0,s.useState)(""),[b,S]=(0,s.useState)(void 0),[C,F]=(0,s.useState)(""),[D,L]=(0,f.fp)(m.AG.shellNowDir),[M,I]=(0,f.fp)(m.AG.sshInfo),{check_user_auth:P}=(0,y.MH)(),R=async e=>{const t=new K.x;if(t.password=e?e.password:d,t.domain=e?e.domain:k,t.port=e?e.port:b,t.username=e?e.username:n,t.private_path=e?e.private_path:w,t.dir=e?e.dir:C,!t.dir)return void(0,v.zN)("dir not found");if(!t.username)return void(0,v.zN)("username not found");if(!t.domain)return void(0,v.zN)("domain not found");if(!t.port)return void(0,v.zN)("port not found");if(!t.private_path&&!t.password)return void(0,v.zN)("private_path password not found");const s=await c.Fg.post("start",t);s&&s.code===u.m.Success&&(a((0,B.Jn)("/proxy/remoteShell",t.dir)),L([t.dir]),I(s.data))};return(0,x.jsxs)(s.Fragment,{children:[(0,x.jsxs)(l.aZ,{position:"right",children:[(0,x.jsx)(i.$Z,{placeholder:t("目录"),icon:"home",value:C,handleInputChange:e=>F(e),max_width:"15rem"}),(0,x.jsx)(i.$Z,{placeholder:t("账号"),icon:"verified_user",value:n,handleInputChange:e=>o(e),max_width:"15rem"}),(0,x.jsx)(i.$Z,{type:"password",placeholder:t("密码"),icon:"password",value:d,handleInputChange:e=>g(e),max_width:"15rem"}),(0,x.jsx)(i.$Z,{placeholder:t("私钥路径"),icon:"private_connectivity",value:w,handleInputChange:e=>j(e),max_width:"15rem"}),(0,x.jsx)(i.$Z,{placeholder:t("连接地址"),icon:"location_on",value:k,handleInputChange:e=>{N(e)},max_width:"15rem"}),(0,x.jsx)(i.$Z,{placeholder:t("端口"),icon:"outlet",value:b,handleInputChange:e=>{if(!e)return;/^\d+$/.test(e)||(0,v.zN)("不是数字"),S(parseInt(e))},max_width:"7rem"}),(0,x.jsx)(r.rA,{icon:"play_arrow",title:t("连接"),onClick:()=>{R()}})]}),M.key?(0,x.jsx)(O,{close:async()=>{const e=new K.x;e.key=M.key;await c.Fg.post("close",e);I({})},data:{port:b,password:d,username:n,domain:k,dir:C}}):(0,x.jsx)(p.N,{have_auth_edit:P(_.oV.ssh_proxy_tag_update),getItems:async()=>{const e=await c.Fg.get("tag");return e.code===u.m.Success?e.data:[]},save:async e=>{await c.Fg.post("tag/save",e)},clickItem:async e=>{N(e.domain),F(e.dir),S(e.port),o(e.username),g(e.password),j(e.private_path),await R(e)},items:[{key:"name",preName:t("名字")},{key:"domain",preName:t("地址")},{key:"port",preName:t("端口")},{key:"username",preName:t("账号")},{key:"password",preName:t("密码")},{key:"private_path",preName:t("私钥路径")},{key:"dir",preName:t("访问目录")},{key:"color",preName:"color"}]})]})}function U(e){switch(e){case 0:return 1;case 2:return 2;default:return 0}}class T{constructor(e){this.canvas=e,this.render=new Y.Canvas.create(this.canvas),this.activeSession=!1,this.install()}close(){this.activeSession=!1}install(){var e=this;return this.canvas.addEventListener("mousemove",function(t){var a=Y.elementOffset(e.canvas);return N.ws.sendData(k.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:0,isPressed:!1}),t.preventDefault||e.activeSession(),!1}),this.canvas.addEventListener("mousedown",function(t){var a=Y.elementOffset(e.canvas);return N.ws.sendData(k.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:U(t.button),isPressed:!0}),t.preventDefault(),!1}),this.canvas.addEventListener("mouseup",function(t){if(e.activeSession){var a=Y.elementOffset(e.canvas);return N.ws.sendData(k.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:U(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("contextmenu",function(t){if(e.activeSession){var a=Y.elementOffset(e.canvas);return N.ws.sendData(k.HK.mouse,{x:t.clientX-a.left,y:t.clientY-a.top,button:U(t.button),isPressed:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("DOMMouseScroll",function(t){if(e.activeSession){var a=t.detail,s=Math.round(15*Math.abs(a)/8),n=Y.elementOffset(e.canvas);return N.ws.sendData(k.HK.wheel,{x:t.clientX-n.left,y:t.clientY-n.top,step:s,isNegative:a>0,isHorizontal:!1}),t.preventDefault(),!1}}),this.canvas.addEventListener("mousewheel",function(t){if(e.activeSession){var a=Math.abs(t.deltaX)>Math.abs(t.deltaY),s=a?t.deltaX:t.deltaY,n=Math.round(15*Math.abs(s)/8),o=Y.elementOffset(e.canvas);return N.ws.sendData(k.HK.wheel,{x:t.clientX-o.left,y:t.clientY-o.top,step:n,isNegative:s>0,isHorizontal:a}),t.preventDefault(),!1}}),window.addEventListener("keydown",function(t){if(e.activeSession)return N.ws.sendData(k.HK.scancode,{code:Y.scancode(t),isPressed:!0}),t.preventDefault(),!1}),window.addEventListener("keyup",function(t){if(e.activeSession)return N.ws.sendData(k.HK.scancode,{code:Y.scancode(t),isPressed:!1}),t.preventDefault(),!1}),this}connect(e,t,a,s,n,o){var i=this;N.ws.addMsg(k.HK.rdp_connect,e=>{console.log("[mstsc.js] connected"),i.activeSession=!0}),N.ws.addMsg(k.HK.rdp_bitmap,e=>{const t=e.context;t.data=e.bin_context,i.render.update(t)}),N.ws.addMsg(k.HK.rdp_close,e=>{o(null),console.log("[mstsc.js] close"),i.activeSession=!1}),N.ws.addMsg(k.HK.rdp_error,e=>{i.activeSession=!1});const r=new k.hf;r.cmdType=k.HK.infos,r.context={ip:e.indexOf(":")>-1?e.split(":")[0]:e,port:a,screen:{width:this.canvas.width,height:this.canvas.height},domain:t,username:s,password:n,locale:Y.locale()},N.ws.send(r)}}class z{constructor(e){this.canvas=e,this.ctx=e.getContext("2d")}update(e){var t=null;t=e.isCompress?function(e){var t=null;switch(e.bitsPerPixel){case 15:t="bitmap_decompress_15";break;case 16:t="bitmap_decompress_16";break;case 24:t="bitmap_decompress_24";break;case 32:t="bitmap_decompress_32";break;default:throw"invalid bitmap data format"}var a=new Uint8Array(e.data),s=Module._malloc(a.length),n=new Uint8Array(Module.HEAPU8.buffer,s,a.length);n.set(a);var o=e.destRight-e.destLeft+1,i=e.destBottom-e.destTop+1,r=o*i*4,l=Module._malloc(r),c=new Uint8Array(Module.HEAPU8.buffer,l,r),d=(Module.ccall(t,"number",["number","number","number","number","number","number","number","number"],[c.byteOffset,o,i,e.width,e.height,n.byteOffset,a.length]),new Uint8ClampedArray(c.buffer,c.byteOffset,r));return Module._free(s),Module._free(l),{width:o,height:i,data:d}}(e):function(e){return{width:e.width,height:e.height,data:new Uint8ClampedArray(e.data)}}(e);var a=this.ctx.createImageData(t.width,t.height);a.data.set(t.data),this.ctx.putImageData(a,e.destLeft,e.destTop)}}var Z={"":0,Escape:1,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Digit0:11,Minus:12,Equal:13,Backspace:14,Tab:15,KeyQ:16,KeyW:17,KeyE:18,KeyR:19,KeyT:20,KeyY:21,KeyU:22,KeyI:23,KeyO:24,KeyP:25,BracketLeft:26,BracketRight:27,Enter:28,ControlLeft:29,KeyA:30,KeyS:31,KeyD:32,KeyF:33,KeyG:34,KeyH:35,KeyJ:36,KeyK:37,KeyL:38,Semicolon:39,Quote:40,Backquote:41,ShiftLeft:42,Backslash:43,KeyZ:44,KeyX:45,KeyC:46,KeyV:47,KeyB:48,KeyN:49,KeyM:50,Comma:51,Period:52,Slash:53,ShiftRight:54,NumpadMultiply:55,AltLeft:56,Space:57,CapsLock:58,F1:59,F2:60,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,F10:68,Pause:69,ScrollLock:70,Numpad7:71,Numpad8:72,Numpad9:73,NumpadSubtract:74,Numpad4:75,Numpad5:76,Numpad6:77,NumpadAdd:78,Numpad1:79,Numpad2:80,Numpad3:81,Numpad0:82,NumpadDecimal:83,PrintScreen:84,IntlBackslash:86,F11:87,F12:88,NumpadEqual:89,F13:100,F14:101,F15:102,F16:103,F17:104,F18:105,F19:106,F20:107,F21:108,F22:109,F23:110,KanaMode:112,Lang2:113,Lang1:114,IntlRo:115,F24:118,Convert:121,NonConvert:123,IntlYen:125,NumpadComma:126,MediaTrackPrevious:57360,MediaTrackNext:57369,NumpadEnter:57372,ControlRight:57373,VolumeMute:57376,LaunchApp2:57377,MediaPlayPause:57378,MediaStop:57380,VolumeDown:57390,VolumeUp:57392,BrowserHome:57394,NumpadDivide:57397,PrintScreen:57399,AltRight:57400,NumLock:57413,Pause:57414,Home:57415,ArrowUp:57416,PageUp:57417,ArrowLeft:57419,ArrowRight:57421,End:57423,ArrowDown:57424,PageDown:57425,Insert:57426,Delete:57427,OSLeft:57435,OSRight:57436,ContextMenu:57437,Power:57438,BrowserSearch:57445,BrowserFavorites:57446,BrowserRefresh:57447,BrowserStop:57448,BrowserForward:57449,BrowserBack:57450,LaunchApp1:57451,LaunchMail:57452,MediaSelect:57453},V={27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",192:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",173:"Minus",61:"Equal",8:"Backspace",9:"Tab",81:"KeyQ",87:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",219:"BracketLeft",221:"BracketRight",13:"Enter",20:"CapsLock",65:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",59:"Semicolon",222:"Quote",220:"Backslash",16:"ShiftLeft",220:"IntlBackslash",90:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",77:"KeyM",188:"Comma",190:"Period",191:"Slash",16:"ShiftRight",17:"ControlLeft",18:"AltLeft",91:"OSLeft",32:"Space",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",13:"NumpadEnter",96:"Numpad0",110:"NumpadDecimal",17:"ControlLeft"},J={firefox:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",169:"Minus",61:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",160:"BracketLeft",164:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",165:"Quote",170:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",59:"Comma",58:"Period",161:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:V},chrome:{fr:{27:"Escape",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",0:"Backquote",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",48:"Digit0",219:"Minus",187:"Equal",8:"Backspace",9:"Tab",65:"KeyQ",90:"KeyW",69:"KeyE",82:"KeyR",84:"KeyT",89:"KeyY",85:"KeyU",73:"KeyI",79:"KeyO",80:"KeyP",221:"BracketLeft",186:"BracketRight",13:"Enter",20:"CapsLock",20:"CapsLock",81:"KeyA",83:"KeyS",68:"KeyD",70:"KeyF",71:"KeyG",72:"KeyH",74:"KeyJ",75:"KeyK",76:"KeyL",77:"Semicolon",192:"Quote",220:"Backslash",16:"ShiftLeft",60:"IntlBackslash",87:"KeyZ",88:"KeyX",67:"KeyC",86:"KeyV",66:"KeyB",78:"KeyN",188:"KeyM",190:"Comma",191:"Period",223:"Slash",16:"ShiftRight",17:"ControlLeft",91:"OSLeft",18:"AltLeft",32:"Space",17:"ControlLeft",18:"AltRight",91:"OSRight",93:"ContextMenu",17:"ControlRight",37:"ArrowLeft",38:"ArrowUp",40:"ArrowDown",39:"ArrowRight",144:"NumLock",144:"NumLock",111:"NumpadDivide",106:"NumpadMultiply",109:"NumpadSubtract",103:"Numpad7",104:"Numpad8",105:"Numpad9",107:"NumpadAdd",100:"Numpad4",101:"Numpad5",102:"Numpad6",97:"Numpad1",98:"Numpad2",99:"Numpad3",96:"Numpad0",110:"NumpadDecimal",13:"NumpadEnter",17:"ControlLeft",67:"KeyC",17:"ControlLeft"},en:V}};function X(){}X.prototype={$:function(e){return document.getElementById(e)},elementOffset:function(e){for(var t=0,a=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-e.scrollLeft,a+=e.offsetTop-e.scrollTop,e=e.offsetParent;return{top:a,left:t}},browser:function(){return"undefined"!=typeof InstallTrigger?"firefox":window.chrome?"chrome":document.docuemntMode?"ie":null},locale:function(){return window.navigator.userLanguage||window.navigator.language},client:{create:function(e){return new T(e)}},Canvas:{create:function(e){return new z(e)}},scancode(e){var t=X.prototype.locale();return t=["fr","en"].indexOf(t)>0&&t||"en",Z[e.code||J[X.prototype.browser()||"firefox"][t][e.keyCode]]}};let Y=new X;var q=a(38240);let W;function Q(){const{t:e}=(0,h.B)(),[t,a]=(0,f.fp)(m.AG.header_min),{check_user_auth:n}=(0,y.MH)(),[d,g]=(0,s.useState)(void 0),[w,j]=(0,s.useState)(3389),[K,b]=(0,s.useState)(void 0),[S,C]=(0,s.useState)(void 0),[A,F]=(0,s.useState)(!1),[D,L]=(0,s.useState)(!1);var M=null;(0,s.useEffect)(()=>(W||(async()=>{try{await(0,q.J)("rle.js"),W=!0}catch(e){return void(0,v.zN)("加载资源失败")}})(),()=>{M&&(M.close(),M=null)}),[]);const B=t=>{L(!0),function(s,n,o,i){if(s=s||t.address,o=o||t.username,i=i||t.password,!s||!o)return(0,v.zN)(e("ip或者账号不允许为空")),void L(!1);!function(e){M||(M=Y.client.create(Y.$(e)))}("rdpwebview");var r=Y.$("rdpwebview");r.style.display="inline",r.width=window.innerWidth,r.height=window.innerHeight,F(!0),a(!0),M.connect(s,"",n,o,i,function(e){Y.$("rdpwebview").style.display="none",a(!1),L(!1),F(!1)})}(d,w,K,S)};return(0,x.jsxs)("div",{children:[(0,x.jsxs)(l.aZ,{position:"right",children:[(0,x.jsx)(i.$Z,{placeholder:e("地址"),icon:"network_ping",value:d,max_width:"15rem",handleInputChange:e=>g(e)}),(0,x.jsx)(i.$Z,{placeholder:e("端口"),icon:"outlet",value:w,max_width:"10rem",handleInputChange:e=>{e&&j(parseInt(e))}}),(0,x.jsx)(i.$Z,{placeholder:e("账号"),icon:"manage_accounts",value:K,max_width:"15rem",handleInputChange:e=>b(e)}),(0,x.jsx)(i.$Z,{placeholder:e("密码"),icon:"password",value:S,max_width:"15rem",handleInputChange:e=>C(e)}),!D&&(0,x.jsx)(r.rA,{icon:"play_arrow",title:e("连接"),onClick:B}),D&&(0,x.jsx)(r.rA,{icon:"close",title:e("关闭"),onClick:async()=>{F(!1),await N.ws.sendData(k.HK.rdp_disconnect,"");var e=Y.$("rdpwebview");e.getContext("2d").clearRect(0,0,e.width,e.height),Y.$("rdpwebview").style.display="none",L(!1),a(!1)}})]}),(0,x.jsxs)(o.jW,{isFull:A,children:[!D&&(0,x.jsx)(p.N,{have_auth_edit:n(_.oV.rdp_proxy_tag_update),getItems:async()=>{const e=await c.J0.get("tag");return e.code===u.m.Success?e.data:[]},save:async e=>{(await c.J0.post("tag/save",e)).code!==u.m.Success&&(0,v.zN)("网络错误")},clickItem:async e=>{C(e.password),b(e.username),g(e.address),j(e.port),B(e)},items:[{key:"name",preName:e("名字")},{key:"address",preName:e("地址")},{key:"port",preName:e("端口")},{key:"username",preName:e("账号")},{key:"password",preName:e("密码")},{key:"color",preName:"color"}]}),(0,x.jsx)("canvas",{id:"rdpwebview",style:{display:"none"}})]})]})}var ee=a(77481),te=a(40505),ae=a(99380);const se=(0,s.createContext)({activeKey:"",setActiveKey:()=>{}});function ne(e){const{children:t,activeKey:a,defaultActiveKey:n,onChange:o,width:i}=e,[r,l]=(0,s.useState)(()=>a??n??"");(0,s.useEffect)(()=>{void 0!==a&&l(a)},[a]);const c=e=>{void 0===a&&l(e),o&&o(e)},d=[];return s.Children.forEach(t,e=>{s.isValidElement(e)&&e.type===oe&&d.push({key:e.props.itemKey,tab:e.props.tab,disabled:e.props.disabled})}),(0,s.useEffect)(()=>{!r&&d.length>0&&l(d[0].key)},[d,r]),(0,x.jsx)(se.Provider,{value:{activeKey:r,setActiveKey:c},children:(0,x.jsxs)("div",{className:"modern-tabs-container",style:{width:i||"100%"},children:[(0,x.jsx)("div",{className:"modern-tabs-nav",children:d.map(e=>{const t=["modern-tabs-tab",r===e.key?"active":"",e.disabled?"disabled":""].filter(Boolean).join(" ");return(0,x.jsx)("div",{className:t,onClick:()=>!e.disabled&&c(e.key),children:e.tab},e.key)})}),(0,x.jsx)("div",{className:"modern-tabs-content",children:t})]})})}function oe(e){const{itemKey:t,children:a}=e,{activeKey:n}=(0,s.useContext)(se),o=n===t;return(0,x.jsx)("div",{className:"modern-tab-panel "+(o?"active":""),children:a})}const ie=s.lazy(()=>Promise.all([a.e(5880),a.e(4091)]).then(()=>a(84091)));let re,le,ce,de;function ue(){const{t:e}=(0,h.B)(),[t,a]=(0,f.fp)(m.AG.confirm),[l,g]=(0,f.fp)(m.AG.showPrompt),{check_user_auth:w}=(0,y.MH)(),[j,K]=(0,s.useState)(""),[b,S]=(0,f.fp)(m.AG.router_jump),[C,A]=(0,s.useState)("get"),[F,D]=(0,s.useState)(""),[M,B]=(0,s.useState)(void 0),[P,R]=(0,s.useState)([]),[E,G]=(0,s.useState)([]),[O,H]=(0,s.useState)("headers"),[U,T]=(0,s.useState)(String(d.RB.row)),[z,Z]=(0,s.useState)("body"),[V,J]=(0,s.useState)(),[X,Y]=(0,f.fp)(m.AG.nav_index_add_item_by_now_list),[q,W]=(0,f.fp)(m.AG.prompt_card);y.xK.set_value_temp("{}",0),y.xK.set_value_temp("",1),(0,s.useEffect)(()=>(re={},le="",ce="",de="",y.xK.get_editor(0).session.setMode("ace/mode/json"),b.http_download_map_path&&(B(b.http_download_map_path),S({})),N.ws.sendData(k.HK.http_download_water,void 0).then(()=>{N.ws.addMsg(k.HK.http_download_water,e=>{const t=e.context;G(t)})}),()=>{N.ws&&"function"==typeof N.ws.removeMsg&&N.ws.removeMsg(k.HK.http_download_water)}),[]);const Q=e=>{const t=new d.vr;t.url=F,t.method=C,t.header_type="headers"===O?1:2,"headers"===O&&(re=JSON.parse(y.xK.get_editor_value(0))),t.headers=re;const a=Number(U);if(t.body_type=a,a===d.RB.row)le=y.xK.get_editor_value(1),t.data=le;else if(a===d.RB.json)re["Content-Type"]="application/json",le=y.xK.get_editor_value(1),t.data=le;else if(a===d.RB.form){re["Content-Type"]="multipart/form-data",t.form_data_list=P;for(const t of P)t.key&&t.is_file&&e&&e.append(t.fullPath,t.file_object)}return t};return(0,x.jsx)("div",{children:(0,x.jsxs)(o.xh,{children:[(0,x.jsxs)(o.fI,{children:[(0,x.jsxs)(o.VP,{children:[0!==E.length&&(0,x.jsx)(n.Zp,{title:"正在下载",children:(0,x.jsx)("div",{children:E.map((t,a)=>(0,x.jsxs)("div",{children:[(0,x.jsxs)("div",{className:"div-row",children:[(0,x.jsx)(r.rA,{icon:"cancel",title:e("取消"),onClick:()=>{N.ws.sendData(k.HK.http_download_cancel,t.local_download_path)}}),(0,x.jsx)(n.xP,{context:t.filename,tip_context:t.local_download_path}),(0,x.jsx)("span",{style:{paddingLeft:".3rem",color:"green"},children:`${t.progresses??0}% ${t.loaded?(0,L.v7)(t.loaded):""}MB / ${t.seep??""}MB/s `})]}),(0,x.jsx)("div",{style:{width:t.progresses?`${t.progresses}%`:"0",backgroundColor:"#40c4ff",height:"5px",transition:"0.2s ease width",borderRadius:"10px"}})]},a))})}),(0,x.jsxs)(n.Zp,{title:"",rightBottomCom:Number(U)===d.RB.form&&"body"===O&&(0,x.jsx)(r.rA,{icon:"add",title:e("添加"),onClick:()=>{R([{},...P])}}),children:[(0,x.jsxs)("div",{className:"http_url",children:[(0,x.jsx)(i.l6,{width:"10rem",value:C,onChange:e=>{A(e)},options:[{value:"get",color:"#28a745"},{value:"post",color:"#007bff"},{value:"put",color:"#fd7e14"},{value:"delete",color:"#dc3545"},{value:"head",color:"#6f42c1"},{value:"options",color:"#17a2b8"},{value:"connect",color:"#666666"},{value:"trace",color:"#666666"},{value:"custom",color:"#e83e8c"}]}),(0,x.jsx)(i.Sm,{width:"50rem",placeholder:e("http url"),value:F,handleInputChange:e=>{D(e)}}),(0,x.jsx)(r.rA,{icon:"send",title:e("发送"),onClick:async()=>{if(!c._U.have_http_method(C))return void(0,v.zN)("不存在的http method");if(!F)return void(0,v.zN)("url is empty");J(void 0),K("");const e=new FormData;e.append("data",JSON.stringify(Q(e)));let t="http/send";M&&(t+=`?local_download_path=${M}`),ae.A.post(c._U.getUrl(t),e,{headers:{"Content-Type":"multipart/form-data",Authorization:localStorage.getItem("token")}}).catch(e=>{(0,v.zN)(e.message)}).then(e=>{if(!e)return;let t={};try{if(e.headers.filecat_remote_raw_headers&&(t=JSON.parse(e.headers.filecat_remote_raw_headers),de=JSON.stringify(t,null,2)),e.headers.filecat_remote_code)try{const t=JSON.parse(e.headers.filecat_remote_code);J(200===t||201===t?(0,x.jsx)("span",{style:{color:"green"},children:"200"}):t)}catch(e){console.log(e)}}catch(t){de=String(e.headers.filecat_remote_raw_headers)}const a=(t["content-type"]||t["Content-Type"]||"").toLowerCase();ce="object"==typeof e.data?JSON.stringify(e.data,null,2):e.data;const s=y.xK.get_editor(2),n="body"===z?ce:de;if(s){if(a.includes("application/json")||a.includes("+json")){s.session.setMode("ace/mode/json");try{const e=JSON.parse(ce);ce=JSON.stringify(e,null,2)}catch(e){}}else a.includes("html")?s.session.setMode("ace/mode/html"):a.includes("xml")?s.session.setMode("ace/mode/xml"):a.includes("javascript")?s.session.setMode("ace/mode/javascript"):s.session.setMode("ace/mode/text");s.setValue("body"===z?ce:de,-1)}K(n)})}}),w(_.oV.http_proxy_tag_update)&&(0,x.jsx)(r.rA,{title:e("添加"),icon:"save_as",onClick:()=>{if(!w(_.oV.http_proxy_tag_update))return void(0,v.zN)("no permission");for(const t of P)if(t.is_file)return void(0,v.zN)(e("表单中含有文件,浏览器限制不能添加"));let t;W({open:!0,title:e("信息"),context_div:(0,x.jsxs)("div",{children:[(0,x.jsx)("div",{className:"card-content",children:(0,x.jsx)(i.Sm,{placeholderOut:e("输入标签名"),handleInputChange:e=>t=e})}),(0,x.jsx)("div",{className:"card-action",children:(0,x.jsx)("button",{className:"button button--flat",onClick:async()=>{const e=await Q();e.local_download_path=M,e.form_data_list=JSON.stringify(P),e.headers=JSON.stringify(e.headers),"object"==typeof e.data&&(e.data=JSON.stringify(e.data)),e.name=t,Y(e),W({open:!1})},children:e("确定")})})]})})}})]}),(0,x.jsxs)(ne,{activeKey:O,onChange:e=>H(e),children:[(0,x.jsx)(oe,{itemKey:"headers",tab:e("请求头")+"(json)",children:(0,x.jsxs)("div",{style:{marginTop:"10px"},children:[(0,x.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"4px"},children:(0,x.jsx)(r.rA,{title:e("格式化"),icon:"data_object",onClick:function(){y.xK.get_editor(0)?.formatCode?.()}})}),(0,x.jsx)("div",{className:"http_ace",children:(0,x.jsx)(ie,{name:"",editor_id:0})})]})}),(0,x.jsx)(oe,{itemKey:"body",tab:e("请求体"),children:(0,x.jsxs)("div",{style:{marginTop:"10px"},children:[(0,x.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,x.jsxs)(ne,{activeKey:U,onChange:e=>{T(e);const t=Number(e);t===d.RB.row?y.xK.get_editor(1).session.setMode("ace/mode/text"):t===d.RB.json&&y.xK.get_editor(1).session.setMode("ace/mode/json")},children:[(0,x.jsx)(oe,{itemKey:String(d.RB.row),tab:e("row")}),(0,x.jsx)(oe,{itemKey:String(d.RB.json),tab:e("json")}),(0,x.jsx)(oe,{itemKey:String(d.RB.form),tab:e("form")})]}),Number(U)!==d.RB.form&&(0,x.jsx)(r.rA,{title:e("格式化"),icon:"data_object",onClick:function(){y.xK.get_editor(1)?.formatCode?.()}})]}),Number(U)===d.RB.form&&(0,x.jsx)("div",{style:{marginTop:"10px"},children:(0,x.jsx)(ee.X,{headers:["key",e("值")],rows:P.map((t,a)=>[(0,x.jsx)(i.Sm,{value:t.key,handleInputChange:e=>{t.key=e,R([...P])},no_border:!0}),(0,x.jsx)(i.Sm,{value:t.value,handleInputChange:e=>{t.value=e,t.is_file=!1,R([...P])},no_border:!0}),(0,x.jsxs)("div",{children:[(0,x.jsx)(r.rA,{icon:"file_upload",title:e("上传文件"),onClick:()=>(e=>{g({show:!0,type:I.PromptEnum.UploadFile,overlay:!0,data:{extra_data:{only_file:!0},call:t=>{let a=t.currentTarget?.files;if(!a)return;const s=a[0];s.fullPath=(0,$.hU)()+Date.now().toString(),P[e].value=`${s}(${s.name})`,P[e].is_file=!0,P[e].fileName=s.name,P[e].fullPath=s.fullPath,R([...P]),P[e].file_object=s,g({overlay:!1,type:"",show:!1,data:{}})}}})})(a)}),(0,x.jsx)(r.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{P.splice(e,1),R([...P])})(a)})]})]),width:"10rem"})}),(0,x.jsx)("div",{className:"http_ace",style:{marginTop:"10px",display:Number(U)!==d.RB.form?"block":"none"},children:(0,x.jsx)(ie,{name:"",editor_id:1})})]})})]}),(0,x.jsx)("div",{style:{paddingTop:"1rem"},children:void 0===M?(0,x.jsx)("span",{style:{cursor:"pointer",color:"#3b82f6"},onClick:()=>{B("")},children:e("下载到本地目录")}):(0,x.jsx)(i.Sm,{placeholder:e("本地地址"),value:M,handleInputChange:e=>{B(e)},handlerEnter:()=>{M||B(void 0)}})})]})]}),(0,x.jsx)(o.VP,{children:(0,x.jsxs)(n.Zp,{title:V,titleCom:(0,x.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,x.jsx)(r.rA,{title:e("格式化"),icon:"data_object",onClick:()=>{y.xK.get_editor(2)?.formatCode?.()}}),(0,x.jsx)(r.rA,{title:e("复制"),icon:"copy_all",onClick:()=>{const e=y.xK.get_editor_value(2);e&&((0,te.lW)(e),(0,v.SK)("完成"))}})]}),children:[(0,x.jsxs)(ne,{activeKey:z,onChange:e=>{Z(e);const t="body"===e?ce:de;K(t);const a=y.xK.get_editor(2);if(a){try{JSON.parse(t),a.session.setMode("ace/mode/json")}catch{a.session.setMode("ace/mode/text")}a.setValue(t,-1)}},children:[(0,x.jsx)(oe,{itemKey:"body",tab:e("响应体")}),(0,x.jsx)(oe,{itemKey:"headers",tab:e("响应头")})]}),(0,x.jsx)("div",{className:"http_ace",style:{marginTop:"10px",height:"21rem"},children:(0,x.jsx)(ie,{name:"",editor_id:2})})]})})]}),(0,x.jsx)(o.fI,{children:(0,x.jsx)(o.VP,{children:(0,x.jsx)(p.N,{getItems:async()=>{const e=await c._U.get("http/tag");return e.code===u.m.Success?e.data:[]},save:async e=>{(await c._U.post("http/tag/save",e)).code!==u.m.Success&&(0,v.zN)("网络错误")},have_auth_edit:w(_.oV.http_proxy_tag_update),clickItem:async e=>{D(e.url),A(e.method),B(e.local_download_path),e.header_type&&H(1===e.header_type?"headers":"body"),e.headers&&(re=JSON.parse(e.headers),1===e.header_type&&(y.xK.get_editor(0).setValue(e.headers,-1),y.xK.get_editor(0).session.setMode("ace/mode/json"))),e.form_data_list&&R(JSON.parse(e.form_data_list)),e.data&&(le=e.data),e.body_type&&(T(String(e.body_type)),e.body_type===d.RB.row?y.xK.get_editor(1).session.setMode("ace/mode/text"):e.body_type===d.RB.json&&y.xK.get_editor(1).session.setMode("ace/mode/json"),y.xK.get_editor(1).setValue(e.data,-1))},items:[{key:"name",preName:e("名字")},{key:"url",preName:"url"},{key:"method",preName:"method"},{key:"headers",preName:"headers"},{key:"data",preName:"data"},{key:"form_data_list",preName:"form_data_list"},{key:"local_download_path",preName:"local_download_path"},{key:"color",preName:"color"}]})})})]})})}var pe=a(87361);const he=s.lazy(()=>Promise.all([a.e(3215),a.e(8257),a.e(7759)]).then(()=>a(45601)));function me({}){const{check_user_auth:e}=(0,y.MH)(),{t}=(0,h.B)(),a=[];return e(_.oV.http_proxy)&&a.push({index:1,name:t("http代理"),rto:"http/",component:(0,x.jsx)(ue,{})}),e(_.oV.ssh_proxy)&&a.push({index:1,name:`ssh${t("代理")}`,rto:"remoteShell/",component:(0,x.jsx)(H,{})}),e(_.oV.browser_proxy)&&a.push({index:1,name:`${t("浏览器")}${t("代理")}`,rto:"browserproxy/",component:(0,x.jsx)(g,{})}),e(_.oV.rdp_proxy)&&a.push({index:1,name:`rdp${t("代理")}`,rto:"rdp/",component:(0,x.jsx)(Q,{})}),e(_.oV.rtsp_proxy)&&a.push({index:1,name:t("rtsp播放器"),rto:"rtsp/",component:(0,x.jsx)(he,{})}),(0,x.jsx)(o.W1,{optionList:a,father_route:pe.o.proxy})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6247],{77481(e,t,n){n.d(t,{S:()=>i,X:()=>l});var r=n(96540),o=n(61443),s=n(74848);function l(e){const[t,n]=r.useState([]),l=(0,r.useRef)(-1),[i,a]=(0,r.useState)(-1),[c,d]=(0,r.useState)(-1);(0,r.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{l.current=-1,a(-1),d(-1)};return(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{children:e.headers?.map((t,n)=>(0,s.jsx)("th",{children:e.filter&&(e.filter.column??0)===n?(0,s.jsxs)("div",{className:"table-th-filter",children:[(0,s.jsx)("span",{children:t}),(0,s.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},n))})}),(0,s.jsx)("tbody",{children:t.map((t,n)=>{const r=!!e.onRowDrag;return(0,s.jsx)("tr",{className:r?(i===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:r,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{r&&(l.current=n,a(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!r||l.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{r&&(t.preventDefault(),(()=>{const t=l.current,n=c;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,r)=>{const o=r===t.length-1?"small":"";return(0,s.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},r)})},n)})})]})}function i(e){return(0,s.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,s.jsx)("div",{children:e},t))})}},66247(e,t,n){n.r(t),n.d(t,{default:()=>C});var r=n(96540),o=n(75725),s=n(70447),l=n(85997),i=n(77481),a=n(61443),c=n(86149),d=n(14284),h=n(53459),u=n(62042),f=n(87361),x=n(40505),p=n(4412),j=n(86090),_=n(34843),m=n(82893),w=n(21469),v=n(21499),g=n(74848);function C(){const{t:e,i18n:t}=(0,c.B)(),n=(0,j.Zp)(),C=[e("编号"),e("路径"),e("过期小时"),e("token"),e("备注"),e("剩余时间(h)"),e("下载次数")],[b,k]=(0,r.useState)([]),[S,y]=(0,_.fp)(m.AG.prompt_card),A=async()=>{const e=await d.XO.get("get_share_file_list");if(e.code===h.m.Success){const t=e.data??[],n=Date.now();for(const e of t)try{if(null!=e.left_hour&&e.left_hour>0){const t=n-e.time_stamp,r=36e5*e.left_hour-t;e.show_left_hour=parseFloat((r/36e5).toFixed(2))}else e.show_left_hour=e.left_hour}catch(e){}k(t)}};(0,r.useEffect)(()=>{A()},[]);return(0,g.jsxs)("div",{className:"common-box ",style:{overflowY:"auto"},children:[(0,g.jsx)(p.aZ,{position:"right",children:(0,g.jsx)(l.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{n(-1)}})}),(0,g.jsx)(o.J,{widthPer:100,children:(0,g.jsx)(s.uF,{self_title:(0,g.jsxs)("span",{className:" div-row ",children:[(0,g.jsx)("h2",{children:e("文件分享列表")}),(0,g.jsx)(l.rA,{icon:"info",title:e("提示"),onClick:()=>{let e=(0,g.jsx)("div",{children:"小时设置为-1或者不设置就没有过期时间"});y({open:!0,title:"信息",context_div:(0,g.jsx)("div",{children:e})})}})]}),titleCom:(0,g.jsxs)("div",{children:[(0,g.jsx)(l.rA,{icon:"add",title:e("添加"),onClick:()=>{k([...b,{note:"",path:""}])}}),(0,g.jsx)(l.rA,{icon:"save",title:e("保存"),onClick:async()=>{(await d.XO.post("set_share_file_list",b)).code===h.m.Success&&((0,u.SK)("保存成功"),A())}})]}),children:(0,g.jsx)(i.X,{headers:C,rows:b.map((t,n)=>{const r=[(0,g.jsx)("div",{children:n}),(0,g.jsx)(a.Sm,{value:t.path,handleInputChange:e=>{t.path=e},no_border:!0}),(0,g.jsx)(a.Sm,{value:t.left_hour,handleInputChange:e=>{t.left_hour=parseFloat(e),t.time_stamp=Date.now()},no_border:!0}),(0,g.jsx)(a.Sm,{value:t.token,handleInputChange:e=>{t.token=e},no_border:!0}),(0,g.jsx)(a.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,g.jsx)("p",{children:t.show_left_hour}),(0,g.jsx)("p",{children:t.download_num}),(0,g.jsxs)("div",{children:[(0,g.jsx)(l.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{b.splice(e,1),k([...b])})(n)}),t.id&&(0,g.jsx)(l.rA,{icon:"content_copy",title:e("复制地址"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);(0,x.lW)(e),(0,u.SK)(e)}}),t.id&&(0,g.jsx)(l.rA,{icon:"open_in_new",title:e("打开新页面"),onClick:()=>{const e=(0,v.bi)(`${window.location.origin}${w.m.base_url}`,`${f.o.share}/${t.id}`);window.open(e)}})]})];return r}),width:"10rem"})})})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[676,4091,8319],{77481(e,t,s){s.d(t,{S:()=>l,X:()=>a});var n=s(96540),r=s(61443),i=s(74848);function a(e){const[t,s]=n.useState([]),a=(0,n.useRef)(-1),[l,c]=(0,n.useState)(-1),[o,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const u=()=>{a.current=-1,c(-1),d(-1)};return(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((t,s)=>(0,i.jsx)("th",{children:e.filter&&(e.filter.column??0)===s?(0,i.jsxs)("div",{className:"table-th-filter",children:[(0,i.jsx)("span",{children:t}),(0,i.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},s))})}),(0,i.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,i.jsx)("tr",{className:n?(l===s?"row-dragging":"")+(o===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(a.current=s,c(s),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!n||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(s))},onDrop:t=>{n&&(t.preventDefault(),(()=>{const t=a.current,s=o;u(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:u,children:t.map((s,n)=>{const r=n===t.length-1?"small":"";return(0,i.jsx)("td",{className:r,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function l(e){return(0,i.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,i.jsx)("div",{children:e},t))})}},84091(e,t,s){s.r(t),s.d(t,{default:()=>d});var n=s(96540),r=s(80952),i=(s(82327),s(1766),s(24854),s(90008),s(90846),s(40975),s(44286),s(30766),s(14973),s(69687),s(1234),s(47507),s(87268),s(24522)),a=s(34843),l=s(82893),c=s(78247),o=s(74848);function d(e){const t=(0,n.useRef)(null),[s,d]=(0,a.fp)(l.AG.user_base_info),u=s.user_data.theme?.includes("dark")?"cloud_editor_dark":"cloud9_day";return(0,n.useEffect)(()=>{const s=r.edit(t.current,{value:c.xK.get_value_temp(e.editor_id),showPrintMargin:!1,theme:`ace/theme/${u}`,mode:e.model??i.getModeForPath(e.name??"").mode,wrap:!1,highlightActiveLine:!1,fontSize:14,...e.options});return s.setOptions({}),s.container.addEventListener("wheel",function(e){e.preventDefault()}),s.focus(),s.on("change",function(t){e.on_change&&e.on_change()}),t.current=s,s.formatCode=()=>{const e=r.require("ace/ext/beautify"),s=t.current;s&&e.beautify(s.session)},c.xK.set_editor_temp(s,e.editor_id),()=>{c.xK.delete_editor_temp(e.editor_id),s.destroy()}},[]),(0,o.jsx)("div",{ref:t,style:{height:"100%",width:"100%"}})}r.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`),r.config.set("modePath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`),r.config.set("themePath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`),r.config.set("workerPath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`),r.config.set("basePath",`https://gcore.jsdelivr.net/npm/ace-builds@${r.version}/src-min-noconflict/`)},60676(e,t,s){s.r(t),s.d(t,{default:()=>C});var n=s(96540),r=s(57952),i=s(85997),a=s(14284),l=s(86090),c=s(77481),o=s(70447),d=s(34843),u=s(82893),h=s(84091),p=s(78247),f=s(61443),m=s(23496),x=s(62042),_=s(86149),j=s(53459),v=s(7523),g=s(74848);function b(e,t="auto"){return"s"===t||"auto"===t&&e>=1e3?`${(e/1e3).toFixed(2)} s`:`${Math.round(e)} ms`}function S(e){const{running:t=!1,resetKey:s=0,format:r="auto",prefix:i="",onTick:a,className:l}=e,[c,o]=(0,n.useState)(0),d=(0,n.useRef)(0),u=(0,n.useRef)(null),h=(0,n.useRef)(t);h.current=t;const p=(0,n.useCallback)(()=>{null!==u.current&&(cancelAnimationFrame(u.current),u.current=null)},[]),f=(0,n.useCallback)(()=>{p();const e=()=>{const t=performance.now()-d.current;o(t),a?.(t),h.current&&(u.current=requestAnimationFrame(e))};e()},[a,p]);return(0,n.useEffect)(()=>{d.current=performance.now(),o(0),a?.(0),h.current&&f()},[s]),(0,n.useEffect)(()=>{t?f():p()},[t,f,p]),(0,n.useEffect)(()=>()=>p(),[p]),(0,g.jsxs)("span",{className:l,children:[i,b(c,r)]})}var q=s(87361),y=s(28319);function w(e){const[t,s]=(0,n.useState)("");return(0,g.jsxs)("div",{className:"db-query-preset-input",children:[(0,g.jsx)(f.Sm,{placeholder:e.placeholder,value:t,handleInputChange:s}),(0,g.jsx)("div",{className:"db-query-preset-input__actions",children:(0,g.jsx)(i.C3,{text:e.confirmText,clickFun:()=>e.onConfirm(t.trim())})})]})}function C(){const e=(0,l.Zp)(),{t}=(0,_.B)(),{initUserInfo:s}=(0,n.useContext)(v.F),[b]=(0,d.fp)(u.AG.sqlite_query_context),[C]=(0,d.fp)(u.AG.user_base_info),[,k]=(0,d.fp)(u.AG.prompt_card),N=(0,n.useMemo)(()=>b?.path??"",[b?.path]),E=(0,n.useMemo)(()=>b?.path?`${b?.name||"数据库"} | ${b.path}`:"未选择数据库",[b?.name,b?.path]),A=97,[K,L]=(0,n.useState)(""),[F,$]=(0,n.useState)("table"),[R,M]=(0,n.useState)(!1),[Q,O]=(0,n.useState)(""),[P,D]=(0,n.useState)(null),[T,G]=(0,n.useState)(!1),[I,J]=(0,n.useState)(0),[Z,W]=(0,n.useState)(!1),[B,H]=(0,n.useState)([]),[V,X]=(0,n.useState)(-1);(0,n.useEffect)(()=>{const e=C?.user_data?.sql_preset_list;e&&e.length?H([...e]):H([{index:0,note:t("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}])},[C?.user_data?.sql_preset_list]);const U=async e=>{const t=e.map((e,t)=>({...e,index:t})),n=await a.wm.post(m.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:t});return n?.code===j.m.Success&&(await s(),H(t),!0)},z=async(e,s)=>{const n=[...B,{note:s||t("SQL 预设"),sql:e,env:y.sqlEnvDefault}];await U(n)&&(k({open:!1}),(0,x.SK)(t("创建成功")),X(n.length-1))},Y=(e,t)=>{if(!e)return"";for(const s of e.split("\n")){const e=s.indexOf("=");if(!(e<0)&&s.slice(0,e).trim()===t)return s.slice(e+1).trim()}return""},[ee,te]=(0,n.useState)(""),[se,ne]=(0,n.useState)("");(0,n.useEffect)(()=>{p.xK.set_value_temp(K,A)},[K]),(0,n.useEffect)(()=>{L(""),O(""),D(null),$("table"),G(!1),W(!1),J(0),te(""),ne(""),p.xK.set_value_temp("",A),N||O("请先从文件右键打开一个数据库")},[N,b?.open]);const re=async()=>{const e=(p.xK.get_editor_value(A)??K).trim();if(!N)return O("请先从文件右键打开一个数据库"),void D(null);if(!e)return O("请输入 SQL 语句"),void D(null);M(!0),O(""),W(!0),J(e=>e+1),G(!0);try{const s=(t=e,ee?t.split(ee).join(se):t),n=await a.$M.post("sqlite/query",{path:N,sql:s});D(n.data),$("table")}catch(e){O(e?.message??`${e}`),D(null)}finally{G(!1),M(!1)}var t},ie=P?.columns?.length?P.columns:Object.keys(P?.rows?.[0]??{}),ae=(P?.rows??[]).map(e=>ie.map(t=>{return null==(s=e[t])?"":"object"==typeof s?JSON.stringify(s):`${s}`;var s}));return(0,g.jsxs)("div",{className:"db-query-page",children:[(0,g.jsx)(r.A,{ignore_tags:!0,left_children:[(0,g.jsx)(i.rA,{icon:"arrow_back",title:"返回",onClick:()=>e(-1)},"back"),(0,g.jsx)(i.rA,{icon:"play_arrow",title:"执行",onClick:re},"run"),(0,g.jsx)(i.rA,{icon:"table_chart",title:"表格视图",onClick:()=>$("table")},"table"),(0,g.jsx)(i.rA,{icon:"data_object",title:"原 JSON",onClick:()=>$("json")},"json"),(0,g.jsx)(i.rA,{icon:"settings",title:t("SQL预设设置"),onClick:()=>{e(q.o.sql_preset_setting_page)}},"preset-setting")],children:(0,g.jsx)(o.xP,{context:E,tip_context:"点击复制数据库信息"})}),(0,g.jsxs)("div",{className:"db-query-page__content",children:[(0,g.jsxs)(o.Zp,{title:"SQL 查询",titleCom:(0,g.jsxs)("div",{className:"db-query-page__preset-bar",children:[ee&&(0,g.jsx)(f.Sm,{placeholder:`${t("替换")}: ${ee}`,value:se,handleInputChange:ne,width:"12rem"}),B.length>0&&(0,g.jsx)(f.l6,{width:"16rem",tip:t("SQL预设"),value:V,onChange:e=>{const t=B[e];t&&(X(e),(e=>{p.xK.set_value_temp(e,A);const t=p.xK.get_editor(A);t&&t.setValue(e,-1),L(e)})(t.sql),te(Y(t.env??"","find")),ne(""),O(""))},options:B.map((e,t)=>({value:t,title:`${e.note||e.sql.slice(0,24)}`}))}),(0,g.jsx)(i.C3,{text:t(V>=0?"更新保存":"创建新预选项"),clickFun:async()=>{const e=(p.xK.get_editor_value(A)??K).trim();if(!e)return void O(t("请输入 SQL 语句"));const s=[...B];if(V>=0&&s[V]){s[V].sql=e,s[V].note||(s[V].note=t("SQL 预设"));await U(s)&&(0,x.SK)(t("更新成功"))}else k({open:!0,title:t("创建新预选项"),context_div:(0,g.jsx)(w,{placeholder:t("请输入备注"),confirmText:t("确认"),onConfirm:t=>z(e,t)}),cancel:()=>k({open:!1})})}})]}),rightBottomCom:(0,g.jsxs)("div",{className:"db-query-page__actions",children:[(0,g.jsx)(i.C3,{text:R?"查询中...":"执行查询",clickFun:re}),(0,g.jsx)(i.C3,{text:"清空",clickFun:()=>{p.xK.set_value_temp("",A);const e=p.xK.get_editor(A);e&&e.setValue("",-1),L("")}}),(0,g.jsx)(i.C3,{text:"table"===F?"表格视图":"切换到表格",clickFun:()=>$("table")}),(0,g.jsx)(i.C3,{text:"json"===F?"原 JSON":"切换到 JSON",clickFun:()=>$("json")})]}),children:[(0,g.jsx)("div",{className:"db-query-page__editor",children:(0,g.jsx)(h.default,{name:"sqlite.sql",editor_id:A,model:"ace/mode/sql",on_change:()=>{const e=p.xK.get_editor_value(A)??"";L(e)},options:{showPrintMargin:!1,highlightActiveLine:!0,wrap:!0}})}),Q&&(0,g.jsx)("div",{className:"db-query-page__error",children:Q})]}),(0,g.jsxs)(o.Zp,{title:"查询结果",titleCom:(0,g.jsxs)("span",{className:"db-query-page__result-meta",children:[P?`${P.row_count} 行`:"暂无结果",Z&&(0,g.jsx)("span",{className:"db-query-page__elapsed",children:(0,g.jsx)(S,{running:T,resetKey:I,prefix:`${t("耗时")}: `,format:"auto"})})]}),children:[P&&"table"===F&&(0,g.jsx)(c.X,{headers:ie,rows:ae}),P&&"json"===F&&(0,g.jsx)("pre",{className:"db-query-page__result-json",children:JSON.stringify(P.rows,null,2)}),!P&&!Q&&(0,g.jsx)("div",{className:"db-query-page__hint",children:"先输入查询语句,再执行。支持 `select`、`with`、`pragma`、`explain`。"}),!P&&Q&&(0,g.jsx)("div",{className:"db-query-page__hint",children:Q})]})]})]})}},28319(e,t,s){s.r(t),s.d(t,{default:()=>q,defaultSqlPreset:()=>b});var n=s(96540),r=s(86149),i=s(4412),a=s(85997),l=s(75725),c=s(77481),o=s(70447),d=s(61443),u=s(34843),h=s(82893),p=s(14284),f=s(23496),m=s(53459),x=s(62042),_=s(7523),j=s(78247),v=s(86090),g=s(74848);function b(e){return{index:0,note:e("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}}const S='# 可选:设置 SQL 中的"替换词"(在查询页选中该预设后,会显示输入框)\n# 例子:SQL 为 SELECT * FROM t WHERE id = 123456 ,请填写下面的 find=123456\n# 这样查询页输入新值即可把 SQL 中的 123456 替换掉后再查询\nfind=';function q(){const{t:e}=(0,r.B)(),{initUserInfo:t}=(0,n.useContext)(_.F),[,s]=(0,u.fp)(h.AG.editorSetting),[q]=(0,u.fp)(h.AG.user_base_info),y=(0,v.Zp)(),w=n.useRef(-1),[C,k]=(0,n.useState)([]);(0,n.useEffect)(()=>{const t=q?.user_data?.sql_preset_list;k(t?.length?[...t]:[b(e)])},[e,q?.user_data?.sql_preset_list]);const N=async()=>{const s=C.map((e,t)=>({...e,index:t})),n=await p.wm.post(f.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:s});n?.code===m.m.Success&&(await t(),(0,x.SK)(e("保存成功")))},E=(e,t)=>{w.current=e;const n=C[e][t]??"";j.xK.set_value_temp(n),s({model:"sql"===t?"ace/mode/sql":"ace/mode/ini",open:!0,fileName:"",save:async e=>{C[w.current][t]=e,k([...C]),j.xK.set_value_temp(""),N()}})},A=[e("编号"),e("备注"),e("SQL代码"),e("env编辑"),e("操作")];return(0,g.jsxs)("div",{children:[(0,g.jsx)(i.aZ,{position:"right",children:(0,g.jsx)(a.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>y(-1)})}),(0,g.jsx)(l.jW,{isFull:!0,more:!0,children:(0,g.jsx)(l.NN,{children:(0,g.jsx)(l.xh,{children:(0,g.jsx)(l.fI,{children:(0,g.jsx)(l.VP,{widthPer:60,children:(0,g.jsx)(o.uF,{self_title:(0,g.jsx)("span",{className:"div-row",children:(0,g.jsx)("h2",{children:e("SQL 预设")})}),titleCom:(0,g.jsxs)("div",{className:"db-query-setting__toolbar",children:[(0,g.jsx)(a.rA,{icon:"add",title:e("添加"),onClick:()=>k([...C,{note:"",sql:"",env:S}])}),(0,g.jsx)(a.rA,{icon:"save",title:e("保存"),onClick:()=>N()})]}),children:(0,g.jsx)(c.X,{headers:A,rows:C.map((t,s)=>[(0,g.jsx)("div",{children:s+1}),(0,g.jsx)(d.Sm,{value:t.note,no_border:!0,placeholder:e("备注"),handleInputChange:e=>{t.note=e,k([...C])}}),(0,g.jsx)("div",{children:(0,g.jsx)(a.rA,{icon:"short_text",title:e("编辑SQL"),onClick:()=>E(s,"sql")})}),(0,g.jsx)("div",{children:(0,g.jsx)(a.rA,{icon:"settings",title:e("env编辑"),onClick:()=>E(s,"env")})}),(0,g.jsx)("div",{children:(0,g.jsx)(a.rA,{icon:"delete",title:e("删除"),onClick:()=>{C.splice(s,1),k([...C])}})})]),width:"8rem"})})})})})})})]})}s.d(t,["sqlEnvDefault",0,S])}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6919],{86919(e,t,l){l.r(t),l.d(t,{default:()=>_});var r=l(96540),a=l(86149),i=l(86090),s=l(34843),n=l(4412),o=l(85997),h=l(75725),c=l(70447),d=l(61443),p=l(82893),u=l(14284),m=l(53459),x=l(62042),j=l(74848);function _(){const{t:e}=(0,a.B)(),t=(0,i.Zp)(),[l,_]=(0,s.fp)(p.AG.confirm),[,v]=(0,s.fp)(p.AG.prompt_card),[b,C]=(0,r.useState)(""),[g,S]=(0,r.useState)(""),[w,f]=(0,r.useState)(""),[k,y]=(0,r.useState)(""),[B,I]=(0,r.useState)(""),[W,N]=(0,r.useState)(""),[A,D]=(0,r.useState)(""),[P,T]=(0,r.useState)(""),[H,Y]=(0,r.useState)(!0),[z,F]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{const e=await u.Yu.get("docker/config");if(e?.code!==m.m.Success)return;const t=e.data??{};C(t.http_proxy??""),S(t.https_proxy??""),f(t.no_proxy??""),y((t.registry_mirrors||[]).join(",")),I((t.insecure_registries||[]).join(",")),N(t.data_root??""),D(t.storage_driver??""),T(t.log_driver??""),Y(t.iptables??!0),F(!!t.live_restore)})()},[]);return(0,j.jsxs)("div",{children:[(0,j.jsx)(n.aZ,{position:"right",children:(0,j.jsx)(o.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>t(-1)})}),(0,j.jsx)(h.jW,{isFull:!0,more:!0,children:(0,j.jsx)(h.NN,{children:(0,j.jsx)(h.xh,{children:(0,j.jsx)(h.fI,{children:(0,j.jsx)(h.VP,{widthPer:35,children:(0,j.jsxs)(c.uF,{self_title:(0,j.jsxs)("span",{className:"div-row",children:[(0,j.jsx)("h2",{children:e("Docker 代理配置")}),(0,j.jsx)(o.rA,{icon:"info",title:e("信息"),onClick:()=>{v({open:!0,title:e("信息"),context_div:(0,j.jsx)("div",{style:{whiteSpace:"pre-wrap",lineHeight:"1.6"},children:e("代理写入 systemd 服务环境变量,其余写入 daemon.json;修改后需重启 Docker 生效,请谨慎操作(尤其数据存储目录变更)。")})})}})]}),titleCom:(0,j.jsx)(o.rA,{icon:"save",title:e("保存"),onClick:()=>(async()=>{const t=e=>e.split(/[\n,,]/).map(e=>e.trim()).filter(Boolean),l=await u.Yu.post("docker/config/save",{http_proxy:b,https_proxy:g,no_proxy:w,registry_mirrors:t(k),insecure_registries:t(B),data_root:W,storage_driver:A,log_driver:P,iptables:H,live_restore:z});l?.code===m.m.Success?_({open:!0,title:e("是否重启 Docker 服务以生效?"),sub_title:e("重启 Docker 会短暂中断容器服务,请确认当前没有关键任务在执行"),handle:async()=>{const t=await u.Yu.post("docker/restart");_({open:!1,handle:null}),t?.code===m.m.Success?(0,x.SK)(e("已重启 Docker,代理配置已生效")):(0,x.zN)(e("重启失败"))}}):(0,x.zN)(e("保存失败"))})()}),children:[(0,j.jsx)(d.BC,{label:e("HTTP 代理"),label_width:"4rem",children:(0,j.jsx)(d.Sm,{maxWidth:"24rem",placeholder:"http://127.0.0.1:3067",value:b,handleInputChange:e=>C(e)})}),(0,j.jsx)(d.BC,{label:e("HTTPS 代理"),label_width:"4rem",children:(0,j.jsx)(d.Sm,{maxWidth:"24rem",placeholder:"https://127.0.0.1:3067",value:g,handleInputChange:e=>S(e)})}),(0,j.jsx)(d.BC,{label:e("No Proxy"),label_width:"4rem",children:(0,j.jsx)(d.Sm,{maxWidth:"24rem",placeholder:"localhost,127.0.0.1",value:w,handleInputChange:e=>f(e)})}),(0,j.jsx)(d.BC,{label:e("镜像加速"),label_width:"4rem",children:(0,j.jsx)(d.Sm,{maxWidth:"24rem",placeholder:"https://docker.mirrors.ustc.edu.cn,https://hub-mirror.c.163.com",value:k,handleInputChange:e=>y(e)})}),(0,j.jsx)(d.BC,{label:e("不安全仓库"),label_width:"4rem",children:(0,j.jsx)(d.Sm,{maxWidth:"24rem",placeholder:"127.0.0.1:5000,registry.example.com",value:B,handleInputChange:e=>I(e)})}),(0,j.jsx)(d.BC,{label:e("数据存储目录"),label_width:"4rem",children:(0,j.jsx)(d.Sm,{maxWidth:"24rem",placeholder:"/var/lib/docker",value:W,handleInputChange:e=>N(e)})}),(0,j.jsx)(d.BC,{label:e("存储驱动"),label_width:"4rem",children:(0,j.jsx)(d.Sm,{maxWidth:"24rem",placeholder:"overlay2",value:A,handleInputChange:e=>D(e)})}),(0,j.jsx)(d.BC,{label:e("日志驱动"),label_width:"4rem",children:(0,j.jsx)(d.Sm,{maxWidth:"24rem",placeholder:"json-file",value:P,handleInputChange:e=>T(e)})}),(0,j.jsx)(d.BC,{label:e("启用 iptables"),label_width:"4rem",input_max_width:"8rem",children:(0,j.jsx)(d.l6,{options:[{title:e("是"),value:!0},{title:e("否"),value:!1}],value:H,onChange:e=>Y(!!e)})}),(0,j.jsx)(d.BC,{label:e("Live Restore"),label_width:"4rem",input_max_width:"8rem",children:(0,j.jsx)(d.l6,{options:[{title:e("是"),value:!0},{title:e("否"),value:!1}],value:z,onChange:e=>F(!!e)})})]})})})})})})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7759],{45601(A,e,s){"use strict";s.r(e),s.d(e,{default:()=>G});var a=s(96540),t=s(86149),c=s(34843),d=s(82893),l=s(14944),r=s(92275),o=s(14284),Y=s(53459),i=s(61443),n=s(85997),p=s(83029),B=s(4412),j=(s(82341),s(7003)),h=s(18257),S=s.n(h),u=s(76559),f=s(62042),m=s(74777),x=s(78247),y=s(23430),z=s(74848);let N;function G(){const{t:A}=(0,t.B)(),[e,s]=(0,a.useState)(void 0),[h,G]=(0,a.useState)(!1),[P,k]=(0,c.fp)(d.AG.user_base_info),{check_user_auth:g}=(0,x.MH)(),H=(0,a.useRef)(null),w=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{N&&(N.pause(),N.unload(),N.detachMediaElement(),N.destroy(),N=null),w.current&&w.current.dispose()},[]);const L=s=>{G(!0),(async e=>{P.sysSoftWare&&P.sysSoftWare[m.jk.ffmpeg]&&P.sysSoftWare[m.jk.ffmpeg].installed?(w.current=(0,j.default)(H.current,{controls:!0,width:640,height:360}),S().isSupported()?(N=S().createPlayer({type:"flv",url:u.I.getOtherWebSocketUrl(r.HK.rtsp_get,{url:e}),isLive:!0}),N.attachMediaElement(H.current),N.load(),N.load()):(0,f.zN)("FLV.js is not supported in this browser.")):(0,f.zN)(A("找不到ffmpeg"))})(s.address?s.address:e)};return(0,z.jsxs)("div",{children:[(0,z.jsxs)(B.aZ,{position:"right",children:[(0,z.jsx)(i.$Z,{max_width:"40rem",placeholder:A(" rtsp://username:password@ip:port/path"),icon:"link",value:e,handleInputChange:A=>s(A)}),!h&&(0,z.jsx)(n.rA,{icon:"play_arrow",title:A("连接"),onClick:L}),h&&(0,z.jsx)(n.rA,{icon:"close",title:A("关闭"),onClick:async()=>{await l.ws.sendData(r.HK.rdp_disconnect,""),G(!1)}})]}),!h&&(0,z.jsx)(p.N,{have_auth_edit:g(y.oV.rtsp_proxy_tag_update),getItems:async()=>{const A=await o.K4.get("tag");return A.code===Y.m.Success?A.data:[]},save:async A=>{(await o.K4.post("tag/save",A)).code!==Y.m.Success&&(0,f.zN)("网络错误")},clickItem:async A=>{s(A.address),L(A)},items:[{key:"name",preName:A("名字")},{key:"address",preName:A("地址")},{key:"color",preName:"color"}]}),(0,z.jsx)("canvas",{id:"rdpwebview",style:{display:"none"}}),(0,z.jsx)("div",{style:{display:h?"block":"none"},children:(0,z.jsx)("video",{ref:H,className:"video-js vjs-default-skin"})})]})}},17422(A){"use strict";A.exports="data:application/font-woff;charset=utf-8;base64,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"},80542(){}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6010,8302],{83277(e,t,n){n.d(t,{$j:()=>i,Lv:()=>s});class s{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,t){if(!e||!t?.length)return e;for(const n of t)if(n.value===e)return n.label;return e}static have_label_by_v(e,t){if(!e||!t?.length)return!1;for(const n of t)if(n.value===e)return!0;return!1}}const o=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function i(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}n.d(t,["CP",0,'\n\n\n\n# 聊天循环最大次数\ntool_call_max=500\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n\n# ===== 模型类型(request_type)=====\n# 必填项,不同类型的 model 接口格式不同,默认 completions。\n# 可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n#request_type=completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,可实现不同模型担任不同角色/能力,供 AI agent 在对话中动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n#tool_mode=false\n',"cL",0,o])},77481(e,t,n){n.d(t,{S:()=>l,X:()=>a});var s=n(96540),o=n(61443),i=n(74848);function a(e){const[t,n]=s.useState([]),a=(0,s.useRef)(-1),[l,r]=(0,s.useState)(-1),[c,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const p=()=>{a.current=-1,r(-1),d(-1)};return(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((t,n)=>(0,i.jsx)("th",{children:e.filter&&(e.filter.column??0)===n?(0,i.jsxs)("div",{className:"table-th-filter",children:[(0,i.jsx)("span",{children:t}),(0,i.jsx)(o.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},n))})}),(0,i.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,i.jsx)("tr",{className:s?(l===n?"row-dragging":"")+(c===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(a.current=n,r(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||a.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=a.current,n=c;p(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:p,children:t.map((n,s)=>{const o=s===t.length-1?"small":"";return(0,i.jsx)("td",{className:o,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}function l(e){return(0,i.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,i.jsx)("div",{children:e},t))})}},29591(e,t,n){n.r(t),n.d(t,{default:()=>L});var s=n(86149),o=n(96540),i=n(85997),a=n(4412),l=n(34843),r=n(82893),c=n(75725),d=n(77481),p=n(61443),m=n(70447),u=n(34299),h=n(74848);var _=n(14284),x=n(53459),g=n(62042),v=n(7523),j=n(78247),f=n(23430),y=n(86090),w=n(14944),b=n(92275),C=n(88815),k=n(45907),A=n(12721),S=n(24659),I=n(83277);function L(){const{t:e}=(0,s.B)(),{initUserInfo:t}=(0,o.useContext)(v.F),n=[e("编号"),e("url"),e("是否开启"),e("key"),"model",e("更多属性"),e("备注")],L=[e("编号"),e("本地目录"),e("自动加载"),e("备注")],[$,K]=(0,o.useState)([]),[N,M]=(0,o.useState)([]),[O,P]=(0,o.useState)([]),[X,D]=(0,o.useState)(null),F=(0,o.useRef)(),V=(0,o.useRef)(!1),T=(0,o.useRef)(!1),[H,Y]=(0,o.useState)([]),[q,R]=(0,o.useState)(!1),[E,G]=(0,l.fp)(r.AG.prompt_card),[B,J]=(0,l.fp)(r.AG.user_base_info),[z,W]=(0,o.useState)(!1),Z=O.filter(e=>"http"!==(e.transport??"stdio")),U=O.filter(e=>"http"===e.transport),Q=[e("编号"),e("名称"),e("是否开启"),"command","args","cwd",e("tools|env"),e("备注")],ee=[e("编号"),e("名称"),e("是否开启"),e("endpoint"),e("tools|headers"),e("备注")],te=[e("编号"),e("提示词"),e("LLM编辑开关"),e("LLM编辑提示词"),e("编辑规则"),e("备注")],[ne,se]=(0,o.useState)([]),[oe,ie]=(0,o.useState)(!1),ae=function(){const[e,t]=(0,l.fp)(r.AG.prompt_card);return e=>{t({open:!0,title:"信息",context_div:(0,h.jsx)("div",{children:(0,h.jsx)(u.default,{context:e})})})}}(),{check_user_auth:le}=(0,j.MH)(),[re,ce]=(0,l.fp)(r.AG.editorSetting),de=(0,y.Zp)(),pe=(0,k.y)(),me=(0,S.K)(),ue=async()=>{const e=await _.jV.get("docs_on_get");e.code===x.m.Success&&W(e.data)};(0,o.useEffect)(()=>{(async()=>{const e=await _.XO.get("ai_agent_setting");e.code===x.m.Success&&K(e.data.models),await w.ws.addMsg(b.HK.ai_load_info,e=>{D(e.context)});const t=await w.ws.sendData(b.HK.ai_load_info,{});t?.context&&D(t.context);const n=await _.XO.get("ai_docs_setting");n.code===x.m.Success&&(F.current=n.data.param,n.data.list?.length&&M(n.data.list));const s=await _.XO.get("ai_mcp_setting");s.code===x.m.Success&&P(s.data.list??[]),await je(),ue();const o=await _.XO.get("ai_system_prompts");o.code===x.m.Success&&se(o.data??[]);const i=await _.XO.get("ai_long_term_memory_setting");i.code===x.m.Success&&ie(i.data?.open??!1)})()},[]);const he=(e="stdio")=>{const t="http"===e?{name:"",open:!1,note:"",transport:"http",endpoint:"",headers:"",stream:!1,timeout_ms:1e4}:{name:"",open:!1,command:"",args:"",cwd:"",env:"",note:"",transport:"stdio",timeout_ms:1e4};P([...O,t]),V.current=!0},_e=e=>{const t=O.indexOf(e);t<0||(O.splice(t,1),P([...O]),V.current=!0)},xe=e=>{P([...O,{...e,open:!1}]),V.current=!0},ge=async e=>{for(let e=0;e<$.length;e++)$[e].index=e;(await _.XO.post("ai_agent_setting/save",{models:e??$})).code===x.m.Success&&(0,g.SK)("保存成功")},ve=async e=>{for(let e=0;e<O.length;e++)O[e].index=e;(await _.XO.post("ai_mcp_setting/save",{list:e??O})).code===x.m.Success&&((0,g.SK)("保存成功"),V.current=!1,await je())},je=async()=>{const e=await _.XO.get("ai_mcp_tools");return e.code===x.m.Success?(Y(e.data??[]),e.data??[]):[]},fe=async e=>{R(!0);try{const t=await _.XO.post("ai_mcp_tools/reload",{index:e});if(t.code===x.m.Success)return await je(),(0,g.SK)("MCP工具加载成功"),t.data??null}finally{R(!1)}return null},ye=async(t,n,s,o)=>{const i=o??H.find(e=>e.index===n)??{index:n,key:`${n}`,name:t.name??"",note:t.note,transport:t.transport??"stdio",open:!!t.open,loaded:!1,tool_count:0,tools:[]},a=(i.tools??[]).map(t=>({id:t.runtime_name,title:t.tool_name,subtitle:t.description||e("无描述"),detail:t.display_name,meta:t.runtime_name}));G({open:!0,title:`${t.name||t.note||n} MCP工具`,context_div:(0,h.jsx)(A.O,{title:`${t.name||t.note||n} MCP工具`,subtitle:`${i.transport??"stdio"} | ${i.open?e("是"):e("否")} | ${i.loaded?"loaded":"idle"} | ${i.tool_count} tools`,pages:a,initialPageId:s,onRefresh:async()=>{const e=await fe(n);e&&await ye(t,n,s,e)},renderPage:t=>{if(!t)return(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")});const n=i.tools?.find(e=>e.runtime_name===t.id);return n?(0,h.jsxs)("div",{className:"prompt-switch-page__detail",children:[(0,h.jsx)("div",{className:"prompt-switch-page__detail-title",children:n.display_name}),(0,h.jsx)("div",{className:"prompt-switch-page__detail-desc",children:n.description||e("无描述")}),(0,h.jsxs)("div",{className:"prompt-switch-page__detail-row",children:[(0,h.jsx)("strong",{children:"runtime:"})," ",n.runtime_name]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("strong",{children:"schema:"}),(0,h.jsx)("pre",{className:"prompt-switch-page__schema",children:JSON.stringify(n.input_schema??{},null,2)})]})]}):(0,h.jsx)("div",{className:"prompt-switch-page__empty",children:e("暂无工具")})}}),cancel:()=>G({open:!1})})},we=async e=>{for(let e=0;e<$.length;e++)$[e].index=e;let t={list:N,docs_update_tag:T.current};null!=e&&(t={param:e}),T.current=!1;(await _.XO.post("ai_docs_setting_save",t)).code===x.m.Success&&(0,g.SK)("保存成功")},be=async()=>{for(let e=0;e<ne.length;e++)ne[e].index=e;(await _.XO.post("ai_system_prompts/save",{list:ne})).code===x.m.Success&&(0,g.SK)("保存成功")};return(0,h.jsxs)("div",{children:[(0,h.jsx)(a.aZ,{position:"right",children:le(f.oV.ai_agent_setting)&&(0,h.jsx)(i.rA,{icon:"arrow_back",title:e("上一页"),onClick:()=>{de(-1)}})}),(0,h.jsx)(c.jW,{isFull:!0,more:!0,children:(0,h.jsx)(c.NN,{children:(0,h.jsxs)(c.xh,{children:[(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:100,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("Model")+" "+e("设置")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae('\n1. Only OpenAI-style AI APIs are supported. Fill in the FULL endpoint path (not just the domain), e.g. https://ark.cn-beijing.volces.com/api/v3/chat/completions\n2. The longer the conversation history, the more expensive the LLM token cost. Currently, there is no long-term memory simplification capability. You can set the system prompt to make the AI answer more concisely to save tokens\n3. When writing the model request parameter JSON, you can only write JSON in it, to configure the attributes supported by OpenAI-style AI, such as temperature, thinking (Doubao\'s deep thinking toggle), etc.\n4. You can enable "stream": true in the model request parameters to improve response speed.\n5. Deep thinking currently affects output speed. It is recommended to set { "thinking" : { "type":"disabled" } } to disable it (Doubao example).\n6. To use the AI feature to query server information, the AI needs to be able to know some commands. You need to first set command permissions for the user in user settings. It is recommended to set * to allow all commands, and then set the dangerous commands that are not allowed to be executed in the settings\n7. The model type and Become Tool are now both configured in "More Attributes → Extra Parameter Settings" using request_type / tool_mode (comments are already provided in the editor).\n8. After becoming a tool, the model will be loaded as a tool, enabling different models to serve as different roles; please do not set both it and "Enabled" to true at the same time.\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{K([...$,{note:"",open:!1,path:"",dotenv:I.CP,json_params:I.cL}])}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:async()=>{await ge()}})]}),children:(0,h.jsx)(d.X,{headers:n,rows:$.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:I.Lv.get_label_by_v(t.url,t.show_options?.options_agent_url_list),options:t.show_options?.options_agent_url_list,handleInputChange:e=>{t.url=e},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{((e,t,n)=>{const s=[];for(let e=0;e<$.length;e++)$[e].open=e===n&&t,s.push($[e]);K(s)})(0,e,n)},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{type:I.Lv.have_label_by_v(t.token,t.show_options?.options_agent_key_list)?null:"password",value:I.Lv.get_label_by_v(t.token,t.show_options?.options_agent_key_list),options:t.show_options?.options_agent_key_list,handleInputChange:e=>{t.token=e},no_border:!0}),(0,h.jsx)(p.Sm,{value:I.Lv.get_label_by_v(t.model,t.show_options?.options_agent_model_list),options:t.show_options?.options_agent_model_list,handleInputChange:e=>{t.model=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"short_text",title:"prompt",onClick:()=>{j.xK.set_value_temp($[n].sys_prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{$[n].sys_prompt=e,K($),j.xK.set_value_temp(""),ge($)}})}}),(0,h.jsx)(i.rA,{icon:"edit_attributes",title:"model请求参数json编写",onClick:()=>{j.xK.set_value_temp($[n].json_params),ce({model:"ace/mode/json",open:!0,fileName:"",save:async e=>{$[n].json_params=e,K($),j.xK.set_value_temp(""),ge($)},can_format:!0})}}),(0,h.jsx)(i.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp($[n].dotenv),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{$[n].dotenv=e,K($),j.xK.set_value_temp(""),ge($)}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{$.splice(e,1),K([...$])})(n)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>(e=>{K([...$,{...$[e],open:!1}])})(n)})]})];return s}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsx)(c.VP,{widthPer:70,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - stdio"]})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae("\n1. 这里配置的是 MCP Client 启动参数,当前实现的是 stdio 模式,也就是通过 command + args 启动本地 MCP Server\n2. 例如可以填 npx / uvx / python 等命令,再配合对应的 MCP server 包参数\n3. 保存后会自动重新加载 MCP 工具,agent 聊天时会把这些工具一起带给模型\n4. 建议把 cwd 配到具体项目目录,避免 server 在错误目录里运行\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>he("stdio")}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{ve()}})]}),children:(0,h.jsx)(d.X,{headers:Q,rows:Z.map((t,n)=>{const s=O.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,P([...O]),V.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.command,handleInputChange:e=>{t.command=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.args,handleInputChange:e=>{t.args=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.Sm,{value:t.cwd,handleInputChange:e=>{t.cwd=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"visibility",title:"查看工具",onClick:()=>{ye(t,s)}}),(0,h.jsx)(i.rA,{icon:"settings",title:"env",onClick:()=>{j.xK.set_value_temp(t.env??""),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.env=e,P([...O]),j.xK.set_value_temp(""),V.current=!0,ve()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>_e(t)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>xe(t)})]})]}),width:"10rem"})})})}),(0,h.jsx)(c.fI,{children:(0,h.jsxs)(c.VP,{widthPer:70,children:[(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsxs)("h2",{children:[e("MCP")+" "+e("设置")," - HTTP"]})," "]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>he("http")}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{ve()}})]}),children:(0,h.jsx)(d.X,{headers:ee,rows:U.map((t,n)=>{const s=O.indexOf(t);return[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.name,handleInputChange:e=>{t.name=e,V.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.open,onChange:e=>{t.open=e,P([...O]),V.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.endpoint,handleInputChange:e=>{t.endpoint=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"visibility",title:"查看工具",onClick:()=>{ye(t,s)}}),(0,h.jsx)(i.rA,{icon:"settings",title:"headers",onClick:()=>{j.xK.set_value_temp(t.headers??""),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{t.headers=e,P([...O]),j.xK.set_value_temp(""),V.current=!0,ve()}})}})]}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e,V.current=!0},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>_e(t)}),(0,h.jsx)(i.rA,{icon:"copy_all",title:e("复制"),onClick:()=>xe(t)})]})]}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("系统会话提示词")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae('\n1. 系统会话提示词,在 AI 聊天页创建会话时可以选择,选中的提示词会自动填入聊天框作为第一条系统消息\n2. 适用于预先设定常用的会话场景模板,如"代码审查"、"翻译助手"、"运维诊断"等\n3. "LLM编辑开关":开启后,当用户选择了该系统提示词发起对话时,AI 将会获得一个"更新会话提示词"工具,允许 AI 在对话中对当前会话进行总结,并写入到本提示词的"LLM编辑提示词"字段(全局保存,供之后的新会话沿用),使 AI 能自我维护长期上下文。\n4. "LLM编辑提示词":可选。AI 编辑后写回的内容(可预填初始方向)。仅在"LLM编辑开关"开启时生效。\n5. "编辑规则":可选。给 LLM 的编辑要求,例如"总结时不要超过 300 token"、"用简洁的项目要点记录"等。仅在"LLM编辑开关"开启时生效。\n')},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{se([...ne,{prompt:"",note:"",llm_prompt_enable:!1}])}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{be()}})]}),children:(0,h.jsx)(d.X,{headers:te,rows:ne.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"short_text",title:e("提示词"),onClick:()=>{j.xK.set_value_temp(t.prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.prompt=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)(i.Ay,{checked:!!t.llm_prompt_enable,onChange:e=>{t.llm_prompt_enable=e,se([...ne])},title:e("LLM编辑开关")}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"edit_note",title:e("LLM编辑提示词"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"rule",title:e("编辑规则"),onClick:()=>{j.xK.set_value_temp(t.llm_prompt_tip??""),ce({model:"ace/mode/text",open:!0,fileName:"",save:async e=>{t.llm_prompt_tip=e,se([...ne]),j.xK.set_value_temp(""),be()}})}})}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsx)("div",{children:(0,h.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>(e=>{ne.splice(e,1),se([...ne])})(n)})})];return s}),width:"10rem"})}),(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("长期记忆")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae(e("开启后跨会话保存记忆。四个固定文件:周/月/年/永久。每周结束自动压缩周→月,每月结束自动压缩月→年,每年结束自动压缩年→永久。编辑按钮可手动查看和修改。"))},title:"信息"})]}),titleCom:(0,h.jsx)("div",{children:(0,h.jsx)(i.Ay,{checked:oe,onChange:async t=>{ie(t),await _.XO.post("ai_long_term_memory_setting/save",{open:t}),(0,g.SK)(e("长期记忆设置已保存"))},title:e("开关")})}),children:(0,h.jsx)("div",{style:{display:"flex",gap:"0.5rem",padding:"0.5rem 0",flexWrap:"wrap"},children:[{type:"week",label:e("周记忆"),tip:e("上限3000字")},{type:"month",label:e("月记忆"),tip:e("上限6000字")},{type:"year",label:e("年记忆"),tip:e("上限9000字")},{type:"forever",label:e("永久记忆"),tip:e("上限12000字")}].map(({type:t,label:n,tip:s})=>(0,h.jsx)(i.rA,{icon:"edit",title:`${e("编辑")} ${n} (${s})`,onClick:async()=>{const s=await _.XO.get(`ai_long_term_memory_bucket/${t}`),o=s.code===x.m.Success?s.data??"":"";j.xK.set_value_temp(o),ce({model:"ace/mode/text",open:!0,fileName:`long_term_memory_${t}.txt`,save:async s=>{await _.XO.post(`ai_long_term_memory_bucket/${t}/save`,{data:s}),j.xK.set_value_temp(""),(0,g.SK)(`${n} ${e("已保存")}`)}})}},t))})})]})}),(0,h.jsxs)(c.fI,{children:[(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsx)(m.uF,{self_title:(0,h.jsxs)("span",{className:" div-row ",children:[(0,h.jsx)("h2",{children:e("本地知识库")})," ",(0,h.jsx)(i.rA,{icon:"info",onClick:()=>{ae("\n1. 本地知识库用于为AI增强理解能力,或者分析本地文件,原理读取本地的文件,对文件在内存中建立全文索引,为AI提供额外数据(需要有模型开启才能使用)\n2. 该功能只能用于小型知识库,作为本地小型或者公司内部资料使用还是没有问题的\n3. 每次保存都会重新加载知识库中的文件,不会全部重新加载,而是检测哪些文件有变更\n")},title:"信息"})]}),titleCom:(0,h.jsxs)("div",{children:[(0,h.jsx)(i.Ay,{checked:z,onChange:async e=>{await _.jV.post("docs_on_set",{status:e}),ue(),t()},title:e("知识库开关")}),(0,h.jsx)(i.rA,{icon:"settings",title:"额外参数设置",onClick:()=>{j.xK.set_value_temp(F.current),ce({model:"ace/mode/ini",open:!0,fileName:"",save:async e=>{F.current=e,j.xK.set_value_temp(""),we(F.current)}})}}),(0,h.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>{M([...N,{note:"",auto_load:!1,dir:""}]),T.current=!0}}),(0,h.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>{we()}})]}),children:(0,h.jsx)(d.X,{headers:L,rows:N.map((t,n)=>{const s=[(0,h.jsx)("div",{children:n}),(0,h.jsx)(p.Sm,{value:t.dir,handleInputChange:e=>{t.dir=e,T.current=!0},no_border:!0}),(0,h.jsx)(p.l6,{value:t.auto_load,onChange:e=>{t.auto_load=e,M([...N]),T.current=!0},options:me,no_border:!0}),(0,h.jsx)(p.Sm,{value:t.note,handleInputChange:e=>{t.note=e},no_border:!0}),(0,h.jsxs)("div",{children:[(0,h.jsx)(i.rA,{icon:"delete",title:e("删除记录"),onClick:()=>(e=>{N.splice(e,1),M([...N]),T.current=!0})(n)}),(0,h.jsx)(i.rA,{icon:"restore",title:e("手动加载"),onClick:()=>{pe({sub_title:"手动加载",confirm_fun:()=>{_.jV.post("ai_load_one_file",{param_path:t.dir}),(0,g.SK)("ok")}})}}),(0,h.jsx)(i.rA,{icon:"delete_forever",title:e("从索引删除"),onClick:()=>{pe({sub_title:"从索引删除",confirm_fun:()=>{_.jV.post("ai_del",{param_path:t.dir}),(0,g.SK)("ok")}})}})]})];return s}),width:"10rem"})})}),X&&(0,h.jsx)(c.VP,{widthPer:50,children:(0,h.jsxs)(m.Zp,{title:e("知识库加载信息"),children:[(0,h.jsx)(c.Yh,{left:e("最近一次加载")+","+e("加载进度"),right:X?.progress}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件数量")}`,right:X?.num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件字符数量")}`,right:X?.char_num}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总文件大小")}`,right:(0,C.v7)(X?.size)}),(0,h.jsx)(c.Yh,{left:`${e("最近一次加载")},${e("总耗时")}`,right:(0,C.a3)(X?.consume_time_ms_len)}),(0,h.jsx)(c.Yh,{left:`${e("总文件数量")}`,right:X?.total_num})]})})]})]})})})]})}},34299(e,t,n){n.r(t),n.d(t,{default:()=>_});n(96540);var s=n(22091),o=n(53995),i=n(18569),a=n(77979),l=n(8263),r=n(69428),c=n.n(r),d=(n(3775),n(21499)),p=n(99214),m=n(19878),u=(n(72411),n(74848));const h=new s.A({html:!0,highlight:function(e,t){if(t&&m.A.getLanguage(t))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${t}">${m.A.highlight(e,{language:t}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${m.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${h.utils.escapeHtml(e)}</code></pre>`}});function _(e){return(0,p.VD)(),(0,u.jsx)("div",{dangerouslySetInnerHTML:{__html:h.render(e.context)}})}h.use(o.A).use(i.A).use(a.A).use(l.A).use(c()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(t,n,s,o,i)=>{const a=t[n],l=a.content.trim(),r=a.info.trim();let c="";if(r&&m.A.getLanguage(r))try{c=m.A.highlight(l,{language:r}).value}catch(t){c=e.utils.escapeHtml(l)}else try{c=m.A.highlightAuto(l).value}catch(t){c=e.utils.escapeHtml(l)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${r||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(l)}">复制</button>\n </div>\n <pre><code class="hljs ${r?`language-${r}`:""}">${c}</code></pre>\n </div>`}}).use(e=>{const t=e.renderer.rules.link_open||function(e,t,n,s,o){return o.renderToken(e,t,n)};e.renderer.rules.link_open=(e,n,s,o,i)=>{const a=e[n],l=a.attrIndex("href");if(l>=0){const e=a.attrs[l][1];a.attrs[l][1]=(0,d.bi)(window.location.href,e)}return t(e,n,s,o,i)}})},45907(e,t,n){n.d(t,{y:()=>i});var s=n(34843),o=n(82893);function i(){const[e,t]=(0,s.fp)(o.AG.confirm);return({sub_title:e,confirm_fun:n,title:s,context_div:o})=>{t({open:!0,sub_title:e,handle:()=>{n(),t({open:!1,handle:null})},title:s,context_div:o})}}},24659(e,t,n){var s=n(86149);n.d(t,["K",0,()=>{const{t:e}=(0,s.B)();return[{title:e("是"),value:!0,color:"#28a745"},{title:e("否"),value:!1,color:"#666666"}]}])},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8319],{77481(e,t,n){n.d(t,{S:()=>a,X:()=>i});var s=n(96540),r=n(61443),l=n(74848);function i(e){const[t,n]=s.useState([]),i=(0,s.useRef)(-1),[a,c]=(0,s.useState)(-1),[o,d]=(0,s.useState)(-1);(0,s.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]);const h=()=>{i.current=-1,c(-1),d(-1)};return(0,l.jsxs)("table",{children:[(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e.headers?.map((t,n)=>(0,l.jsx)("th",{children:e.filter&&(e.filter.column??0)===n?(0,l.jsxs)("div",{className:"table-th-filter",children:[(0,l.jsx)("span",{children:t}),(0,l.jsx)(r.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},n))})}),(0,l.jsx)("tbody",{children:t.map((t,n)=>{const s=!!e.onRowDrag;return(0,l.jsx)("tr",{className:s?(a===n?"row-dragging":"")+(o===n?" row-drop-target":""):"",draggable:s,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{s&&(i.current=n,c(n),e.dataTransfer.effectAllowed="move")},onDragOver:e=>{!s||i.current<0||(e.preventDefault(),e.dataTransfer.dropEffect="move",d(n))},onDrop:t=>{s&&(t.preventDefault(),(()=>{const t=i.current,n=o;h(),t<0||n<0||t===n||e.onRowDrag?.(t,n)})())},onDragEnd:h,children:t.map((n,s)=>{const r=s===t.length-1?"small":"";return(0,l.jsx)("td",{className:r,style:{width:e.width??"auto"},children:n},s)})},n)})})]})}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))})}},28319(e,t,n){n.r(t),n.d(t,{default:()=>C,defaultSqlPreset:()=>w});var s=n(96540),r=n(86149),l=n(4412),i=n(85997),a=n(75725),c=n(77481),o=n(70447),d=n(61443),h=n(34843),u=n(82893),x=n(14284),f=n(23496),p=n(53459),j=n(62042),v=n(7523),m=n(78247),_=n(86090),g=n(74848);function w(e){return{index:0,note:e("查询全部表"),sql:"SELECT name, type FROM sqlite_master WHERE type='table';"}}const S='# 可选:设置 SQL 中的"替换词"(在查询页选中该预设后,会显示输入框)\n# 例子:SQL 为 SELECT * FROM t WHERE id = 123456 ,请填写下面的 find=123456\n# 这样查询页输入新值即可把 SQL 中的 123456 替换掉后再查询\nfind=';function C(){const{t:e}=(0,r.B)(),{initUserInfo:t}=(0,s.useContext)(v.F),[,n]=(0,h.fp)(u.AG.editorSetting),[C]=(0,h.fp)(u.AG.user_base_info),b=(0,_.Zp)(),q=s.useRef(-1),[E,k]=(0,s.useState)([]);(0,s.useEffect)(()=>{const t=C?.user_data?.sql_preset_list;k(t?.length?[...t]:[w(e)])},[e,C?.user_data?.sql_preset_list]);const y=async()=>{const n=E.map((e,t)=>({...e,index:t})),s=await x.wm.post(f.s.user_save_private_attr,{is_sql_preset:!0,sql_preset_list:n});s?.code===p.m.Success&&(await t(),(0,j.SK)(e("保存成功")))},A=(e,t)=>{q.current=e;const s=E[e][t]??"";m.xK.set_value_temp(s),n({model:"sql"===t?"ace/mode/sql":"ace/mode/ini",open:!0,fileName:"",save:async e=>{E[q.current][t]=e,k([...E]),m.xK.set_value_temp(""),y()}})},D=[e("编号"),e("备注"),e("SQL代码"),e("env编辑"),e("操作")];return(0,g.jsxs)("div",{children:[(0,g.jsx)(l.aZ,{position:"right",children:(0,g.jsx)(i.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>b(-1)})}),(0,g.jsx)(a.jW,{isFull:!0,more:!0,children:(0,g.jsx)(a.NN,{children:(0,g.jsx)(a.xh,{children:(0,g.jsx)(a.fI,{children:(0,g.jsx)(a.VP,{widthPer:60,children:(0,g.jsx)(o.uF,{self_title:(0,g.jsx)("span",{className:"div-row",children:(0,g.jsx)("h2",{children:e("SQL 预设")})}),titleCom:(0,g.jsxs)("div",{className:"db-query-setting__toolbar",children:[(0,g.jsx)(i.rA,{icon:"add",title:e("添加"),onClick:()=>k([...E,{note:"",sql:"",env:S}])}),(0,g.jsx)(i.rA,{icon:"save",title:e("保存"),onClick:()=>y()})]}),children:(0,g.jsx)(c.X,{headers:D,rows:E.map((t,n)=>[(0,g.jsx)("div",{children:n+1}),(0,g.jsx)(d.Sm,{value:t.note,no_border:!0,placeholder:e("备注"),handleInputChange:e=>{t.note=e,k([...E])}}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"short_text",title:e("编辑SQL"),onClick:()=>A(n,"sql")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"settings",title:e("env编辑"),onClick:()=>A(n,"env")})}),(0,g.jsx)("div",{children:(0,g.jsx)(i.rA,{icon:"delete",title:e("删除"),onClick:()=>{E.splice(n,1),k([...E])}})})]),width:"8rem"})})})})})})})]})}n.d(t,["sqlEnvDefault",0,S])}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8603],{58603(e,t,i){i.r(t),i.d(t,{default:()=>$});var n=i(96540),s=i(75725),r=i(70447),a=i(34843),o=i(82893),l=i(60096),c=i(85997),d=i(34251),m=i(34289),h=i(87361),_=i(14284),u=i(53459),x=i(61443),f=i(86149),p=i(62042),j=(i(47022),i(4412)),k=i(99214),g=i(6960),w=i(88815),v=i(78247),z=i(40505),F=i(23430),b=i(64694),C=i(86090),N=i(74848);function $(){const[e,t]=(0,n.useState)(null),i=(0,n.useRef)(""),$=(0,n.useRef)(""),[y,S]=(0,a.fp)(o.AG.prompt_card),[M,A]=(0,a.fp)(o.AG.share_sort_type),{t:G}=(0,f.B)(),[I,U]=(0,a.fp)(o.AG.selectedFileList),[V,W]=(0,a.fp)(o.AG.clickFileList),{click_file:D}=(0,v.kZ)(),[L]=(0,C.ok)(),R=(0,k.oT)(),Z=(0,k.xp)(),B=(0,k.Vs)(!0),H=(0,n.useMemo)(()=>{const t=[...e?.items??[]],i=e=>Number(e.mtime??0);return M===F.t8.time_minx_max?t.sort((e,t)=>i(e)-i(t)):M===F.t8.time_max_min&&t.sort((e,t)=>i(t)-i(e)),t},[e?.items,M]),T=async()=>{const e=await _.$M.post("share",{id:i.current,token:$.current});if(e.code===u.m.Success){const n={is_dir:e.data.is_dir};n.items=e.data.files??[];for(const e of n.items)e.origin_size=e.size,e.show_mtime=e.mtime?(0,g.s)(e.mtime):"",e.size=(0,w.v7)(e.size);if(!n.is_dir){const t=e.data.files[0];n.name=t.name,n.size=t.size,n.show_mtime=t.show_mtime}localStorage.setItem(`file_share_token_${i.current}`,$.current);const s=L.get("share_preview_file_name");if(s)try{const t=e.data.files.find(e=>e.name===s);D({file_path:t.path,file_url:_.$M.getDownloadUrlV2(t.path,"share_download",{share_id:i.current,share_token:$.current}),name:t.name,size:t.origin_size,opt_shell:!0,mtime:t.mtime,not_type_tip:G("未知类型,请下载查看"),close:()=>{R("share_preview_file_name",null)}})}catch(e){(0,p.zN)(e?.message||e)}else t(n)}else e.code===u.m.need_token_share&&(localStorage.removeItem(`file_share_token_${i.current}`),(0,p.zN)("需要正确的访问token"),S({open:!0,title:"share file",confirm:()=>{S({open:!1}),T()},context_div:(0,N.jsx)("div",{className:"card-content",children:(0,N.jsx)(x.Sm,{placeholderOut:G("请输入访问token"),value:"",handleInputChange:e=>{$.current=e}})})}))};if((0,n.useEffect)(()=>{const e=(0,m.oW)(`${(0,m.GG)(h.o.share,(0,m.vX)())}`);i.current=e,$.current=localStorage.getItem(`file_share_token_${e}`),T()},[L]),!e)return(0,N.jsx)(s.jW,{isFull:!0,children:(0,N.jsx)("div",{className:"common-box common-box-center",children:"Loading..."})});return(0,N.jsxs)(n.Fragment,{children:[(0,N.jsx)(j.aZ,{children:(0,N.jsx)(N.Fragment,{children:(0,N.jsxs)("h2",{children:["Share ",e.is_dir?"Folder":"File"]})})}),(0,N.jsxs)(j.aZ,{position:"right",children:[I.length>0&&(0,N.jsx)(c.rA,{icon:"download",title:G("下载"),onClick:function(){const e=[];for(let t=0;t<I.length;t++){const i=H[I[t]];e.push(encodeURIComponent(i.path))}const t=_.$M.getDownloadUrlV2(e,"share_download",{share_id:i.current,share_token:$.current});window.open(t)}}),e.is_dir&&(0,N.jsx)(c.rA,{icon:"grid_view",title:G("切换样式"),onClick:B}),e.is_dir&&(0,N.jsx)(c.rA,{icon:"schedule",title:M===F.t8.time_minx_max?G("时间逆序"):G("时间顺序"),onClick:()=>{const e=(0,b.jH)([F.t8.time_max_min,F.t8.time_minx_max,F.t8.defualt],M);A(e),U([]),W([])}})]}),(0,N.jsx)(s.xh,{children:(0,N.jsx)(s.jW,{isFull:!0,children:(0,N.jsx)("div",{className:"common-box ",children:e.is_dir?(0,N.jsx)(l.QW,{share:{share_id:i.current,share_token:$.current},handleContextMenu:()=>{},file_list:H,clickBlank:e=>{e.target===e.currentTarget&&(U([]),W([]))}}):(0,N.jsx)(r.uF,{children:(0,N.jsxs)("div",{style:{height:"25rem"},className:"common-box common-box-center",children:[(0,N.jsx)("div",{className:"file-icons",children:(0,N.jsx)("div",{"data-type":(0,d.uL)(e.name),"data-dir":e.is_dir,"aria-label":e.name,children:(0,N.jsx)(c.In,{icon:"",style:{fontSize:"10rem",display:"inline-block",lineHeight:1},aria_label:e.name})})}),(0,N.jsx)("div",{className:"",children:e.name}),(0,N.jsx)("div",{className:"",children:e.size}),(0,N.jsx)("div",{className:"",children:e.show_mtime}),(0,N.jsx)(c.C3,{text:"download",clickFun:()=>{const e=H[0],t=_.$M.getDownloadUrlV2(e.path,"share_download",{share_id:i.current,share_token:$.current});window.open(t)}}),(0,N.jsx)(c.C3,{text:"copy url",clickFun:()=>{const e=H[0],t=_.$M.getDownloadUrlV2(e.path,"share_download",{share_id:i.current,share_token:$.current}),n=_.$M.get_full_url(t);(0,z.lW)(n),(0,p.SK)(n)}}),(0,N.jsx)(c.C3,{text:"preview",clickFun:()=>{const e=H[0];Z(e.name)}})]})})})})})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8714],{47374(e,t,i){i.d(t,{e:()=>d});var o=i(96540),n=i(86090),s=i(64694),a=i(34289),l=i(61443),r=i(75725),_=i(86149),c=i(85997),f=i(74848);function d(e){let t=(0,n.zy)();const[i,d]=(0,o.useState)([]),[p,m]=(0,o.useState)("/"),[h,u]=(0,o.useState)(void 0),{t:w,i18n:y}=(0,_.B)();o.useEffect(()=>{let t="",i=(0,a.vX)().split("/");i=i.filter(e=>e);const o=i.indexOf(e.baseRoute),n=[];if(-1!=o){t=(0,s.IO)(i.slice(0,o),e.baseRoute);const a=i.slice(o+1);for(let e=0;e<a.length;e++){const i=a[e];n.push({value:i,href:0===e?`${t}${i}/`:(0,s.IO)(n[e-1].href,i)})}m(t),d(n)}},[t]);const g=t=>{t.stopPropagation(),e.clickFun(t)};return(0,f.jsx)("div",{className:"breadcrumbs",onClick:e=>{u(void 0!==h?void 0:"")},children:(0,f.jsx)(o.Fragment,{children:void 0===h?(0,f.jsxs)(o.Fragment,{children:[(0,f.jsx)("span",{className:"chevron",children:(0,f.jsx)(n.N_,{to:p,onClick:g,children:(0,f.jsx)(c.In,{icon:"home"})})}),i.map((e,t)=>(0,f.jsxs)("span",{className:"chevron",children:[(0,f.jsx)(c.In,{icon:"keyboard_arrow_right"}),(0,f.jsx)(n.N_,{to:e.href,onClick:g,children:decodeURIComponent(e.value)})]},t))]}):(0,f.jsx)(r.QM,{click:()=>{u(void 0)},children:(0,f.jsx)(l.Sm,{width:"100%",placeholder:w("输入跳转的目录"),handlerEnter:t=>{e.input_path_enter&&e.input_path_enter(t),u(void 0)}})})})})}},78714(e,t,i){i.r(t),i.d(t,{default:()=>U});var o=i(96540),n=i(47374),s=i(34843),a=i(82893),l=i(14284),r=i(86090),_=i(4412),c=i(18538),f=i(34289),d=i(53459),p=i(99214),m=i(61443),h=i(47022),u=i(62042),w=i(86149),y=i(7523),g=i(78247),v=i(88815),x=i(6960),k=i(47071),j=i(14944),G=i(92275),A=i(23430);var C=i(34251),b=i(60096),z=i(85997),P=i(23496),F=i(12730),M=i(75725),$=i(70447),S=i(87361),D=i(40505),I=i(74848);let X={};function E(){const{t:e}=(0,w.B)();let t=(0,r.zy)();const i=(0,r.Zp)(),{check_user_auth:n}=(0,g.MH)(),[_,d]=(0,s.fp)(a.AG.nowFileList),[m,v]=(0,s.fp)(a.AG.uploadFiles),[x,k]=(0,s.fp)(a.AG.showPrompt),[b,P]=(0,s.fp)(a.AG.selectedFileList),[D,E]=(0,s.fp)(a.AG.copyedFileList),[K,Y]=(0,s.fp)(a.AG.cutedFileList),[L,R]=(0,s.fp)(a.AG.selectedFileList),[H,N]=(0,s.fp)(a.AG.clickFileList),[B,U]=(0,s.fp)(a.AG.fileShellShow),[W,Z]=(0,s.fp)(a.AG.file_root_list),[O,q]=(0,s.fp)(a.AG.file_root_index),[V,T]=(0,o.useState)(void 0),[J,Q]=(0,o.useState)(""),[ee,te]=(0,s.fp)(a.AG.workflow_show),[ie,oe]=(0,s.fp)(a.AG.workflow_realtime_show),[ne,se]=(0,s.fp)(a.AG.work_flow_show),{initUserInfo:ae}=(0,o.useContext)(y.F),[le,re]=(0,s.fp)(a.AG.user_base_info),{click_file:_e}=(0,g.kZ)(),[ce,fe]=(0,s.fp)(a.AG.prompt_card),de=(0,o.useMemo)(()=>_.files.reduce((e,t)=>e+(t.type!==h.Iw.folder?1:0),0),[_]),pe=(0,o.useMemo)(()=>_.files.reduce((e,t)=>e+(t.type===h.Iw.folder?1:0),0)+(_.folders?.length??0),[_]);function me(e){(0,u.SK)(e)}(0,o.useEffect)(()=>{X={}},[t]),(0,o.useEffect)(()=>()=>{U({show:!1,path:""})},[]);const he=(0,p.Vs)(),ue=t=>{fe({open:!0,title:e("信息"),context_div:(0,I.jsxs)("div",{style:{maxWidth:"25rem"},children:[(0,I.jsx)(M.Yh,{left:e("挂载位置磁盘"),right:t?.total_size}),(0,I.jsx)(M.Yh,{left:`${e("磁盘剩余")}`,right:t?.left_size}),(0,I.jsx)(M.Yh,{left:`${e("文件系统")}`,right:t?.fs_type}),(0,I.jsx)(M.Yh,{left:`${e("文件夹数")}`,right:pe}),(0,I.jsx)(M.Yh,{left:`${e("文件数")}`,right:de}),(0,I.jsx)(M.Yh,{left:`${e("当前位置")}`,right:(0,I.jsx)($.xP,{context:t?.now_absolute_path})})]}),cancel:()=>{j.ws.removeMsg(G.HK.file_info)}})};return(0,I.jsxs)(o.Fragment,{children:[b.length>0&&(0,I.jsx)(z.rA,{icon:"delete",title:e("删除"),onClick:()=>{k({show:!0,type:c.PromptEnum.FilesDelete,overlay:!0,data:{}})}}),b.length>0&&(0,I.jsx)(z.rA,{icon:"content_copy",title:e("复制"),onClick:function(){const e=(0,p.ib)(_,b);E(e.map(e=>(0,p.Ok)(e.name))),Y([]),me("已复制")}}),b.length>0&&(0,I.jsx)(z.rA,{icon:"content_cut",title:e("剪切"),onClick:function(){const e=(0,p.ib)(_,b);Y(e.map(e=>(0,p.Ok)(e.name))),E([]),me("已剪切")}}),(D.length>0||K.length>0)&&(0,I.jsx)(z.rA,{onClick:function(){k({show:!0,type:c.PromptEnum.Confirm,overlay:!0,data:{}})},icon:"content_paste",title:e("粘贴到此处"),tip:D.length+K.length}),b.length>0&&(0,I.jsx)(z.rA,{icon:"download",title:e("下载"),onClick:function(){const e=(0,p.ib)(_,b);for(let t=0;t<e.length;t++){const i=e[t];e[t]=encodeURIComponent((0,p.Ok)(i.name))}const t=l.$M.getDownloadUrl(e);window.open(t)}}),b.length>0&&(0,I.jsx)(z.rA,{icon:"compress",title:e("压缩"),onClick:function(){const e=(0,p.ib)(_,b);for(let t=0;t<e.length;t++){const i=e[t];e[t]=(0,p.Ok)(i.name)}e&&0!==e.length?k({show:!0,type:c.PromptEnum.Compress,overlay:!0,data:{files:e}}):(0,u.zN)("没有选中")}}),1===b.length&&(0,I.jsx)(z.rA,{icon:"edit_attributes",title:e("重命名"),onClick:function(){k({show:!0,type:c.PromptEnum.FileRename,overlay:!0,data:{}})}}),ne&&(0,I.jsx)(z.rA,{icon:"api",title:"workflow",onClick:()=>{te(!ee)}}),(0,I.jsx)(z.rA,{icon:"terminal",title:"shell",onClick:function(){B.show?U({show:!1,path:""}):U({show:!0,path:(0,f.GG)("file",(0,f.vX)())})}}),n(A.oV.share_file)&&(0,I.jsx)(z.rA,{icon:"share",title:e("文件分享"),onClick:()=>{i(`${S.o.share_list_setting_page}`)}}),(0,I.jsx)(z.rA,{icon:"grid_view",title:e("切换样式"),onClick:he}),(0,I.jsx)(z.rA,{icon:"create_new_folder",title:e("创建文件夹"),onClick:function(){k({show:!0,type:c.PromptEnum.DirNew,overlay:!0,data:{dir:(0,f.GG)("file",(0,f.vX)())}})}}),(0,I.jsx)(z.rA,{icon:"note_add",title:e("创建文本文件"),onClick:function(){k({show:!0,type:c.PromptEnum.FileNew,overlay:!0,data:{dir:(0,f.GG)("file",(0,f.vX)())}})}}),(0,I.jsx)(z.rA,{icon:"upload_file",title:e("上传"),onClick:()=>{k({show:!0,type:c.PromptEnum.UploadFile,overlay:!0,data:{call:e=>{let t=e.currentTarget?.files;if(!t)return;let i=!!t[0].webkitRelativePath;const o=[],n=new Set;for(let e=0;e<t.length;e++){const s=t[e],a=i?s.webkitRelativePath:`${s.webkitRelativePath}${s.name}`;s.fullPath=a,i&&n.add((0,F.S)(a)),o.push(s)}const s=[];if(i)for(const e of n)s.push({isDir:!0,fullPath:e,name:e});s.push(...o),v(s),k({show:!0,type:c.PromptEnum.FilesUpload,overlay:!1,data:{}})}}})}}),(0,I.jsx)(z.rA,{icon:"info",title:e("信息"),onClick:async()=>{let e;if(!X.now_absolute_path){j.ws.addMsg(G.HK.file_info,t=>{const i=t.context;e&&(X={...X,...i},j.ws.removeMsg(G.HK.file_info),ue(X))});const t=await j.ws.sendData(G.HK.file_info,{type:h.Iw.folder,path:(0,f.GG)("file",(0,f.vX)())});e=t.context,X=e,ue(X)}ue(X)}}),(0,I.jsx)(z.rA,{icon:"more_vert",title:e("切换目录"),onClick:t=>{const o=new C.ik;o.x=t.clientX,o.y=t.clientY,o.type=h.Iw.directory,o.items=W,o.item_pre_value=O,o.textClick=async t=>{if(-1===t)return i(`${S.o.setting_private_env_setting}`),k({data:void 0,overlay:!1,type:"",show:!1}),void(0,u.N9)(e("请配置 文件夹路径"));(async e=>{q(e),await l.$M.post("base_switch",{root_index:e}),await ae(),i("/file/"),R([]),N([])})(t),k({data:void 0,overlay:!1,type:"",show:!1})},k({show:!0,type:c.PromptEnum.FileMenu,overlay:!1,data:o})}})]})}var K=i(2543),Y=i(21499),L=i(64694);const R=o.lazy(()=>Promise.all([i.e(7856),i.e(6349),i.e(3659)]).then(()=>i(63659))),H=o.lazy(()=>Promise.all([i.e(7856),i.e(1636)]).then(()=>i(81636)));let N,B="";function U(){const[e,t]=(0,s.fp)(a.AG.editorSetting),[i,u]=(0,s.fp)(a.AG.file_preview),{t:F}=(0,w.B)();let M=(0,r.zy)();const $=(0,r.Zp)(),[X,U]=(0,s.fp)(a.AG.nowFileList),[W,Z]=(0,s.fp)(a.AG.showPrompt),[O,q]=(0,s.fp)(a.AG.selectedFileList),[V,T]=(0,s.fp)(a.AG.clickFileList),[J,Q]=(0,s.fp)(a.AG.fileShellShow),[ee,te]=(0,o.useState)(""),[ie,oe]=(0,s.fp)(a.AG.workflow_show),[ne,se]=(0,s.fp)(a.AG.workflow_realtime_show),[ae,le]=(0,s.fp)(a.AG.work_flow_show),{initUserInfo:re}=(0,o.useContext)(y.F),[_e,ce]=(0,s.fp)(a.AG.user_base_info),{click_file:fe}=(0,g.kZ)(),[de,pe]=(0,s.fp)(a.AG.to_running_files),[me,he]=(0,s.fp)(a.AG.file_page),[ue]=(0,s.fp)(a.AG.blank_search_mode),[we,ye]=(0,s.fp)(a.AG.blank_search_mode_for_temp),ge=function(){const[e,t]=(0,s.fp)(a.AG.user_base_info),{t:i}=(0,w.B)(),{check_user_auth:n}=(0,g.MH)(),[_,d]=(0,s.fp)(a.AG.router_jump),m=(0,r.Zp)(),{initUserInfo:u}=(0,o.useContext)(y.F),[v,x]=(0,s.fp)(a.AG.nowFileList),[k,b]=(0,s.fp)(a.AG.showPrompt),[z,F]=(0,s.fp)(a.AG.fileShellShow),[M,$]=(0,s.fp)(a.AG.blank_search_mode);return t=>{t.preventDefault(),t.stopPropagation();const o=new C.ik;o.x=t.clientX,o.y=t.clientY,o.type=h.Iw.directory;const s=[{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.dir_show_type===A.t8.time_minx_max),children:i("时间逆序")}),v:A.t8.time_minx_max},{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.dir_show_type===A.t8.time_max_min),children:i("时间顺序")}),v:A.t8.time_max_min}],a=[{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.dir_show_type===A.t8.size_min_max),children:i("大小顺序")}),v:A.t8.size_min_max},{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.dir_show_type===A.t8.size_max_min),children:i("大小逆序")}),v:A.t8.size_max_min}],r=[{r:(0,I.jsx)("span",{style:(0,D.ok)(!e.user_data.file_list_pagination_mode||e.user_data.file_list_pagination_mode===A.yM.all),children:i("全部加载文件")}),v:A.yM.all},{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.file_list_pagination_mode===A.yM.pagination),children:i("分页滚动加载文件")}),v:A.yM.pagination}],_=[{r:(0,I.jsx)("span",{style:(0,D.ok)(!e.user_data.file_time_show_type||e.user_data.file_time_show_type===A.KD.current),children:i("最近时间")}),v:A.KD.current},{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.file_time_show_type===A.KD.time),children:i("准确时间")}),v:A.KD.time}],w=[{r:i("文件列表展示"),items:[{r:i("文件排序"),v:"",items:[{r:(0,I.jsx)("span",{style:(0,D.ok)(!e.user_data.dir_show_type),children:i("系统默认")}),v:A.t8.defualt},{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.dir_show_type===A.t8.name),children:i("名字")}),v:A.t8.name},{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.dir_show_type===A.t8.time_minx_max||e.user_data.dir_show_type===A.t8.time_max_min),children:i("修改时间")}),v:!1,items:s},{r:(0,I.jsx)("span",{style:(0,D.ok)(e.user_data.dir_show_type===A.t8.size_min_max||e.user_data.dir_show_type===A.t8.size_max_min),children:i("文件大小")}),v:!1,items:a}]},{r:i("文件加载方式"),v:"",items:r},{r:i("时间展示"),v:"",items:_},{r:i("缩放调整"),v:"zoom_adjust"},{r:(0,I.jsx)("span",{style:(0,D.ok)(M),children:i("以空白搜索模式打开目录")}),v:"blank_search_mode"}]},{r:i("以配置表方式打开目录"),v:"gcfg_dir_config"}];v?.folders?.find(e=>".git"===e.name)&&w.push({r:i("查看Git提交"),v:"git_page"}),n(A.oV.code_resource)&&w.push({r:i("添加http资源根目录"),v:"code_resource"}),n(A.oV.http_proxy)&&w.push({r:i("在此目录下载http资源"),v:"http_resource"}),e?.user_data?.quick_cmd&&(0,p.LL)([...e.user_data.quick_cmd],w),o.items=w,o.textClick=async e=>{if(console.log(e),!1===e)return;const t={};if("gcfg_dir_config"===e){const e=(0,f.GG)("file",(0,f.vX)());return b({data:void 0,overlay:!1,type:"",show:!1}),void m(`${S.o.gcfg_page}/${encodeURIComponent(e)}`)}if("git_page"===e){const e=(0,f.GG)("file",(0,f.vX)());return b({data:void 0,overlay:!1,type:"",show:!1}),void m(`${S.o.git_page}/${encodeURIComponent(e)}`)}if("code_resource"===e){const e=await j.ws.sendData(G.HK.file_info,{path:(0,f.GG)("file",(0,f.vX)())});return d({page_self_router_api_data:[`/api/${Date.now()}`,e.context.now_absolute_path]}),b({data:void 0,overlay:!1,type:"",show:!1}),void m("/setting/customer_router/")}if("http_resource"===e){const e=await j.ws.sendData(G.HK.file_info,{path:(0,f.GG)("file",(0,f.vX)())});return d({http_download_map_path:e.context.now_absolute_path}),b({data:void 0,overlay:!1,type:"",show:!1}),void m("/proxy/http/")}if("zoom_adjust"===e)return b({data:void 0,overlay:!1,type:"",show:!1}),void setTimeout(()=>{b({show:!0,type:c.PromptEnum.ZoomAdjust,overlay:!1,data:{}})},0);if("object"==typeof e&&"quick_cmd"===e.tag){let t=e.cmd;t&&(t.endsWith("\r")||(t+="\r",F({show:!0,path:(0,f.GG)("file",(0,f.vX)()),cmd:t})))}else{if("blank_search_mode"===e)return $(!M),void b({data:void 0,overlay:!1,type:"",show:!1});if(e===A.yM.all||e===A.yM.pagination)t.is_pagination_mode=!0;else if(e===A.KD.current||e===A.KD.time)t.is_file_show_type=!0;else{if(e!==A.t8.defualt&&e!==A.t8.name&&e!==A.t8.size_max_min&&e!==A.t8.size_min_max&&e!==A.t8.time_max_min&&e!==A.t8.time_minx_max)return;t.is_dir_list_type=!0}}await l.wm.post(P.s.user_save_private_attr,{type:e,...t}),await u(),b({data:void 0,overlay:!1,type:"",show:!1}),m((0,f.vX)())},b({show:!0,type:c.PromptEnum.FileMenu,overlay:!1,data:o})}}(),ve=async()=>{const e=new k.Nd;e.dir_path=`${(0,f.GG)("file",(0,f.vX)())}`,j.ws.addMsg(G.HK.workflow_realtime,e=>{const t=e.context;if(e.context){for(const e of t.sucess_file_list)(0,p.Ys)(e);for(const e of t.failed_file_list)(0,p.V$)(e);pe(new Set(t.running_file_list))}}),await j.ws.sendData(G.HK.workflow_realtime,e)},xe=async e=>{let t=!1;for(const i of e.files??[])i.origin_size=i.size,i.size=(0,v.v7)(i.size),_e.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,Y.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,x.s)(i.mtime):"",t||!i.name.endsWith(".workflow.yml")&&!i.name.endsWith(".act")||(t=!0,Promise.resolve().then(()=>{ve()})),i.name===k.SB&&(t=!0);for(const i of e.folders??[])_e.user_data.file_time_show_type===A.KD.time?i.show_mtime=i.mtime?(0,Y.Yq)(i.mtime):"":i.show_mtime=i.mtime?(0,x.s)(i.mtime):"",i.name===k.SB&&(t=!0);le(t)};(0,o.useEffect)(()=>async()=>{pe(new Set)},[]);const ke=()=>{(async()=>{const e=(0,f.GG)("file",(0,f.vX)());if(ue||we)return;let t;if(_e.user_data.file_list_pagination_mode===A.yM.pagination){if(B!==e){if(B=e,1!==me.page_num)return void he({page_size:me.page_size,page_num:1})}else if(me.page_num<0)return;if(t=await l.$M.post("file_get_page",{param_path:e,page_num:me.page_num,page_size:me.page_size}),t.code!==d.m.Success)return;const i=t.data;return xe(i),i.files?.length?(U(e=>{const t=(0,K.cloneDeep)(1===me.page_num?i.files:[...e?.files??[],...i.files]),o={...e,files:t};return(0,p.yC)(o,_e.user_data.dir_show_type),o}),void(N=t.data)):void he({page_size:me.page_size,page_num:-1})}if(t=await l.$M.get(e),t.code!==d.m.Success)return;const i=t.data;(0,p.yC)(i,_e.user_data.dir_show_type),xe(t.data),U(t.data),N=t.data})(),t({open:!1}),u({open:!1}),le(!1)};(0,o.useEffect)(()=>{ke()},[M,me]);const je=e=>{e.target===e.currentTarget&&(q([]),T([]))};return(0,I.jsxs)(o.Fragment,{children:[(0,I.jsx)(_.aZ,{children:(0,I.jsx)(m.$Z,{handleEnterPress:async()=>{if(ue||we){if(q([]),T([]),!ee||!ee.trim())return void U({files:[],folders:[]});const e=(0,f.GG)("file",(0,f.vX)()),t=await l.$M.post("file_get_page",{param_path:e,page_num:1,page_size:1e4,search:ee.trim()});if(t.code!==d.m.Success)return;const i=t.data;return(0,p.yC)(i,_e.user_data.dir_show_type),xe(i),U(i),void(N=i)}if(!N)return;q([]),T([]);const e=[],t=[];for(const t of N.files??[])t.name.includes(ee)&&e.push(t);for(const e of N.folders??[])e.name.includes(ee)&&t.push(e);U({files:e,folders:t})},placeholder:F("搜索当前目录"),icon:"search",value:"",mobile_hidden:!0,handleInputChange:e=>{te(e)},max_width:"25em"})}),(0,I.jsxs)(_.aZ,{position:"right",children:[(0,I.jsx)("div",{className:"mobile-context-btn",children:(0,I.jsx)(z.rA,{icon:"more_horiz",title:F("右键"),onClick:()=>{const e=O[O.length-1];if(void 0!==e){const t=[...X.folders??[],...X.files??[]][e];if(t){const i=document.querySelectorAll(".item")[e],o=i?i.getBoundingClientRect():{left:window.innerWidth/2,bottom:100},n={preventDefault:()=>{},stopPropagation:()=>{},clientX:o.left+10,clientY:o.bottom??100},s=new C.ik;s.path=(0,L.IO)((0,f.vX)(),t.name),s.filename=t.name,s.x=n.clientX,s.y=n.clientY,s.type=t.type===h.Iw.folder?h.Iw.folder:(0,C.uL)(t.name),s.size=t.origin_size,Z({show:!0,type:c.PromptEnum.FileMenu,overlay:!1,data:s})}}else{const e={preventDefault:()=>{},stopPropagation:()=>{},clientX:window.innerWidth/2,clientY:window.innerHeight/2};ge(e)}}})}),(0,I.jsx)(E,{})]}),(0,I.jsx)(n.e,{baseRoute:"file",clickFun:function(){if(q([]),T([]),_e.user_data.file_list_pagination_mode===A.yM.pagination){const e=document.getElementById("listing");e&&(e.scrollTop=0),he({page_size:me.page_size,page_num:1})}},input_path_enter:e=>{var t;q([]),T([]),U({files:[],folders:[]}),!function(e){return"string"==typeof e&&0!==e.length&&(/^[a-zA-Z]:[\\\/]/.test(e)||/^\\\\[^\\/]+[\\/]/.test(e)||/^\//.test(e))}(e)?$(function(e,t){let i=function(e){let t="\\";for(const i of e)if("/"===i||"\\"===i){t=i;break}return t}(e);if("."===t)return e;if(".."===t){if(e.length>1){let t=e[e.length-1]===i?1:0;for(let o=e.length-1-t;o>=0;o--)if(e[o]===i)return e.substring(0,o+1)}return e}return e.endsWith(i)&&t.startsWith(i)?e.slice(0,-1)+t:e.endsWith(i)||t.startsWith(i)?e+t:e+i+t}((0,f.vX)(),e)):(e=e.replace(0===(t=_e.user_data).folder_item_now||void 0===t.folder_item_now?t.cwd:t.folder_items[t.folder_item_now-1].path,""),$(e))}}),_e.user_data.file_list_pagination_mode===A.yM.pagination?(0,I.jsx)(b.$J,{handleContextMenu:ge,clickBlank:je,list:X.files}):(0,I.jsx)(b.t$,{handleContextMenu:ge,file_list:X.files,folder_list:X.folders,clickBlank:je}),ie&&(0,I.jsx)(R,{}),ne.open&&(0,I.jsx)(H,{})]})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[9546],{75007(e,t,s){s.d(t,{h:()=>r});s(96540);var n=s(85997),i=s(74848);function r(e){return(0,i.jsxs)("h2",{className:"message",children:[(0,i.jsx)(n.In,{icon:"sentiment_dissatisfied"}),(0,i.jsx)("span",{children:e.context})]})}},22081(e,t,s){var n=s(96540),i=s(16349),r=s(74848);const o=({percentage:e})=>{const t=(0,n.useRef)(null),[s,o]=(0,n.useState)(null);return(0,n.useEffect)(()=>{const s=t.current.getContext("2d"),n=new i.Ay(s,{type:"doughnut",data:{labels:["use","left"],datasets:[{data:[e,100-e],backgroundColor:["#007bff","#f0f0f0"],borderWidth:0}]},options:{plugins:{legend:{display:!1},tooltip:{enabled:!1}},elements:{arc:{borderWidth:0}}}});return o(n),()=>{n.destroy()}},[]),(0,n.useEffect)(()=>{s&&(s.data.datasets[0].data=[e,100-e],s.update())},[e]),(0,r.jsx)("div",{style:{width:"8rem",overflow:"hidden"},children:(0,r.jsx)("canvas",{ref:t})})};s.d(t,["A",0,o])},77481(e,t,s){s.d(t,{S:()=>c,X:()=>o});var n=s(96540),i=s(61443),r=s(74848);function o(e){const[t,s]=n.useState([]),o=(0,n.useRef)(-1),[c,l]=(0,n.useState)(-1),[a,d]=(0,n.useState)(-1);(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]);const u=()=>{o.current=-1,l(-1),d(-1)};return(0,r.jsxs)("table",{children:[(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{children:e.headers?.map((t,s)=>(0,r.jsx)("th",{children:e.filter&&(e.filter.column??0)===s?(0,r.jsxs)("div",{className:"table-th-filter",children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)(i.l6,{value:e.filter.value,options:e.filter.options,onChange:e.filter.onChange,width:"auto",no_border:!0})]}):t},s))})}),(0,r.jsx)("tbody",{children:t.map((t,s)=>{const n=!!e.onRowDrag;return(0,r.jsx)("tr",{className:n?(c===s?"row-dragging":"")+(a===s?" row-drop-target":""):"",draggable:n,onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},onDragStart:e=>{n&&(o.current=s,l(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=a;u(),t<0||s<0||t===s||e.onRowDrag?.(t,s)})())},onDragEnd:u,children:t.map((s,n)=>{const i=n===t.length-1?"small":"";return(0,r.jsx)("td",{className:i,style:{width:e.width??"auto"},children:s},n)})},s)})})]})}function c(e){return(0,r.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,r.jsx)("div",{children:e},t))})}},88062(e,t,s){s(96540),s(47022);var n=s(74848);function i(e){return(0,n.jsx)("div",{className:"black-tip",onClick:()=>{e.click&&e.click(e)},onContextMenu:t=>{t.stopPropagation(),t.nativeEvent.stopImmediatePropagation(),e.onContextMenu&&e.onContextMenu(t,e)},children:e.name})}const r=e=>(0,n.jsxs)("li",{children:[e.click?(0,n.jsx)(i,{...e.node,name:e.render?e.render(e.node):e.node.name,click:e.click,onContextMenu:e.onContextMenu}):(0,n.jsx)("div",{children:e.render?e.render(e.node):e.node.name}),e.node.children&&e.node.children.length>0&&(0,n.jsx)("ul",{children:e.node.children.map((t,s)=>(0,n.jsx)(r,{node:t,click:e.click,onContextMenu:e.onContextMenu,render:e.render},s))})]}),o=e=>(0,n.jsx)("div",{className:"card-tree-view",children:(0,n.jsx)("ul",{children:e.list&&e.list.map((t,s)=>(0,n.jsx)(r,{node:t,click:e.click,onContextMenu:e.onContextMenu,render:e.render},s))})});s.d(t,["A",0,o])},59546(e,t,s){s.r(t),s.d(t,{default:()=>ce});var n=s(96540),i=s(75725),r=s(70447),o=s(22081),c=s(92275),l=s(14944),a=s(14284),d=s(4412),u=s(85997),h=s(77481),x=s(53459),p=s(86149),m=s(34843),j=s(82893),f=s(74777),_=s(62042),g=s(61443),w=s(74848);function y(e){const{t}=(0,p.B)(),[s,o]=(0,m.fp)(j.AG.disk),[c,l]=(0,n.useState)({}),[f,_]=(0,n.useState)([]),g=[t("名字"),t("当前值"),t("历史最低"),t("临界值")];return(0,n.useEffect)(()=>{(async()=>{const s=await a.Yu.post("sys/disk/info",{name:e.name});if(s.code===x.m.Success){const e=[];for(const n of s.data.ata_smart_attributes??[]){let s;n[1]>=n[2]?s="var(--icon-green)":n[1]<=n[3]&&(s="var(--icon-red)"),n[0]=(0,w.jsx)("span",{style:{color:s},children:t(n[0])}),e.push(n)}_(s.data.ata_smart_attributes),l(s.data)}})()},[]),(0,w.jsxs)("div",{children:[(0,w.jsx)(d.aZ,{position:"right",children:(0,w.jsx)(u.rA,{icon:"close",title:t("关闭"),onClick:()=>{o({})}})}),(0,w.jsx)(i.jW,{isFull:!0,more:!0,children:(0,w.jsx)(i.NN,{children:(0,w.jsxs)(i.fI,{children:[(0,w.jsxs)(i.VP,{widthPer:30,children:[(0,w.jsx)(i.xh,{children:(0,w.jsxs)(r.Zp,{title:t("基本信息"),children:[(0,w.jsx)(i.Yh,{left:t("名字"),right:e.name}),(0,w.jsx)(i.Yh,{left:t("厂商名称"),right:e.typeName}),(0,w.jsx)(i.Yh,{left:t("类型"),right:e.type}),(0,w.jsx)(i.Yh,{left:t("容量"),right:e.total})]})}),(0,w.jsx)(i.xh,{children:(0,w.jsxs)(r.Zp,{title:t("物理信息"),children:[(0,w.jsx)(i.Yh,{left:t("是否健康"),right:!0===c.smart_status?"是":"否"}),(0,w.jsx)(i.Yh,{left:t("设备型号"),right:c.model_name}),(0,w.jsx)(i.Yh,{left:t("序列号"),right:c.serial_number}),(0,w.jsx)(i.Yh,{left:t("固件版本"),right:c.firmware_version}),(0,w.jsx)(i.Yh,{left:t("转速(每分钟)"),right:c.rotation_rate}),(0,w.jsx)(i.Yh,{left:t("通电时长(小时)"),right:c.power_on_time_hours}),(0,w.jsx)(i.Yh,{left:t("通电次数"),right:c.power_cycle_count}),(0,w.jsx)(i.Yh,{left:t("温度(°C)"),right:c.temperature}),(0,w.jsx)(i.Yh,{left:t("通信协议"),right:c.device_protocol})]})})]}),(0,w.jsx)(i.VP,{widthPer:50,children:(0,w.jsxs)(i.xh,{children:[f?.length?(0,w.jsx)(r.uF,{title:t("ATA/SATA详细信息"),children:(0,w.jsx)(h.X,{headers:g,rows:f,width:"10rem"})}):(0,w.jsx)(w.Fragment,{}),c.nvme_smart?(0,w.jsxs)(r.Zp,{title:t("NVME详细信息"),children:[(0,w.jsx)(i.Yh,{left:t("NVMe 可用备用块(%)"),right:c.nvme_smart.available_spare}),(0,w.jsx)(i.Yh,{left:t("NVMe 已使用寿命(%)"),right:c.nvme_smart.percentage_used}),(0,w.jsx)(i.Yh,{left:t("NVMe 读取量"),right:c.nvme_smart.data_units_read}),(0,w.jsx)(i.Yh,{left:t("NVMe 写入量"),right:c.nvme_smart.data_units_written}),(0,w.jsx)(i.Yh,{left:t("NVMe 通电次数"),right:c.nvme_smart.power_cycles}),(0,w.jsx)(i.Yh,{left:t("NVMe 通电时长(小时)"),right:c.nvme_smart.power_on_hours}),(0,w.jsx)(i.Yh,{left:t("NVMe 非正常关机"),right:c.nvme_smart.unsafe_shutdowns}),(0,w.jsx)(i.Yh,{left:t("NVMe 媒体错误"),right:c.nvme_smart.media_errors}),(0,w.jsx)(i.Yh,{left:t("NVMe 错误日志数"),right:c.nvme_smart.num_err_log_entries})]}):(0,w.jsx)(w.Fragment,{})]})})]})})})]})}let v=function(e){return e[e.mount=0]="mount",e}({});var k=s(88062),S=s(78247),b=s(23430);const C=e=>(0,w.jsxs)("div",{style:{border:"2px solid black",padding:"10px",width:"300px",height:"300px",position:"relative"},children:[e.name,e.lvms.map((e,t)=>(0,w.jsx)("div",{style:{margin:"5px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid "},children:e.name},t))]});function A(){return(0,w.jsx)("div",{style:{position:"relative",height:"300px",margin:"10px",width:"30px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,w.jsx)("div",{style:{width:0,height:0,borderTop:"10px solid transparent",borderBottom:"10px solid transparent",borderLeft:"10px solid black"}})})}function P(){const{t:e}=(0,p.B)(),[t,s]=(0,m.fp)(j.AG.disk),[o,c]=(0,n.useState)({}),[l,f]=(0,n.useState)([]),[g,y]=(0,n.useState)([]),[P,V]=(0,m.fp)(j.AG.showPrompt),{check_user_auth:Y}=(0,S.MH)(),[F,$]=(0,n.useState)([]),{click_file:I}=(0,S.kZ)(),[M,N]=(0,m.fp)(j.AG.prompt_card),E=[e("挂载点"),"uuid",e("类型"),e("文件系统类型"),e("文件系统容量"),e("卷容量"),e("设备路径"),e("分区表类型")],K=async()=>{const e=await a.Yu.get("disk/blk");return e.code===x.m.Success&&f(e.data),e.code};(0,n.useEffect)(()=>{(async()=>{K()})()},[]);const B=[(0,w.jsx)(u.rA,{icon:"info",title:e("提示"),onClick:async()=>{N({open:!0,title:"信息",context_div:(0,w.jsx)("div",{children:(0,w.jsxs)("ul",{children:[(0,w.jsxs)("li",{children:["通用格式:","<文件系统> <挂载点> <类型> <挂载选项> <dump> <fsck> "]}),(0,w.jsxs)("li",{children:["文件系统,有多种格式",(0,w.jsxs)("ul",{children:[(0,w.jsx)("li",{children:"1(usb口默认名称)./dev/sda1"}),(0,w.jsx)("li",{children:"2(唯一Id).UUID=123e4567-e89b-12d3-a456-426614174000"}),(0,w.jsx)("li",{children:"3.LABEL=DATA"})]})]}),(0,w.jsx)("li",{children:"挂载点,就是文件路径,例如 /mnt/data ,这个目录要提前创建,且为空"}),(0,w.jsx)("li",{children:"类型,就是文件系统类型,对于系统不支持的类型,例如ntfs需要额外前提安装ntfs-3g(linux 5.15内核以后自带 ntfs)"}),(0,w.jsxs)("li",{children:['挂载选项的值只能是以下这些,可以用 "," 同时使用多个选项',(0,w.jsxs)("ul",{children:[(0,w.jsx)("li",{children:"defaults:使用默认挂载选项"}),(0,w.jsx)("li",{children:"noatime:不更新访问时间,提高性能"}),(0,w.jsx)("li",{children:"auto:系统启动时自动挂载"}),(0,w.jsx)("li",{children:"rw:以读写方式挂载"}),(0,w.jsx)("li",{children:"nofail:防止启动阻塞,挂载失败系统继续执行"}),(0,w.jsx)("li",{children:"...等"})]})]}),(0,w.jsx)("li",{children:"dump 0是需要备份 1是不需要备份"}),(0,w.jsx)("li",{children:"Fsck 整数值0是不检查,文件系统检查顺序越小越先检查"}),(0,w.jsx)("li",{children:"提示:只有含有文件系统的逻辑卷,或者分区才可以进行挂载。"})]})})})}}),(0,w.jsx)(u.rA,{icon:"update",title:e("更新挂载"),onClick:async()=>{(await a.Yu.post("cmd/exe",{type:v.mount})).code===x.m.Success&&(0,_.SK)("挂载文件已生效")}},1)],H=async()=>(await a.Yu.get("get_fstab")).data,Z=async e=>{await a.Yu.post("save_fstab",{content:e})};return(0,w.jsxs)("div",{children:[(0,w.jsx)(d.aZ,{position:"right",children:(0,w.jsx)(u.rA,{icon:"close",title:e("关闭"),onClick:()=>{s({})}})}),(0,w.jsx)(i.jW,{isFull:!0,more:!0,children:(0,w.jsx)(i.NN,{children:(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{widthPer:40,children:(0,w.jsxs)(r.Zp,{title:e("物理块(硬盘)设备、逻辑卷、物理卷"),titleCom:(0,w.jsxs)("div",{children:[Y(b.oV.sys_disk_mount)&&(0,w.jsx)(u.rA,{icon:"file_open",title:e("打开挂载文件"),onClick:async()=>{I({name:"fstab(谨慎修改,内容错误会导致系统无法启动)",model:"text",get_file_fun:H,save_file_fun:Z,menu_list:B})}}),(0,w.jsx)(u.rA,{icon:"update",title:e("刷新"),onClick:async()=>{await K()===x.m.Success&&(0,_.SK)("刷新成功")}})]}),children:[(0,w.jsx)(h.X,{headers:E,rows:g,width:"10rem"}),(0,w.jsx)(k.A,{list:l,render:e=>{let t=e.name;return e.label&&(t+=`(${e.label})`),e.mountpoint?(0,w.jsxs)("span",{children:[t,(0,w.jsx)("span",{style:{color:"green"},children:"(已挂载)"})]}):t},onContextMenu:(e,t)=>{e.preventDefault()},click:t=>{let s="";if(t.mountpoint)for(let e=0;e<t.mountpoints.length;e++)s+=t.mountpoints[e]+";";y([[(0,w.jsx)(r.xP,{children:s}),(0,w.jsx)(r.xP,{children:t.uuid}),e(t.type),e(t.fstype),t.fssize,t.size,(0,w.jsx)(r.xP,{children:t.path}),t.pttype]])}})]})}),(0,w.jsx)(i.VP,{widthPer:60,children:F.map((t,s)=>{const n=[];for(const e of t.pv_list)n.push({name:`${e.name}---(${e.size})---(${e.free_size})`});const o=[];for(const e of t.lv_list)o.push({name:`${e.name}---(${e.size})`});return(0,w.jsx)(r.Zp,{children:(0,w.jsxs)(i.n5,{children:[(0,w.jsx)(C,{name:e("物理卷"),lvms:n}),(0,w.jsx)(A,{}),(0,w.jsx)(C,{name:`${e("逻辑卷")}---(${t.name})---size(${t.size})`,lvms:[]}),(0,w.jsx)(A,{}),(0,w.jsx)(C,{name:e("逻辑卷"),lvms:o})]})},s)})})]})})})]})}var V=s(88815);let Y=!0;function F(e){const{t}=(0,p.B)(),s=[t("名字"),t("厂商名称"),t("类型"),t("容量")],g=[t("名字"),t("物理硬盘"),t("文件系统类型"),t("挂载位置"),t("总容量"),t("剩余容量")],[v,k]=(0,m.fp)(j.AG.user_base_info),[S,C]=(0,n.useState)(0),[A,F]=(0,n.useState)(0),[$,I]=(0,n.useState)(0),[M,N]=(0,n.useState)(0),[E,K]=(0,n.useState)(0),[B,H]=(0,n.useState)({}),[Z,D]=(0,n.useState)(!1),[G,z]=(0,n.useState)(!1),[W,T]=(0,n.useState)(!1),[X,U]=(0,n.useState)(Y),[q,L]=(0,n.useState)(null),[R,O]=(0,n.useState)([]),[J,Q]=(0,n.useState)([]),[ee,te]=(0,m.fp)(j.AG.user_base_info),[se,ne]=(0,m.fp)(j.AG.disk),ie=async()=>{if(!Y)return;const e=new c.hf(c.HK.sys_get);await l.ws.send(e),l.ws.addMsg(c.HK.sys_getting,e=>{N(e.context?.cpu_currentLoad);const t=e.context?.memLeft,s=e.context?.memTotal;F(t),I(s),C((s-t)/s*100),L(e.context?.node_memory_usage),K(e.context?.node_cpu_usage)})};return(0,n.useEffect)(()=>((async()=>{await ie()})(),()=>{l.ws.sendData(c.HK.sys_cancel,{})}),[]),(0,w.jsxs)("div",{children:[(0,w.jsxs)(d.aZ,{position:"right",children:[v.sys===b.XM.linux&&(0,w.jsx)(u.rA,{icon:"sd_card",title:"硬盘挂载",onClick:()=>{ne({type:"mount"})}}),(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("基本信息"),clickFun:e=>{D(e),e&&(async()=>{const e=await a.Yu.get("base");if(e.code===x.m.Success){const t=e.data;H(t)}})()}}),(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("物理硬盘"),clickFun:e=>{z(e),e&&(async()=>{const e=await a.Yu.get("disk");if(e.code===x.m.Success){const s=e.data,n=[];let i=!0;ee.sysSoftWare&&ee.sysSoftWare[f.jk.smartmontools]&&ee.sysSoftWare[f.jk.smartmontools].installed||(i=!1);for(const e of s??[])n.push([(0,w.jsx)(r.xP,{context:e.name}),e.typeName,e.type,e.total,(0,w.jsx)(u.rA,{icon:"health_and_safety",title:t("查看健康信息"),onClick:()=>{i?ne({type:"check",data:e}):(0,_.zN)("没有安装smartmontools")}})]);O(n)}})()}}),(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("文件硬盘"),clickFun:e=>{T(e),e&&(async()=>{const e=await a.Yu.get("filedisk");if(e.code===x.m.Success){const t=e.data,s=[];for(const e of t??[])s.push([(0,w.jsx)(r.xP,{context:e.name}),(0,w.jsx)(r.xP,{context:e.device_name}),e.fsType,(0,w.jsx)(r.xP,{context:e.mount}),e.total,e.available]);Q(s)}})()}}),(0,w.jsx)(u.Z$,{defaultStatus:X,text:t("实时信息"),clickFun:e=>{U(e),Y=e,ie()}})]}),(0,w.jsxs)(i.xh,{children:[X&&(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,w.jsx)(r.Zp,{title:"Sys "+t("内存"),children:(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{children:(0,w.jsx)(o.A,{percentage:S})}),(0,w.jsx)(i.VP,{children:(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{widthPer:100,children:(0,w.jsx)("div",{children:(0,w.jsx)(i.Yh,{left:t("总容量"),center:`${$}G`})})}),(0,w.jsx)(i.VP,{widthPer:100,children:(0,w.jsx)(i.Yh,{left:t("剩余"),center:`${A}G`})})]})})]})})}),(0,w.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,w.jsx)(r.Zp,{title:"Sys cpu",children:(0,w.jsxs)(i.fI,{children:[(0,w.jsx)(i.VP,{children:(0,w.jsx)(o.A,{percentage:M})}),(0,w.jsx)(i.VP,{children:(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.Yh,{left:t("使用率"),center:M})})})]})})}),(0,w.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,w.jsx)(r.Zp,{title:"FileCat",children:(0,w.jsxs)(i.fI,{children:[(0,w.jsxs)(i.VP,{children:[(0,w.jsx)(i.qV,{content:t("内存")}),(0,w.jsx)(i.qV,{content:"total: "+(0,V.v7)(q?.rss)}),(0,w.jsx)(i.qV,{content:"object: "+(0,V.v7)(q?.heapTotal)}),(0,w.jsx)(i.qV,{content:"obj-use: "+(0,V.v7)(q?.heapUsed)}),(0,w.jsx)(i.qV,{content:"external: "+(0,V.v7)(q?.external)}),(0,w.jsx)(i.qV,{content:"buffer: "+(0,V.v7)(q?.arrayBuffers)})]}),(0,w.jsx)(i.VP,{children:(0,w.jsx)(i.qV,{content:"cpu growth rate: "+E})})]})})})]}),(0,w.jsxs)(i.fI,{children:[Z&&(0,w.jsx)(i.VP,{children:(0,w.jsxs)(r.Zp,{title:t("基本信息"),children:[(0,w.jsx)(i.Yh,{left:t("总内存"),right:B.mem_total}),(0,w.jsx)(i.Yh,{left:`cpu ${t("制造商")}`,right:B.cpu_manufacturer}),(0,w.jsx)(i.Yh,{left:`cpu ${t("品牌")}`,right:B.cpu_brand}),(0,w.jsx)(i.Yh,{left:`cpu ${t("逻辑核心")}`,right:B.cpu_core_num}),(0,w.jsx)(i.Yh,{left:`cpu ${t("物理核心")}`,right:B.cpu_phy_core_num}),(0,w.jsx)(i.Yh,{left:`cpu ${t("最大")}hz`,right:B.cpu_speed_hz}),(0,w.jsx)(i.Yh,{left:`${t("当前系统")}:pid;ppid`,right:B.pid_ppid}),(0,w.jsx)(i.Yh,{left:t("运行用户"),right:B.user})]})}),G&&(0,w.jsx)(i.VP,{children:(0,w.jsx)(r.uF,{title:t("物理硬盘"),children:(0,w.jsx)(h.X,{headers:s,rows:R,width:"10rem"})})}),W&&(0,w.jsx)(i.VP,{children:(0,w.jsx)(r.uF,{title:t("文件硬盘"),children:(0,w.jsx)(h.X,{headers:g,rows:J,width:"10rem"})})})]})]}),se&&"check"===se.type&&(0,w.jsx)(y,{...se.data}),se&&"mount"===se.type&&(0,w.jsx)(P,{})]})}var $=s(75007),I=s(97856),M=s(64405);const N=n.lazy(()=>Promise.all([s.e(2543),s.e(5614)]).then(()=>s(85614)));function E(e){const[t,s]=(0,n.useState)(null),[i,r]=(0,m.fp)(j.AG.dockerShellShow),[o,a]=(0,m.fp)(j.AG.user_base_info),d=o.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",u=()=>{(async()=>{t&&(t.writeln("[38;2;29;153;243mclose![0m "),t.dispose(),s(null))})()};(0,n.useEffect)(()=>{i.show?(async()=>{const e=new I.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:d,cursor:d,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});let t;l.ws.subscribeUnconnect(u);const n=t=>{e.write(t)};t=s=>{e.clear(),e.write(s),t=n},l.ws.addMsg("logs"===i.type?c.HK.docker_shell_logs_getting:c.HK.docker_shell_exec_getting,e=>{"error"===e.context&&u(),t(e.context)}),"exec"===i.type&&e.onData(async e=>{const t=new c.hf(c.HK.docker_shell_exec);t.context=e,await l.ws.send(t)}),s(e)})():u()},[i]),(0,n.useEffect)(()=>()=>{u()},[]);return(0,w.jsx)(N,{show:i.show,terminal:t,init:(e,s)=>{t.writeln("[38;2;29;153;243mconnect...[0m ");const n=new M.n;let r;n.rows=e,n.cols=s,n.dockerId=i.dockerId,r="logs"===i.type?new c.hf(c.HK.docker_shell_logs):new c.hf(c.HK.docker_shell_exec_open),r.context=n,l.ws.send(r)}})}var K=s(18538),B=s(86090),H=s(87361);let Z="",D=[],G=!1;function z(e){const{t}=(0,p.B)(),s=(0,B.Zp)(),[o]=(0,m.fp)(j.AG.user_base_info),[f,y]=(0,n.useState)({}),[v,k]=(0,n.useState)([]),[C,A]=(0,n.useState)([]),{check_user_auth:P}=(0,S.MH)(),[V,Y]=(0,m.fp)(j.AG.dockerShellShow),[F,I]=(0,m.fp)(j.AG.showPrompt),[M,N]=(0,m.fp)(j.AG.confirm),[z,W]=(0,n.useState)(Z),[T,X]=(0,n.useState)(["id",t("名字"),t("镜像"),t("命令"),t("状态"),t("内存"),"cpu%",t("选择")]),[U,q]=(0,n.useState)([]),[L,R]=(0,n.useState)(void 0),[O,J]=(0,n.useState)(!1),Q=["id",t("name"),t("create时间"),t("大小"),(0,w.jsxs)("span",{children:["选中",(0,w.jsx)(u.rA,{icon:"check_box",title:"全选",onClick:()=>{G=!G;const e={};for(let t=0;t<C.length&&G;t++)e[C[t][0].props.context]=1;y(e)}})]})],ee=async()=>{k([]),q([]);const e=new c.hf(c.HK.docker_get);await l.ws.send(e),l.ws.addMsg(c.HK.docker_getting,e=>{const t=[];if(Z){for(const s of e.context)for(const e of s)if(`${e}`.includes(Z)){t.push(s);break}}else t.push(...e.context);k(t.map(e=>{const t=e.map(e=>(0,w.jsx)(r.xP,{context:e}));return t.push((0,w.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{q(t)}})),t}))})};(0,n.useEffect)(()=>(W(Z),ee(),()=>{(async()=>{Y({show:!1,type:"",dockerId:""})})()}),[]),(0,n.useEffect)(()=>{Z=z},[z]);const te=()=>{const e=new c.hf("logs"===V.type?c.HK.docker_shell_logs_cancel:c.HK.docker_shell_exec_cancel);e.context="",l.ws.send(e)},se=e=>{const t=new c.hf(c.HK.docker_switch);t.context={type:e,dockerId:U[0].props.context},q([]),l.ws.send(t)},ne=async()=>{const e=await a.Yu.get("docker/images");if(e.code===x.m.Success){const t=e.data??[],s=[];for(let e=0;e<t.length;e++){const n=t[e],i=[(0,w.jsx)(r.xP,{context:n[0]}),(0,w.jsx)(r.xP,{context:n[1]}),n[2],n[3],""];s.push(i)}D=s,A(s)}};return(0,w.jsxs)("div",{children:[(0,w.jsx)(d.aZ,{children:(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("docker镜像"),clickFun:e=>{J(e),e?(ne(),q([])):(ee(),A([]),y({}))}})}),(0,w.jsxs)(d.aZ,{position:"right",children:[o.sys===b.XM.linux&&(0,w.jsx)(u.rA,{icon:"settings",title:t("Docker 配置"),onClick:()=>s(H.o.docker_setting_page)}),Object.keys(f).length>0&&(0,w.jsx)(u.rA,{icon:"delete",title:t("删除镜像"),onClick:async()=>{N({open:!0,title:t("确定删除选中的镜像吗"),handle:async()=>{const e=Object.keys(f),t=await a.Yu.post("docker/check/delete",{ids:e});if(t.code===x.m.Success)if(0===t.data.length){(await a.Yu.post("docker/delete",{ids:e})).code===x.m.Success&&((0,_.SK)("删除完成"),ne(),N({open:!1,handle:null}))}else(0,_.N9)(`有镜像正在运行${JSON.stringify(t.data)}`)}})}}),U.length>0&&(0,w.jsx)("div",{children:U[1].props.context}),U.length>0&&(0,w.jsxs)("div",{children:[P(b.oV.docker_container_update)&&(0,w.jsx)(u.rA,{icon:"delete",title:t("删除容器"),onClick:()=>{I({show:!0,overlay:!0,type:K.PromptEnum.DockerDel,data:{dockerId:U[0].props.context,name:U[1].props.context}})}}),(0,w.jsx)(u.rA,{icon:"print",title:t("打印日志"),onClick:()=>{V.show?(Y({show:!1,type:"",dockerId:""}),te()):Y({show:!0,dockerId:U[0].props.context,type:"logs"})}}),P(b.oV.docker_container_update)&&(0,w.jsx)(u.rA,{icon:"personal_video",title:t("执行命令"),onClick:()=>{V.show?(Y({show:!1,type:"",dockerId:""}),te()):Y({show:!0,dockerId:U[0].props.context,type:"exec"})}}),P(b.oV.docker_container_update)&&U[4].props.context.includes("Up")&&(0,w.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>se("stop")}),P(b.oV.docker_container_update)&&!U[4].props.context.includes("Up")&&(0,w.jsx)(u.rA,{icon:"play_arrow",title:t("开启"),onClick:()=>{se("start")}})]}),(0!==v.length||z)&&!O&&(0,w.jsx)(u.rA,{icon:"refresh",title:t("列表更新"),onClick:async()=>{const e=new c.hf(c.HK.docker_get);await l.ws.send(e)}})]}),(0,w.jsxs)(i.xh,{children:[O&&(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`${t("镜像")} (${C.length})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:t("过滤镜像"),value:L,handleInputChange:e=>{R(e)},handlerEnter:()=>{const e=[];if(L){for(const t of C)(t[0].props.context.includes(L)||t[1].props.context.includes(L))&&e.push(t);A(e)}else A(D)}}),children:(0,w.jsx)(h.X,{headers:Q,rows:C.map((e,s)=>(e[4]=(0,w.jsx)(g.GL,{context:t(""),selected:f[e[0].props.context],onchange:()=>{(e=>{const t={};Object.assign(t,f),t[e]?delete t[e]:t[e]=1,y(t)})(e[0].props.context)}}),e)),width:"10rem"})})})}),0===v.length&&!z&&!O&&(0,w.jsx)($.h,{context:t("检测不到docker,主机可能没有安装docker or 容器为空")}),(0!==v.length||z)&&!O&&(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`${t("容器")} (${v.length})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:t("过滤"),value:z,handleInputChange:e=>{W(e)}}),children:(0,w.jsx)(h.X,{headers:T,rows:v,width:"10rem"})})})})]}),(0,w.jsx)(E,{})]})}var W=s(64694);let T="",X=!1,U=!1;function q(e){const{t}=(0,p.B)(),[s,o]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[m,j]=(0,n.useState)(0),[f,_]=(0,n.useState)(""),[y,v]=(0,n.useState)(["pid",t("名字"),t("创建用户"),(0,w.jsxs)("span",{children:[t("内存"),(0,w.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{X=!X}})]}),(0,w.jsxs)("span",{children:["cpu%",(0,w.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{U=!U}})]}),t("选择")]),{check_user_auth:k}=(0,S.MH)();(0,n.useEffect)(()=>{_(T),(async()=>{o([]),j(0),x([]);const e=new c.hf(c.HK.process_get);await l.ws.send(e),l.ws.addMsg(c.HK.process_getting,e=>{const s=[];if(T){for(const t of e.context)for(const e of t)if(`${e}`.includes(T)){s.push(t);break}}else s.push(...e.context);X&&(0,W.di)(s,e=>e[3],!1),U&&(0,W.di)(s,e=>e[4],!1);const n=s.map(e=>{const s=e.map((e,t)=>(0,w.jsx)(r.xP,{context:3===t?(0,V.v7)(e):e}));return s.push((0,w.jsx)(u.rA,{icon:"place",title:t("选中"),onClick:()=>{x(s)}})),s});j(s.length),o(n)})})()},[]),(0,n.useEffect)(()=>{T=f},[f]);return(0,w.jsxs)("div",{children:[(0,w.jsxs)(d.aZ,{position:"right",children:[a.length>0&&(0,w.jsx)("div",{children:a[1].props.context}),a.length>0&&k(b.oV.sys_process_close)&&(0,w.jsx)("div",{children:(0,w.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>{const e=new c.hf(c.HK.process_close);e.context={pid:a[0].props.context},x([]),l.ws.send(e)}})})]}),(0,w.jsx)(i.xh,{children:0!==s.length||T?(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`${t("进程")} (${m})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:t("过滤"),value:f,handleInputChange:e=>{_(e)}}),children:(0,w.jsx)(h.X,{headers:y,rows:s,width:"10rem"})})})}):(0,w.jsx)($.h,{context:t("加载中请等待...")})})]})}const L=n.lazy(()=>Promise.all([s.e(2543),s.e(5614)]).then(()=>s(85614)));function R(e){const[t,s]=(0,n.useState)(null),[i,r]=(0,m.fp)(j.AG.systemd_shell_show),[o,a]=(0,m.fp)(j.AG.user_base_info),d=o.user_data.theme?.includes("dark")?"#FFFFFF":"#000000",u=()=>{(async()=>{t&&(t.writeln("[38;2;29;153;243mclose![0m "),t.dispose(),s(null))})()};(0,n.useEffect)(()=>{if(!i.show)return void u();(async()=>{const e=new I.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:d,cursor:d,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4,convertEol:!0});l.ws.subscribeUnconnect(u),l.ws.addMsg(c.HK.systemd_logs_getting,t=>{"error"===t.context&&u(),e.write(t.context)}),s(e)})();const e=e=>{};return document.addEventListener("cancel_systemd_logs",e),()=>{document.removeEventListener("cancel_systemd_logs",e)}},[i]),(0,n.useEffect)(()=>()=>{u()},[]);return(0,w.jsx)(L,{show:i.show,terminal:t,init:(e,s)=>{t.writeln("[38;2;29;153;243mconnect...[0m ");const n={unit_name:i.unit_name},r=new c.hf(c.HK.systemd_logs_get);r.context=n,l.ws.send(r)}})}const O=[{title:"no(不自动重启)",value:"no"},{title:"always(总是重启)",value:"always"},{title:"on-failure(失败才重启)",value:"on-failure"},{title:"on-abnormal(异常才重启)",value:"on-abnormal"}],J=[{title:"simple",value:"simple"},{title:"forking",value:"forking"},{title:"oneshot",value:"oneshot"},{title:"notify",value:"notify"}],Q=[{title:"multi-user.target",value:"multi-user.target"},{title:"network.target",value:"network.target"}];function ee(e,t){const s=[];return s.push("[Unit]"),t.description.trim()?s.push(`Description=${t.description.trim()}`):s.push(`Description=${e}`),s.push(""),s.push("[Service]"),s.push(`Type=${t.type.trim()||"simple"}`),t.exec_start.trim()&&s.push(`ExecStart=${t.exec_start.trim()}`),t.working_dir.trim()&&s.push(`WorkingDirectory=${t.working_dir.trim()}`),t.user_.trim()&&s.push(`User=${t.user_.trim()}`),t.restart&&"no"!==t.restart&&s.push(`Restart=${t.restart.trim()}`),s.push(""),s.push("[Install]"),s.push(`WantedBy=${t.wanted.trim()||"multi-user.target"}`),s.push(""),s.join("\n")}function te(e){const t={description:"",type:"simple",exec_start:"",working_dir:"",user_:"root",restart:"no",wanted:"multi-user.target"},s=(t,s)=>{const n=e.split(/\r?\n/);let i=!1;for(const e of n){const n=e.trim(),r=n.match(/^\[(.*)\]$/);if(r){i=(r[1]||"").trim()===t;continue}if(!i)continue;const o=n.match(new RegExp(`^${s}\\s*=\\s*(.*)$`,"i"));if(o)return o[1].trim()}return""};return t.description=s("Unit","Description"),t.type=s("Service","Type")||"simple",t.exec_start=s("Service","ExecStart"),t.working_dir=s("Service","WorkingDirectory"),t.user_=s("Service","User"),t.restart=s("Service","Restart")||"no",t.wanted=s("Install","WantedBy")||"multi-user.target",t}function se(e){const{t}=(0,p.B)(),[s,i]=(0,n.useState)("form"),[r,o]=(0,n.useState)(()=>(e.unit_name||"").replace(/\.service$/i,"")),[c,l]=(0,n.useState)({description:"",type:"simple",exec_start:"",working_dir:"",user_:"root",restart:"no",wanted:"multi-user.target"}),[d,u]=(0,n.useState)(""),[h,m]=(0,n.useState)(""),[j,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{"edit"===e.mode&&e.unit_name&&(async()=>{f(!0);try{const t=await a.Yu.post("systemd/get/context",{unit_name:e.unit_name});if(t.code!==x.m.Success)return;const s=t.data.context??"",n=t.data.path??"";m(n),u(s),l(te(s))}finally{f(!1)}})()},[e.mode,e.unit_name]);const y=e=>{e!==s&&("text"===e?u(ee(r,c)):l(te(d)),i(e))},v=e=>t=>{l(s=>({...s,[e]:t}))};return(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{style:{display:"flex",gap:"0.4rem",marginBottom:"0.6rem"},children:[(0,w.jsx)("button",{className:"button button--flat "+("form"===s?"":"button--grey"),onClick:()=>y("form"),children:t("表单")}),(0,w.jsx)("button",{className:"button button--flat "+("text"===s?"":"button--grey"),onClick:()=>y("text"),children:t("文本")})]}),j?(0,w.jsx)("div",{children:t("加载中...")}):"form"===s?(0,w.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.6rem"},children:[(0,w.jsx)(g.BC,{label:t("服务名称"),children:(0,w.jsx)(g.Sm,{placeholder:t("服务名称"),value:r,disabled:"edit"===e.mode,handleInputChange:e=>o(e),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("服务描述"),children:(0,w.jsx)(g.Sm,{placeholder:t("服务描述"),value:c.description,handleInputChange:v("description"),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("启动命令"),required:!0,children:(0,w.jsx)(g.Sm,{placeholder:t("ExecStart 启动命令,必填"),value:c.exec_start,handleInputChange:v("exec_start"),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("运行类型"),children:(0,w.jsx)(g.l6,{options:J,value:c.type,onChange:v("type")})}),(0,w.jsx)(g.BC,{label:t("工作目录"),children:(0,w.jsx)(g.Sm,{placeholder:t("工作目录(可选)"),value:c.working_dir,handleInputChange:v("working_dir"),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("运行用户"),children:(0,w.jsx)(g.Sm,{placeholder:t("运行用户(可选)"),value:c.user_,handleInputChange:v("user_"),width:"100%"})}),(0,w.jsx)(g.BC,{label:t("重启策略"),children:(0,w.jsx)(g.l6,{options:O,value:c.restart,onChange:v("restart")})}),(0,w.jsx)(g.BC,{label:t("安装目标"),children:(0,w.jsx)(g.l6,{options:Q,value:c.wanted,onChange:v("wanted")})})]}):(0,w.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",minHeight:"16rem",fontFamily:"monospace",fontSize:"0.85rem",boxSizing:"border-box"},value:d,onChange:e=>u(e.target.value),spellCheck:!1}),(0,w.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.4rem",marginTop:"0.6rem"},children:[(0,w.jsx)("button",{className:"button button--flat button--grey",disabled:j,onClick:e.onClose,children:t("取消")}),(0,w.jsx)("button",{className:"button button--flat",disabled:j,onClick:async()=>{if(!r.trim())return void(0,_.zN)(t("请填写服务名称"));const n=(i=r).trim().endsWith(".service")?i.trim():`${i.trim()}.service`;var i;const o="text"===s?d:ee(n,c);if(o.includes("ExecStart=")){f(!0);try{if("create"===e.mode){const e=`/etc/systemd/system/${n}`;await a.Yu.post("systemd/sys/save",{unit_name:n,path:e,context:o}),await a.Yu.post("systemd/sys/enable",{unit_name:n}),await a.Yu.post("systemd/add",{unit_name:n}),(0,_.SK)(t("添加成功"))}else await a.Yu.post("systemd/sys/save",{unit_name:n,path:h,context:o}),(0,_.SK)(t("保存成功"));e.onClose(),e.onDone?.()}catch(e){console.error("systemd 保存失败",e)}finally{f(!1)}}else(0,_.zN)(t("请至少填写 ExecStart 启动命令"))},children:t("保存")})]})]})}let ne,ie="";function re(e){const{t}=(0,p.B)(),{check_user_auth:s}=(0,S.MH)(),[o,f]=(0,m.fp)(j.AG.systemd_shell_show),[y,v]=(0,m.fp)(j.AG.confirm),[k,C]=(0,n.useState)(["pid","name","process",t("创建用户"),t("内存"),t("cpu%"),t("active状态"),t("选择")]),[A,P]=(0,n.useState)(["单元名字","加载状态",t("active(sub)状态"),t("描述"),t("选择")]),[Y,F]=(0,n.useState)([]),[I,M]=(0,n.useState)([]),[N,E]=(0,n.useState)([]),[K,B]=(0,n.useState)(!1),[H,Z]=(0,n.useState)([]),[D,G]=(0,n.useState)(""),[z,W]=(0,n.useState)(""),[T,X]=(0,n.useState)(new Set),[U,q]=(0,m.fp)(j.AG.editorSetting),[L,O]=(0,m.fp)(j.AG.prompt_card);(0,n.useEffect)(()=>{W(ie),(async()=>{F([]),E([]);const e=new c.hf(c.HK.systemd_inside_get);await l.ws.send(e),l.ws.addMsg(c.HK.systemd_inside_getting,e=>{const t=[];if(ie){for(const s of e.context)for(const e of s)if(`${e}`.includes(ie)){t.push(s);break}}else t.push(...e.context);F(t.map(e=>{const t=e.map((e,t)=>(0,w.jsx)(r.xP,{context:4===t?(0,V.v7)(e):e}));return t.push((0,w.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{E(t)}})),t}))})})()},[]),(0,n.useEffect)(()=>{ie=z},[z]);const J=e=>{if(o.show){f({show:!1,unit_name:""});const e=new CustomEvent("cancel_systemd_logs",{detail:{}});document.dispatchEvent(e)}else f({show:!0,unit_name:e})},Q=async()=>{M([]),Z([]);const e=await a.Yu.get("systemd/inside/all");if(e.code!==x.m.Success)return;X(new Set(e.data));const t=await a.Yu.get("systemd/allget");if(t.code===x.m.Success){const e=t.data,s=[];for(const t of e??[]){const e=[(0,w.jsx)(r.xP,{context:t.unit}),t.load,`${t.active}(${t.sub})`,(0,w.jsx)(r.xP,{context:t.description})];s.push([...e,(0,w.jsx)(u.rA,{icon:"place",title:"添加",onClick:()=>{Z([...e])}})])}ne=s,M(s)}},ee=(e,s)=>{O({open:!0,title:t("create"===e?"新建 systemd 服务":"编辑 systemd 服务"),context_div:(0,w.jsx)(se,{mode:e,unit_name:s,onClose:()=>O({open:!1}),onDone:()=>{O({open:!1}),l.ws.send(new c.hf(c.HK.systemd_inside_get)),K&&Q(),E([]),Z([])}})})};return(0,w.jsxs)("div",{children:[(0,w.jsx)(d.aZ,{children:(0,w.jsx)(u.Z$,{defaultStatus:!1,text:t("系统systemd单元"),clickFun:e=>{B(e),e?(Q(),E([])):Z([])}})}),(0,w.jsxs)(d.aZ,{position:"right",children:[s(b.oV.systemd)&&(0,w.jsx)("div",{children:(0,w.jsx)(u.rA,{icon:"add_circle",title:t("添加 systemd"),onClick:()=>{ee("create")}})}),N.length>0&&(0,w.jsx)("div",{children:N[1].props.context}),H.length>0&&(0,w.jsx)("div",{children:H[0].props.context}),N.length>0&&(0,w.jsxs)("div",{children:[s(b.oV.systemd)&&(0,w.jsx)(u.rA,{icon:"remove",title:"从实时监控删除",onClick:()=>{(async e=>{v({open:!0,handle:async()=>{(await a.Yu.post("systemd/delete",{unit_name:e})).code===x.m.Success&&((0,_.SK)("删除成功"),v({open:!1,handle:null}))}})})(N[1].props.context)}}),s(b.oV.systemd)&&(0,w.jsx)(u.rA,{icon:"edit",title:"可视化编辑",onClick:()=>{ee("edit",N[1].props.context)}}),(0,w.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(N[1].props.context)}})]}),H.length>0&&(0,w.jsxs)("div",{children:[s(b.oV.systemd)&&(0,w.jsx)(u.rA,{icon:"delete",title:"删除系统上的sytemd",onClick:()=>{(async e=>{v({open:!0,handle:async()=>{(await a.Yu.post("systemd/sys/delete",{unit_name:e})).code===x.m.Success&&((0,_.SK)("删除成功"),v({open:!1,handle:null}))}})})(H[0].props.context)}}),(0,w.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(H[0].props.context)}}),s(b.oV.systemd)&&(0,w.jsx)(u.rA,{icon:"text_fields",title:"sytemd文件内容",onClick:()=>{(async t=>{const s=await a.Yu.post("systemd/get/context",{unit_name:t});s.code===x.m.Success&&(q({model:"text",open:!0,fileName:e.name,save:async e=>{const n={unit_name:t,path:s.data.path,context:e};(await a.Yu.post("systemd/sys/save",n)).code===x.m.Success&&(S.xK.set_value_temp(""),q({open:!1,model:"",fileName:"",save:null}))}}),S.xK.set_value_temp(s.data.context))})(H[0].props.context)}}),s(b.oV.systemd)&&!T.has(H[0].props.context)&&(0,w.jsx)(u.rA,{icon:"plus_one",title:"添加到管理",onClick:()=>(async e=>{const t=await a.Yu.post("systemd/add",{unit_name:e});t.code===x.m.Success&&(X(new Set(t.data)),(0,_.SK)("添加成功"))})(H[0].props.context)})]})]}),(0,w.jsxs)(i.xh,{children:[K&&(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`systemd系统单元(${I.length})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:"过滤单元",value:D,handleInputChange:e=>{G(e)},handlerEnter:()=>{const e=[];if(D){for(const t of ne)(t[0].props.context.includes(D)||t[3].props.context.includes(D))&&e.push(t);M(e)}else M(ne)}}),children:(0,w.jsx)(h.X,{headers:A,rows:I,width:"10rem"})})})}),0===Y.length&&!K&&(0,w.jsx)($.h,{context:"没有管理的单元 or 加载中请等待..."}),0!==Y.length&&!K&&(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsx)(r.uF,{title:`filecat监控单元(${Y.length})`,titleCom:(0,w.jsx)(g.Sm,{placeholder:"过滤单元",value:z,handleInputChange:e=>{W(e)}}),children:(0,w.jsx)(h.X,{headers:k,rows:Y,width:"10rem"})})})})]}),(0,w.jsx)(R,{})]})}function oe(){const{t:e}=(0,p.B)(),t=[{title:e("放行"),value:"allow"},{title:e("拒绝"),value:"deny"},{title:e("限速"),value:"limit"},{title:e("拒绝响应"),value:"reject"}],s=[{title:e("入站"),value:"in"},{title:e("出站"),value:"out"}],[o,c]=(0,n.useState)(null),[l,f]=(0,n.useState)("allow"),[y,v]=(0,n.useState)("in"),[k,S]=(0,n.useState)("tcp"),[b,C]=(0,n.useState)(""),[A,P]=(0,n.useState)(""),[V,Y]=(0,n.useState)("list"),[F,I]=(0,n.useState)([]),[M,N]=(0,n.useState)(""),[E,K]=(0,n.useState)(!1),[B,H]=(0,m.fp)(j.AG.confirm),Z=async()=>{try{const e=await a.V_.get("status");e.code===x.m.Success&&c(e.data)}catch(e){}},D=async()=>{K(!0);try{const e=await a.V_.get("rules");if(e.code===x.m.Success){const t=e.data;I(t?.rules??[]),N(t?.raw??"")}}catch(e){I([]),N("")}finally{K(!1)}};(0,n.useEffect)(()=>{Z(),D()},[]);const G=!0===o?.installed,z=!0===o?.active;return(0,w.jsxs)("div",{children:[(0,w.jsxs)(d.aZ,{position:"right",children:[(0,w.jsxs)("div",{children:[e("已安装"),": ",G?(0,w.jsx)("span",{style:{color:"green"},children:"✓"}):(0,w.jsx)("span",{style:{color:"red"},children:"✗"})]}),(0,w.jsxs)("div",{children:[e("已启用"),": ",z?(0,w.jsx)("span",{style:{color:"green"},children:"✓"}):(0,w.jsx)("span",{style:{color:"gray"},children:"✗"})]}),G&&(0,w.jsx)(u.rA,{icon:"power_settings_new",title:e(z?"停用":"启用"),onClick:()=>(async t=>{try{const s=await a.V_.post("enable",{enabled:t});if(s.code!==x.m.Success)return void(0,_.zN)(s.message||e("操作失败"));(0,_.SK)(s.data||e(t?"已启用":"已停用")),Z(),D()}catch(e){}})(!z)}),(0,w.jsx)(u.rA,{icon:"refresh",title:e("刷新规则"),onClick:D})]}),(0,w.jsxs)(i.xh,{children:[(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:35,children:(0,w.jsxs)(r.uF,{title:e("添加ufw规则"),titleCom:(0,w.jsx)(u.rA,{icon:"add",title:e("添加"),onClick:async()=>{if(b.trim())try{const t=await a.V_.post("rule/add",{action:l,direction:y,proto:k,port:b.trim(),from:"in"===y&&A.trim()||void 0});if(t.code!==x.m.Success)return void(0,_.zN)(t.message||e("操作失败"));(0,_.SK)(t.data||e("已添加")),D()}catch(e){}else(0,_.zN)(e("请填写端口号"))}}),children:[(0,w.jsx)(g.BC,{label:e("动作"),label_width:"4rem",input_max_width:"8rem",children:(0,w.jsx)(g.l6,{options:t,value:l,onChange:e=>f(e),defaultValue:"allow"})}),(0,w.jsx)(g.BC,{label:e("方向"),label_width:"4rem",input_max_width:"8rem",children:(0,w.jsx)(g.l6,{options:s,value:y,onChange:e=>v(e),defaultValue:"in"})}),(0,w.jsx)(g.BC,{label:e("协议"),label_width:"4rem",input_max_width:"8rem",children:(0,w.jsx)(g.l6,{options:[{title:"tcp",value:"tcp"},{title:"udp",value:"udp"}],value:k,onChange:e=>S(e),defaultValue:"tcp"})}),(0,w.jsx)(g.BC,{label:e("端口"),label_width:"4rem",required:!0,children:(0,w.jsx)(g.Sm,{maxWidth:"20rem",placeholder:e("可填范围如 1000:2000"),value:b,handleInputChange:e=>C(e)})}),"in"===y&&(0,w.jsx)(g.BC,{label:e("来源"),label_width:"4rem",children:(0,w.jsx)(g.Sm,{maxWidth:"20rem",placeholder:e("IP/网段,可选"),value:A,handleInputChange:e=>P(e)})})]})})}),(0,w.jsx)(i.fI,{children:(0,w.jsx)(i.VP,{widthPer:80,children:(0,w.jsxs)(r.uF,{title:e("规则列表"),titleCom:(0,w.jsxs)("div",{style:{display:"flex",gap:"0.4rem"},children:[(0,w.jsx)(u.C3,{text:e("名单视图"),clickFun:()=>Y("list")}),(0,w.jsx)(u.C3,{text:e("文本视图"),clickFun:()=>Y("text")})]}),children:[E&&(0,w.jsx)($.h,{context:e("加载中...")}),!E&&"list"===V&&(0===F.length?(0,w.jsx)($.h,{context:e("暂无规则")}):(0,w.jsx)(h.X,{headers:[e("编号"),e("目标(To)"),e("动作"),e("来源(From)"),e("备注"),e("操作")],rows:F.map(t=>[t.number,(0,w.jsx)(r.xP,{context:t.to,tip_context:t.to}),t.action,t.from?(0,w.jsx)(r.xP,{context:t.from,tip_context:t.from}):"",t.description||"",(0,w.jsx)(u.rA,{icon:"delete",title:e("删除规则"),onClick:()=>(async(t,s,n)=>{H({open:!0,title:e("确定删除吗?"),sub_title:e(`${s} ${n}`),handle:async()=>{try{const s=await a.V_.post("ufw/rule/del",{number:t});if(s.code!==x.m.Success)return void(0,_.zN)(s.message||e("操作失败"));(0,_.SK)(s.data||e("规则已删除")),H({open:!1,handle:null}),D()}catch(e){}}})})(t.number,t.to,t.from)})]),width:"8rem"})),!E&&"text"===V&&(M?(0,w.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",fontSize:"0.85rem",margin:0},children:M}):(0,w.jsx)($.h,{context:e("暂无规则")}))]})})})]})]})}function ce(e){const{t}=(0,p.B)(),[s,n]=(0,m.fp)(j.AG.user_base_info),r=[{index:1,name:t("系统性能"),rto:"sys/",component:(0,w.jsx)(F,{})},{index:2,name:t("系统进程"),rto:"process/",component:(0,w.jsx)(q,{})},{index:3,name:t("docker容器"),rto:"docker/",component:(0,w.jsx)(z,{})}];if(s.sys===b.XM.linux){(s.user_data?.is_root||(s.user_data?.auth_list??[]).includes(b.oV.systemd))&&r.push({index:4,name:t("systemd"),rto:"systemd/",component:(0,w.jsx)(re,{})});(s.user_data?.is_root||(s.user_data?.auth_list??[]).includes(b.oV.firewall))&&s.sysSoftWare?.[f.jk.ufw]?.installed&&r.push({index:5,name:t("防火墙"),rto:"firewall/",component:(0,w.jsx)(oe,{})})}return(0,w.jsx)(i.W1,{optionList:r,father_route:H.o.info})}}}]);
|
package/build/dist/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{{web_site_title}}}</title><link rel="icon" href="{{{logo_favicon}}}"/><script defer="defer" src="main.1af9587a0d6db4cebacf.js"></script></head><body><div id="root"></div></body><script id="pre_code" type="text/template">return {{{Windows_FileCat}}};</script><script>window.EXCALIDRAW_ASSET_PATH = "/";window.FileCat;</script></html>
|