filecat 6.63.1 → 6.64.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.232c15e7a54d5fd63ecf.js +1 -0
- package/build/dist/1472.5db284b3632a44705cde.js +1 -0
- package/build/dist/1893.4caf367bf06a83c09adf.js +1 -0
- package/build/dist/2542.98a0391ad37c342ef5d0.js +1 -0
- package/build/dist/2674.4822fb467f3da4255c10.js +1 -0
- package/build/dist/{2851.feefe2fc4a39ad506719.js → 2851.baea584c36417d65ded8.js} +1 -1
- package/build/dist/{3215.aed023089c03fa4b3c40.js → 3215.1d29fa4eb2be01d77fea.js} +2 -2
- package/build/dist/4273.9d196861ce7907a19e13.js +1 -0
- package/build/dist/5308.78bd4ed591fdfdcd82e7.js +1 -0
- package/build/dist/5516.14b0319983e46a1880ca.js +1 -0
- package/build/dist/5877.803d7b1a9f6d6e1264e9.js +1 -0
- package/build/dist/5937.2505cb3d3bcf2393e063.js +1 -0
- package/build/dist/6247.f337a0766a216e034bde.js +1 -0
- package/build/dist/6505.f37ff577812fccac9b45.js +1 -0
- package/build/dist/676.98b607bbe65d44bc5df1.js +1 -0
- package/build/dist/6919.a65dcb5e95df23edd818.js +1 -0
- package/build/dist/8302.53fffbe4b9ecef206405.js +1 -0
- package/build/dist/8319.307ec20219e2828c9a47.js +1 -0
- package/build/dist/8603.72dcd1e8f1337a1b72bb.js +1 -0
- package/build/dist/8714.859f6f455bef5c6af36c.js +1 -0
- package/build/dist/8765.afede4d25bab0100d561.js +1 -0
- package/build/dist/8947.8b6aa577603dd4cf3d2d.js +2 -0
- package/build/dist/8947.8b6aa577603dd4cf3d2d.js.LICENSE.txt +3 -0
- package/build/dist/9546.bd518f38fcce8f30331d.js +1 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.e83a6beb323ff107165d.js +2 -0
- package/build/dist/{main.f074592fdc7851278bc0.js.LICENSE.txt → main.e83a6beb323ff107165d.js.LICENSE.txt} +1 -1
- package/build/main.js +1 -1
- package/build/threads.work.filecat.js +1 -1
- package/package.json +1 -1
- package/build/dist/1448.bec31a359f572e75c1ff.js +0 -1
- package/build/dist/1472.895b811ec7f9765b8afc.js +0 -1
- package/build/dist/1893.f2725744511511fde713.js +0 -1
- package/build/dist/2542.78f4821c3f796775f225.js +0 -1
- package/build/dist/2674.42bc8edcb369615417fd.js +0 -1
- package/build/dist/4273.2b31ae7645819802cf52.js +0 -1
- package/build/dist/5308.8059b2d04eb5de133d15.js +0 -1
- package/build/dist/5516.f96b5a3874804392788c.js +0 -1
- package/build/dist/5877.49ca6d4e542f022dbb0d.js +0 -1
- package/build/dist/5937.8d7e5116bbc7d2b4e478.js +0 -1
- package/build/dist/6247.9bbd3852fd64eadebd20.js +0 -1
- package/build/dist/6505.ac89deebae8c008595a1.js +0 -1
- package/build/dist/676.2854877784f5c96f2f52.js +0 -1
- package/build/dist/6892.bd3adea0ce83f685bfa5.js +0 -1
- package/build/dist/6919.c7510e6ed23cff35cd52.js +0 -1
- package/build/dist/8302.ac3c41dd08d3109cf766.js +0 -1
- package/build/dist/8319.fc897106bf47394f677c.js +0 -1
- package/build/dist/8603.8819e88398056f0e0562.js +0 -1
- package/build/dist/8714.76bcf304b61c484f32df.js +0 -1
- package/build/dist/8765.8f7b9458371b88887661.js +0 -1
- package/build/dist/8947.23e0d2bbb7604e1e0063.js +0 -2
- package/build/dist/8947.23e0d2bbb7604e1e0063.js.LICENSE.txt +0 -1
- package/build/dist/9546.fa400fbfc3c4ae7850ad.js +0 -1
- package/build/dist/main.f074592fdc7851278bc0.js +0 -2
- /package/build/dist/{3215.aed023089c03fa4b3c40.js.LICENSE.txt → 3215.1d29fa4eb2be01d77fea.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE */
|
|
2
|
+
|
|
3
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
@@ -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:()=>o,X:()=>r});var n=s(96540),i=s(74848);function r(e){const[t,s]=n.useState([]);return(0,n.useEffect)(()=>{e.children?s(Array.isArray(e.children)?e.children:[e.children]):s(e.rows)},[e.rows,e.children]),(0,i.jsxs)("table",{children:[(0,i.jsx)("thead",{children:(0,i.jsx)("tr",{children:e.headers?.map((e,t)=>(0,i.jsx)("th",{children:e},t))})}),(0,i.jsx)("tbody",{children:t.map((t,s)=>(0,i.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((s,n)=>(0,i.jsx)("td",{style:{width:e.width??"auto"},className:n===t.length-1?"small":"",children:s},n))},s))})]})}function o(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))})}},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(57952),u=s(85997),h=s(77481),x=s(53459),p=s(86149),m=s(34843),j=s(82893),f=s(74777),_=s(62042),w=s(61443),y=s(74848);function g(e){const{t}=(0,p.B)(),[s,o]=(0,m.fp)(j.AG.disk),[c,l]=(0,n.useState)({}),[f,_]=(0,n.useState)([]),w=[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,y.jsx)("span",{style:{color:s},children:t(n[0])}),e.push(n)}_(s.data.ata_smart_attributes),l(s.data)}})()},[]),(0,y.jsxs)("div",{children:[(0,y.jsx)(d.A,{children:(0,y.jsx)(u.rA,{icon:"close",title:t("关闭"),onClick:()=>{o({})}})}),(0,y.jsx)(i.jW,{isFull:!0,more:!0,children:(0,y.jsx)(i.NN,{children:(0,y.jsxs)(i.fI,{children:[(0,y.jsxs)(i.VP,{widthPer:30,children:[(0,y.jsx)(i.xh,{children:(0,y.jsxs)(r.Zp,{title:t("基本信息"),children:[(0,y.jsx)(i.Yh,{left:t("名字"),right:e.name}),(0,y.jsx)(i.Yh,{left:t("厂商名称"),right:e.typeName}),(0,y.jsx)(i.Yh,{left:t("类型"),right:e.type}),(0,y.jsx)(i.Yh,{left:t("容量"),right:e.total})]})}),(0,y.jsx)(i.xh,{children:(0,y.jsxs)(r.Zp,{title:t("物理信息"),children:[(0,y.jsx)(i.Yh,{left:t("是否健康"),right:!0===c.smart_status?"是":"否"}),(0,y.jsx)(i.Yh,{left:t("设备型号"),right:c.model_name}),(0,y.jsx)(i.Yh,{left:t("序列号"),right:c.serial_number}),(0,y.jsx)(i.Yh,{left:t("固件版本"),right:c.firmware_version}),(0,y.jsx)(i.Yh,{left:t("转速(每分钟)"),right:c.rotation_rate}),(0,y.jsx)(i.Yh,{left:t("通电时长(小时)"),right:c.power_on_time_hours}),(0,y.jsx)(i.Yh,{left:t("通电次数"),right:c.power_cycle_count}),(0,y.jsx)(i.Yh,{left:t("温度(°C)"),right:c.temperature}),(0,y.jsx)(i.Yh,{left:t("通信协议"),right:c.device_protocol})]})})]}),(0,y.jsx)(i.VP,{widthPer:50,children:(0,y.jsxs)(i.xh,{children:[f?.length?(0,y.jsx)(r.uF,{title:t("ATA/SATA详细信息"),children:(0,y.jsx)(h.X,{headers:w,rows:f,width:"10rem"})}):(0,y.jsx)(y.Fragment,{}),c.nvme_smart?(0,y.jsxs)(r.Zp,{title:t("NVME详细信息"),children:[(0,y.jsx)(i.Yh,{left:t("NVMe 可用备用块(%)"),right:c.nvme_smart.available_spare}),(0,y.jsx)(i.Yh,{left:t("NVMe 已使用寿命(%)"),right:c.nvme_smart.percentage_used}),(0,y.jsx)(i.Yh,{left:t("NVMe 读取量"),right:c.nvme_smart.data_units_read}),(0,y.jsx)(i.Yh,{left:t("NVMe 写入量"),right:c.nvme_smart.data_units_written}),(0,y.jsx)(i.Yh,{left:t("NVMe 通电次数"),right:c.nvme_smart.power_cycles}),(0,y.jsx)(i.Yh,{left:t("NVMe 通电时长(小时)"),right:c.nvme_smart.power_on_hours}),(0,y.jsx)(i.Yh,{left:t("NVMe 非正常关机"),right:c.nvme_smart.unsafe_shutdowns}),(0,y.jsx)(i.Yh,{left:t("NVMe 媒体错误"),right:c.nvme_smart.media_errors}),(0,y.jsx)(i.Yh,{left:t("NVMe 错误日志数"),right:c.nvme_smart.num_err_log_entries})]}):(0,y.jsx)(y.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,y.jsxs)("div",{style:{border:"2px solid black",padding:"10px",width:"300px",height:"300px",position:"relative"},children:[e.name,e.lvms.map((e,t)=>(0,y.jsx)("div",{style:{margin:"5px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid "},children:e.name},t))]});function A(){return(0,y.jsx)("div",{style:{position:"relative",height:"300px",margin:"10px",width:"30px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,y.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)([]),[w,g]=(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,y.jsx)(u.rA,{icon:"info",title:e("提示"),onClick:async()=>{N({open:!0,title:"信息",context_div:(0,y.jsx)("div",{children:(0,y.jsxs)("ul",{children:[(0,y.jsxs)("li",{children:["通用格式:","<文件系统> <挂载点> <类型> <挂载选项> <dump> <fsck> "]}),(0,y.jsxs)("li",{children:["文件系统,有多种格式",(0,y.jsxs)("ul",{children:[(0,y.jsx)("li",{children:"1(usb口默认名称)./dev/sda1"}),(0,y.jsx)("li",{children:"2(唯一Id).UUID=123e4567-e89b-12d3-a456-426614174000"}),(0,y.jsx)("li",{children:"3.LABEL=DATA"})]})]}),(0,y.jsx)("li",{children:"挂载点,就是文件路径,例如 /mnt/data ,这个目录要提前创建,且为空"}),(0,y.jsx)("li",{children:"类型,就是文件系统类型,对于系统不支持的类型,例如ntfs需要额外前提安装ntfs-3g(linux 5.15内核以后自带 ntfs)"}),(0,y.jsxs)("li",{children:['挂载选项的值只能是以下这些,可以用 "," 同时使用多个选项',(0,y.jsxs)("ul",{children:[(0,y.jsx)("li",{children:"defaults:使用默认挂载选项"}),(0,y.jsx)("li",{children:"noatime:不更新访问时间,提高性能"}),(0,y.jsx)("li",{children:"auto:系统启动时自动挂载"}),(0,y.jsx)("li",{children:"rw:以读写方式挂载"}),(0,y.jsx)("li",{children:"nofail:防止启动阻塞,挂载失败系统继续执行"}),(0,y.jsx)("li",{children:"...等"})]})]}),(0,y.jsx)("li",{children:"dump 0是需要备份 1是不需要备份"}),(0,y.jsx)("li",{children:"Fsck 整数值0是不检查,文件系统检查顺序越小越先检查"}),(0,y.jsx)("li",{children:"提示:只有含有文件系统的逻辑卷,或者分区才可以进行挂载。"})]})})})}}),(0,y.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,G=async e=>{await a.Yu.post("save_fstab",{content:e})};return(0,y.jsxs)("div",{children:[(0,y.jsx)(d.A,{children:(0,y.jsx)(u.rA,{icon:"close",title:e("关闭"),onClick:()=>{s({})}})}),(0,y.jsx)(i.jW,{isFull:!0,more:!0,children:(0,y.jsx)(i.NN,{children:(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:40,children:(0,y.jsxs)(r.Zp,{title:e("物理块(硬盘)设备、逻辑卷、物理卷"),titleCom:(0,y.jsxs)("div",{children:[Y(b.oV.sys_disk_mount)&&(0,y.jsx)(u.rA,{icon:"file_open",title:e("打开挂载文件"),onClick:async()=>{I({name:"fstab(谨慎修改,内容错误会导致系统无法启动)",model:"text",get_file_fun:H,save_file_fun:G,menu_list:B})}}),(0,y.jsx)(u.rA,{icon:"update",title:e("刷新"),onClick:async()=>{await K()===x.m.Success&&(0,_.SK)("刷新成功")}})]}),children:[(0,y.jsx)(h.X,{headers:E,rows:w,width:"10rem"}),(0,y.jsx)(k.A,{list:l,render:e=>{let t=e.name;return e.label&&(t+=`(${e.label})`),e.mountpoint?(0,y.jsxs)("span",{children:[t,(0,y.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]+";";g([[(0,y.jsx)(r.xP,{children:s}),(0,y.jsx)(r.xP,{children:t.uuid}),e(t.type),e(t.fstype),t.fssize,t.size,(0,y.jsx)(r.xP,{children:t.path}),t.pttype]])}})]})}),(0,y.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,y.jsx)(r.Zp,{children:(0,y.jsxs)(i.n5,{children:[(0,y.jsx)(C,{name:e("物理卷"),lvms:n}),(0,y.jsx)(A,{}),(0,y.jsx)(C,{name:`${e("逻辑卷")}---(${t.name})---size(${t.size})`,lvms:[]}),(0,y.jsx)(A,{}),(0,y.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("容量")],w=[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)({}),[G,z]=(0,n.useState)(!1),[W,Z]=(0,n.useState)(!1),[D,X]=(0,n.useState)(!1),[T,U]=(0,n.useState)(Y),[q,L]=(0,n.useState)(null),[O,R]=(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,y.jsxs)("div",{children:[(0,y.jsxs)(d.A,{children:[v.sys===b.XM.linux&&(0,y.jsx)(u.rA,{icon:"sd_card",title:"硬盘挂载",onClick:()=>{ne({type:"mount"})}}),(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("基本信息"),clickFun:e=>{z(e),e&&(async()=>{const e=await a.Yu.get("base");if(e.code===x.m.Success){const t=e.data;H(t)}})()}}),(0,y.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,y.jsx)(r.xP,{context:e.name}),e.typeName,e.type,e.total,(0,y.jsx)(u.rA,{icon:"health_and_safety",title:t("查看健康信息"),onClick:()=>{i?ne({type:"check",data:e}):(0,_.zN)("没有安装smartmontools")}})]);R(n)}})()}}),(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("文件硬盘"),clickFun:e=>{X(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,y.jsx)(r.xP,{context:e.name}),(0,y.jsx)(r.xP,{context:e.device_name}),e.fsType,(0,y.jsx)(r.xP,{context:e.mount}),e.total,e.available]);Q(s)}})()}}),(0,y.jsx)(u.Z$,{defaultStatus:T,text:t("实时信息"),clickFun:e=>{U(e),Y=e,ie()}})]}),(0,y.jsxs)(i.xh,{children:[T&&(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,y.jsx)(r.Zp,{title:"Sys "+t("内存"),children:(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{children:(0,y.jsx)(o.A,{percentage:S})}),(0,y.jsx)(i.VP,{children:(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{widthPer:100,children:(0,y.jsx)("div",{children:(0,y.jsx)(i.Yh,{left:t("总容量"),center:`${$}G`})})}),(0,y.jsx)(i.VP,{widthPer:100,children:(0,y.jsx)(i.Yh,{left:t("剩余"),center:`${A}G`})})]})})]})})}),(0,y.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,y.jsx)(r.Zp,{title:"Sys cpu",children:(0,y.jsxs)(i.fI,{children:[(0,y.jsx)(i.VP,{children:(0,y.jsx)(o.A,{percentage:M})}),(0,y.jsx)(i.VP,{children:(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.Yh,{left:t("使用率"),center:M})})})]})})}),(0,y.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,y.jsx)(r.Zp,{title:"FileCat",children:(0,y.jsxs)(i.fI,{children:[(0,y.jsxs)(i.VP,{children:[(0,y.jsx)(i.qV,{content:t("内存")}),(0,y.jsx)(i.qV,{content:"total: "+(0,V.v7)(q?.rss)}),(0,y.jsx)(i.qV,{content:"object: "+(0,V.v7)(q?.heapTotal)}),(0,y.jsx)(i.qV,{content:"obj-use: "+(0,V.v7)(q?.heapUsed)}),(0,y.jsx)(i.qV,{content:"external: "+(0,V.v7)(q?.external)}),(0,y.jsx)(i.qV,{content:"buffer: "+(0,V.v7)(q?.arrayBuffers)})]}),(0,y.jsx)(i.VP,{children:(0,y.jsx)(i.qV,{content:"cpu growth rate: "+E})})]})})})]}),(0,y.jsxs)(i.fI,{children:[G&&(0,y.jsx)(i.VP,{children:(0,y.jsxs)(r.Zp,{title:t("基本信息"),children:[(0,y.jsx)(i.Yh,{left:t("总内存"),right:B.mem_total}),(0,y.jsx)(i.Yh,{left:`cpu ${t("制造商")}`,right:B.cpu_manufacturer}),(0,y.jsx)(i.Yh,{left:`cpu ${t("品牌")}`,right:B.cpu_brand}),(0,y.jsx)(i.Yh,{left:`cpu ${t("逻辑核心")}`,right:B.cpu_core_num}),(0,y.jsx)(i.Yh,{left:`cpu ${t("物理核心")}`,right:B.cpu_phy_core_num}),(0,y.jsx)(i.Yh,{left:`cpu ${t("最大")}hz`,right:B.cpu_speed_hz}),(0,y.jsx)(i.Yh,{left:`${t("当前系统")}:pid;ppid`,right:B.pid_ppid}),(0,y.jsx)(i.Yh,{left:t("运行用户"),right:B.user})]})}),W&&(0,y.jsx)(i.VP,{children:(0,y.jsx)(r.uF,{title:t("物理硬盘"),children:(0,y.jsx)(h.X,{headers:s,rows:O,width:"10rem"})})}),D&&(0,y.jsx)(i.VP,{children:(0,y.jsx)(r.uF,{title:t("文件硬盘"),children:(0,y.jsx)(h.X,{headers:w,rows:J,width:"10rem"})})})]})]}),se&&"check"===se.type&&(0,y.jsx)(g,{...se.data}),se&&"mount"===se.type&&(0,y.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,y.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 G="",z=[],W=!1;function Z(e){const{t}=(0,p.B)(),s=(0,B.Zp)(),[o]=(0,m.fp)(j.AG.user_base_info),[f,g]=(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,D]=(0,n.useState)(G),[X,T]=(0,n.useState)(["id",t("名字"),t("镜像"),t("命令"),t("状态"),t("内存"),"cpu%",t("选择")]),[U,q]=(0,n.useState)([]),[L,O]=(0,n.useState)(void 0),[R,J]=(0,n.useState)(!1),Q=["id",t("name"),t("create时间"),t("大小"),(0,y.jsxs)("span",{children:["选中",(0,y.jsx)(u.rA,{icon:"check_box",title:"全选",onClick:()=>{W=!W;const e={};for(let t=0;t<C.length&&W;t++)e[C[t][0].props.context]=1;g(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(G){for(const s of e.context)for(const e of s)if(`${e}`.includes(G)){t.push(s);break}}else t.push(...e.context);k(t.map(e=>{const t=e.map(e=>(0,y.jsx)(r.xP,{context:e}));return t.push((0,y.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{q(t)}})),t}))})};(0,n.useEffect)(()=>(D(G),ee(),()=>{(async()=>{Y({show:!1,type:"",dockerId:""})})()}),[]),(0,n.useEffect)(()=>{G=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,y.jsx)(r.xP,{context:n[0]}),(0,y.jsx)(r.xP,{context:n[1]}),n[2],n[3],""];s.push(i)}z=s,A(s)}};return(0,y.jsxs)("div",{children:[(0,y.jsxs)(d.A,{left_children:(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("docker镜像"),clickFun:e=>{J(e),e?(ne(),q([])):(ee(),A([]),g({}))}}),children:[o.sys===b.XM.linux&&(0,y.jsx)(u.rA,{icon:"settings",title:t("Docker 配置"),onClick:()=>s(H.o.docker_setting_page)}),Object.keys(f).length>0&&(0,y.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,y.jsx)("div",{children:U[1].props.context}),U.length>0&&(0,y.jsxs)("div",{children:[P(b.oV.docker_container_update)&&(0,y.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,y.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,y.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,y.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>se("stop")}),P(b.oV.docker_container_update)&&!U[4].props.context.includes("Up")&&(0,y.jsx)(u.rA,{icon:"play_arrow",title:t("开启"),onClick:()=>{se("start")}})]}),(0!==v.length||Z)&&!R&&(0,y.jsx)(u.rA,{icon:"refresh",title:t("列表更新"),onClick:async()=>{const e=new c.hf(c.HK.docker_get);await l.ws.send(e)}})]}),(0,y.jsxs)(i.xh,{children:[R&&(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(r.uF,{title:`${t("镜像")} (${C.length})`,titleCom:(0,y.jsx)(w.Sm,{placeholder:t("过滤镜像"),value:L,handleInputChange:e=>{O(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(z)}}),children:(0,y.jsx)(h.X,{headers:Q,rows:C.map((e,s)=>(e[4]=(0,y.jsx)(w.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,g(t)})(e[0].props.context)}}),e)),width:"10rem"})})})}),0===v.length&&!Z&&!R&&(0,y.jsx)($.h,{context:t("检测不到docker,主机可能没有安装docker or 容器为空")}),(0!==v.length||Z)&&!R&&(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(r.uF,{title:`${t("容器")} (${v.length})`,titleCom:(0,y.jsx)(w.Sm,{placeholder:t("过滤"),value:Z,handleInputChange:e=>{D(e)}}),children:(0,y.jsx)(h.X,{headers:X,rows:v,width:"10rem"})})})})]}),(0,y.jsx)(E,{})]})}var D=s(64694);let X="",T=!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)(""),[g,v]=(0,n.useState)(["pid",t("名字"),t("创建用户"),(0,y.jsxs)("span",{children:[t("内存"),(0,y.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{T=!T}})]}),(0,y.jsxs)("span",{children:["cpu%",(0,y.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{U=!U}})]}),t("选择")]),{check_user_auth:k}=(0,S.MH)();(0,n.useEffect)(()=>{_(X),(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(X){for(const t of e.context)for(const e of t)if(`${e}`.includes(X)){s.push(t);break}}else s.push(...e.context);T&&(0,D.di)(s,e=>e[3],!1),U&&(0,D.di)(s,e=>e[4],!1);const n=s.map(e=>{const s=e.map((e,t)=>(0,y.jsx)(r.xP,{context:3===t?(0,V.v7)(e):e}));return s.push((0,y.jsx)(u.rA,{icon:"place",title:t("选中"),onClick:()=>{x(s)}})),s});j(s.length),o(n)})})()},[]),(0,n.useEffect)(()=>{X=f},[f]);return(0,y.jsxs)("div",{children:[(0,y.jsxs)(d.A,{children:[a.length>0&&(0,y.jsx)("div",{children:a[1].props.context}),a.length>0&&k(b.oV.sys_process_close)&&(0,y.jsx)("div",{children:(0,y.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,y.jsx)(i.xh,{children:0!==s.length||X?(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(r.uF,{title:`${t("进程")} (${m})`,titleCom:(0,y.jsx)(w.Sm,{placeholder:t("过滤"),value:f,handleInputChange:e=>{_(e)}}),children:(0,y.jsx)(h.X,{headers:g,rows:s,width:"10rem"})})})}):(0,y.jsx)($.h,{context:t("加载中请等待...")})})]})}const L=n.lazy(()=>Promise.all([s.e(2543),s.e(5614)]).then(()=>s(85614)));function O(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,y.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 R=[{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 g=e=>{e!==s&&("text"===e?u(ee(r,c)):l(te(d)),i(e))},v=e=>t=>{l(s=>({...s,[e]:t}))};return(0,y.jsxs)("div",{children:[(0,y.jsxs)("div",{style:{display:"flex",gap:"0.4rem",marginBottom:"0.6rem"},children:[(0,y.jsx)("button",{className:"button button--flat "+("form"===s?"":"button--grey"),onClick:()=>g("form"),children:t("表单")}),(0,y.jsx)("button",{className:"button button--flat "+("text"===s?"":"button--grey"),onClick:()=>g("text"),children:t("文本")})]}),j?(0,y.jsx)("div",{children:t("加载中...")}):"form"===s?(0,y.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.6rem"},children:[(0,y.jsx)(w.BC,{label:t("服务名称"),children:(0,y.jsx)(w.Sm,{placeholder:t("服务名称"),value:r,disabled:"edit"===e.mode,handleInputChange:e=>o(e),width:"100%"})}),(0,y.jsx)(w.BC,{label:t("服务描述"),children:(0,y.jsx)(w.Sm,{placeholder:t("服务描述"),value:c.description,handleInputChange:v("description"),width:"100%"})}),(0,y.jsx)(w.BC,{label:t("启动命令"),required:!0,children:(0,y.jsx)(w.Sm,{placeholder:t("ExecStart 启动命令,必填"),value:c.exec_start,handleInputChange:v("exec_start"),width:"100%"})}),(0,y.jsx)(w.BC,{label:t("运行类型"),children:(0,y.jsx)(w.l6,{options:J,value:c.type,onChange:v("type")})}),(0,y.jsx)(w.BC,{label:t("工作目录"),children:(0,y.jsx)(w.Sm,{placeholder:t("工作目录(可选)"),value:c.working_dir,handleInputChange:v("working_dir"),width:"100%"})}),(0,y.jsx)(w.BC,{label:t("运行用户"),children:(0,y.jsx)(w.Sm,{placeholder:t("运行用户(可选)"),value:c.user_,handleInputChange:v("user_"),width:"100%"})}),(0,y.jsx)(w.BC,{label:t("重启策略"),children:(0,y.jsx)(w.l6,{options:R,value:c.restart,onChange:v("restart")})}),(0,y.jsx)(w.BC,{label:t("安装目标"),children:(0,y.jsx)(w.l6,{options:Q,value:c.wanted,onChange:v("wanted")})})]}):(0,y.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,y.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.4rem",marginTop:"0.6rem"},children:[(0,y.jsx)("button",{className:"button button--flat button--grey",disabled:j,onClick:e.onClose,children:t("取消")}),(0,y.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),[g,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,G]=(0,n.useState)([]),[z,W]=(0,n.useState)(""),[Z,D]=(0,n.useState)(""),[X,T]=(0,n.useState)(new Set),[U,q]=(0,m.fp)(j.AG.editorSetting),[L,R]=(0,m.fp)(j.AG.prompt_card);(0,n.useEffect)(()=>{D(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,y.jsx)(r.xP,{context:4===t?(0,V.v7)(e):e}));return t.push((0,y.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([]),G([]);const e=await a.Yu.get("systemd/inside/all");if(e.code!==x.m.Success)return;T(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,y.jsx)(r.xP,{context:t.unit}),t.load,`${t.active}(${t.sub})`,(0,y.jsx)(r.xP,{context:t.description})];s.push([...e,(0,y.jsx)(u.rA,{icon:"place",title:"添加",onClick:()=>{G([...e])}})])}ne=s,M(s)}},ee=(e,s)=>{R({open:!0,title:t("create"===e?"新建 systemd 服务":"编辑 systemd 服务"),context_div:(0,y.jsx)(se,{mode:e,unit_name:s,onClose:()=>R({open:!1}),onDone:()=>{R({open:!1}),l.ws.send(new c.hf(c.HK.systemd_inside_get)),K&&Q(),E([]),G([])}})})};return(0,y.jsxs)("div",{children:[(0,y.jsxs)(d.A,{left_children:(0,y.jsx)(u.Z$,{defaultStatus:!1,text:t("系统systemd单元"),clickFun:e=>{B(e),e?(Q(),E([])):G([])}}),children:[s(b.oV.systemd)&&(0,y.jsx)("div",{children:(0,y.jsx)(u.rA,{icon:"add_circle",title:t("添加 systemd"),onClick:()=>{ee("create")}})}),N.length>0&&(0,y.jsx)("div",{children:N[1].props.context}),H.length>0&&(0,y.jsx)("div",{children:H[0].props.context}),N.length>0&&(0,y.jsxs)("div",{children:[s(b.oV.systemd)&&(0,y.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,y.jsx)(u.rA,{icon:"edit",title:"可视化编辑",onClick:()=>{ee("edit",N[1].props.context)}}),(0,y.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(N[1].props.context)}})]}),H.length>0&&(0,y.jsxs)("div",{children:[s(b.oV.systemd)&&(0,y.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,y.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(H[0].props.context)}}),s(b.oV.systemd)&&(0,y.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)&&!X.has(H[0].props.context)&&(0,y.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&&(T(new Set(t.data)),(0,_.SK)("添加成功"))})(H[0].props.context)})]})]}),(0,y.jsxs)(i.xh,{children:[K&&(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(r.uF,{title:`systemd系统单元(${I.length})`,titleCom:(0,y.jsx)(w.Sm,{placeholder:"过滤单元",value:z,handleInputChange:e=>{W(e)},handlerEnter:()=>{const e=[];if(z){for(const t of ne)(t[0].props.context.includes(z)||t[3].props.context.includes(z))&&e.push(t);M(e)}else M(ne)}}),children:(0,y.jsx)(h.X,{headers:A,rows:I,width:"10rem"})})})}),0===Y.length&&!K&&(0,y.jsx)($.h,{context:"没有管理的单元 or 加载中请等待..."}),0!==Y.length&&!K&&(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsx)(r.uF,{title:`filecat监控单元(${Y.length})`,titleCom:(0,y.jsx)(w.Sm,{placeholder:"过滤单元",value:Z,handleInputChange:e=>{D(e)}}),children:(0,y.jsx)(h.X,{headers:k,rows:Y,width:"10rem"})})})})]}),(0,y.jsx)(O,{})]})}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"),[g,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),G=async()=>{try{const e=await a.V_.get("status");e.code===x.m.Success&&c(e.data)}catch(e){}},z=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)(()=>{G(),z()},[]);const W=!0===o?.installed,Z=!0===o?.active;return(0,y.jsxs)("div",{children:[(0,y.jsxs)(d.A,{children:[(0,y.jsxs)("div",{children:[e("已安装"),": ",W?(0,y.jsx)("span",{style:{color:"green"},children:"✓"}):(0,y.jsx)("span",{style:{color:"red"},children:"✗"})]}),(0,y.jsxs)("div",{children:[e("已启用"),": ",Z?(0,y.jsx)("span",{style:{color:"green"},children:"✓"}):(0,y.jsx)("span",{style:{color:"gray"},children:"✗"})]}),W&&(0,y.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?"已启用":"已停用")),G(),z()}catch(e){}})(!Z)}),(0,y.jsx)(u.rA,{icon:"refresh",title:e("刷新规则"),onClick:z})]}),(0,y.jsxs)(i.xh,{children:[(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:35,children:(0,y.jsxs)(r.uF,{title:e("添加ufw规则"),titleCom:(0,y.jsx)(u.rA,{icon:"add",title:e("添加"),onClick:async()=>{if(b.trim())try{const t=await a.V_.post("rule/add",{action:l,direction:g,proto:k,port:b.trim(),from:"in"===g&&A.trim()||void 0});if(t.code!==x.m.Success)return void(0,_.zN)(t.message||e("操作失败"));(0,_.SK)(t.data||e("已添加")),z()}catch(e){}else(0,_.zN)(e("请填写端口号"))}}),children:[(0,y.jsx)(w.BC,{label:e("动作"),label_width:"4rem",input_max_width:"8rem",children:(0,y.jsx)(w.l6,{options:t,value:l,onChange:e=>f(e),defaultValue:"allow"})}),(0,y.jsx)(w.BC,{label:e("方向"),label_width:"4rem",input_max_width:"8rem",children:(0,y.jsx)(w.l6,{options:s,value:g,onChange:e=>v(e),defaultValue:"in"})}),(0,y.jsx)(w.BC,{label:e("协议"),label_width:"4rem",input_max_width:"8rem",children:(0,y.jsx)(w.l6,{options:[{title:"tcp",value:"tcp"},{title:"udp",value:"udp"}],value:k,onChange:e=>S(e),defaultValue:"tcp"})}),(0,y.jsx)(w.BC,{label:e("端口"),label_width:"4rem",required:!0,children:(0,y.jsx)(w.Sm,{maxWidth:"20rem",placeholder:e("可填范围如 1000:2000"),value:b,handleInputChange:e=>C(e)})}),"in"===g&&(0,y.jsx)(w.BC,{label:e("来源"),label_width:"4rem",children:(0,y.jsx)(w.Sm,{maxWidth:"20rem",placeholder:e("IP/网段,可选"),value:A,handleInputChange:e=>P(e)})})]})})}),(0,y.jsx)(i.fI,{children:(0,y.jsx)(i.VP,{widthPer:80,children:(0,y.jsxs)(r.uF,{title:e("规则列表"),titleCom:(0,y.jsxs)("div",{style:{display:"flex",gap:"0.4rem"},children:[(0,y.jsx)(u.C3,{text:e("名单视图"),clickFun:()=>Y("list")}),(0,y.jsx)(u.C3,{text:e("文本视图"),clickFun:()=>Y("text")})]}),children:[E&&(0,y.jsx)($.h,{context:e("加载中...")}),!E&&"list"===V&&(0===F.length?(0,y.jsx)($.h,{context:e("暂无规则")}):(0,y.jsx)(h.X,{headers:[e("编号"),e("目标(To)"),e("动作"),e("来源(From)"),e("备注"),e("操作")],rows:F.map(t=>[t.number,(0,y.jsx)(r.xP,{context:t.to,tip_context:t.to}),t.action,t.from?(0,y.jsx)(r.xP,{context:t.from,tip_context:t.from}):"",t.description||"",(0,y.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}),z()}catch(e){}}})})(t.number,t.to,t.from)})]),width:"8rem"})),!E&&"text"===V&&(M?(0,y.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",fontSize:"0.85rem",margin:0},children:M}):(0,y.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,y.jsx)(F,{})},{index:2,name:t("系统进程"),rto:"process/",component:(0,y.jsx)(q,{})},{index:3,name:t("docker容器"),rto:"docker/",component:(0,y.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,y.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,y.jsx)(oe,{})})}return(0,y.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"
|
|
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.e83a6beb323ff107165d.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>
|