1 line
8.2 KiB
JavaScript
1 line
8.2 KiB
JavaScript
"use strict";(()=>{var e={};e.id=7122,e.ids=[3220,7122],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,s){return s in t?t[s]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,s)):"function"==typeof t&&"default"===s?t:void 0}}})},9247:(e,t,s)=>{s.r(t),s.d(t,{config:()=>D,default:()=>y,getServerSideProps:()=>b,getStaticPaths:()=>E,getStaticProps:()=>j,reportWebVitals:()=>A,routeModule:()=>k,unstable_getServerProps:()=>I,unstable_getServerSideProps:()=>M,unstable_getStaticParams:()=>N,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>L});var r={};s.r(r),s.d(r,{default:()=>P,getServerSideProps:()=>v});var n=s(63865),a=s(9455),o=s(30671),i=s(49407),c=s(89600),l=s(8732),u=s(82015),p=s.n(u),m=s(27912),d=s.n(m),g=s(29021),f=s.n(g);s(63715),s(76601);var _=s(32415),h=s(6505),x=s.n(h);let S=s(20048);function P({user:e,query:t}){let s=(0,l.jsxs)(p().Fragment,{children:[(0,l.jsx)("title",{children:"Loging Out | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Login you out"}),(0,l.jsx)("script",{src:"https://accounts.google.com/gsi/client"}),(0,l.jsx)("script",{src:"https://connect.facebook.net/en_US/sdk.js",crossOrigin:"anonymous"})]});return(0,l.jsxs)(p().Fragment,{children:[(0,l.jsx)(d(),{children:s}),(0,l.jsx)("main",{className:"w-screen h-screen flex items-center justify-center p-4 md:p-8",children:(0,l.jsxs)("div",{className:"card max-w-md flex-col items-center bg-white p-6 rounded border border-slate-200 border-solid",children:[(0,l.jsxs)("a",{href:"/",className:"flex items-center gap-2",children:[(0,l.jsx)("img",{src:"/images/logo-icon-alt-2.png",alt:"Logo Icon",width:37}),(0,l.jsx)("span",{className:"font-bold text-2xl",children:"Datasquirel"})]}),(0,l.jsx)("h3",{className:"text-lg m-0 mt-4 text-slate-400",children:"Logging out"}),(0,l.jsx)(_.A,{position:"relative",width:"20px"})]})})]})}async function v({req:e,res:t,query:s}){let r=await S(e,t);if(r){console.log(r.csrf_k);try{let e=process.env.DSQL_USER_LOGIN_KEYS_PATH,t=`${e}/${r.csrf_k}`;console.log("allowedAuthKeyPath",t),f().unlinkSync(t)}catch(e){console.log(`Logout API error: ${e.message}`)}}let{keyCookieName:n,csrfCookieName:a}=x()();return t.setHeader("Set-Cookie",[`${n}=none;max-age=0`,`${a}=null;max-age=0`]),{props:{user:r,logged_out:!0,query:s}}}let y=(0,o.M)(r,"default"),j=(0,o.M)(r,"getStaticProps"),E=(0,o.M)(r,"getStaticPaths"),b=(0,o.M)(r,"getServerSideProps"),D=(0,o.M)(r,"config"),A=(0,o.M)(r,"reportWebVitals"),L=(0,o.M)(r,"unstable_getStaticProps"),O=(0,o.M)(r,"unstable_getStaticPaths"),N=(0,o.M)(r,"unstable_getStaticParams"),I=(0,o.M)(r,"unstable_getServerProps"),M=(0,o.M)(r,"unstable_getServerSideProps"),k=new n.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/logout",pathname:"/logout",bundlePath:"",filename:""},components:{App:c.default,Document:i.default},userland:r})},20048:(e,t,s)=>{s(81630);let r=s(67216),n=s(77463),a=s(29021),o=s(6505);async function i(e,t,s,i){let{keyCookieName:c,csrfCookieName:l}=o();if(!e.cookies?.[c]?.match(/./))return null;let u=n({encryptedString:e.cookies[c]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||s&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.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(s&&!a.existsSync(`${m}/${p.csrf_k}`))return null;if(0==p.verification_status&&!s){let e=await r(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=i},76601:(e,t,s)=>{s.d(t,{A:()=>r});async function r(){try{let e=await caches.keys();e[0]&&await Promise.all(e.map(e=>caches.delete(e)))}catch(e){console.log("Error in clearing cache =>",e.message)}}},6505:e=>{e.exports=function(e){let t=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",r=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=t;e?.userId&&(n+=`user_${e.userId}_`),e?.database&&(n+=`${e.database}_`),n+=s;let a=t;return e?.userId&&(a+=`user_${e.userId}_`),e?.database&&(a+=`${e.database}_`),{keyCookieName:n,csrfCookieName:a+=r}}},77463:(e,t,s)=>{let{scryptSync:r,createDecipheriv:n}=s(55511),{Buffer:a}=s(79428);e.exports=({encryptedString:e,encryptionKey:t,encryptionSalt:s})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=t||process.env.DSQL_ENCRYPTION_PASSWORD,i=s||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=n("aes-192-cbc",r(o,i,c),a.alloc(16,0));try{let t=l.update(e,"hex","utf8");return t+=l.final("utf8")}catch(t){return console.log("Error in decrypting =>",t.message),e}}},67216:(e,t,s)=>{let r=s(9973),n=s(31976),a=r({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:n()}});async function o(...e){try{let t=await a.query(...e);return await a.end(),JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},31976:(e,t,s)=>{let r=s(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let t=`${e}/ca-cert.pem`;if(!r.existsSync(t)){console.log(`${t} does not exist`);return}return{ca:r.readFileSync(`${e}/ca-cert.pem`)}}},49407:(e,t,s)=>{s.r(t),s.d(t,{default:()=>a});var r=s(8732);s(82015);var n=s(20883);function a(e){return(0,r.jsxs)(n.Html,{lang:"en",children:[(0,r.jsxs)(n.Head,{children:[(0,r.jsx)("meta",{name:"author",content:"Datasquirel"}),(0,r.jsx)("meta",{name:"Copyright",content:`Copyright (c) ${new Date().getFullYear()} Datasquirel`}),"dev_dev".match(/dev/)&&(0,r.jsx)("meta",{name:"robots",content:"noindex,nofollow"}),(0,r.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com/",crossOrigin:"anonymous"}),(0,r.jsx)("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Poppins"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Inter"}),(0,r.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=IBM+Plex+Mono"}),(0,r.jsx)("script",{src:"/scripts/themeSelector.js"}),(0,r.jsx)("meta",{httpEquiv:"Content-Type",content:"text/html; charset=UTF-8"}),(0,r.jsx)("meta",{property:"og:site_name",content:"DATASQUIREL"}),(0,r.jsx)("meta",{property:"og:type",content:"website"}),(0,r.jsx)("meta",{name:"twitter:card",content:"summary"}),(0,r.jsx)("meta",{property:"og:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("meta",{itemProp:"image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("meta",{name:"twitter:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,r.jsx)("link",{rel:"stylesheet",href:"/styles/prism.css"}),(0,r.jsx)("script",{src:"/scripts/prism.js",async:!0}),(0,r.jsx)("script",{dangerouslySetInnerHTML:{__html:"var DSQL = {}"}})]}),(0,r.jsxs)("body",{children:[(0,r.jsx)(n.Main,{}),(0,r.jsx)(n.NextScript,{})]})]})}},9455:(e,t)=>{var s;Object.defineProperty(t,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")}};var t=require("../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[883,9821,9600],()=>s(9247));module.exports=r})(); |