1 line
4.4 KiB
JavaScript
1 line
4.4 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[890],{25292:function(e,l,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/shell",function(){return s(30904)}])},40806:function(e,l,s){"use strict";s.d(l,{Z:function(){return h}});var n=s(85893),r=s(93452),t=s(76242),i=s(36969),a=s(25808),c=s(94495),u=s(57493),o=s(94655),d=s(3668),f=s(60),p=s(67294),m=s(98388);function h(e){let{url:l,wrapperProps:s,title:h,...x}=e,{loading:j,setLoading:g}=(0,a.Z)();return(0,n.jsx)(r.Z,{...s,className:(0,m.m6)("p-0",null==s?void 0:s.className),children:(0,n.jsxs)(f.Z,{className:"gap-0",children:[(0,n.jsxs)(o.Z,{className:"p-4 w-full justify-between",children:[(0,n.jsx)(o.Z,{children:h?(0,n.jsx)(p.Fragment,{children:(0,n.jsx)(d.Z,{size:"small",variant:"faded",children:h})}):null}),(0,n.jsxs)(o.Z,{children:[(0,n.jsx)(c.Z,{title:"Open Full Screen",variant:"ghost",className:"p-1!",href:l,target:"_blank",children:(0,n.jsx)(i.Z,{name:"ArrowUpRight",size:20})}),(0,n.jsx)(c.Z,{title:"Refresh Iframe",variant:"ghost",className:"p-1!",loading:j,onClick:()=>{g(!0),setTimeout(()=>{g(!1)},2e3)},loadingProps:{size:"smaller"},children:(0,n.jsx)(i.Z,{name:"RotateCcw",size:18})})]})]}),(0,n.jsx)("hr",{}),j?(0,n.jsx)(u.Z,{className:"w-full p-10 h-[400px]",children:(0,n.jsx)(t.Z,{})}):(0,n.jsx)("iframe",{...x,src:l,className:(0,m.m6)("w-full h-[400px]",x.className)})]})})}},30904:function(e,l,s){"use strict";s.r(l),s.d(l,{__N_SSP:function(){return g},default:function(){return v}});var n=s(85893),r=s(67294),t=s(5606),i=s(60705),a=s(33028),c=s(60),u=s(71077),o=s(76242),d=s(57493),f=s(40806),p=s(25808);function m(e){let{paradigm:l}=e,{pageProps:s,ws:i}=(0,r.useContext)(t.AppContext),{user:a}=s,m=a.super_admin?"root":a.username,h="pm2-logs"==l?"pm2 logs":a.super_admin?"bash":m?"su - ".concat(m,' -c "bash"'):void 0,{data:x}=(0,u.Z)(),[j,g]=(0,r.useState)(),{refresh:v,setRefresh:Z}=(0,p.Z)(),N=(0,r.useRef)(!1);function w(){(null==j?void 0:j.port)&&i.sendData({event:"client:kill-port",port:j.port})}return(0,r.useEffect)(()=>{if((null==i?void 0:i.socket)&&!N.current)return i.sendData({event:"pm2-logs"==l?"client:relay-pm2-logs":"client:relay-shell",cmd:h}),N.current=!0,function(){w()}},[i,v]),(0,r.useEffect)(()=>{N.current&&(w(),g(void 0),N.current=!1,Z(e=>e+1))},[]),(0,r.useEffect)(()=>{!j&&("shell"==l&&(null==x?void 0:x.event)=="server:relay-shell"&&(null==x?void 0:x.ttyd)||"pm2-logs"==l&&(null==x?void 0:x.event)=="server:relay-pm2-logs"&&(null==x?void 0:x.ttyd))&&setTimeout(()=>{g(x.ttyd?{...x.ttyd,href:"".concat(window.location.origin).concat(x.ttyd.url)}:void 0)},2e3)},[x]),(0,n.jsxs)(c.Z,{className:"gap-0 w-full",children:[(null==j?void 0:j.url)&&j.port?(0,n.jsx)(c.Z,{className:"gap-0",children:(0,n.jsx)(f.Z,{url:null==j?void 0:j.url,title:"pm2-logs"==l?"Admin Logs":"Relay Shell",wrapperProps:{className:"border-none"}})}):(0,n.jsx)(d.Z,{className:"p-10 h-[460px]",children:(0,n.jsx)(o.Z,{})}),(0,n.jsx)("hr",{})]})}function h(){let{pageProps:e}=(0,r.useContext)(t.AppContext),{user:l}=e;return(0,n.jsxs)(c.Z,{className:"w-full nested-grid-frame xl:grid-cols-2",children:[(0,n.jsx)(c.Z,{className:"grid-cell w-full",children:(0,n.jsx)(m,{paradigm:"shell"})}),l.super_admin?(0,n.jsx)(c.Z,{className:"grid-cell w-full",children:(0,n.jsx)(m,{paradigm:"pm2-logs"})}):null]})}function x(){let{pageProps:e}=(0,r.useContext)(t.AppContext);return(0,n.jsxs)(r.Fragment,{children:[(0,n.jsx)(a.Z,{title:"Shell",description:(0,n.jsx)(n.Fragment,{children:"Access the relay server shell"})}),(0,n.jsx)(i.Z,{}),(0,n.jsx)(h,{})]})}var j=s(89350),g=!0;function v(){return(0,n.jsx)(j.Z,{children:(0,n.jsx)(x,{})})}},93452:function(e,l,s){"use strict";s.d(l,{Z:function(){return t}});var n=s(85893),r=s(98388);function t(e){let{spacing:l,componentRef:s,...t}=e;return(0,n.jsx)("div",{...t,className:(0,r.m6)("relative flex items-center gap-2 border border-solid rounded-default","border-slate-200 dark:border-white/10",l?"normal"==l?"px-3 py-2":"tight"==l?"px-2 py-1":"":"px-3 py-2","twui-border",t.className),ref:s,children:t.children})}},57493:function(e,l,s){"use strict";s.d(l,{Z:function(){return t}});var n=s(85893),r=s(98388);function t(e){let{...l}=e;return(0,n.jsx)("div",{...l,className:(0,r.m6)("flex flex-col items-center justify-center gap-4 p-2 w-full","h-full twui-center",l.className),children:l.children})}},9008:function(e,l,s){e.exports=s(23867)}},function(e){e.O(0,[662,75,664,433,7,910,888,774,179],function(){return e(e.s=25292)}),_N_E=e.O()}]); |