filecat 6.60.3 → 6.60.4
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/{1472.b75b7d997ae04556a8f3.js → 1472.2221ac3c87c2a069147c.js} +1 -1
- package/build/dist/6919.b72bdf859f5f73a22a1e.js +1 -0
- package/build/dist/9546.9c6aa2936010188abb31.js +1 -0
- package/build/dist/dark.css +0 -3
- package/build/dist/google-dark.css +0 -3
- package/build/dist/index.html +1 -1
- package/build/dist/{main.9a5ea5e915f703c45202.js → main.e92dc6b4b1a6ec264ea4.js} +2 -2
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/6919.8df9652177bc9e8713d8.js +0 -1
- package/build/dist/9546.7c0cada5f1bde597c2db.js +0 -1
- /package/build/dist/{main.9a5ea5e915f703c45202.js.LICENSE.txt → main.e92dc6b4b1a6ec264ea4.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6919],{86919(e,s,l){l.r(s),l.d(s,{default:()=>p});var t=l(96540),a=l(34899),r=l(76213),i=l(34843),c=l(57952),n=l(85997),d=l(75725),o=l(70447),h=l(61443),_=l(82893),u=l(14284),x=l(53459),j=l(62042),m=l(74848);function p(){const{t:e}=(0,a.Bd)(),s=(0,r.Zp)(),[l,p]=(0,i.fp)(_.AG.confirm),[g,v]=(0,t.useState)(""),[k,b]=(0,t.useState)(""),[N,f]=(0,t.useState)(""),[S,y]=(0,t.useState)(""),[C,I]=(0,t.useState)(""),[w,D]=(0,t.useState)(!1),[P,A]=(0,t.useState)(""),[T,Y]=(0,t.useState)(""),[z,B]=(0,t.useState)(""),[F,H]=(0,t.useState)(!0),[q,E]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(async()=>{const e=await u.Yu.get("docker/config");if(e?.code!==x.m.Success)return;const s=e.data??{};v(s.http_proxy??""),b(s.https_proxy??""),f(s.no_proxy??""),y((s.registry_mirrors||[]).join(",")),I((s.insecure_registries||[]).join(",")),D(!!s.debug),A(s.data_root??""),Y(s.storage_driver??""),B(s.log_driver??""),H(s.iptables??!0),E(!!s.live_restore)})()},[]);return(0,m.jsxs)("div",{children:[(0,m.jsx)(c.A,{children:(0,m.jsx)(n.rA,{icon:"arrow_back",title:e("返回"),onClick:()=>s(-1)})}),(0,m.jsx)(d.jW,{isFull:!0,more:!0,children:(0,m.jsx)(d.NN,{children:(0,m.jsx)(d.xh,{children:(0,m.jsx)(d.fI,{children:(0,m.jsx)(d.VP,{widthPer:60,children:(0,m.jsx)(o.uF,{self_title:(0,m.jsx)("span",{className:"div-row",children:(0,m.jsx)("h2",{children:e("Docker 代理配置")})}),titleCom:(0,m.jsx)("div",{className:"db-query-setting__toolbar",children:(0,m.jsx)(n.rA,{icon:"save",title:e("保存"),onClick:()=>(async()=>{const s=e=>e.split(/[\n,,]/).map(e=>e.trim()).filter(Boolean),l=await u.Yu.post("docker/config/save",{http_proxy:g,https_proxy:k,no_proxy:N,registry_mirrors:s(S),insecure_registries:s(C),debug:w,data_root:P,storage_driver:T,log_driver:z,iptables:F,live_restore:q});l?.code===x.m.Success?p({open:!0,title:e("是否重启 Docker 服务以生效?"),sub_title:e("重启 Docker 会短暂中断容器服务,请确认当前没有关键任务在执行"),handle:async()=>{const s=await u.Yu.post("docker/restart");p({open:!1,handle:null}),s?.code===x.m.Success?(0,j.SK)(e("已重启 Docker,代理配置已生效")):(0,j.zN)(e("重启失败"))}}):(0,j.zN)(e("保存失败"))})()})}),children:(0,m.jsxs)("div",{className:"docker-setting__form",children:[(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("HTTP 代理")}),(0,m.jsx)(h.Sm,{placeholder:"http://127.0.0.1:3067",value:g,handleInputChange:e=>v(e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("HTTPS 代理")}),(0,m.jsx)(h.Sm,{placeholder:"https://127.0.0.1:3067",value:k,handleInputChange:e=>b(e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("No Proxy")}),(0,m.jsx)(h.Sm,{placeholder:"localhost,127.0.0.1",value:N,handleInputChange:e=>f(e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("镜像加速")}),(0,m.jsx)(h.Sm,{placeholder:"https://docker.mirrors.ustc.edu.cn,https://hub-mirror.c.163.com",value:S,handleInputChange:e=>y(e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("不安全仓库")}),(0,m.jsx)(h.Sm,{placeholder:"127.0.0.1:5000,registry.example.com",value:C,handleInputChange:e=>I(e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("开启调试")}),(0,m.jsx)(h.l6,{options:[{title:e("是"),value:!0},{title:e("否"),value:!1}],value:w,onChange:e=>D(!!e)})]}),(0,m.jsx)("div",{className:"docker-setting__separator",children:e("存储 / 日志 / 网络")}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("数据存储目录")}),(0,m.jsx)(h.Sm,{placeholder:"/var/lib/docker",value:P,handleInputChange:e=>A(e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("存储驱动")}),(0,m.jsx)(h.Sm,{placeholder:"overlay2",value:T,handleInputChange:e=>Y(e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("日志驱动")}),(0,m.jsx)(h.Sm,{placeholder:"json-file",value:z,handleInputChange:e=>B(e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("启用 iptables")}),(0,m.jsx)(h.l6,{options:[{title:e("是"),value:!0},{title:e("否"),value:!1}],value:F,onChange:e=>H(!!e)})]}),(0,m.jsxs)("div",{className:"docker-setting__field",children:[(0,m.jsx)("label",{className:"docker-setting__label",children:e("Live Restore")}),(0,m.jsx)(h.l6,{options:[{title:e("是"),value:!0},{title:e("否"),value:!1}],value:q,onChange:e=>E(!!e)})]}),(0,m.jsx)("p",{className:"docker-setting__tip",children:e("代理写入 systemd 服务环境变量,其余写入 daemon.json;修改后需重启 Docker 生效,请谨慎操作(尤其数据存储目录变更)。")})]})})})})})})})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
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 c=({percentage:e})=>{const t=(0,n.useRef)(null),[s,c]=(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 c(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,c])},77481(e,t,s){s.d(t,{S:()=>c,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 c(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))})]}),c=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,c])},59546(e,t,s){s.r(t),s.d(t,{default:()=>oe});var n=s(96540),i=s(75725),r=s(70447),c=s(22081),o=s(92275),l=s(14944),a=s(14284),d=s(57952),u=s(85997),h=s(77481),x=s(53459),p=s(34899),m=s(34843),f=s(82893),j=s(74777),_=s(62042),y=s(61443),g=s(74848);function w(e){const{t}=(0,p.Bd)(),[s,c]=(0,m.fp)(f.AG.disk),[o,l]=(0,n.useState)({}),[j,_]=(0,n.useState)([]),y=[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,g.jsx)("span",{style:{color:s},children:t(n[0])}),e.push(n)}_(s.data.ata_smart_attributes),l(s.data)}})()},[]),(0,g.jsxs)("div",{children:[(0,g.jsx)(d.A,{children:(0,g.jsx)(u.rA,{icon:"close",title:t("关闭"),onClick:()=>{c({})}})}),(0,g.jsx)(i.jW,{isFull:!0,more:!0,children:(0,g.jsx)(i.NN,{children:(0,g.jsxs)(i.fI,{children:[(0,g.jsxs)(i.VP,{widthPer:30,children:[(0,g.jsx)(i.xh,{children:(0,g.jsxs)(r.Zp,{title:t("基本信息"),children:[(0,g.jsx)(i.Yh,{left:t("名字"),right:e.name}),(0,g.jsx)(i.Yh,{left:t("厂商名称"),right:e.typeName}),(0,g.jsx)(i.Yh,{left:t("类型"),right:e.type}),(0,g.jsx)(i.Yh,{left:t("容量"),right:e.total})]})}),(0,g.jsx)(i.xh,{children:(0,g.jsxs)(r.Zp,{title:t("物理信息"),children:[(0,g.jsx)(i.Yh,{left:t("是否健康"),right:!0===o.smart_status?"是":"否"}),(0,g.jsx)(i.Yh,{left:t("设备型号"),right:o.model_name}),(0,g.jsx)(i.Yh,{left:t("序列号"),right:o.serial_number}),(0,g.jsx)(i.Yh,{left:t("固件版本"),right:o.firmware_version}),(0,g.jsx)(i.Yh,{left:t("转速(每分钟)"),right:o.rotation_rate}),(0,g.jsx)(i.Yh,{left:t("通电时长(小时)"),right:o.power_on_time_hours}),(0,g.jsx)(i.Yh,{left:t("通电次数"),right:o.power_cycle_count}),(0,g.jsx)(i.Yh,{left:t("温度(°C)"),right:o.temperature}),(0,g.jsx)(i.Yh,{left:t("通信协议"),right:o.device_protocol})]})})]}),(0,g.jsx)(i.VP,{widthPer:50,children:(0,g.jsxs)(i.xh,{children:[j?.length?(0,g.jsx)(r.uF,{title:t("ATA/SATA详细信息"),children:(0,g.jsx)(h.X,{headers:y,rows:j,width:"10rem"})}):(0,g.jsx)(g.Fragment,{}),o.nvme_smart?(0,g.jsxs)(r.Zp,{title:t("NVME详细信息"),children:[(0,g.jsx)(i.Yh,{left:t("NVMe 可用备用块(%)"),right:o.nvme_smart.available_spare}),(0,g.jsx)(i.Yh,{left:t("NVMe 已使用寿命(%)"),right:o.nvme_smart.percentage_used}),(0,g.jsx)(i.Yh,{left:t("NVMe 读取量"),right:o.nvme_smart.data_units_read}),(0,g.jsx)(i.Yh,{left:t("NVMe 写入量"),right:o.nvme_smart.data_units_written}),(0,g.jsx)(i.Yh,{left:t("NVMe 通电次数"),right:o.nvme_smart.power_cycles}),(0,g.jsx)(i.Yh,{left:t("NVMe 通电时长(小时)"),right:o.nvme_smart.power_on_hours}),(0,g.jsx)(i.Yh,{left:t("NVMe 非正常关机"),right:o.nvme_smart.unsafe_shutdowns}),(0,g.jsx)(i.Yh,{left:t("NVMe 媒体错误"),right:o.nvme_smart.media_errors}),(0,g.jsx)(i.Yh,{left:t("NVMe 错误日志数"),right:o.nvme_smart.num_err_log_entries})]}):(0,g.jsx)(g.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,g.jsxs)("div",{style:{border:"2px solid black",padding:"10px",width:"300px",height:"300px",position:"relative"},children:[e.name,e.lvms.map((e,t)=>(0,g.jsx)("div",{style:{margin:"5px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid "},children:e.name},t))]});function A(){return(0,g.jsx)("div",{style:{position:"relative",height:"300px",margin:"10px",width:"30px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,g.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.Bd)(),[t,s]=(0,m.fp)(f.AG.disk),[c,o]=(0,n.useState)({}),[l,j]=(0,n.useState)([]),[y,w]=(0,n.useState)([]),[P,V]=(0,m.fp)(f.AG.showPrompt),{check_user_auth:$}=(0,S.MH)(),[Y,F]=(0,n.useState)([]),{click_file:I}=(0,S.kZ)(),[N,M]=(0,m.fp)(f.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&&j(e.data),e.code};(0,n.useEffect)(()=>{(async()=>{K()})()},[]);const B=[(0,g.jsx)(u.rA,{icon:"info",title:e("提示"),onClick:async()=>{M({open:!0,title:"信息",context_div:(0,g.jsx)("div",{children:(0,g.jsxs)("ul",{children:[(0,g.jsxs)("li",{children:["通用格式:","<文件系统> <挂载点> <类型> <挂载选项> <dump> <fsck> "]}),(0,g.jsxs)("li",{children:["文件系统,有多种格式",(0,g.jsxs)("ul",{children:[(0,g.jsx)("li",{children:"1(usb口默认名称)./dev/sda1"}),(0,g.jsx)("li",{children:"2(唯一Id).UUID=123e4567-e89b-12d3-a456-426614174000"}),(0,g.jsx)("li",{children:"3.LABEL=DATA"})]})]}),(0,g.jsx)("li",{children:"挂载点,就是文件路径,例如 /mnt/data ,这个目录要提前创建,且为空"}),(0,g.jsx)("li",{children:"类型,就是文件系统类型,对于系统不支持的类型,例如ntfs需要额外前提安装ntfs-3g(linux 5.15内核以后自带 ntfs)"}),(0,g.jsxs)("li",{children:['挂载选项的值只能是以下这些,可以用 "," 同时使用多个选项',(0,g.jsxs)("ul",{children:[(0,g.jsx)("li",{children:"defaults:使用默认挂载选项"}),(0,g.jsx)("li",{children:"noatime:不更新访问时间,提高性能"}),(0,g.jsx)("li",{children:"auto:系统启动时自动挂载"}),(0,g.jsx)("li",{children:"rw:以读写方式挂载"}),(0,g.jsx)("li",{children:"nofail:防止启动阻塞,挂载失败系统继续执行"}),(0,g.jsx)("li",{children:"...等"})]})]}),(0,g.jsx)("li",{children:"dump 0是需要备份 1是不需要备份"}),(0,g.jsx)("li",{children:"Fsck 整数值0是不检查,文件系统检查顺序越小越先检查"}),(0,g.jsx)("li",{children:"提示:只有含有文件系统的逻辑卷,或者分区才可以进行挂载。"})]})})})}}),(0,g.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,g.jsxs)("div",{children:[(0,g.jsx)(d.A,{children:(0,g.jsx)(u.rA,{icon:"close",title:e("关闭"),onClick:()=>{s({})}})}),(0,g.jsx)(i.jW,{isFull:!0,more:!0,children:(0,g.jsx)(i.NN,{children:(0,g.jsxs)(i.fI,{children:[(0,g.jsx)(i.VP,{widthPer:40,children:(0,g.jsxs)(r.Zp,{title:e("物理块(硬盘)设备、逻辑卷、物理卷"),titleCom:(0,g.jsxs)("div",{children:[$(b.oV.sys_disk_mount)&&(0,g.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,g.jsx)(u.rA,{icon:"update",title:e("刷新"),onClick:async()=>{await K()===x.m.Success&&(0,_.SK)("刷新成功")}})]}),children:[(0,g.jsx)(h.X,{headers:E,rows:y,width:"10rem"}),(0,g.jsx)(k.A,{list:l,render:e=>{let t=e.name;return e.label&&(t+=`(${e.label})`),e.mountpoint?(0,g.jsxs)("span",{children:[t,(0,g.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]+";";w([[(0,g.jsx)(r.xP,{children:s}),(0,g.jsx)(r.xP,{children:t.uuid}),e(t.type),e(t.fstype),t.fssize,t.size,(0,g.jsx)(r.xP,{children:t.path}),t.pttype]])}})]})}),(0,g.jsx)(i.VP,{widthPer:60,children:Y.map((t,s)=>{const n=[];for(const e of t.pv_list)n.push({name:`${e.name}---(${e.size})---(${e.free_size})`});const c=[];for(const e of t.lv_list)c.push({name:`${e.name}---(${e.size})`});return(0,g.jsx)(r.Zp,{children:(0,g.jsxs)(i.n5,{children:[(0,g.jsx)(C,{name:e("物理卷"),lvms:n}),(0,g.jsx)(A,{}),(0,g.jsx)(C,{name:`${e("逻辑卷")}---(${t.name})---size(${t.size})`,lvms:[]}),(0,g.jsx)(A,{}),(0,g.jsx)(C,{name:e("逻辑卷"),lvms:c})]})},s)})})]})})})]})}var V=s(88815);let $=!0;function Y(e){const{t}=(0,p.Bd)(),s=[t("名字"),t("厂商名称"),t("类型"),t("容量")],y=[t("名字"),t("物理硬盘"),t("文件系统类型"),t("挂载位置"),t("总容量"),t("剩余容量")],[v,k]=(0,m.fp)(f.AG.user_base_info),[S,C]=(0,n.useState)(0),[A,Y]=(0,n.useState)(0),[F,I]=(0,n.useState)(0),[N,M]=(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)($),[L,q]=(0,n.useState)(null),[R,O]=(0,n.useState)([]),[J,Q]=(0,n.useState)([]),[ee,te]=(0,m.fp)(f.AG.user_base_info),[se,ne]=(0,m.fp)(f.AG.disk),ie=async()=>{if(!$)return;const e=new o.hf(o.HK.sys_get);await l.ws.send(e),l.ws.addMsg(o.HK.sys_getting,e=>{M(e.context?.cpu_currentLoad);const t=e.context?.memLeft,s=e.context?.memTotal;Y(t),I(s),C((s-t)/s*100),q(e.context?.node_memory_usage),K(e.context?.node_cpu_usage)})};return(0,n.useEffect)(()=>((async()=>{await ie()})(),()=>{l.ws.sendData(o.HK.sys_cancel,{})}),[]),(0,g.jsxs)("div",{children:[(0,g.jsxs)(d.A,{children:[v.sys===b.XM.linux&&(0,g.jsx)(u.rA,{icon:"sd_card",title:"硬盘挂载",onClick:()=>{ne({type:"mount"})}}),(0,g.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,g.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[j.jk.smartmontools]&&ee.sysSoftWare[j.jk.smartmontools].installed||(i=!1);for(const e of s??[])n.push([(0,g.jsx)(r.xP,{context:e.name}),e.typeName,e.type,e.total,(0,g.jsx)(u.rA,{icon:"health_and_safety",title:t("查看健康信息"),onClick:()=>{i?ne({type:"check",data:e}):(0,_.zN)("没有安装smartmontools")}})]);O(n)}})()}}),(0,g.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,g.jsx)(r.xP,{context:e.name}),(0,g.jsx)(r.xP,{context:e.device_name}),e.fsType,(0,g.jsx)(r.xP,{context:e.mount}),e.total,e.available]);Q(s)}})()}}),(0,g.jsx)(u.Z$,{defaultStatus:T,text:t("实时信息"),clickFun:e=>{U(e),$=e,ie()}})]}),(0,g.jsxs)(i.xh,{children:[T&&(0,g.jsxs)(i.fI,{children:[(0,g.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,g.jsx)(r.Zp,{title:"Sys "+t("内存"),children:(0,g.jsxs)(i.fI,{children:[(0,g.jsx)(i.VP,{children:(0,g.jsx)(c.A,{percentage:S})}),(0,g.jsx)(i.VP,{children:(0,g.jsxs)(i.fI,{children:[(0,g.jsx)(i.VP,{widthPer:100,children:(0,g.jsx)("div",{children:(0,g.jsx)(i.Yh,{left:t("总容量"),center:`${F}G`})})}),(0,g.jsx)(i.VP,{widthPer:100,children:(0,g.jsx)(i.Yh,{left:t("剩余"),center:`${A}G`})})]})})]})})}),(0,g.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,g.jsx)(r.Zp,{title:"Sys cpu",children:(0,g.jsxs)(i.fI,{children:[(0,g.jsx)(i.VP,{children:(0,g.jsx)(c.A,{percentage:N})}),(0,g.jsx)(i.VP,{children:(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.Yh,{left:t("使用率"),center:N})})})]})})}),(0,g.jsx)(i.VP,{widthPer:33,maxWidth:"30rem",children:(0,g.jsx)(r.Zp,{title:"FileCat",children:(0,g.jsxs)(i.fI,{children:[(0,g.jsxs)(i.VP,{children:[(0,g.jsx)(i.qV,{content:t("内存")}),(0,g.jsx)(i.qV,{content:"total: "+(0,V.v7)(L?.rss)}),(0,g.jsx)(i.qV,{content:"object: "+(0,V.v7)(L?.heapTotal)}),(0,g.jsx)(i.qV,{content:"obj-use: "+(0,V.v7)(L?.heapUsed)}),(0,g.jsx)(i.qV,{content:"external: "+(0,V.v7)(L?.external)}),(0,g.jsx)(i.qV,{content:"buffer: "+(0,V.v7)(L?.arrayBuffers)})]}),(0,g.jsx)(i.VP,{children:(0,g.jsx)(i.qV,{content:"cpu growth rate: "+E})})]})})})]}),(0,g.jsxs)(i.fI,{children:[G&&(0,g.jsx)(i.VP,{children:(0,g.jsxs)(r.Zp,{title:t("基本信息"),children:[(0,g.jsx)(i.Yh,{left:t("总内存"),right:B.mem_total}),(0,g.jsx)(i.Yh,{left:`cpu ${t("制造商")}`,right:B.cpu_manufacturer}),(0,g.jsx)(i.Yh,{left:`cpu ${t("品牌")}`,right:B.cpu_brand}),(0,g.jsx)(i.Yh,{left:`cpu ${t("逻辑核心")}`,right:B.cpu_core_num}),(0,g.jsx)(i.Yh,{left:`cpu ${t("物理核心")}`,right:B.cpu_phy_core_num}),(0,g.jsx)(i.Yh,{left:`cpu ${t("最大")}hz`,right:B.cpu_speed_hz}),(0,g.jsx)(i.Yh,{left:`${t("当前系统")}:pid;ppid`,right:B.pid_ppid}),(0,g.jsx)(i.Yh,{left:t("运行用户"),right:B.user})]})}),W&&(0,g.jsx)(i.VP,{children:(0,g.jsx)(r.uF,{title:t("物理硬盘"),children:(0,g.jsx)(h.X,{headers:s,rows:R,width:"10rem"})})}),D&&(0,g.jsx)(i.VP,{children:(0,g.jsx)(r.uF,{title:t("文件硬盘"),children:(0,g.jsx)(h.X,{headers:y,rows:J,width:"10rem"})})})]})]}),se&&"check"===se.type&&(0,g.jsx)(w,{...se.data}),se&&"mount"===se.type&&(0,g.jsx)(P,{})]})}var F=s(75007),I=s(97856),N=s(64405);const M=n.lazy(()=>Promise.all([s.e(2543),s.e(5614)]).then(s.bind(s,85614)));function E(e){const[t,s]=(0,n.useState)(null),[i,r]=(0,m.fp)(f.AG.dockerShellShow),[c,a]=(0,m.fp)(f.AG.user_base_info),d=c.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?o.HK.docker_shell_logs_getting:o.HK.docker_shell_exec_getting,e=>{"error"===e.context&&u(),t(e.context)}),"exec"===i.type&&e.onData(async e=>{const t=new o.hf(o.HK.docker_shell_exec);t.context=e,await l.ws.send(t)}),s(e)})():u()},[i]),(0,n.useEffect)(()=>()=>{u()},[]);return(0,g.jsx)(M,{show:i.show,terminal:t,init:(e,s)=>{t.writeln("[38;2;29;153;243mconnect...[0m ");const n=new N.n;let r;n.rows=e,n.cols=s,n.dockerId=i.dockerId,r="logs"===i.type?new o.hf(o.HK.docker_shell_logs):new o.hf(o.HK.docker_shell_exec_open),r.context=n,l.ws.send(r)}})}var K=s(27690),B=s(76213),H=s(87361);let G="",z=[],W=!1;function Z(e){const{t}=(0,p.Bd)(),s=(0,B.Zp)(),[c]=(0,m.fp)(f.AG.user_base_info),[j,w]=(0,n.useState)({}),[v,k]=(0,n.useState)([]),[C,A]=(0,n.useState)([]),{check_user_auth:P}=(0,S.MH)(),[V,$]=(0,m.fp)(f.AG.dockerShellShow),[Y,I]=(0,m.fp)(f.AG.showPrompt),[N,M]=(0,m.fp)(f.AG.confirm),[Z,D]=(0,n.useState)(G),[X,T]=(0,n.useState)(["id",t("名字"),t("镜像"),t("命令"),t("状态"),t("内存"),"cpu%",t("选择")]),[U,L]=(0,n.useState)([]),[q,R]=(0,n.useState)(void 0),[O,J]=(0,n.useState)(!1),Q=["id",t("name"),t("create时间"),t("大小"),(0,g.jsxs)("span",{children:["选中",(0,g.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;w(e)}})]})],ee=async()=>{k([]),L([]);const e=new o.hf(o.HK.docker_get);await l.ws.send(e),l.ws.addMsg(o.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,g.jsx)(r.xP,{context:e}));return t.push((0,g.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{L(t)}})),t}))})};(0,n.useEffect)(()=>(D(G),ee(),()=>{(async()=>{$({show:!1,type:"",dockerId:""})})()}),[]),(0,n.useEffect)(()=>{G=Z},[Z]);const te=()=>{const e=new o.hf("logs"===V.type?o.HK.docker_shell_logs_cancel:o.HK.docker_shell_exec_cancel);e.context="",l.ws.send(e)},se=e=>{const t=new o.hf(o.HK.docker_switch);t.context={type:e,dockerId:U[0].props.context},L([]),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,g.jsx)(r.xP,{context:n[0]}),(0,g.jsx)(r.xP,{context:n[1]}),n[2],n[3],""];s.push(i)}z=s,A(s)}};return(0,g.jsxs)("div",{children:[(0,g.jsxs)(d.A,{left_children:(0,g.jsx)(u.Z$,{defaultStatus:!1,text:t("docker镜像"),clickFun:e=>{J(e),e?(ne(),L([])):(ee(),A([]),w({}))}}),children:[c.sys===b.XM.linux&&(0,g.jsx)(u.rA,{icon:"settings",title:t("Docker 配置"),onClick:()=>s(H.o.docker_setting_page)}),Object.keys(j).length>0&&(0,g.jsx)(u.rA,{icon:"delete",title:t("删除镜像"),onClick:async()=>{M({open:!0,title:t("确定删除选中的镜像吗"),handle:async()=>{const e=Object.keys(j),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(),M({open:!1,handle:null}))}else(0,_.N9)(`有镜像正在运行${JSON.stringify(t.data)}`)}})}}),U.length>0&&(0,g.jsx)("div",{children:U[1].props.context}),U.length>0&&(0,g.jsxs)("div",{children:[P(b.oV.docker_container_update)&&(0,g.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,g.jsx)(u.rA,{icon:"print",title:t("打印日志"),onClick:()=>{V.show?($({show:!1,type:"",dockerId:""}),te()):$({show:!0,dockerId:U[0].props.context,type:"logs"})}}),P(b.oV.docker_container_update)&&(0,g.jsx)(u.rA,{icon:"personal_video",title:t("执行命令"),onClick:()=>{V.show?($({show:!1,type:"",dockerId:""}),te()):$({show:!0,dockerId:U[0].props.context,type:"exec"})}}),P(b.oV.docker_container_update)&&U[4].props.context.includes("Up")&&(0,g.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>se("stop")}),P(b.oV.docker_container_update)&&!U[4].props.context.includes("Up")&&(0,g.jsx)(u.rA,{icon:"play_arrow",title:t("开启"),onClick:()=>{se("start")}})]}),(0!==v.length||Z)&&!O&&(0,g.jsx)(u.rA,{icon:"refresh",title:t("列表更新"),onClick:async()=>{const e=new o.hf(o.HK.docker_get);await l.ws.send(e)}})]}),(0,g.jsxs)(i.xh,{children:[O&&(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.VP,{widthPer:80,children:(0,g.jsx)(r.uF,{title:`${t("镜像")} (${C.length})`,titleCom:(0,g.jsx)(y.Sm,{placeholder:t("过滤镜像"),value:q,handleInputChange:e=>{R(e)},handlerEnter:()=>{const e=[];if(q){for(const t of C)(t[0].props.context.includes(q)||t[1].props.context.includes(q))&&e.push(t);A(e)}else A(z)}}),children:(0,g.jsx)(h.X,{headers:Q,rows:C.map((e,s)=>(e[4]=(0,g.jsx)(y.GL,{context:t(""),selected:j[e[0].props.context],onchange:()=>{(e=>{const t={};Object.assign(t,j),t[e]?delete t[e]:t[e]=1,w(t)})(e[0].props.context)}}),e)),width:"10rem"})})})}),0===v.length&&!Z&&!O&&(0,g.jsx)(F.h,{context:t("检测不到docker,主机可能没有安装docker or 容器为空")}),(0!==v.length||Z)&&!O&&(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.VP,{widthPer:80,children:(0,g.jsx)(r.uF,{title:`${t("容器")} (${v.length})`,titleCom:(0,g.jsx)(y.Sm,{placeholder:t("过滤"),value:Z,handleInputChange:e=>{D(e)}}),children:(0,g.jsx)(h.X,{headers:X,rows:v,width:"10rem"})})})})]}),(0,g.jsx)(E,{})]})}var D=s(64694);let X="",T=!1,U=!1;function L(e){const{t}=(0,p.Bd)(),[s,c]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[m,f]=(0,n.useState)(0),[j,_]=(0,n.useState)(""),[w,v]=(0,n.useState)(["pid",t("名字"),t("创建用户"),(0,g.jsxs)("span",{children:[t("内存"),(0,g.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{T=!T}})]}),(0,g.jsxs)("span",{children:["cpu%",(0,g.jsx)(u.rA,{icon:"sort",title:t("升序"),onClick:()=>{U=!U}})]}),t("选择")]),{check_user_auth:k}=(0,S.MH)();(0,n.useEffect)(()=>{_(X),(async()=>{c([]),f(0),x([]);const e=new o.hf(o.HK.process_get);await l.ws.send(e),l.ws.addMsg(o.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,g.jsx)(r.xP,{context:3===t?(0,V.v7)(e):e}));return s.push((0,g.jsx)(u.rA,{icon:"place",title:t("选中"),onClick:()=>{x(s)}})),s});f(s.length),c(n)})})()},[]),(0,n.useEffect)(()=>{X=j},[j]);return(0,g.jsxs)("div",{children:[(0,g.jsxs)(d.A,{children:[a.length>0&&(0,g.jsx)("div",{children:a[1].props.context}),a.length>0&&k(b.oV.sys_process_close)&&(0,g.jsx)("div",{children:(0,g.jsx)(u.rA,{icon:"stop",title:t("停止"),onClick:()=>{const e=new o.hf(o.HK.process_close);e.context={pid:a[0].props.context},x([]),l.ws.send(e)}})})]}),(0,g.jsx)(i.xh,{children:0!==s.length||X?(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.VP,{widthPer:80,children:(0,g.jsx)(r.uF,{title:`${t("进程")} (${m})`,titleCom:(0,g.jsx)(y.Sm,{placeholder:t("过滤"),value:j,handleInputChange:e=>{_(e)}}),children:(0,g.jsx)(h.X,{headers:w,rows:s,width:"10rem"})})})}):(0,g.jsx)(F.h,{context:t("加载中请等待...")})})]})}const q=n.lazy(()=>Promise.all([s.e(2543),s.e(5614)]).then(s.bind(s,85614)));function R(e){const[t,s]=(0,n.useState)(null),[i,r]=(0,m.fp)(f.AG.systemd_shell_show),[c,a]=(0,m.fp)(f.AG.user_base_info),d=c.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(o.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,g.jsx)(q,{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 o.hf(o.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 c=n.match(new RegExp(`^${s}\\s*=\\s*(.*)$`,"i"));if(c)return c[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.Bd)(),[s,i]=(0,n.useState)("form"),[r,c]=(0,n.useState)(()=>(e.unit_name||"").replace(/\.service$/i,"")),[o,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)(""),[f,j]=(0,n.useState)(!1);(0,n.useEffect)(()=>{"edit"===e.mode&&e.unit_name&&(async()=>{j(!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{j(!1)}})()},[e.mode,e.unit_name]);const w=e=>{e!==s&&("text"===e?u(ee(r,o)):l(te(d)),i(e))},v=e=>t=>{l(s=>({...s,[e]:t}))};return(0,g.jsxs)("div",{children:[(0,g.jsxs)("div",{style:{display:"flex",gap:"0.4rem",marginBottom:"0.6rem"},children:[(0,g.jsx)("button",{className:"button button--flat "+("form"===s?"":"button--grey"),onClick:()=>w("form"),children:t("表单")}),(0,g.jsx)("button",{className:"button button--flat "+("text"===s?"":"button--grey"),onClick:()=>w("text"),children:t("文本")})]}),f?(0,g.jsx)("div",{children:t("加载中...")}):"form"===s?(0,g.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.6rem"},children:[(0,g.jsx)(y.BC,{label:t("服务名称"),children:(0,g.jsx)(y.Sm,{placeholder:t("服务名称"),value:r,disabled:"edit"===e.mode,handleInputChange:e=>c(e),width:"100%"})}),(0,g.jsx)(y.BC,{label:t("服务描述"),children:(0,g.jsx)(y.Sm,{placeholder:t("服务描述"),value:o.description,handleInputChange:v("description"),width:"100%"})}),(0,g.jsx)(y.BC,{label:t("启动命令"),required:!0,children:(0,g.jsx)(y.Sm,{placeholder:t("ExecStart 启动命令,必填"),value:o.exec_start,handleInputChange:v("exec_start"),width:"100%"})}),(0,g.jsx)(y.BC,{label:t("运行类型"),children:(0,g.jsx)(y.l6,{options:J,value:o.type,onChange:v("type")})}),(0,g.jsx)(y.BC,{label:t("工作目录"),children:(0,g.jsx)(y.Sm,{placeholder:t("工作目录(可选)"),value:o.working_dir,handleInputChange:v("working_dir"),width:"100%"})}),(0,g.jsx)(y.BC,{label:t("运行用户"),children:(0,g.jsx)(y.Sm,{placeholder:t("运行用户(可选)"),value:o.user_,handleInputChange:v("user_"),width:"100%"})}),(0,g.jsx)(y.BC,{label:t("重启策略"),children:(0,g.jsx)(y.l6,{options:O,value:o.restart,onChange:v("restart")})}),(0,g.jsx)(y.BC,{label:t("安装目标"),children:(0,g.jsx)(y.l6,{options:Q,value:o.wanted,onChange:v("wanted")})})]}):(0,g.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,g.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.4rem",marginTop:"0.6rem"},children:[(0,g.jsx)("button",{className:"button button--flat button--grey",disabled:f,onClick:e.onClose,children:t("取消")}),(0,g.jsx)("button",{className:"button button--flat",disabled:f,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 c="text"===s?d:ee(n,o);if(c.includes("ExecStart=")){j(!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:c}),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:c}),(0,_.SK)(t("保存成功"));e.onClose(),e.onDone?.()}catch(e){console.error("systemd 保存失败",e)}finally{j(!1)}}else(0,_.zN)(t("请至少填写 ExecStart 启动命令"))},children:t("保存")})]})]})}let ne,ie="";function re(e){const{t}=(0,p.Bd)(),{check_user_auth:s}=(0,S.MH)(),[c,j]=(0,m.fp)(f.AG.systemd_shell_show),[w,v]=(0,m.fp)(f.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]=(0,n.useState)([]),[I,N]=(0,n.useState)([]),[M,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,L]=(0,m.fp)(f.AG.editorSetting),[q,O]=(0,m.fp)(f.AG.prompt_card);(0,n.useEffect)(()=>{D(ie),(async()=>{Y([]),E([]);const e=new o.hf(o.HK.systemd_inside_get);await l.ws.send(e),l.ws.addMsg(o.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);Y(t.map(e=>{const t=e.map((e,t)=>(0,g.jsx)(r.xP,{context:4===t?(0,V.v7)(e):e}));return t.push((0,g.jsx)(u.rA,{icon:"place",title:"选中",onClick:()=>{E(t)}})),t}))})})()},[]),(0,n.useEffect)(()=>{ie=Z},[Z]);const J=e=>{if(c.show){j({show:!1,unit_name:""});const e=new CustomEvent("cancel_systemd_logs",{detail:{}});document.dispatchEvent(e)}else j({show:!0,unit_name:e})},Q=async()=>{N([]),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,g.jsx)(r.xP,{context:t.unit}),t.load,`${t.active}(${t.sub})`,(0,g.jsx)(r.xP,{context:t.description})];s.push([...e,(0,g.jsx)(u.rA,{icon:"place",title:"添加",onClick:()=>{G([...e])}})])}ne=s,N(s)}},ee=(e,s)=>{O({open:!0,title:t("create"===e?"新建 systemd 服务":"编辑 systemd 服务"),context_div:(0,g.jsx)(se,{mode:e,unit_name:s,onClose:()=>O({open:!1}),onDone:()=>{O({open:!1}),l.ws.send(new o.hf(o.HK.systemd_inside_get)),K&&Q(),E([]),G([])}})})};return(0,g.jsxs)("div",{children:[(0,g.jsxs)(d.A,{left_children:(0,g.jsx)(u.Z$,{defaultStatus:!1,text:t("系统systemd单元"),clickFun:e=>{B(e),e?(Q(),E([])):G([])}}),children:[s(b.oV.systemd)&&(0,g.jsx)("div",{children:(0,g.jsx)(u.rA,{icon:"add_circle",title:t("添加 systemd"),onClick:()=>{ee("create")}})}),M.length>0&&(0,g.jsx)("div",{children:M[1].props.context}),H.length>0&&(0,g.jsx)("div",{children:H[0].props.context}),M.length>0&&(0,g.jsxs)("div",{children:[s(b.oV.systemd)&&(0,g.jsx)(u.rA,{icon:"delete",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}))}})})(M[1].props.context)}}),s(b.oV.systemd)&&(0,g.jsx)(u.rA,{icon:"edit",title:"可视化编辑",onClick:()=>{ee("edit",M[1].props.context)}}),(0,g.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(M[1].props.context)}})]}),H.length>0&&(0,g.jsxs)("div",{children:[s(b.oV.systemd)&&(0,g.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,g.jsx)(u.rA,{icon:"print",title:"打印日志",onClick:()=>{J(H[0].props.context)}}),s(b.oV.systemd)&&(0,g.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&&(L({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(""),L({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,g.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,g.jsxs)(i.xh,{children:[K&&(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.VP,{widthPer:80,children:(0,g.jsx)(r.uF,{title:`systemd系统单元(${I.length})`,titleCom:(0,g.jsx)(y.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);N(e)}else N(ne)}}),children:(0,g.jsx)(h.X,{headers:A,rows:I,width:"10rem"})})})}),0===$.length&&!K&&(0,g.jsx)(F.h,{context:"没有管理的单元 or 加载中请等待..."}),0!==$.length&&!K&&(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.VP,{widthPer:80,children:(0,g.jsx)(r.uF,{title:`filecat监控单元(${$.length})`,titleCom:(0,g.jsx)(y.Sm,{placeholder:"过滤单元",value:Z,handleInputChange:e=>{D(e)}}),children:(0,g.jsx)(h.X,{headers:k,rows:$,width:"10rem"})})})})]}),(0,g.jsx)(R,{})]})}function ce(){const{t:e}=(0,p.Bd)(),[,t]=(0,m.fp)(f.AG.confirm),[,s]=(0,m.fp)(f.AG.prompt_card),[c,o]=(0,n.useState)([]),[l,j]=(0,n.useState)("ufw"),[w,v]=(0,n.useState)("tcp"),[k,S]=(0,n.useState)(""),[b,C]=(0,n.useState)(""),[A,P]=(0,n.useState)(""),[V,$]=(0,n.useState)([]),[Y,I]=(0,n.useState)("list"),[N,M]=(0,n.useState)(!1),E=async()=>{const e=await a.V_.get("status");if(e.code===x.m.Success){const t=e.data??[];o(t);const s=t.find(e=>e.installed);s&&!0!==t.find(e=>e.id===l)?.installed&&j(s.id)}},K=async()=>{M(!0);try{if("ufw"===l){const[e,t]=await Promise.all([a.V_.get(`rules?backend=${l}`),a.V_.get("ufw/rules")]);e.code===x.m.Success&&P(e.data??""),t.code===x.m.Success&&$(t.data??[])}else{const e=await a.V_.get(`rules?backend=${l}`);e.code===x.m.Success&&P(e.data??"")}}catch(e){P(""),$([])}finally{M(!1)}};(0,n.useEffect)(()=>{E()},[]),(0,n.useEffect)(()=>{l&&K()},[l]);const B=!0===c.find(e=>e.id===l)?.installed,H=!0===c.find(e=>e.id===l)?.active;return(0,g.jsxs)("div",{children:[(0,g.jsxs)(d.A,{left_children:(0,g.jsx)("span",{className:"header-title",children:e("防火墙")}),children:[(0,g.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},children:[(0,g.jsxs)("span",{style:{whiteSpace:"nowrap"},children:[e("后端"),":"]}),(0,g.jsx)("button",{className:"button button--flat "+("ufw"===l?"":"button--grey"),disabled:!0!==c.find(e=>"ufw"===e.id)?.installed,onClick:()=>j("ufw"),children:"ufw"}),(0,g.jsx)("button",{className:"button button--flat "+("nft"===l?"":"button--grey"),disabled:!0!==c.find(e=>"nft"===e.id)?.installed,onClick:()=>j("nft"),children:"nftables"})]}),B&&(0,g.jsx)(u.rA,{icon:"power_settings_new",title:e(H?"停用":"启用"),onClick:()=>(async t=>{try{const s=await a.V_.post("enable",{backend:l,enabled:t});if(s.code!==x.m.Success)return void(0,_.zN)(s.message||e("操作失败"));(0,_.SK)(s.data||e(t?"已启用":"已停用")),E(),K()}catch(e){}})(!H)}),(0,g.jsx)(u.rA,{icon:"refresh",title:e("刷新规则"),onClick:K})]}),(0,g.jsxs)(i.xh,{children:[(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.VP,{widthPer:100,children:(0,g.jsx)(r.Zp,{title:e("状态"),children:(0,g.jsx)("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap"},children:c.map(t=>(0,g.jsxs)("div",{style:{padding:"0.6rem 0.8rem",minWidth:"12rem",border:"1px solid var(--border-color)",borderRadius:"0.4rem"},children:[(0,g.jsx)("div",{style:{fontWeight:"bold"},children:"ufw"===t.id?"ufw":"nftables"}),(0,g.jsxs)("div",{children:[e("已安装"),": ",(0,g.jsx)(r.xP,{context:t.installed?(0,g.jsx)("span",{style:{color:"green"},children:"✓"}):(0,g.jsx)("span",{style:{color:"red"},children:"✗"})})]}),(0,g.jsxs)("div",{children:[e("已启用"),": ",(0,g.jsx)(r.xP,{context:t.active?(0,g.jsx)("span",{style:{color:"green"},children:"✓"}):(0,g.jsx)("span",{style:{color:"gray"},children:"✗"})})]}),(0,g.jsx)("div",{style:{color:"gray",fontSize:"0.8rem"},children:t.note})]},t.id))})})})}),(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.VP,{widthPer:100,children:(0,g.jsx)(r.uF,{title:e("端口放行 / 禁用"),children:(0,g.jsxs)("div",{style:{display:"flex",gap:"0.6rem",alignItems:"center",flexWrap:"wrap"},children:[(0,g.jsx)(y.l6,{options:[{title:"tcp",value:"tcp"},{title:"udp",value:"udp"}],value:w,onChange:e=>v(e),defaultValue:"tcp"}),(0,g.jsx)(y.Sm,{placeholder:e("端口号"),value:k,handleInputChange:e=>S(e),width:"10rem"}),(0,g.jsx)(y.Sm,{placeholder:e("来源地址(可选)"),value:b,handleInputChange:e=>C(e),width:"12rem"}),(0,g.jsx)(u.rA,{icon:"info",title:e("信息"),onClick:()=>{s({open:!0,title:e("信息"),context_div:(0,g.jsx)("div",{children:e("来源地址填写说明")})})}}),(0,g.jsx)(u.C3,{text:e("放行"),clickFun:async()=>{if(k.trim())try{const t=await a.V_.post("rule/add",{backend:l,proto:w,port:k.trim(),from:b.trim()||void 0});if(t.code!==x.m.Success)return void(0,_.zN)(t.message||e("操作失败"));(0,_.SK)(t.data||e("已放行")),K()}catch(e){}else(0,_.zN)(e("请填写端口号"))}}),(0,g.jsx)(u.C3,{text:e("禁用"),clickFun:async()=>{if(k.trim())try{const t=await a.V_.post("rule/del",{backend:l,proto:w,port:k.trim(),from:b.trim()||void 0});if(t.code!==x.m.Success)return void(0,_.zN)(t.message||e("操作失败"));(0,_.SK)(t.data||e("已禁用放行")),K()}catch(e){}else(0,_.zN)(e("请填写端口号"))}})]})})})}),(0,g.jsx)(i.fI,{children:(0,g.jsx)(i.VP,{widthPer:100,children:(0,g.jsxs)(r.uF,{title:`${e("规则列表")} (${l})`,titleCom:"ufw"===l?(0,g.jsxs)("div",{style:{display:"flex",gap:"0.4rem"},children:[(0,g.jsx)(u.C3,{text:e("名单视图"),clickFun:()=>I("list")}),(0,g.jsx)(u.C3,{text:e("文本视图"),clickFun:()=>I("text")})]}):void 0,children:[N&&(0,g.jsx)(F.h,{context:e("加载中...")}),!N&&"ufw"===l&&"list"===Y&&(0===V.length?(0,g.jsx)(F.h,{context:e("暂无规则")}):(0,g.jsx)(h.X,{headers:[e("编号"),e("目标(To)"),e("动作"),e("来源(From)"),e("备注"),e("操作")],rows:V.map(s=>[s.number,(0,g.jsx)(r.xP,{context:s.to,tip_context:s.to}),s.action,s.from?(0,g.jsx)(r.xP,{context:s.from,tip_context:s.from}):"",s.description||"",(0,g.jsx)(u.rA,{icon:"delete",title:e("删除规则"),onClick:()=>(async s=>{t({open:!0,title:e("确定删除该规则吗?"),sub_title:`${e("规则编号")} ${s}`,handle:async()=>{try{const n=await a.V_.post("ufw/rule/del",{number:s});if(t({open:!1,handle:null}),n.code!==x.m.Success)return void(0,_.zN)(n.message||e("操作失败"));(0,_.SK)(n.data||e("已删除")),K()}catch(e){}}})})(s.number)})]),width:"8rem"})),!N&&("ufw"!==l||"text"===Y)&&(A?(0,g.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-all",fontSize:"0.85rem",margin:0},children:A}):(0,g.jsx)(F.h,{context:e("暂无规则")}))]})})})]})]})}function oe(e){const{t}=(0,p.Bd)(),[s,n]=(0,m.fp)(f.AG.user_base_info),r=[{index:1,name:t("系统性能"),rto:"sys/",component:(0,g.jsx)(Y,{})},{index:2,name:t("系统进程"),rto:"process/",component:(0,g.jsx)(L,{})},{index:3,name:t("docker容器"),rto:"docker/",component:(0,g.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,g.jsx)(re,{})});(s.user_data?.is_root||(s.user_data?.auth_list??[]).includes(b.oV.firewall))&&r.push({index:5,name:t("防火墙"),rto:"firewall/",component:(0,g.jsx)(ce,{})})}return(0,g.jsx)(i.W1,{optionList:r,father_route:H.o.info})}}}]);
|
|
File without changes
|