This commit is contained in:
Benjamin Toby
2024-11-06 07:52:57 +01:00
parent 0a32750faa
commit 319af16fff
318 changed files with 389 additions and 25460 deletions
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1973],{71889:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/su/console",function(){return t(73794)}])},73794:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return h},default:function(){return x}});var l=t(85893),o=t(67294),s=t(85313),i=t(828),r=t(53920),c=t(47568),a=t(97582);function u(){return(u=(0,c.Z)((function(e){var n,l,o,s,i,r,c,u,d,f,m,h;return(0,a.__generator)(this,(function(a){return n=e.socket,l=t(12320).Terminal,o=t(12617).FitAddon,s=new o,i=document.getElementById("terminalWrapper"),r=document.getElementById("terminal"),c=i.clientWidth,u=Math.round(c/12),(d=new l({cols:u,rows:6})).open(r),s.fit(),n.on("console",(function(e){d.write(e)})),f=new o,m=document.getElementById("shell"),(h=new l({cols:u,rows:17})).open(m),f.fit(),n.on("shell",(function(e){h.write(e)})),h.onKey((function(e,t){n.emit("shell",e.key)})),[2,d]}))}))).apply(this,arguments)}var d=t(48531),f=!1;function m(e){var n=e.socketDomain,t=(0,i.Z)(o.useState(null),2),s=t[0],c=t[1],a=(0,i.Z)(o.useState(null),2),m=a[0],h=a[1],x=(0,i.Z)(o.useState(""),2),v=x[0],g=x[1];return o.useEffect((function(){var e=n;if(console.log("Socket Domain =>",e),e){var t=(0,r.io)(e,{extraHeaders:{"X-Socket-Paradigm":"Console"}});t.on("connect",(function(){c(t),console.log("Socket Connected!")})),setInterval((function(){t.emit("get-log")}),1e3),t.on("console-log",(function(e){console.log("Fetched Log",e),g(e.replace((0,d.Z)(),"")),setTimeout((function(){var e=document.getElementById("logHistoryWrapper");e&&!f&&(e.scrollTop=e.scrollHeight)}),200)}))}}),[]),o.useEffect((function(){if(s)return function(e){return u.apply(this,arguments)}({socket:s}).then((function(e){h(e)})),function(){var e,n;null===(e=document.getElementById("terminal"))||void 0===e||e.childNodes.forEach((function(e){var n;null===(n=e.parentNode)||void 0===n||n.removeChild(e)})),null===(n=document.getElementById("shell"))||void 0===n||n.childNodes.forEach((function(e){var n;null===(n=e.parentNode)||void 0===n||n.removeChild(e)})),null===m||void 0===m||m.dispose()}}),[s]),(0,l.jsxs)(o.Fragment,{children:[(0,l.jsxs)("div",{className:"w-full justify-between",children:[(0,l.jsx)("h2",{className:"text-2xl m-0",children:"Console"}),(0,l.jsx)("button",{onClick:function(e){s&&s.emit("log","Logging to the console")},children:"Log console"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-6 w-full items-stretch",children:[(0,l.jsx)("section",{className:"paper bg-slate-900",id:"terminalWrapper",children:(0,l.jsxs)("div",{className:"flex flex-col w-full gap-10 items-start justify-start terminal",children:[(0,l.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,l.jsx)("h2",{className:"m-0 text-white text-base",children:"Server Log"}),(0,l.jsx)("hr",{className:"opacity-20"}),(0,l.jsx)("div",{id:"terminal",className:"relative grow z-50 overflow-hidden w-full h-[150px]"})]}),(0,l.jsxs)("div",{className:"flex flex-col items-start w-full",children:[(0,l.jsx)("h2",{className:"m-0 text-white text-base",children:"Shell"}),(0,l.jsx)("hr",{className:"opacity-20"}),(0,l.jsx)("div",{id:"shell",className:"relative grow z-50 overflow-hidden w-full h-[340px]"})]})]})}),(0,l.jsxs)("section",{className:"paper",children:[(0,l.jsxs)("div",{className:"flex w-full justify-between",children:[(0,l.jsx)("h2",{className:"m-0 text-2xl",children:"Log History"}),(0,l.jsx)("button",{className:"outlined smallest gray",onClick:function(e){window.confirm("Clear Log History?")&&s&&s.emit("clear-log")},children:"Clear Log"})]}),(0,l.jsx)("hr",{}),(0,l.jsx)("div",{className:"w-full max-h-[500px] overflow-auto",id:"logHistoryWrapper",style:{scrollBehavior:"smooth"},onMouseEnter:function(){return f=!0},onMouseLeave:function(){return f=!1},children:(0,l.jsx)("pre",{className:"block",children:v})})]})]})]})}t(56500);var h=!0;function x(e){var n=e.user,t=(e.data,e.socketDomain),o=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:"Console | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Databases Console"})]});return(0,l.jsx)(s.Z,{head:o,user:n,children:(0,l.jsx)(m,{socketDomain:t})})}}},function(e){e.O(0,[6142,493,5313,9774,2888,179],(function(){return n=71889,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
@@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3753],{31893:function(n,e,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/su/error-logs",function(){return r(31300)}])},96251:function(n,e,r){"use strict";r.d(e,{Z:function(){return u}});var t=r(828),o=r(85893),s=r(67294),i=r(86729),a=r(95264);function u(n){var e=function(){(0,i.Z)("/api/admin/grabErrorLogs").then((function(n){var e;"string"!==typeof n.log||(null===(e=n.log)||void 0===e?void 0:e.match(/./))?c(n.log.replace(/\n|\r|\n\r|\\n/gm,"<br/>")):c("No Logs Yet")}))},r=(0,t.Z)(s.useState(null),2),u=r[0],c=r[1],l=(0,t.Z)(s.useState(!1),2),d=l[0],f=l[1],h=(0,t.Z)(s.useState(0),2),g=h[0],p=h[1];return s.useEffect((function(){e(),0===g&&setInterval((function(){e()}),1e4)}),[g]),(0,o.jsxs)(s.Fragment,{children:[(0,o.jsxs)("div",{className:"w-full justify-between",children:[(0,o.jsx)("h2",{className:"text-xl m-0",children:"Error Logs"}),(0,o.jsx)("div",{children:(0,o.jsxs)("button",{onClick:function(n){window.confirm("Clear Error Logs?")&&(f(!0),(0,i.Z)("/api/admin/clearErrorLogs","post").then((function(n){console.log(n),p((function(n){return n+1}))})),setTimeout((function(){f(!1)}),2e3))},className:"outlined gray relative",children:[d&&(0,o.jsx)(a.Z,{width:"20px"}),"Clear Error Log"]})})]}),(0,o.jsxs)("section",{className:"paper",children:[u&&(0,o.jsx)("p",{dangerouslySetInnerHTML:{__html:u||"No Log"}}),!u&&(0,o.jsx)(a.Z,{position:"relative",width:"25px"})]})]})}},31300:function(n,e,r){"use strict";r.r(e),r.d(e,{__N_SSP:function(){return i},default:function(){return a}});var t=r(85893),o=(r(67294),r(85313)),s=(r(44187),r(96251)),i=!0;function a(n){var e=n.user,r=(n.data,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,t.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}));return(0,t.jsx)(o.Z,{head:r,user:e,children:(0,t.jsx)(s.Z,{})})}}},function(n){n.O(0,[5313,3695,9774,2888,179],(function(){return e=31893,n(n.s=e);var e}));var e=n.O();_N_E=e}]);
@@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7570],{20343:function(e,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/su/login",function(){return n(54211)}])},54211:function(e,s,n){"use strict";n.r(s),n.d(s,{__N_SSP:function(){return a},default:function(){return o}});var i=n(85893),l=(n(67294),n(9008)),t=n.n(l),r=n(86729),a=!0;function o(e){e.user;var s=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("title",{children:"Super User Login | Datasquirel"}),(0,i.jsx)("meta",{name:"description",content:"Welcome to your data app"})]});return(0,i.jsxs)("section",{className:"w-full h-screen justify-center items-center",children:[(0,i.jsx)(t(),{children:s}),(0,i.jsxs)("div",{className:"p-6 bg-slate-100 rounded w-full max-w-2xl flex flex-col items-center",children:[(0,i.jsx)(c,{}),(0,i.jsxs)("form",{onSubmit:function(e){e.preventDefault();var s=e.target;(0,r.Z)("/api/admin/loginSuUser",{method:"post",body:{email:s.email.value,password:s.password.value,authKey:s["auth-key"].value}}).then((function(e){window.location.reload()}))},className:"flex flex-col items-stretch gap-4 w-full",children:[(0,i.jsx)("input",{type:"text",name:"email",id:"email",placeholder:"Email Address"}),(0,i.jsx)("input",{type:"password",name:"password",id:"password",placeholder:"Password"}),(0,i.jsx)("input",{type:"password",name:"auth-key",id:"auth-key",placeholder:"Auth Key"}),(0,i.jsx)("button",{children:"Login"})]})]})]})}function c(){return(0,i.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center",children:[(0,i.jsx)("h1",{className:"text-2xl text-center m-0",children:"Super User Login"}),(0,i.jsxs)("span",{children:["This area is reserved only for the owner of this Admin. To login use the info in your ",(0,i.jsx)("b",{children:"dsql.env"})," File. Use the env variables as follows. Your ",(0,i.jsx)("i",{children:"email address"})," is the same address used to register the first user account"]}),(0,i.jsxs)("ul",{className:"p-0",children:[(0,i.jsxs)("li",{children:["Password:"," ",(0,i.jsx)("i",{className:"info small w-auto inline",children:"dsql.env::"}),(0,i.jsx)("b",{children:" USER_KEY"})]}),(0,i.jsxs)("li",{children:["Auth Key:"," ",(0,i.jsx)("i",{className:"info small w-auto inline",children:"dsql.env::"}),(0,i.jsx)("b",{children:" SPECIAL_KEY"})]})]})]})}}},function(e){e.O(0,[9774,2888,179],(function(){return s=20343,e(e.s=s);var s}));var s=e.O();_N_E=s}]);
File diff suppressed because one or more lines are too long