1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"use strict";exports.id=7070,exports.ids=[7070],exports.modules={58548:(e,s,t)=>{t.d(s,{A:()=>i});var a=t(8732),r=t(82015),n=t.n(r);function i({confirmedDelegetedUser:e,linksArray:s,user:t}){e?.delegated,e?.priviledges?.match(/Edit Tables/i),e?.priviledges?.match(/Delete Tables/i),e?.priviledges?.match(/Create Tables/i);let[r,i]=n().useState(s||null);return r&&r[1]?(0,a.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:r.map((e,s,t)=>s===r.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)(n().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)(n().Fragment,{})}},36605:(e,s,t)=>{t.d(s,{A:()=>x});var a=t(8732),r=t(82015),n=t.n(r);t(63715);var i=t(86152),l=t(32415),c=t(66916),o=t(66918),d=t(23293);function x(e){let[s,t]=n().useState(!0),[r,x]=n().useState(0),[m,h]=n().useState(0);return s?(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)(n().Fragment,{children:r?(0,a.jsxs)("div",{className:"button ghost small-text normal-weight p-0",style:{height:"30px",padding:0},onClick:e=>{t(!0),(0,i.A)().then(()=>{h(e=>e+1),t(!1)})},children:[s&&(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:r&&r.toFixed(2)}),(0,a.jsx)("span",{className:"text-slate-500",children:"mb"}),(0,a.jsx)(o.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)(d.A,{}),(0,a.jsx)("span",{children:"No Disk Usage Data Available Yet"})]})})}},20048:(e,s,t)=>{t(81630);let a=t(67216),r=t(77463),n=t(29021),i=t(6505);async function l(e,s,t,l){let{keyCookieName:c,csrfCookieName:o}=i();if(!e.cookies?.[c]?.match(/./))return null;let d=r({encryptedString:e.cookies[c]});if(!d)return null;let x=JSON.parse(d);if(!x.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${x.csrf_k}`)))return null;let m=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!m)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!n.existsSync(`${m}/${x.csrf_k}`))return null;if(0==x.verification_status&&!t){let e=await a(`SELECT verification_status FROM users WHERE id='${x.id}'`);e&&e[0]&&1==e[0].verification_status&&s.setHeader("Set-Cookie",["user_refresh=1"])}return x?.date&&Date.now()-x.date>6048e5?null:x}e.exports=l},86152:(e,s,t)=>{t.d(s,{A:()=>r});var a=t(63715);async function r(){let e=await (0,a.A)("/api/getDiskUsage");localStorage.setItem("disk_usage",e.total)}},72377:e=>{e.exports=function(e,s){return s?e?.id&&String(e?.id)==(process.env.DSQL_SU_USER_ID||"1")&&"true":e?.id&&"1"==String(e?.id)&&"true"}},95222:(e,s,t)=>{t.d(s,{A:()=>N});var a=t(8732),r=t(82015),n=t.n(r),i=t(27912),l=t.n(i);t(64699);var c=t(93353),o=t(52070),d=t(34637),x=t(83158),m=t(25294),h=t(92441),u=t(29743),p=t(10643),j=t(10321),g=t(72377),f=t.n(g);function v({user:e}){let[s,t]=n().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)(o.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)(d.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"})]}),f()(e)&&(0,a.jsx)(n().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"})})]})]})]})}t(20681);var _=t(49538);function S({user:e,extraHeaderContent:s}){let[t,r]=n().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)(_.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(54896);var y=t(36605);function N({children:e,head:s,user:t,productionEnvironment:r,extraHeaderContent:i,aceEditor:o}){return i||(i=(0,a.jsx)(y.A,{})),(0,a.jsxs)(n().Fragment,{children:[(0,a.jsxs)(l(),{children:[s,(0,a.jsxs)(n().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)(v,{user:t}),(0,a.jsxs)("main",{className:"relative",children:[(0,a.jsx)(S,{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(63715),t(28133)},6505:e=>{e.exports=function(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",r=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",n=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=s;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let l=s;e?.userId&&(l+=`user_${e.userId}_`),n&&(l+=`${n}_`),l+=a;let c=s;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:i,csrfCookieName:l,oneTimeCodeName:c+=r}}},77463:(e,s,t)=>{let{scryptSync:a,createDecipheriv:r}=t(55511),{Buffer:n}=t(79428);e.exports=({encryptedString:e,encryptionKey:s,encryptionSalt:t})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let i=s||process.env.DSQL_ENCRYPTION_PASSWORD,l=t||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!i?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let o=r("aes-192-cbc",a(i,l,c),n.alloc(16,0));try{let s=o.update(e,"hex","utf8");return s+=o.final("utf8")}catch(s){return console.log("Error in decrypting =>",s.message),e}}},67216:(e,s,t)=>{let a=t(9973),r=t(31976),n=a({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:r()}});async function i(...e){try{let s=await n.query(...e);return await n.end(),JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},31976:(e,s,t)=>{let a=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let s=`${e}/ca-cert.pem`;if(!a.existsSync(s)){console.log(`${s} does not exist`);return}return{ca:a.readFileSync(`${e}/ca-cert.pem`)}}},49407:(e,s,t)=>{t.r(s),t.d(s,{default:()=>n});var a=t(8732);t(82015);var r=t(20883);function n(e){return(0,a.jsxs)(r.Html,{lang:"en",children:[(0,a.jsxs)(r.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)(r.Main,{}),(0,a.jsx)(r.NextScript,{})]})]})}}}; |