1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
"use strict";exports.id=5392,exports.ids=[5392],exports.modules={53926:(e,s,t)=>{t.d(s,{A:()=>i});var a=t(8732),n=t(82015),r=t.n(n);function i({confirmedDelegetedUser:e,linksArray:s,user:t}){let[n,i]=r().useState(s||null);return n&&n[1]?(0,a.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:n.map((e,s,t)=>s===n.length-1?(0,a.jsx)("a",{href:e.path,className:"text-slate-400 dark:text-slate-500 pointer-events-none",children:e.title},s):(0,a.jsxs)(r().Fragment,{children:[(0,a.jsx)("a",{href:e.path,className:"query-url",children:e.title}),(0,a.jsx)("span",{className:"opacity-20",children:"|"})]},s))}):(0,a.jsx)(r().Fragment,{})}},87639:(e,s,t)=>{t.d(s,{A:()=>x});var a=t(8732),n=t(82015),r=t.n(n);t(46169);var i=t(72390),l=t(16757),c=t(66916),d=t(66918),o=t(23293);function x(){let[e,s]=r().useState(!0),[t,n]=r().useState(0),[x,m]=r().useState(0);return e?(0,a.jsx)("div",{className:"button ghost small-text",style:{height:"30px"},children:(0,a.jsx)(l.A,{width:"15px",position:"relative"})}):(0,a.jsx)(r().Fragment,{children:t?(0,a.jsxs)("div",{className:"button ghost small-text normal-weight p-0",style:{height:"30px",padding:0},onClick:e=>{s(!0),(0,i.A)().then(()=>{m(e=>e+1),s(!1)})},children:[e&&(0,a.jsx)(l.A,{width:"15px"}),(0,a.jsx)(c.A,{size:20,className:"text-slate-400 mr-[3px]"}),(0,a.jsx)("span",{className:"font-bold text-slate-700 dark:text-white",children:t&&t.toFixed(2)}),(0,a.jsx)("span",{className:"text-slate-500",children:"mb"}),(0,a.jsx)(d.A,{size:17,className:"text-slate-400",strokeWidth:2})]}):(0,a.jsxs)("span",{className:"text-sm info gray font-normal w-auto",children:[(0,a.jsx)(o.A,{}),(0,a.jsx)("span",{children:"No Disk Usage Data Available Yet"})]})})}},92702:(e,s,t)=>{t.r(s),t.d(s,{default:()=>c});var a=t(71934),n=t(71205),r=t(29021),i=t.n(r),l=t(41939);async function c(e,s,t){let{keyCookieName:r,csrfCookieName:c}=(0,l.A)();if(!e.cookies?.[r]?.match(/./))return null;let d=(0,n.A)({encryptedString:e.cookies[r]});if(!d)return null;let o=JSON.parse(d);if(!o.csrf_k||t&&!Object.keys(e.headers).find(e=>e.includes(o.csrf_k)))return null;let x=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!x)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i().existsSync(`${x}/${o.csrf_k}`))return null;if(0==o.verification_status&&!t){let e=await (0,a.A)(`SELECT verification_status FROM users WHERE id='${o.id}'`);e&&e[0]&&1==e[0].verification_status&&s.setHeader("Set-Cookie",["user_refresh=1"])}return o?.date&&Date.now()-o.date>6048e5?null:o}},72390:(e,s,t)=>{t.d(s,{A:()=>n});var a=t(46169);async function n(){let e=await (0,a.A)("/api/getDiskUsage");localStorage.setItem("disk_usage",e.total)}},89923:(e,s,t)=>{t.d(s,{A:()=>a});function a(e,s){return s?!!(e?.id&&String(e?.id)==(process.env.DSQL_SU_USER_ID||"1")):!!(e?.id&&"1"==String(e?.id))}},25562:(e,s,t)=>{t.d(s,{A:()=>N});var a=t(8732),n=t(82015),r=t.n(n),i=t(27912),l=t.n(i),c=t(50139),d=t(52070),o=t(34637),x=t(83158),m=t(25294),h=t(92441),u=t(29743),p=t(10643),j=t(10321),g=t(89923);function f({user:e}){let[s,t]=r().useState(!0);return(0,a.jsxs)("aside",{className:"aside"+(s?" mobile-collapsed":" mobile-expanded"),children:[(0,a.jsx)(c.A,{adminAside:!0,collapseAsideMobile:s,setCollapseAsideMobile:t}),(0,a.jsx)("hr",{className:"opacity-0 mt-4"}),(0,a.jsxs)("div",{className:"main-links"+(s?" hidden lg:flex":" "),children:[(0,a.jsxs)("a",{href:"/admin","data-currentlink":"/admin","data-strictlink":"true",children:[(0,a.jsx)(d.A,{size:20}),(0,a.jsx)("span",{children:"Dashboard"})]}),(0,a.jsxs)("a",{href:`/admin/${e?.id}/databases`,"data-currentlink":`/admin/${e?.id}/databases`,children:[(0,a.jsx)(o.A,{size:20}),(0,a.jsx)("span",{children:"Databases"})]}),(0,a.jsxs)("a",{href:`/admin/${e?.id}/media`,"data-currentlink":`/admin/${e?.id}/media`,children:[(0,a.jsx)(x.A,{size:20}),(0,a.jsx)("span",{children:"Media"})]}),(0,a.jsxs)("a",{href:`/admin/${e?.id}/users`,"data-currentlink":`/admin/${e?.id}/users`,children:[(0,a.jsx)(m.A,{size:20}),(0,a.jsx)("span",{children:"Users"})]}),(0,a.jsxs)("a",{href:`/admin/${e?.id}/schema`,"data-currentlink":`/admin/${e?.id}/schema`,children:[(0,a.jsx)(h.A,{size:20}),(0,a.jsx)("span",{children:"Schema"})]}),(0,a.jsxs)("a",{href:`/admin/${e?.id}/api-keys`,"data-currentlink":`/admin/${e?.id}/api-keys`,children:[(0,a.jsx)(u.A,{size:20}),(0,a.jsx)("span",{children:"API Keys"})]}),(0,a.jsxs)("a",{href:`/admin/${e?.id}/connect`,"data-currentlink":`/admin/${e?.id}/connect`,children:[(0,a.jsx)(p.A,{size:20}),(0,a.jsx)("span",{children:"Connect"})]}),(0,g.A)(e)&&(0,a.jsx)(r().Fragment,{children:(0,a.jsxs)("a",{href:"/su","data-currentlink":"/su",children:[(0,a.jsx)(j.A,{size:20}),(0,a.jsx)("span",{children:"Super Admin User"})]})}),(0,a.jsx)("hr",{className:"opacity-80"}),(0,a.jsxs)("div",{className:"flex-col gap-0 items-start w-full",children:[(0,a.jsx)("a",{href:`/admin/${e?.id}/settings`,"data-currentlink":`/admin/${e?.id}/settings`,children:(0,a.jsx)("span",{children:"Settings"})}),(0,a.jsx)("a",{href:"/docs","data-currentlink":"/docs",target:"_blank",children:(0,a.jsx)("span",{children:"Documentation"})}),(0,a.jsx)("a",{href:"/logout","data-currentlink":"/logout",children:(0,a.jsx)("span",{children:"Logout"})})]})]})]})}var v=t(192);function y({user:e,extraHeaderContent:s}){let[t,n]=r().useState(e||null);return(0,a.jsx)("section",{className:"overflow-visible w-full px-0 md:px-8 py-0 flex justify-center bg-white dark:bg-slate-800 shadow-lg gap-4 dark:shadow-black/10 shadow-slate-900/5 relative z-[100]",style:{zIndex:700,border:"none"},children:(0,a.jsxs)("div",{className:"w-full items-center justify-between gap-4 md:gap-8",children:[(0,a.jsxs)("div",{className:"hidden xl:flex flex-col items-stretch grow fixed xl:static top-0 right-0 px-4 xl:px-0 shadow-xl xl:shadow-none h-screen xl:h-auto overflow-auto xl:overflow-visible w-screen sl:w-auto bg-white xl:bg-transparent pb-10 xl:pb-0",id:"main-nav-content-wrapper",children:[(0,a.jsxs)("div",{className:"items-center mb-2 flex xl:hidden",children:[(0,a.jsx)("a",{href:"/",className:"hidden xl:flex",children:(0,a.jsx)("img",{src:"/images/logo-icon-alt-2.png",alt:"Logo Icon",width:37})}),(0,a.jsx)("button",{className:"outlined gray ml-auto",onClick:e=>{let s=document.getElementById("main-nav-content-wrapper");s?.classList.toggle("hidden")},style:{border:"none"},children:(0,a.jsx)("span",{className:"font-semibold text-4xl",children:"✕"})})]}),(0,a.jsxs)("div",{className:"flex items-center w-full gap-6 grow flex-col xl:flex-row justify-start xl:justify-between",children:[(0,a.jsx)("div",{className:"gap-6",children:s}),(0,a.jsx)(v.A,{activeUser:t})]})]}),(0,a.jsxs)("button",{className:"bg-transparent w-16 p-4 gap-1.5 flex xl:hidden flex-col hover:bg-transparent transition-all ml-auto",onClick:e=>{let s=document.getElementById("main-nav-content-wrapper");s?.classList.toggle("hidden")},style:{minWidth:"50px",backgroundColor:"transparent"},id:"main-header-hamburger-button","aria-label":"Mobile Hambutget Button",children:[(0,a.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"}),(0,a.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"}),(0,a.jsx)("div",{className:"w-full h-1 bg-slate-600 dark:bg-slate-400 rounded-full"})]})]})})}t(27550);var _=t(87639);function N({children:e,head:s,user:t,productionEnvironment:n,extraHeaderContent:i,aceEditor:d}){return i||(i=(0,a.jsx)(_.A,{})),(0,a.jsxs)(r().Fragment,{children:[(0,a.jsxs)(l(),{children:[s,(0,a.jsxs)(r().Fragment,{children:[(0,a.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js",integrity:"sha512-q6CTB0jS+VuJnSct82rVcWlI06LGzNjaG3CWenHWVUncRvc4UQMFkA3a5Ip880xr+lBx38FcHDclOxPdSg+sBw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),(0,a.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js",integrity:"sha512-6g6cvocV7eT/J8L44lL8gJKqq9onqQeYGgJO0DmrsYFcCfRl6wYkYA/KHS768r4QVTB4JxsCcMQ9gIezxpTCZw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"})]})]}),(0,a.jsxs)("div",{className:"admin w-full flex items-start gap-0",children:[(0,a.jsx)(f,{user:t}),(0,a.jsxs)("main",{className:"relative",children:[(0,a.jsx)(y,{user:t,extraHeaderContent:i}),(0,a.jsx)("div",{className:"admin-content relative z-10",children:e}),(0,a.jsx)("footer",{className:"flex justify-center w-full items-center p-4",children:(0,a.jsxs)("div",{className:"max-w-6xl w-full justify-center flex-wrap",children:[(0,a.jsx)("div",{className:"flex items-center gap-2 scale-75",children:(0,a.jsx)(c.A,{})}),(0,a.jsx)("span",{className:"opacity-25",children:"|"}),(0,a.jsxs)("span",{className:"text-sm text-slate-400 dark:text-slate-600 text-center",children:[new Date().getFullYear()," \xa9 Datasquirel. All rights reserved."]}),(0,a.jsx)("span",{className:"opacity-25",children:"|"}),(0,a.jsx)("a",{href:"/docs",children:"Docs"}),(0,a.jsx)("span",{className:"opacity-25",children:"|"}),(0,a.jsx)("a",{href:"/terms",children:"Terms"})]})})]})]})]})}t(46169)},41939:(e,s,t)=>{t.d(s,{A:()=>a});function a(e){let s=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",a=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",r=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=s;e?.userId&&(i+=`user_${e.userId}_`),r&&(i+=`${r}_`),i+=t;let l=s;e?.userId&&(l+=`user_${e.userId}_`),r&&(l+=`${r}_`),l+=a;let c=s;return e?.userId&&(c+=`user_${e.userId}_`),r&&(c+=`${r}_`),{keyCookieName:i,csrfCookieName:l,oneTimeCodeName:c+=n}}},71205:(e,s,t)=>{t.d(s,{A:()=>r});var a=t(55511),n=t(79428);function r({encryptedString:e,encryptionKey:s,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let r=s||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!r?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=(0,a.scryptSync)(r,i,l),d=n.Buffer.alloc(16,0),o=(0,a.createDecipheriv)("aes-192-cbc",c,d);try{let s=o.update(e,"hex","utf8");return s+=o.final("utf8")}catch(s){return console.log("Error in decrypting =>",s.message),e}}},71934:(e,s,t)=>{t.d(s,{A:()=>a});async function a(...e){let s=global.DSQL_DB_CONN;try{if(!s)throw Error("No Connection provided to DB_HANDLER function!");let t=await s.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await s?.end()}}},5583:(e,s,t)=>{t.r(s),t.d(s,{default:()=>r});var a=t(8732);t(82015);var n=t(20883);function r(){return(0,a.jsxs)(n.Html,{lang:"en",children:[(0,a.jsxs)(n.Head,{children:[(0,a.jsx)("meta",{name:"author",content:"Datasquirel"}),(0,a.jsx)("meta",{name:"Copyright",content:`Copyright (c) ${new Date().getFullYear()} Datasquirel`}),"dev_dev".match(/dev/)&&(0,a.jsx)("meta",{name:"robots",content:"noindex,nofollow"}),(0,a.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com/",crossOrigin:"anonymous"}),(0,a.jsx)("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),(0,a.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Poppins"}),(0,a.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Inter"}),(0,a.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=IBM+Plex+Mono"}),(0,a.jsx)("script",{src:"/scripts/themeSelector.js"}),(0,a.jsx)("meta",{httpEquiv:"Content-Type",content:"text/html; charset=UTF-8"}),(0,a.jsx)("meta",{property:"og:site_name",content:"DATASQUIREL"}),(0,a.jsx)("meta",{property:"og:type",content:"website"}),(0,a.jsx)("meta",{name:"twitter:card",content:"summary"}),(0,a.jsx)("meta",{property:"og:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,a.jsx)("meta",{itemProp:"image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,a.jsx)("meta",{name:"twitter:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,a.jsx)("link",{rel:"stylesheet",href:"/styles/prism.css"}),(0,a.jsx)("script",{src:"/scripts/prism.js",async:!0}),(0,a.jsx)("script",{dangerouslySetInnerHTML:{__html:"var DSQL = {}"}})]}),(0,a.jsxs)("body",{children:[(0,a.jsx)(n.Main,{}),(0,a.jsx)(n.NextScript,{})]})]})}}}; |