This commit is contained in:
Benjamin Toby 2025-01-14 08:24:54 +01:00
parent 885c11f674
commit 1564c2811a
106 changed files with 200 additions and 200 deletions

View File

@ -1 +1 @@
Vwi6iXhX7A60Ca2R9JTQV
BYGBoTeiBrkCn0j6XrihZ

View File

@ -5,8 +5,8 @@
"devFiles": [],
"ampDevFiles": [],
"lowPriorityFiles": [
"static/Vwi6iXhX7A60Ca2R9JTQV/_buildManifest.js",
"static/Vwi6iXhX7A60Ca2R9JTQV/_ssgManifest.js"
"static/BYGBoTeiBrkCn0j6XrihZ/_buildManifest.js",
"static/BYGBoTeiBrkCn0j6XrihZ/_ssgManifest.js"
],
"rootMainFiles": [],
"rootMainFilesTree": {},
@ -117,7 +117,7 @@
"static/chunks/8261-3c3582fc434ee275.js",
"static/chunks/7391-b72414be460cf0f0.js",
"static/chunks/8076-c34ce8d8512255e7.js",
"static/chunks/3867-14d00e04cb2d431b.js",
"static/chunks/3867-2967250ea22dd40a.js",
"static/chunks/pages/admin/[user_id]/databases/[single]/edit-database-1f2bf0df5f51fa43.js"
],
"/admin/[user_id]/databases/[single]/schema": [
@ -307,7 +307,7 @@
"static/chunks/main-96e9b4333635008a.js",
"static/chunks/8261-3c3582fc434ee275.js",
"static/chunks/7391-b72414be460cf0f0.js",
"static/chunks/3867-14d00e04cb2d431b.js",
"static/chunks/3867-2967250ea22dd40a.js",
"static/chunks/pages/admin/[user_id]/databases/add-database-276c7177adf6be55.js"
],
"/admin/[user_id]/media": [

View File

@ -1,7 +1,7 @@
{
"telemetry": {
"notifiedAt": "1736836792870",
"anonymousId": "12c333b099226b7f06961f90752c741fa77dd65469741f760bc699718e048ad1",
"salt": "fe4ed0064e0b02598414a60bf810fba6"
"notifiedAt": "1736839426953",
"anonymousId": "4d1be282580018eb008e2249955feed0c6237277a0e637a83767a4769b152164",
"salt": "1a9e1de1f27111c95fb831cf98c2802f"
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":4,"routes":{},"dynamicRoutes":{"/docs/[page]/[sub-page]":{"routeRegex":"^/docs/([^/]+?)/([^/]+?)(?:/)?$","dataRoute":"/_next/data/Vwi6iXhX7A60Ca2R9JTQV/docs/[page]/[sub-page].json","fallback":false,"dataRouteRegex":"^/_next/data/Vwi6iXhX7A60Ca2R9JTQV/docs/([^/]+?)/([^/]+?)\\.json$","allowHeader":["host","x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/[page]":{"routeRegex":"^/docs/([^/]+?)(?:/)?$","dataRoute":"/_next/data/Vwi6iXhX7A60Ca2R9JTQV/docs/[page].json","fallback":false,"dataRouteRegex":"^/_next/data/Vwi6iXhX7A60Ca2R9JTQV/docs/([^/]+?)\\.json$","allowHeader":["host","x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]}},"notFoundRoutes":[],"preview":{"previewModeId":"2531335e345d8dc29e5d06aa705cd30c","previewModeSigningKey":"82eb6532cdbba0a9333716dc3a732c969674cd6875aebf01723092bdb6aca757","previewModeEncryptionKey":"84629edda918ff69e82e4c66cbcb476e4f069bbdbd7fb70df4945c104a31342d"}}
{"version":4,"routes":{},"dynamicRoutes":{"/docs/[page]":{"routeRegex":"^/docs/([^/]+?)(?:/)?$","dataRoute":"/_next/data/BYGBoTeiBrkCn0j6XrihZ/docs/[page].json","fallback":false,"dataRouteRegex":"^/_next/data/BYGBoTeiBrkCn0j6XrihZ/docs/([^/]+?)\\.json$","allowHeader":["host","x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/[page]/[sub-page]":{"routeRegex":"^/docs/([^/]+?)/([^/]+?)(?:/)?$","dataRoute":"/_next/data/BYGBoTeiBrkCn0j6XrihZ/docs/[page]/[sub-page].json","fallback":false,"dataRouteRegex":"^/_next/data/BYGBoTeiBrkCn0j6XrihZ/docs/([^/]+?)/([^/]+?)\\.json$","allowHeader":["host","x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]}},"notFoundRoutes":[],"preview":{"previewModeId":"311f02c94fe2ce6c8f3ed66832b010db","previewModeSigningKey":"035a8b4bc9a45fe20fc043f15dffd5a4b03e900b6e69589d922a1d3fef332a87","previewModeEncryptionKey":"e1dc138ce91f686804ec5d4ab11797095ebeeadfb17b3d28ea93ef5a5d3296cd"}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/404-386ef30594132ecb.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_buildManifest.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/404","query":{},"buildId":"Vwi6iXhX7A60Ca2R9JTQV","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/404-386ef30594132ecb.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_buildManifest.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/404","query":{},"buildId":"BYGBoTeiBrkCn0j6XrihZ","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/500-81f6b715960091f2.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_buildManifest.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/500","query":{},"buildId":"Vwi6iXhX7A60Ca2R9JTQV","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/500-81f6b715960091f2.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_buildManifest.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/500","query":{},"buildId":"BYGBoTeiBrkCn0j6XrihZ","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/3298-73758aefe44233a6.js" defer=""></script><script src="/_next/static/chunks/pages/about-69331c972566352a.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_buildManifest.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/about","query":{},"buildId":"Vwi6iXhX7A60Ca2R9JTQV","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/3298-73758aefe44233a6.js" defer=""></script><script src="/_next/static/chunks/pages/about-69331c972566352a.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_buildManifest.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/about","query":{},"buildId":"BYGBoTeiBrkCn0j6XrihZ","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=8935,e.ids=[8935],e.modules={27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},34042:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>m,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>p});var i=t(89947),a=t(2706),n=t(96762),o=t(69842),l=t(67619),d=t(27825),u=t.n(d),c=t(48786),_=t(98e3);async function p(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,o.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=u().cloneDeep(e.body),i=s.inviting_user_id,a=s.invited_user_email,n=s.database_access,d=s.priviledge;try{let e=await (0,c.A)("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[i,t.id,t.email]);if(e&&e[0])return r.json({success:!1});let s=await (0,_.A)({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:i,invited_user_id:t.id,database_access:n,user_priviledge:d,user_type:"admin",first_name:t.first_name,last_name:t.last_name,email:t.email,username:t.first_name,image:t.image,image_thumbnail:t.image_thumbnail}});await (0,c.A)("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[i,a]);let o=await (0,c.A)("SELECT db_tables_data FROM invitations WHERE inviting_user_id=?",[i]);if(await (0,c.A)(`DELETE FROM delegated_user_tables WHERE root_user_id='${i}' AND delegated_user_id='${t.id}'`),o&&o[0]){let e=o[0].db_tables_data.split("|");for(let r=0;r<e.length;r++){let[s,a]=e[r].split("-");await (0,_.A)({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:t.id,root_user_id:i,database:s,table:a,priviledge:d}})}}r.json({success:!!s?.insertId})}catch(s){(0,l.A)({component:"/api/acceptUserInvitation/catch-error",message:s.message,user:t,req:e}),r.json({success:!1})}}let m=(0,n.M)(s,"default"),E=(0,n.M)(s,"config"),f=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/acceptUserInvitation",pathname:"/api/acceptUserInvitation",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(48786),i=t(95969),a=t(29021),n=t.n(a),o=t(89159);async function l(e,r,t){try{let{keyCookieName:a,csrfCookieName:l}=(0,o.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let d=(0,i.A)({encryptedString:e.cookies[a]});if(!d)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(d);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let c=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!n().existsSync(`${c}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",i=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),n+=t;let o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=s;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),{keyCookieName:n,csrfCookieName:o,oneTimeCodeName:l+=i}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),i=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let n=new Date,o=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],i=t||s||r||a.socket.remoteAddress;if(!i)return null;return String(i)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=8935,e.ids=[8935],e.modules={27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},34042:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>m,routeModule:()=>E});var s={};t.r(s),t.d(s,{default:()=>p});var i=t(89947),a=t(2706),n=t(96762),o=t(69842),l=t(67619),u=t(27825),d=t.n(u),c=t(48786),_=t(98e3);async function p(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,o.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=d().cloneDeep(e.body),i=s.inviting_user_id,a=s.invited_user_email,n=s.database_access,u=s.priviledge;try{let e=await (0,c.A)("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[i,t.id,t.email]);if(e&&e[0])return r.json({success:!1});let s=await (0,_.A)({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:i,invited_user_id:t.id,database_access:n,user_priviledge:u,user_type:"admin",first_name:t.first_name,last_name:t.last_name,email:t.email,username:t.first_name,image:t.image,image_thumbnail:t.image_thumbnail}});await (0,c.A)("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[i,a]);let o=await (0,c.A)("SELECT db_tables_data FROM invitations WHERE inviting_user_id=?",[i]);if(await (0,c.A)(`DELETE FROM delegated_user_tables WHERE root_user_id='${i}' AND delegated_user_id='${t.id}'`),o&&o[0]){let e=o[0].db_tables_data.split("|");for(let r=0;r<e.length;r++){let[s,a]=e[r].split("-");await (0,_.A)({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:t.id,root_user_id:i,database:s,table:a,priviledge:u}})}}r.json({success:!!s?.insertId})}catch(s){(0,l.A)({component:"/api/acceptUserInvitation/catch-error",message:s.message,user:t,req:e}),r.json({success:!1})}}let m=(0,n.M)(s,"default"),f=(0,n.M)(s,"config"),E=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/acceptUserInvitation",pathname:"/api/acceptUserInvitation",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(48786),i=t(95969),a=t(29021),n=t.n(a),o=t(89159);async function l(e,r,t){try{let{keyCookieName:a,csrfCookieName:l}=(0,o.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,i.A)({encryptedString:e.cookies[a]});if(!u)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(u);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let c=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!n().existsSync(`${c}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",i=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),n+=t;let o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=s;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),{keyCookieName:n,csrfCookieName:o,oneTimeCodeName:l+=i}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),i=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let n=new Date,o=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],i=t||s||r||a.socket.remoteAddress;if(!i)return null;return String(i)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}
@ -13,4 +13,4 @@ Date: ${n.toDateString()}
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(55511),i=t(79428);function a({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=r||process.env.DSQL_ENCRYPTION_PASSWORD,n=t||process.env.DSQL_ENCRYPTION_SALT,o=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!n?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=(0,s.scryptSync)(a,n,o),d=i.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",l,d);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[1251],()=>t(34042));module.exports=s})();
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(55511),i=t(79428);function a({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=r||process.env.DSQL_ENCRYPTION_PASSWORD,n=t||process.env.DSQL_ENCRYPTION_SALT,o=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!n?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=(0,s.scryptSync)(a,n,o),u=i.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",l,u);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[1251],()=>t(34042));module.exports=s})();

View File

@ -1,16 +1,16 @@
"use strict";(()=>{var e={};e.id=9785,e.ids=[9785],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},92145:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>u,routeModule:()=>c});var s={};t.r(s),t.d(s,{default:()=>l});var i=t(89947),a=t(2706),n=t(96762),o=t(69842),d=t(49941);async function l(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,o.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});console.log("Invitation Received by current logged in user, Loggin in VIA API ...");let s=await (0,d.A)({query:e.body.query,user:t});r.json({success:!0,result:s})}let u=(0,n.M)(s,"default"),_=(0,n.M)(s,"config"),c=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/addAdminUserUser",pathname:"/api/addAdminUserUser",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>d});var s=t(48786),i=t(95969),a=t(29021),n=t.n(a),o=t(89159);async function d(e,r,t){try{let{keyCookieName:a,csrfCookieName:d}=(0,o.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,i.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!n().existsSync(`${_}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},49941:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(67619),i=t(48786),a=t(98e3),n=t(7971);async function o({query:e,user:r,useLocal:t}){try{let s=t?n.A:i.A,{invite:o,database_access:d,priviledge:l,email:u}=e,_=[o,u],c=await s("SELECT date_created_code FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",_);if(!c||!c[0])throw Error("No Invitation Found");let E=[o],m=await s("SELECT first_name,last_name,email FROM users WHERE id=?",E);if(m?.[0]){let e=await s("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[o,r.id,u]);if(e?.[0])console.log("User already added");else{(0,a.A)({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:o,invited_user_id:r.id,database_access:d,first_name:r.first_name,last_name:r.last_name,phone:r.phone,email:r.email,username:r.username,user_type:"admin",user_priviledge:l,image:r.image,image_thumbnail:r.image_thumbnail},useLocal:t});let e=await s("SELECT db_tables_data FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",[o,u]);if(await s("DELETE FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=?",[o,r.id]),e&&e[0]){let s=e[0].db_tables_data.split("|");for(let e=0;e<s.length;e++){let[i,n]=s[e].split("-");await (0,a.A)({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:r.id,root_user_id:o,database:i,table:n,priviledge:l},useLocal:t})}}}await s("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[o,u])}}catch(e){(0,s.A)({component:"addAdminUserOnLogin",message:e.message,user:r})}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",i=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),n+=t;let o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=s;let d=r;return e?.userId&&(d+=`user_${e.userId}_`),a&&(d+=`${a}_`),{keyCookieName:n,csrfCookieName:o,oneTimeCodeName:d+=i}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),i=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let n=new Date,o=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],i=t||s||r||a.socket.remoteAddress;if(!i)return null;return String(i)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=9785,e.ids=[9785],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},92145:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>u,routeModule:()=>c});var i={};t.r(i),t.d(i,{default:()=>l});var s=t(89947),a=t(2706),n=t(96762),o=t(69842),d=t(49941);async function l(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,o.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});console.log("Invitation Received by current logged in user, Loggin in VIA API ...");let i=await (0,d.A)({query:e.body.query,user:t});r.json({success:!0,result:i})}let u=(0,n.M)(i,"default"),_=(0,n.M)(i,"config"),c=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/addAdminUserUser",pathname:"/api/addAdminUserUser",bundlePath:"",filename:""},userland:i})},69842:(e,r,t)=>{t.d(r,{A:()=>d});var i=t(48786),s=t(95969),a=t(29021),n=t.n(a),o=t(89159);async function d(e,r,t){try{let{keyCookieName:a,csrfCookieName:d}=(0,o.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!n().existsSync(`${_}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,i.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},49941:(e,r,t)=>{t.d(r,{A:()=>o});var i=t(67619),s=t(48786),a=t(98e3),n=t(7971);async function o({query:e,user:r,useLocal:t}){try{let i=t?n.A:s.A,{invite:o,database_access:d,priviledge:l,email:u}=e,_=[o,u],c=await i("SELECT date_created_code FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",_);if(!c||!c[0])throw Error("No Invitation Found");let E=[o],m=await i("SELECT first_name,last_name,email FROM users WHERE id=?",E);if(m?.[0]){let e=await i("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[o,r.id,u]);if(e?.[0])console.log("User already added");else{(0,a.A)({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:o,invited_user_id:r.id,database_access:d,first_name:r.first_name,last_name:r.last_name,phone:r.phone,email:r.email,username:r.username,user_type:"admin",user_priviledge:l,image:r.image,image_thumbnail:r.image_thumbnail},useLocal:t});let e=await i("SELECT db_tables_data FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",[o,u]);if(await i("DELETE FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=?",[o,r.id]),e&&e[0]){let i=e[0].db_tables_data.split("|");for(let e=0;e<i.length;e++){let[s,n]=i[e].split("-");await (0,a.A)({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:r.id,root_user_id:o,database:s,table:n,priviledge:l},useLocal:t})}}}await i("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[o,u])}}catch(e){(0,i.A)({component:"addAdminUserOnLogin",message:e.message,user:r})}}},89159:(e,r,t)=>{t.d(r,{A:()=>i});function i(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",i=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),n+=t;let o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=i;let d=r;return e?.userId&&(d+=`user_${e.userId}_`),a&&(d+=`${a}_`),{keyCookieName:n,csrfCookieName:o,oneTimeCodeName:d+=s}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var i=t(29021),s=t.n(i);async function a({user:e,message:r,component:t,noMail:i,req:a}){let n=new Date,o=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],i=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||i||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let i=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(i+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),a?.url&&(s+=`
URL: ${a.url}`),a?.body&&(s+=`
Request Body: ${JSON.stringify(a.body,null,4)}`),o&&(s+=`
IP: ${o}`),s+=`
User Email: ${e?.email}`),a?.url&&(i+=`
URL: ${a.url}`),a?.body&&(i+=`
Request Body: ${JSON.stringify(a.body,null,4)}`),o&&(i+=`
IP: ${o}`),i+=`
Date: ${n.toDateString()}
========================================`,i().existsSync("./.tmp/error.log")||i().writeFileSync("./.tmp/error.log","","utf-8");let d=i().readFileSync("./.tmp/error.log","utf-8");i().writeFileSync("./.tmp/error.log",s),i().appendFileSync("./.tmp/error.log",`
========================================`,s().existsSync("./.tmp/error.log")||s().writeFileSync("./.tmp/error.log","","utf-8");let d=s().readFileSync("./.tmp/error.log","utf-8");s().writeFileSync("./.tmp/error.log",i),s().appendFileSync("./.tmp/error.log",`
${d}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(55511),i=t(79428);function a({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=r||process.env.DSQL_ENCRYPTION_PASSWORD,n=t||process.env.DSQL_ENCRYPTION_SALT,o=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!n?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,s.scryptSync)(a,n,o),l=i.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",d,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[1251],()=>t(92145));module.exports=s})();
${d}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>a});var i=t(55511),s=t(79428);function a({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=r||process.env.DSQL_ENCRYPTION_PASSWORD,n=t||process.env.DSQL_ENCRYPTION_SALT,o=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!n?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,i.scryptSync)(a,n,o),l=s.Buffer.alloc(16,0),u=(0,i.createDecipheriv)("aes-192-cbc",d,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),i=r.X(0,[1251],()=>t(92145));module.exports=i})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=1385,e.ids=[1385],e.modules={47795:e=>{e.exports=require("generate-password")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},15420:(e,r,t)=>{t.r(r),t.d(r,{config:()=>y,default:()=>E,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>m});var o=t(89947),n=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(47795),u=t.n(l),d=t(68829),_=t(67619),p=t(69842),f=t(98e3);async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,p.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{api_key_name:s,api_key_slug:o,api_key_scope:n,target_database:i,target_table:a}=e.body;if(!s?.match(/./)||!o?.match(/./)||!n?.match(/./))return r.json({success:!1,msg:"Wrong Input"});try{let e=process.env.DSQL_API_KEYS_PATH;if(!e)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");c().existsSync(e)||c().mkdirSync(e,{recursive:!0});let l=u().generate({length:24,numbers:!0,uppercase:!0,lowercase:!0,symbols:"-"})+"-"+Date.now(),_={user_id:t.id,date_code:Date.now(),sign:l,target_database:i,target_table:a};"fullAccess"==n&&(_={..._,full_access:!0});let p=(0,d.A)({data:JSON.stringify(_)});if(!p)return r.json({success:!1,msg:"Couldn't encrypt API key"});let m=(0,d.A)({data:p}),E={dbFullName:"datasquirel",tableName:"api_keys",data:{user_id:t.id,name:s,slug:o,key:m,scope:n}};l&&(E.data.csrf=l);let y=await (0,f.A)(E);if(!y.insertId)throw Error(y?.error||"Api Key Couldn't be added");c().writeFileSync(`${e}/${l}`,JSON.stringify(_),"utf-8"),r.json({success:!0})}catch(e){(0,_.A)({component:"/api/addApiKey/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!"})}}let E=(0,i.M)(s,"default"),y=(0,i.M)(s,"config"),S=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/addApiKey",pathname:"/api/addApiKey",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),o=t(95969),n=t(29021),i=t.n(n),a=t(89159);async function c(e,r,t){try{let{keyCookieName:n,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,o.A)({encryptedString:e.cookies[n]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=o}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),o=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let i=new Date,a=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],o=t||s||r||n.socket.remoteAddress;if(!o)return null;return String(o)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=1385,e.ids=[1385],e.modules={47795:e=>{e.exports=require("generate-password")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},15420:(e,r,t)=>{t.r(r),t.d(r,{config:()=>y,default:()=>E,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>m});var o=t(89947),n=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(47795),u=t.n(l),d=t(68829),_=t(67619),p=t(69842),f=t(98e3);async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,p.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{api_key_name:s,api_key_slug:o,api_key_scope:n,target_database:i,target_table:a}=e.body;if(!s?.match(/./)||!o?.match(/./)||!n?.match(/./))return r.json({success:!1,msg:"Wrong Input"});try{let e=process.env.DSQL_API_KEYS_PATH;if(!e)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");c().existsSync(e)||c().mkdirSync(e,{recursive:!0});let l=u().generate({length:24,numbers:!0,uppercase:!0,lowercase:!0,symbols:"-"})+"-"+Date.now(),_={user_id:t.id,date_code:Date.now(),sign:l,target_database:i,target_table:a};"fullAccess"==n&&(_={..._,full_access:!0});let p=(0,d.A)({data:JSON.stringify(_)});if(!p)return r.json({success:!1,msg:"Couldn't encrypt API key"});let m=(0,d.A)({data:p}),E={dbFullName:"datasquirel",tableName:"api_keys",data:{user_id:t.id,name:s,slug:o,key:m,scope:n}};l&&(E.data.csrf=l);let y=await (0,f.A)(E);if(!y.insertId)throw Error(y?.error||"Api Key Couldn't be added");c().writeFileSync(`${e}/${l}`,JSON.stringify(_),"utf-8"),r.json({success:!0})}catch(e){(0,_.A)({component:"/api/addApiKey/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!"})}}let E=(0,i.M)(s,"default"),y=(0,i.M)(s,"config"),S=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/addApiKey",pathname:"/api/addApiKey",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),o=t(95969),n=t(29021),i=t.n(n),a=t(89159);async function c(e,r,t){try{let{keyCookieName:n,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,o.A)({encryptedString:e.cookies[n]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=o}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),o=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let i=new Date,a=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],o=t||s||r||n.socket.remoteAddress;if(!o)return null;return String(o)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=9187,e.ids=[9187],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},3931:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>l,routeModule:()=>p});var t={};s.r(t),s.d(t,{default:()=>u});var a=s(89947),i=s(2706),o=s(96762),n=s(83919),d=s(69842),c=s(98e3);async function u(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await (0,d.A)(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{payload:s,dbFullName:t,dbId:a}=e.body,i=await (0,c.A)({dbContext:"Dsql User",paradigm:"Full Access",dbFullName:t,tableName:"users",data:(()=>{let e=Object.keys(s),r={};return e.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(r[e]=s[e])}),r.password=(0,n.A)({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:s.password}),r.email=s.email_address,r.image="/images/user-preset.png",r.image_thumbnail="/images/user-preset-thumbnail.png",delete r.email_address,r})()});r.json({success:!!i?.insertId,msg:"New User User Added",newUserId:i.insertId})}let l=(0,o.M)(t,"default"),_=(0,o.M)(t,"config"),p=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addDbUser",pathname:"/api/addDbUser",bundlePath:"",filename:""},userland:t})},69842:(e,r,s)=>{s.d(r,{A:()=>d});var t=s(48786),a=s(95969),i=s(29021),o=s.n(i),n=s(89159);async function d(e,r,s){try{let{keyCookieName:i,csrfCookieName:d}=(0,n.A)();if(!e.cookies?.[i]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,a.A)({encryptedString:e.cookies[i]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(s&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(s&&!o().existsSync(`${l}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!s){let e=await (0,t.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,s)=>{s.d(r,{A:()=>t});function t(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=s;let n=r;e?.userId&&(n+=`user_${e.userId}_`),i&&(n+=`${i}_`),n+=t;let d=r;return e?.userId&&(d+=`user_${e.userId}_`),i&&(d+=`${i}_`),{keyCookieName:o,csrfCookieName:n,oneTimeCodeName:d+=a}}},95969:(e,r,s)=>{s.d(r,{A:()=>i});var t=s(55511),a=s(79428);function i({encryptedString:e,encryptionKey:r,encryptionSalt:s}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let i=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=s||process.env.DSQL_ENCRYPTION_SALT,n=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(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,t.scryptSync)(i,o,n),c=a.Buffer.alloc(16,0),u=(0,t.createDecipheriv)("aes-192-cbc",d,c);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},83919:(e,r,s)=>{s.d(r,{A:()=>a});var t=s(55511);function a({password:e,encryptionKey:r}){let s=r||process.env.DSQL_ENCRYPTION_PASSWORD;if(!s?.match(/.{8,}/))throw Error("Encryption key is invalid");let a=(0,t.createHmac)("sha512",s);return a.update(e),a.digest("base64")}}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[1251],()=>s(3931));module.exports=t})();
"use strict";(()=>{var e={};e.id=9187,e.ids=[9187],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},3931:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>l,routeModule:()=>p});var t={};s.r(t),s.d(t,{default:()=>c});var a=s(89947),i=s(2706),o=s(96762),n=s(83919),d=s(69842),u=s(98e3);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await (0,d.A)(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{payload:s,dbFullName:t,dbId:a}=e.body,i=await (0,u.A)({dbContext:"Dsql User",paradigm:"Full Access",dbFullName:t,tableName:"users",data:(()=>{let e=Object.keys(s),r={};return e.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(r[e]=s[e])}),r.password=(0,n.A)({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:s.password}),r.email=s.email_address,r.image="/images/user-preset.png",r.image_thumbnail="/images/user-preset-thumbnail.png",delete r.email_address,r})()});r.json({success:!!i?.insertId,msg:"New User User Added",newUserId:i.insertId})}let l=(0,o.M)(t,"default"),_=(0,o.M)(t,"config"),p=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addDbUser",pathname:"/api/addDbUser",bundlePath:"",filename:""},userland:t})},69842:(e,r,s)=>{s.d(r,{A:()=>d});var t=s(48786),a=s(95969),i=s(29021),o=s.n(i),n=s(89159);async function d(e,r,s){try{let{keyCookieName:i,csrfCookieName:d}=(0,n.A)();if(!e.cookies?.[i]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,a.A)({encryptedString:e.cookies[i]});if(!u)throw Error("Couldn't decrypt auth cookie!");let c=JSON.parse(u);if(!c.csrf_k)throw Error("No `csrf_k` present in user Object!");if(s&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(s&&!o().existsSync(`${l}/${c.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==c.verification_status&&!s){let e=await (0,t.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(c?.date&&Date.now()-c.date>6048e5)throw Error("Key expired!");return c}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,s)=>{s.d(r,{A:()=>t});function t(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=s;let n=r;e?.userId&&(n+=`user_${e.userId}_`),i&&(n+=`${i}_`),n+=t;let d=r;return e?.userId&&(d+=`user_${e.userId}_`),i&&(d+=`${i}_`),{keyCookieName:o,csrfCookieName:n,oneTimeCodeName:d+=a}}},95969:(e,r,s)=>{s.d(r,{A:()=>i});var t=s(55511),a=s(79428);function i({encryptedString:e,encryptionKey:r,encryptionSalt:s}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let i=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=s||process.env.DSQL_ENCRYPTION_SALT,n=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(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,t.scryptSync)(i,o,n),u=a.Buffer.alloc(16,0),c=(0,t.createDecipheriv)("aes-192-cbc",d,u);try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},83919:(e,r,s)=>{s.d(r,{A:()=>a});var t=s(55511);function a({password:e,encryptionKey:r}){let s=r||process.env.DSQL_ENCRYPTION_PASSWORD;if(!s?.match(/.{8,}/))throw Error("Encryption key is invalid");let a=(0,t.createHmac)("sha512",s);return a.update(e),a.digest("base64")}}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[1251],()=>s(3931));module.exports=t})();

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,16 @@
"use strict";(()=>{var e={};e.id=3292,e.ids=[3292],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},10353:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>f,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>d});var o=t(89947),n=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(67619),u=t(69842);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbFullName:s,dbSlug:o,paradigm:n,platforms:i}=e.body;try{let e=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/env.json`;c().existsSync(e)||c().writeFileSync(e,"{}","utf8");let o=JSON.parse(c().readFileSync(e,"utf8")),a=o[s];a||(a={social:[]},o[s]=a);let l=a.social;l=[];for(let e=0;e<i.length;e++){let r=i[e],{clientId:t,clientSecret:s,domain1:o,domain2:a,callbackUrl:c}=r;if(n?.match(/personal/)&&!t?.match(/./))throw Error("Client Id Must be present");if(n?.match(/personal/)&&!s?.match(/./))throw Error("Client Secret Must be present");if(n?.match(/datasquirel/)&&!o?.match(/./))throw Error("Atleast one Domain Must be present");n?.match(/personal/)?l.push({platform:r.platform,paradigm:n,clientId:t,clientSecret:s,callbackUrl:c}):l.push({platform:r.platform,paradigm:n,domain1:o,domain2:a})}a.social=l,c().writeFileSync(e,JSON.stringify(o,null,4),"utf-8"),r.json({success:!0})}catch(e){console.log(e.message),(0,l.A)({component:"/api/addSocialLogin/catch-error",message:e.message,user:t}),r.json({success:!1,msg:e.message})}}let f=(0,i.M)(s,"default"),p=(0,i.M)(s,"config"),_=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/addSocialLogin",pathname:"/api/addSocialLogin",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),o=t(95969),n=t(29021),i=t.n(n),a=t(89159);async function c(e,r,t){try{let{keyCookieName:n,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,o.A)({encryptedString:e.cookies[n]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=o}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),o=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let i=new Date,a=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],o=t||s||r||n.socket.remoteAddress;if(!o)return null;return String(o)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=3292,e.ids=[3292],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},10353:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>f,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>d});var n=t(89947),o=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(67619),u=t(69842);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbFullName:s,dbSlug:n,paradigm:o,platforms:i}=e.body;try{let e=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/env.json`;c().existsSync(e)||c().writeFileSync(e,"{}","utf8");let n=JSON.parse(c().readFileSync(e,"utf8")),a=n[s];a||(a={social:[]},n[s]=a);let l=a.social;l=[];for(let e=0;e<i.length;e++){let r=i[e],{clientId:t,clientSecret:s,domain1:n,domain2:a,callbackUrl:c}=r;if(o?.match(/personal/)&&!t?.match(/./))throw Error("Client Id Must be present");if(o?.match(/personal/)&&!s?.match(/./))throw Error("Client Secret Must be present");if(o?.match(/datasquirel/)&&!n?.match(/./))throw Error("Atleast one Domain Must be present");o?.match(/personal/)?l.push({platform:r.platform,paradigm:o,clientId:t,clientSecret:s,callbackUrl:c}):l.push({platform:r.platform,paradigm:o,domain1:n,domain2:a})}a.social=l,c().writeFileSync(e,JSON.stringify(n,null,4),"utf-8"),r.json({success:!0})}catch(e){console.log(e.message),(0,l.A)({component:"/api/addSocialLogin/catch-error",message:e.message,user:t}),r.json({success:!1,msg:e.message})}}let f=(0,i.M)(s,"default"),p=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/addSocialLogin",pathname:"/api/addSocialLogin",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function c(e,r,t){try{let{keyCookieName:o,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[o]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=n}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(29021),n=t.n(s);async function o({user:e,message:r,component:t,noMail:s,req:o}){let i=new Date,a=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),n?.url&&(s+=`
URL: ${n.url}`),n?.body&&(s+=`
Request Body: ${JSON.stringify(n.body,null,4)}`),a&&(s+=`
User Email: ${e?.email}`),o?.url&&(s+=`
URL: ${o.url}`),o?.body&&(s+=`
Request Body: ${JSON.stringify(o.body,null,4)}`),a&&(s+=`
IP: ${a}`),s+=`
Date: ${i.toDateString()}
========================================`,o().existsSync("./.tmp/error.log")||o().writeFileSync("./.tmp/error.log","","utf-8");let c=o().readFileSync("./.tmp/error.log","utf-8");o().writeFileSync("./.tmp/error.log",s),o().appendFileSync("./.tmp/error.log",`
========================================`,n().existsSync("./.tmp/error.log")||n().writeFileSync("./.tmp/error.log","","utf-8");let c=n().readFileSync("./.tmp/error.log","utf-8");n().writeFileSync("./.tmp/error.log",s),n().appendFileSync("./.tmp/error.log",`
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(55511),o=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.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,s.scryptSync)(n,i,a),l=o.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",c,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=10353);module.exports=t})();
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 c=(0,s.scryptSync)(o,i,a),l=n.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",c,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=10353);module.exports=t})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=3812,e.ids=[3812],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},21572:e=>{e.exports=require("nodemailer")},72583:e=>{e.exports=require("sanitize-html")},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")},70955:(e,s,r)=>{r.r(s),r.d(s,{config:()=>m,default:()=>p,routeModule:()=>f});var t={};r.r(t),r.d(t,{default:()=>_});var a=r(89947),i=r(2706),n=r(96762),o=r(96052),d=r(69842),c=r(98e3),l=r(48786),u=r(83919);async function _(e,s){if("POST"!==e.method)return s.json({msg:"Failed!"});let r=await (0,d.A)(e,s,!0);if(!r)return s.json({success:!1,msg:"Unauthorized"});let t=e.body,a=t.paradigm;if(a?.match(/database/)){let e=await (0,c.A)({dbFullName:"datasquirel",tableName:"user_users",data:(()=>{let e=Object.keys(t),s={};return e.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(s[e]=t[e])}),s.user_id=r.id,s.password=(0,u.A)({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:t.password}),s.user_type="database",s.email=t.email_address,s.image="/images/user-preset.png",s.image_thumbnail="/images/user-preset-thumbnail.png",delete s.email_address,s})()});s.json({success:!!e?.insertId,msg:"New User User Added",newUserId:e.insertId})}else{if(r?.email===t.email_address)return s.json({success:!1,msg:"Can't Invite yourself"});let e=await (0,l.A)("SELECT * FROM invitations WHERE invited_user_email=? AND inviting_user_id=?",[t.email_address,r.id]);if(e&&e[0])return s.json({success:!1,msg:"User Already Invited"});await (0,c.A)({dbFullName:"datasquirel",tableName:"invitations",data:{inviting_user_id:r.id,invited_user_email:t.email_address,database_access:t.database_access,priviledge:t.priviledge,db_tables_data:t.db_tables}});let a=await (0,o.A)({to:t.email_address,subject:`${r.first_name} ${r.last_name} Invited you`,text:`${r.first_name} ${r.last_name} has invited you to manage a datasquirel account`,html:`
<h2>${r.first_name} ${r.last_name} has invited you to manage a datasquirel account.</h2>
<a href="${process.env.DSQL_HOST}/create-account?invite=${r.id}&database_access=${t.database_access}&priviledge=${t.priviledge}&email=${t.email_address}">Accept Invitation</a>
`});s.json({success:!!a?.accepted,msg:"This is an invitation request"})}}let p=(0,n.M)(t,"default"),m=(0,n.M)(t,"config"),f=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addUserUser",pathname:"/api/addUserUser",bundlePath:"",filename:""},userland:t})},69842:(e,s,r)=>{r.d(s,{A:()=>d});var t=r(48786),a=r(95969),i=r(29021),n=r.n(i),o=r(89159);async function d(e,s,r){try{let{keyCookieName:i,csrfCookieName:d}=(0,o.A)();if(!e.cookies?.[i]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,a.A)({encryptedString:e.cookies[i]});if(!c)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(c);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(r&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",l),Error("Deep Auth Failed. `csrf` key not found in request headers!");let u=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!u)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(r&&!n().existsSync(`${u}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!r){let e=await (0,t.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&s.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,s,r)=>{r.d(s,{A:()=>t});function t(e){let s=process.env.DSQL_COOKIES_PREFIX||"dsql_",r=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=s;e?.userId&&(n+=`user_${e.userId}_`),i&&(n+=`${i}_`),n+=r;let o=s;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=t;let d=s;return e?.userId&&(d+=`user_${e.userId}_`),i&&(d+=`${i}_`),{keyCookieName:n,csrfCookieName:o,oneTimeCodeName:d+=a}}},96052:(e,s,r)=>{r.d(s,{A:()=>o});var t=r(29021),a=r.n(t),i=r(21572);let n=r.n(i)().createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});async function o({to:e,subject:s,text:r,html:t,alias:i,senderName:o}){let d;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let c=(i?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!a().existsSync("./email/index.html"))return;let l=a().readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,t||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let t={};t.from=`"${o||"Datasquirel"}" <${c}>`,t.sender=c,i&&(t.replyTo=c),t.to=e,t.subject=s,t.text=r,t.html=l,d=await n.sendMail(t)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return d}},95969:(e,s,r)=>{r.d(s,{A:()=>i});var t=r(55511),a=r(79428);function i({encryptedString:e,encryptionKey:s,encryptionSalt:r}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let i=s||process.env.DSQL_ENCRYPTION_PASSWORD,n=r||process.env.DSQL_ENCRYPTION_SALT,o=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(!n?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,t.scryptSync)(i,n,o),c=a.Buffer.alloc(16,0),l=(0,t.createDecipheriv)("aes-192-cbc",d,c);try{let s=l.update(e,"hex","utf8");return s+=l.final("utf8")}catch(s){return console.log("Error in decrypting =>",s.message),e}}},83919:(e,s,r)=>{r.d(s,{A:()=>a});var t=r(55511);function a({password:e,encryptionKey:s}){let r=s||process.env.DSQL_ENCRYPTION_PASSWORD;if(!r?.match(/.{8,}/))throw Error("Encryption key is invalid");let a=(0,t.createHmac)("sha512",r);return a.update(e),a.digest("base64")}}};var s=require("../../webpack-api-runtime.js");s.C(e);var r=e=>s(s.s=e),t=s.X(0,[1251],()=>r(70955));module.exports=t})();
`});s.json({success:!!a?.accepted,msg:"This is an invitation request"})}}let p=(0,n.M)(t,"default"),m=(0,n.M)(t,"config"),f=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addUserUser",pathname:"/api/addUserUser",bundlePath:"",filename:""},userland:t})},69842:(e,s,r)=>{r.d(s,{A:()=>d});var t=r(48786),a=r(95969),i=r(29021),n=r.n(i),o=r(89159);async function d(e,s,r){try{let{keyCookieName:i,csrfCookieName:d}=(0,o.A)();if(!e.cookies?.[i]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,a.A)({encryptedString:e.cookies[i]});if(!c)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(c);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(r&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let u=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!u)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(r&&!n().existsSync(`${u}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!r){let e=await (0,t.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&s.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(s){return console.log(`userAuth Error for ${e.url}: ${s.message}`),null}}},89159:(e,s,r)=>{r.d(s,{A:()=>t});function t(e){let s=process.env.DSQL_COOKIES_PREFIX||"dsql_",r=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=s;e?.userId&&(n+=`user_${e.userId}_`),i&&(n+=`${i}_`),n+=r;let o=s;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=t;let d=s;return e?.userId&&(d+=`user_${e.userId}_`),i&&(d+=`${i}_`),{keyCookieName:n,csrfCookieName:o,oneTimeCodeName:d+=a}}},96052:(e,s,r)=>{r.d(s,{A:()=>o});var t=r(29021),a=r.n(t),i=r(21572);let n=r.n(i)().createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});async function o({to:e,subject:s,text:r,html:t,alias:i,senderName:o}){let d;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let c=(i?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!a().existsSync("./email/index.html"))return;let l=a().readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,t||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let t={};t.from=`"${o||"Datasquirel"}" <${c}>`,t.sender=c,i&&(t.replyTo=c),t.to=e,t.subject=s,t.text=r,t.html=l,d=await n.sendMail(t)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return d}},95969:(e,s,r)=>{r.d(s,{A:()=>i});var t=r(55511),a=r(79428);function i({encryptedString:e,encryptionKey:s,encryptionSalt:r}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let i=s||process.env.DSQL_ENCRYPTION_PASSWORD,n=r||process.env.DSQL_ENCRYPTION_SALT,o=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(!n?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,t.scryptSync)(i,n,o),c=a.Buffer.alloc(16,0),l=(0,t.createDecipheriv)("aes-192-cbc",d,c);try{let s=l.update(e,"hex","utf8");return s+=l.final("utf8")}catch(s){return console.log("Error in decrypting =>",s.message),e}}},83919:(e,s,r)=>{r.d(s,{A:()=>a});var t=r(55511);function a({password:e,encryptionKey:s}){let r=s||process.env.DSQL_ENCRYPTION_PASSWORD;if(!r?.match(/.{8,}/))throw Error("Encryption key is invalid");let a=(0,t.createHmac)("sha512",r);return a.update(e),a.digest("base64")}}};var s=require("../../webpack-api-runtime.js");s.C(e);var r=e=>s(s.s=e),t=s.X(0,[1251],()=>r(70955));module.exports=t})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=6422,e.ids=[6422],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},49860:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>f,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),o=t(2706),i=t(96762),c=t(29021),u=t.n(c),a=t(33873),l=t.n(a),d=t(69842);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,d.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{name:s,folder:n}=e.query,o=process.env.DSQL_STATIC_SERVER_DIR;if(!o)return console.log("Static File ENV not Found!"),r.json({success:!1,msg:"No Static Path!"});let i=l().join(o,`images/user-images/user-${t.id}/${n?n+"/":""}`),c=u().existsSync(i+s);r.json({success:c})}let f=(0,i.M)(s,"default"),E=(0,i.M)(s,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/checkExistingFolder",pathname:"/api/checkExistingFolder",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),c=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,c.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let a=(0,n.A)({encryptedString:e.cookies[o]});if(!a)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(a);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",l),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let c=r;e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),c+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:c,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||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 u=(0,s.scryptSync)(o,i,c),a=n.Buffer.alloc(16,0),l=(0,s.createDecipheriv)("aes-192-cbc",u,a);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=49860);module.exports=t})();
"use strict";(()=>{var e={};e.id=6422,e.ids=[6422],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},49860:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>f,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),o=t(2706),i=t(96762),u=t(29021),c=t.n(u),a=t(33873),d=t.n(a),l=t(69842);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,l.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{name:s,folder:n}=e.query,o=process.env.DSQL_STATIC_SERVER_DIR;if(!o)return console.log("Static File ENV not Found!"),r.json({success:!1,msg:"No Static Path!"});let i=d().join(o,`images/user-images/user-${t.id}/${n?n+"/":""}`),u=c().existsSync(i+s);r.json({success:u})}let f=(0,i.M)(s,"default"),E=(0,i.M)(s,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/checkExistingFolder",pathname:"/api/checkExistingFolder",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),u=t(89159);async function c(e,r,t){try{let{keyCookieName:o,csrfCookieName:c}=(0,u.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let a=(0,n.A)({encryptedString:e.cookies[o]});if(!a)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(a);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let u=r;e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),u+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:i,csrfCookieName:u,oneTimeCodeName:c+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,u=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 c=(0,s.scryptSync)(o,i,u),a=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",c,a);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=49860);module.exports=t})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=6237,e.ids=[6237],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},27215:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>c,routeModule:()=>l});var n={};t.r(n),t.d(n,{default:()=>u});var o=t(89947),s=t(2706),i=t(96762),a=t(69842);async function u(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,a.A)(e,r,!0);r.json({user:t})}let c=(0,i.M)(n,"default"),d=(0,i.M)(n,"config"),l=new o.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/clientSideAuth",pathname:"/api/clientSideAuth",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var n=t(48786),o=t(95969),s=t(29021),i=t.n(s),a=t(89159);async function u(e,r,t){try{let{keyCookieName:s,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[s]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[s]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",s=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),a+=n;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(55511),o=t(79428);function s({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let s=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!s?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,n.scryptSync)(s,i,a),c=o.Buffer.alloc(16,0),d=(0,n.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=27215);module.exports=t})();
"use strict";(()=>{var e={};e.id=6237,e.ids=[6237],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},27215:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>c,routeModule:()=>l});var n={};t.r(n),t.d(n,{default:()=>a});var o=t(89947),s=t(2706),i=t(96762),u=t(69842);async function a(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);r.json({user:t})}let c=(0,i.M)(n,"default"),d=(0,i.M)(n,"config"),l=new o.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/clientSideAuth",pathname:"/api/clientSideAuth",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(48786),o=t(95969),s=t(29021),i=t.n(s),u=t(89159);async function a(e,r,t){try{let{keyCookieName:s,csrfCookieName:a}=(0,u.A)();if(!e.cookies?.[s]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[s]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",s=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),i+=t;let u=r;e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),u+=n;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),{keyCookieName:i,csrfCookieName:u,oneTimeCodeName:a+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(55511),o=t(79428);function s({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let s=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,u=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!s?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let a=(0,n.scryptSync)(s,i,u),c=o.Buffer.alloc(16,0),d=(0,n.createDecipheriv)("aes-192-cbc",a,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=27215);module.exports=t})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=3033,e.ids=[3033],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},55591:e=>{e.exports=require("https")},79551:e=>{e.exports=require("url")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},77666:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>p,routeModule:()=>_});var o={};t.r(o),t.d(o,{default:()=>d});var n=t(89947),s=t(2706),i=t(96762),a=t(79551),c=t(64166),l=t(67619),u=t(69842);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{url:o,key:n,database:s,dbSchema:i,type:d}=e.body;try{let{hostname:e,port:t,protocol:s}=new a.URL(o),i=await (0,c.A)({scheme:s,headers:{Authorization:n},hostname:e,port:t,path:"/api/connect",method:"POST",body:{url:o,key:n}}),l=JSON.parse(i);if(!l?.success)throw Error(l.msg||"Remote request failed");r.json({success:!0,payload:l.payload})}catch(e){console.log("Connect Verification Initialtor Error, =>",e.message),(0,l.A)({component:"/api/connect/verify/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Operation Failed!"})}}let p=(0,i.M)(o,"default"),f=(0,i.M)(o,"config"),_=new n.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/connect/verify",pathname:"/api/connect/verify",bundlePath:"",filename:""},userland:o})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var o=t(48786),n=t(95969),s=t(29021),i=t.n(s),a=t(89159);async function c(e,r,t){try{let{keyCookieName:s,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[s]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[s]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,o.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>o});function o(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",o=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",s=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),a+=o;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),s&&(c+=`${s}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=n}}},64166:(e,r,t)=>{t.d(r,{A:()=>c});var o=t(55591),n=t.n(o);let s=require("http");var i=t.n(s),a=t(79551);function c({url:e,method:r,hostname:t,path:o,headers:s,body:c,port:l,scheme:u}){let d=c?JSON.stringify(c):null,p=e?new a.URL(e):null,f={method:r||"GET",hostname:p?p.hostname:t,port:u?.match(/https/i)?443:p?p.protocol?.match(/https/i)?443:p.port:l?Number(l):80,headers:{}};return o&&(f.path=o),s&&(f.headers=s),c&&(f.headers["Content-Type"]="application/json",f.headers["Content-Length"]=d?Buffer.from(d).length:void 0),new Promise((e,r)=>{let t=(u?.match(/https/i)?n():p?.protocol?.match(/https/i)?n():i()).request(f,t=>{var o="";t.on("data",function(e){o+=e}),t.on("end",function(){e(o)}),t.on("error",e=>{console.log("HTTP response error =>",e.message),r(`HTTP response error =>, ${e.message}`)}),t.on("close",()=>{console.log("HTTP(S) Response Closed Successfully")})});c&&t.write(d),t.on("error",e=>{console.log("HTTPS request ERROR =>",e.message),r(`HTTP request error =>, ${e.message}`)}),t.end()})}},67619:(e,r,t)=>{t.d(r,{A:()=>s});var o=t(29021),n=t.n(o);async function s({user:e,message:r,component:t,noMail:o,req:s}){let i=new Date,a=(()=>{if(!s)return null;try{let e=s.headers["x-forwarded-for"],r=s.headers["x-real-ip"],t=s.headers["cf-connecting-ip"],o=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||o||r||s.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let o=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=3033,e.ids=[3033],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},55591:e=>{e.exports=require("https")},79551:e=>{e.exports=require("url")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},77666:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>f,routeModule:()=>_});var o={};t.r(o),t.d(o,{default:()=>d});var n=t(89947),s=t(2706),i=t(96762),a=t(79551),c=t(64166),l=t(67619),u=t(69842);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{url:o,key:n,database:s,dbSchema:i,type:d}=e.body;try{let{hostname:e,port:t,protocol:s}=new a.URL(o),i=await (0,c.A)({scheme:s,headers:{Authorization:n},hostname:e,port:t,path:"/api/connect",method:"POST",body:{url:o,key:n}}),l=JSON.parse(i);if(!l?.success)throw Error(l.msg||"Remote request failed");r.json({success:!0,payload:l.payload})}catch(e){console.log("Connect Verification Initialtor Error, =>",e.message),(0,l.A)({component:"/api/connect/verify/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Operation Failed!"})}}let f=(0,i.M)(o,"default"),p=(0,i.M)(o,"config"),_=new n.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/connect/verify",pathname:"/api/connect/verify",bundlePath:"",filename:""},userland:o})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var o=t(48786),n=t(95969),s=t(29021),i=t.n(s),a=t(89159);async function c(e,r,t){try{let{keyCookieName:s,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[s]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[s]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,o.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>o});function o(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",o=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",s=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),a+=o;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),s&&(c+=`${s}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=n}}},64166:(e,r,t)=>{t.d(r,{A:()=>c});var o=t(55591),n=t.n(o);let s=require("http");var i=t.n(s),a=t(79551);function c({url:e,method:r,hostname:t,path:o,headers:s,body:c,port:l,scheme:u}){let d=c?JSON.stringify(c):null,f=e?new a.URL(e):null,p={method:r||"GET",hostname:f?f.hostname:t,port:u?.match(/https/i)?443:f?f.protocol?.match(/https/i)?443:f.port:l?Number(l):80,headers:{}};return o&&(p.path=o),s&&(p.headers=s),c&&(p.headers["Content-Type"]="application/json",p.headers["Content-Length"]=d?Buffer.from(d).length:void 0),new Promise((e,r)=>{let t=(u?.match(/https/i)?n():f?.protocol?.match(/https/i)?n():i()).request(p,t=>{var o="";t.on("data",function(e){o+=e}),t.on("end",function(){e(o)}),t.on("error",e=>{console.log("HTTP response error =>",e.message),r(`HTTP response error =>, ${e.message}`)}),t.on("close",()=>{console.log("HTTP(S) Response Closed Successfully")})});c&&t.write(d),t.on("error",e=>{console.log("HTTPS request ERROR =>",e.message),r(`HTTP request error =>, ${e.message}`)}),t.end()})}},67619:(e,r,t)=>{t.d(r,{A:()=>s});var o=t(29021),n=t.n(o);async function s({user:e,message:r,component:t,noMail:o,req:s}){let i=new Date,a=(()=>{if(!s)return null;try{let e=s.headers["x-forwarded-for"],r=s.headers["x-real-ip"],t=s.headers["cf-connecting-ip"],o=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||o||r||s.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let o=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(o+=`
User Id: ${e?.id}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=7081,e.ids=[7081],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},67859:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>u,routeModule:()=>_});var n={};t.r(n),t.d(n,{default:()=>c});var s=t(89947),a=t(2706),o=t(96762),i=t(30944),l=t(69842);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await (0,l.A)(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{dbFullName:t,userId:n}=e.body;await (0,i.A)({database:t,queryString:`DELETE FROM ${t}.users WHERE id = ?`,queryValuesArray:[n]}),r.json({success:!0,msg:"User Deleted!"})}let u=(0,o.M)(n,"default"),d=(0,o.M)(n,"config"),_=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteDbUser",pathname:"/api/deleteDbUser",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(48786),s=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function l(e,r,t){try{let{keyCookieName:a,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,s.A)({encryptedString:e.cookies[a]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=n;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:l+=s}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(s))continue;let l=o[t];("number"==typeof l||l)&&a?.encrypted&&l?.match(/./)&&(o[t]=(0,n.A)({encryptedString:l}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=7081,e.ids=[7081],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},67859:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>u,routeModule:()=>_});var n={};t.r(n),t.d(n,{default:()=>c});var s=t(89947),a=t(2706),o=t(96762),i=t(30944),l=t(69842);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await (0,l.A)(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{dbFullName:t,userId:n}=e.body;await (0,i.A)({database:t,queryString:`DELETE FROM ${t}.users WHERE id = ?`,queryValuesArray:[n]}),r.json({success:!0,msg:"User Deleted!"})}let u=(0,o.M)(n,"default"),d=(0,o.M)(n,"config"),_=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteDbUser",pathname:"/api/deleteDbUser",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(48786),s=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function l(e,r,t){try{let{keyCookieName:a,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,s.A)({encryptedString:e.cookies[a]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=n;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:l+=s}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(s))continue;let l=o[t];("number"==typeof l||l)&&a?.encrypted&&l?.match(/./)&&(o[t]=(0,n.A)({encryptedString:l}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=291,e.ids=[291],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},7808:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>d,routeModule:()=>_});var n={};t.r(n),t.d(n,{default:()=>c});var o=t(89947),s=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});await (0,a.A)("DELETE FROM invitations WHERE id = ? AND inviting_user_id = ?",[e.body.id,t.id]),r.json({success:!0})}let d=(0,i.M)(n,"default"),l=(0,i.M)(n,"config"),_=new o.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/deleteInvitation",pathname:"/api/deleteInvitation",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var n=t(48786),o=t(95969),s=t(29021),i=t.n(s),a=t(89159);async function u(e,r,t){try{let{keyCookieName:s,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[s]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[s]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",s=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),a+=n;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(55511),o=t(79428);function s({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let s=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!s?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,n.scryptSync)(s,i,a),c=o.Buffer.alloc(16,0),d=(0,n.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=7808);module.exports=t})();
"use strict";(()=>{var e={};e.id=291,e.ids=[291],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},7808:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>d,routeModule:()=>_});var n={};t.r(n),t.d(n,{default:()=>c});var o=t(89947),s=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});await (0,a.A)("DELETE FROM invitations WHERE id = ? AND inviting_user_id = ?",[e.body.id,t.id]),r.json({success:!0})}let d=(0,i.M)(n,"default"),l=(0,i.M)(n,"config"),_=new o.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/deleteInvitation",pathname:"/api/deleteInvitation",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var n=t(48786),o=t(95969),s=t(29021),i=t.n(s),a=t(89159);async function u(e,r,t){try{let{keyCookieName:s,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[s]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[s]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",s=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),a+=n;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(55511),o=t(79428);function s({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let s=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!s?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,n.scryptSync)(s,i,a),c=o.Buffer.alloc(16,0),d=(0,n.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=7808);module.exports=t})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=9918,e.ids=[9918],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},32306:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>p,routeModule:()=>m});var n={};t.r(n),t.d(n,{default:()=>E});var s=t(89947),o=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(48786),u=t(67619),d=t(69842),_=t(33873),f=t.n(_);async function E(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,d.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{folder:n}=e.body;try{async function s({path:e}){try{let r=c().readdirSync(e);for(let t=0;t<r.length;t++){let n=r[t];if(!n.match(/\..{3,4}$/)){await s({path:e+n+"/"});continue}let o=e.replace(/.*user-images\/user-\d+\/|.*jsonData\/dbSchemas\/users\/user-\d+\/media\//,"").replace(/\/+$/,""),i=await (0,l.A)(`SELECT * FROM user_media WHERE folder=? && media_url LIKE '%${n}'`,[o]);i&&i[0]&&await (0,l.A)("DELETE FROM user_media WHERE id = ?",[i[0].id]);try{c().unlinkSync(e+n)}catch(r){try{c().rmdirSync(e+n)}catch(e){}}}c().rmdirSync(e)}catch(e){console.log("File cleaning error =>",e.message)}}let e=process.env.DSQL_STATIC_SERVER_DIR;if(!e)throw console.log("Static File ENV not Found!"),Error("No Static Path!");let o=f().join(e,`images/user-images/user-${t.id}/`),i=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/media/`,a=o+(n?n.replace(/\.| /g,"")+"/":""),u=i+(n?n.replace(/\.| /g,"")+"/":"");await s({path:a}),await s({path:u}),r.json({success:!0})}catch(e){(0,u.A)({component:"/api/deleteMediaFolder/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}let p=(0,i.M)(n,"default"),S=(0,i.M)(n,"config"),m=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/deleteMediaFolder",pathname:"/api/deleteMediaFolder",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function c(e,r,t){try{let{keyCookieName:o,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[o]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=s}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),s=t.n(n);async function o({user:e,message:r,component:t,noMail:n,req:o}){let i=new Date,a=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||o.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=9918,e.ids=[9918],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},32306:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>p,routeModule:()=>m});var n={};t.r(n),t.d(n,{default:()=>E});var s=t(89947),o=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(48786),u=t(67619),d=t(69842),_=t(33873),f=t.n(_);async function E(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,d.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{folder:n}=e.body;try{async function s({path:e}){try{let r=c().readdirSync(e);for(let t=0;t<r.length;t++){let n=r[t];if(!n.match(/\..{3,4}$/)){await s({path:e+n+"/"});continue}let o=e.replace(/.*user-images\/user-\d+\/|.*jsonData\/dbSchemas\/users\/user-\d+\/media\//,"").replace(/\/+$/,""),i=await (0,l.A)(`SELECT * FROM user_media WHERE folder=? && media_url LIKE '%${n}'`,[o]);i&&i[0]&&await (0,l.A)("DELETE FROM user_media WHERE id = ?",[i[0].id]);try{c().unlinkSync(e+n)}catch(r){try{c().rmdirSync(e+n)}catch(e){}}}c().rmdirSync(e)}catch(e){console.log("File cleaning error =>",e.message)}}let e=process.env.DSQL_STATIC_SERVER_DIR;if(!e)throw console.log("Static File ENV not Found!"),Error("No Static Path!");let o=f().join(e,`images/user-images/user-${t.id}/`),i=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/media/`,a=o+(n?n.replace(/\.| /g,"")+"/":""),u=i+(n?n.replace(/\.| /g,"")+"/":"");await s({path:a}),await s({path:u}),r.json({success:!0})}catch(e){(0,u.A)({component:"/api/deleteMediaFolder/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}let p=(0,i.M)(n,"default"),S=(0,i.M)(n,"config"),m=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/deleteMediaFolder",pathname:"/api/deleteMediaFolder",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function c(e,r,t){try{let{keyCookieName:o,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[o]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=s}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),s=t.n(n);async function o({user:e,message:r,component:t,noMail:n,req:o}){let i=new Date,a=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||o.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=3e3,e.ids=[3e3],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},96257:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>E,routeModule:()=>m});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),a=t(2706),o=t(96762),i=t(29021),l=t.n(i),c=t(48786),u=t(67619),d=t(69842),f=t(14160);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,d.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{id:s,db_slug:n,db_full_name:a}=e.body;if(!a.match(`user_${t.id}_`))throw Error("Database doesn't belong to user");await (0,f.A)(`DROP DATABASE \`${a}\``),await (0,c.A)("DELETE FROM user_databases WHERE id = ?",[s]),await (0,c.A)("DELETE FROM user_users WHERE user_id = ? AND `database` = ?",[t.id,n]);try{let e;let s=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`,n=JSON.parse(l().readFileSync(s,"utf8")),o=n.filter((r,t)=>{if(r.dbFullName===a)return e=t,!0});if(o[0].childDatabase){let e=n.filter(e=>e.dbFullName===o[0].childDatabaseDbFullName)[0],r=e.childrenDatabases?.findIndex(e=>e.dbFullName===o[0].childDatabaseDbFullName);e.childrenDatabases&&"number"==typeof r&&e.childrenDatabases.splice(r,1)}n.splice(e,1),l().writeFileSync(`${s}`,JSON.stringify(n),"utf8"),r.json({success:!0})}catch(e){(0,u.A)({component:"/api/deleteUserDatabase/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"File Updates Failed"})}}let E=(0,o.M)(s,"default"),p=(0,o.M)(s,"config"),m=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteUserDatabase",pathname:"/api/deleteUserDatabase",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(48786),n=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function l(e,r,t){try{let{keyCookieName:a,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[a]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=s;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:l+=n}}},14160:(e,r,t)=>{t.d(r,{A:()=>i});var s=t(29021),n=t.n(s),a=t(67619),o=t(47546);async function i(e){let r;"production".match(/dev/)&&n().appendFileSync("./.tmp/sqlQuery.sql",e+"\n"+Date()+"\n\n\n","utf8");try{r=await (0,o.A)(e)}catch(e){(0,a.A)({component:"noDatabaseDbHandler",message:e.message}),console.log("ERROR in noDatabaseDbHandler =>",e.message)}return r||null}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),n=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||a.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=3e3,e.ids=[3e3],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},96257:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>E,routeModule:()=>m});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),a=t(2706),o=t(96762),i=t(29021),l=t.n(i),c=t(48786),u=t(67619),d=t(69842),f=t(14160);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,d.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{id:s,db_slug:n,db_full_name:a}=e.body;if(!a.match(`user_${t.id}_`))throw Error("Database doesn't belong to user");await (0,f.A)(`DROP DATABASE \`${a}\``),await (0,c.A)("DELETE FROM user_databases WHERE id = ?",[s]),await (0,c.A)("DELETE FROM user_users WHERE user_id = ? AND `database` = ?",[t.id,n]);try{let e;let s=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`,n=JSON.parse(l().readFileSync(s,"utf8")),o=n.filter((r,t)=>{if(r.dbFullName===a)return e=t,!0});if(o[0].childDatabase){let e=n.filter(e=>e.dbFullName===o[0].childDatabaseDbFullName)[0],r=e.childrenDatabases?.findIndex(e=>e.dbFullName===o[0].childDatabaseDbFullName);e.childrenDatabases&&"number"==typeof r&&e.childrenDatabases.splice(r,1)}n.splice(e,1),l().writeFileSync(`${s}`,JSON.stringify(n),"utf8"),r.json({success:!0})}catch(e){(0,u.A)({component:"/api/deleteUserDatabase/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"File Updates Failed"})}}let E=(0,o.M)(s,"default"),p=(0,o.M)(s,"config"),m=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteUserDatabase",pathname:"/api/deleteUserDatabase",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(48786),n=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function l(e,r,t){try{let{keyCookieName:a,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[a]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=s;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:l+=n}}},14160:(e,r,t)=>{t.d(r,{A:()=>i});var s=t(29021),n=t.n(s),a=t(67619),o=t(47546);async function i(e){let r;"production".match(/dev/)&&n().appendFileSync("./.tmp/sqlQuery.sql",e+"\n"+Date()+"\n\n\n","utf8");try{r=await (0,o.A)(e)}catch(e){(0,a.A)({component:"noDatabaseDbHandler",message:e.message}),console.log("ERROR in noDatabaseDbHandler =>",e.message)}return r||null}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),n=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||a.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=3462,e.ids=[3462],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},22792:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>d,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.body,{user_type:n,user_id:o,email:i,invited_user_id:c}=s;await (0,a.A)("DELETE FROM user_users WHERE id=?",[s.id]),n?.match(/admin/i)&&(await (0,a.A)("DELETE FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",[t.id,i]),await (0,a.A)("DELETE FROM delegated_user_tables WHERE delegated_user_id=? AND root_user_id=?",[c,t.id])),r.json({success:!0,msg:"User Deleted!"})}let d=(0,i.M)(s,"default"),l=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/deleteUserUser",pathname:"/api/deleteUserUser",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 u=(0,s.scryptSync)(o,i,a),c=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=22792);module.exports=t})();
"use strict";(()=>{var e={};e.id=3462,e.ids=[3462],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},22792:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>l});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),i=t(2706),o=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.body,{user_type:n,user_id:i,email:o,invited_user_id:c}=s;await (0,a.A)("DELETE FROM user_users WHERE id=?",[s.id]),n?.match(/admin/i)&&(await (0,a.A)("DELETE FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",[t.id,o]),await (0,a.A)("DELETE FROM delegated_user_tables WHERE delegated_user_id=? AND root_user_id=?",[c,t.id])),r.json({success:!0,msg:"User Deleted!"})}let d=(0,o.M)(s,"default"),_=(0,o.M)(s,"config"),l=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/deleteUserUser",pathname:"/api/deleteUserUser",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),i=t(29021),o=t.n(i),a=t(89159);async function u(e,r,t){try{let{keyCookieName:i,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[i]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[i]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${_}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),i&&(u+=`${i}_`),{keyCookieName:o,csrfCookieName:a,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>i});var s=t(55511),n=t(79428);function i({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let i=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=t||process.env.DSQL_ENCRYPTION_SALT,a=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(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,s.scryptSync)(i,o,a),c=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=22792);module.exports=t})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=7317,e.ids=[7317],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},86254:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>f,routeModule:()=>E});var n={};t.r(n),t.d(n,{default:()=>_});var o=t(89947),s=t(2706),i=t(96762),a=t(29021),u=t.n(a),c=t(33873),l=t.n(c),d=t(69842);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,d.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbName:n}=e.query;try{let e=l().resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${t.id}/main.json`);if(!u().existsSync(e))return r.end();let o=JSON.parse(u().readFileSync(e,"utf-8")).find(e=>e.dbFullName==n);if(!o)throw Error("Database not found!");let s=l().resolve(process.cwd(),"./.tmp/_tmp.json");u().writeFileSync(s,JSON.stringify(o),"utf-8");let i=u().createReadStream(s);i.pipe(r),i.on("close",()=>{u().unlinkSync(s)})}catch(e){return console.log(e),r.end()}}let f=(0,i.M)(n,"default"),p=(0,i.M)(n,"config"),E=new o.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/downloadDatabaseSchema",pathname:"/api/downloadDatabaseSchema",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var n=t(48786),o=t(95969),s=t(29021),i=t.n(s),a=t(89159);async function u(e,r,t){try{let{keyCookieName:s,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[s]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[s]});if(!c)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(c);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",l),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",s=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),a+=n;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(55511),o=t(79428);function s({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let s=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!s?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,n.scryptSync)(s,i,a),c=o.Buffer.alloc(16,0),l=(0,n.createDecipheriv)("aes-192-cbc",u,c);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=86254);module.exports=t})();
"use strict";(()=>{var e={};e.id=7317,e.ids=[7317],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},86254:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>f,routeModule:()=>E});var n={};t.r(n),t.d(n,{default:()=>_});var o=t(89947),s=t(2706),i=t(96762),a=t(29021),u=t.n(a),c=t(33873),l=t.n(c),d=t(69842);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,d.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbName:n}=e.query;try{let e=l().resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${t.id}/main.json`);if(!u().existsSync(e))return r.end();let o=JSON.parse(u().readFileSync(e,"utf-8")).find(e=>e.dbFullName==n);if(!o)throw Error("Database not found!");let s=l().resolve(process.cwd(),"./.tmp/_tmp.json");u().writeFileSync(s,JSON.stringify(o),"utf-8");let i=u().createReadStream(s);i.pipe(r),i.on("close",()=>{u().unlinkSync(s)})}catch(e){return console.log(e),r.end()}}let f=(0,i.M)(n,"default"),p=(0,i.M)(n,"config"),E=new o.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/downloadDatabaseSchema",pathname:"/api/downloadDatabaseSchema",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var n=t(48786),o=t(95969),s=t(29021),i=t.n(s),a=t(89159);async function u(e,r,t){try{let{keyCookieName:s,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[s]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[s]});if(!c)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(c);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",s=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),a+=n;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(55511),o=t(79428);function s({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let s=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!s?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,n.scryptSync)(s,i,a),c=o.Buffer.alloc(16,0),l=(0,n.createDecipheriv)("aes-192-cbc",u,c);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=86254);module.exports=t})();

View File

@ -1,16 +1,16 @@
"use strict";(()=>{var e={};e.id=7402,e.ids=[7402],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},21820:e=>{e.exports=require("os")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},87476:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>S,routeModule:()=>y});var s={};t.r(s),t.d(s,{default:()=>E});var n=t(89947),o=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(21820),u=t.n(l),d=t(79646),p=t(67619);async function _({dbName:e,user:r,res:t}){let s=u().platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{let n={cwd:process.cwd()},o=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r.id}/export.sql`;u().platform().match(/win/i)&&(n.shell="bash.exe");let i=`${s} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} ${e} > ${o}`;console.log(`exportDb.ts exe => ${i}`),(0,d.execSync)(i,n),t.setHeader("Content-Type","application/zip"),t.setHeader("Content-Disposition","attachment; filename=export.sql"),c().createReadStream(o).pipe(t)}catch(e){(0,p.A)({component:"/functions/backend/exportDb/lines-30-46",message:e.message,user:r})}}var f=t(69842);async function E(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,f.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbName:s}=e.query;await _({dbName:s?.toString()||"",res:r,user:t})}let S=(0,i.M)(s,"default"),m=(0,i.M)(s,"config"),y=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/exportDatabase",pathname:"/api/exportDatabase",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function c(e,r,t){try{let{keyCookieName:o,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[o]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=n}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(29021),n=t.n(s);async function o({user:e,message:r,component:t,noMail:s,req:o}){let i=new Date,a=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=7402,e.ids=[7402],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},21820:e=>{e.exports=require("os")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},87476:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>S,routeModule:()=>y});var n={};t.r(n),t.d(n,{default:()=>E});var s=t(89947),o=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(21820),u=t.n(l),d=t(79646),p=t(67619);async function _({dbName:e,user:r,res:t}){let n=u().platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{let s={cwd:process.cwd()},o=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r.id}/export.sql`;u().platform().match(/win/i)&&(s.shell="bash.exe");let i=`${n} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} ${e} > ${o}`;console.log(`exportDb.ts exe => ${i}`),(0,d.execSync)(i,s),t.setHeader("Content-Type","application/zip"),t.setHeader("Content-Disposition","attachment; filename=export.sql"),c().createReadStream(o).pipe(t)}catch(e){(0,p.A)({component:"/functions/backend/exportDb/lines-30-46",message:e.message,user:r})}}var f=t(69842);async function E(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,f.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbName:n}=e.query;await _({dbName:n?.toString()||"",res:r,user:t})}let S=(0,i.M)(n,"default"),m=(0,i.M)(n,"config"),y=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/exportDatabase",pathname:"/api/exportDatabase",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function c(e,r,t){try{let{keyCookieName:o,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[o]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=s}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),s=t.n(n);async function o({user:e,message:r,component:t,noMail:n,req:o}){let i=new Date,a=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||o.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),o?.url&&(s+=`
URL: ${o.url}`),o?.body&&(s+=`
Request Body: ${JSON.stringify(o.body,null,4)}`),a&&(s+=`
IP: ${a}`),s+=`
User Email: ${e?.email}`),o?.url&&(n+=`
URL: ${o.url}`),o?.body&&(n+=`
Request Body: ${JSON.stringify(o.body,null,4)}`),a&&(n+=`
IP: ${a}`),n+=`
Date: ${i.toDateString()}
========================================`,n().existsSync("./.tmp/error.log")||n().writeFileSync("./.tmp/error.log","","utf-8");let c=n().readFileSync("./.tmp/error.log","utf-8");n().writeFileSync("./.tmp/error.log",s),n().appendFileSync("./.tmp/error.log",`
========================================`,s().existsSync("./.tmp/error.log")||s().writeFileSync("./.tmp/error.log","","utf-8");let c=s().readFileSync("./.tmp/error.log","utf-8");s().writeFileSync("./.tmp/error.log",n),s().appendFileSync("./.tmp/error.log",`
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 c=(0,s.scryptSync)(o,i,a),l=n.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",c,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=87476);module.exports=t})();
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),s=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 c=(0,n.scryptSync)(o,i,a),l=s.Buffer.alloc(16,0),u=(0,n.createDecipheriv)("aes-192-cbc",c,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=87476);module.exports=t})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=4727,e.ids=[4727],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},27310:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{config:()=>c,default:()=>u});var a=t(89947),o=t(2706),n=t(96762),i=t(69842),l=t(33170);let c={api:{responseLimit:"1mb",bodyParser:{sizeLimit:"200mb"}}};async function u(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,i.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{paradigm:s,dbName:a,tableName:o,payload:n}=e.body;try{let e=await (0,l.A)({dbName:a,paradigm:s,payload:n,tableName:o,userId:t.id,payloadType:"base64"});if(!e)return r.json({success:!1,msg:"Operation Failed!"});r.json({success:!0,msg:"Success!",data:e?.tableData})}catch(e){r.json({success:!1,msg:e.message})}}let d=(0,n.M)(s,"default"),p=(0,n.M)(s,"config"),f=new a.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/exportTableData",pathname:"/api/exportTableData",bundlePath:"",filename:""},userland:s})},33170:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(98e3),a=t(67619),o=t(48786);async function n({paradigm:e,userId:r,dbName:t,tableName:n,payload:i,payloadType:l}){let c={};try{let a=`${process.env.DSQL_USER_DB_PREFIX}${r}_${t.replace(/ /g,"")}`;switch(e){case"export":let u=await (0,o.A)(`SELECT * FROM \`${a}\`.\`${n}\``);c.tableData=u;break;case"import":let d="base64"==l?Buffer.from(i,"base64").toString():i,p="object"===l?i:JSON.parse(d);for(let e=0;e<p.length;e++){let r=p[e],t=await (0,s.A)({data:r,dbFullName:a,tableName:n,dbContext:"Dsql User",paradigm:"Full Access",duplicateColumnName:"id",duplicateColumnValue:r?.id,update:!0});if(t.error)throw Error(t.error)}break;default:return null}return c}catch(e){return(0,a.A)({component:"/functions/backend/importExportTableDataFn",message:e.message}),null}}},69842:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(48786),a=t(95969),o=t(29021),n=t.n(o),i=t(89159);async function l(e,r,t){try{let{keyCookieName:o,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,a.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!n().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),o&&(n+=`${o}_`),n+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=s;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:n,csrfCookieName:i,oneTimeCodeName:l+=a}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(29021),a=t.n(s);async function o({user:e,message:r,component:t,noMail:s,req:o}){let n=new Date,i=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],a=t||s||r||o.socket.remoteAddress;if(!a)return null;return String(a)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=4727,e.ids=[4727],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},27310:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{config:()=>u,default:()=>c});var a=t(89947),o=t(2706),n=t(96762),i=t(69842),l=t(33170);let u={api:{responseLimit:"1mb",bodyParser:{sizeLimit:"200mb"}}};async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,i.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{paradigm:s,dbName:a,tableName:o,payload:n}=e.body;try{let e=await (0,l.A)({dbName:a,paradigm:s,payload:n,tableName:o,userId:t.id,payloadType:"base64"});if(!e)return r.json({success:!1,msg:"Operation Failed!"});r.json({success:!0,msg:"Success!",data:e?.tableData})}catch(e){r.json({success:!1,msg:e.message})}}let d=(0,n.M)(s,"default"),p=(0,n.M)(s,"config"),f=new a.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/exportTableData",pathname:"/api/exportTableData",bundlePath:"",filename:""},userland:s})},33170:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(98e3),a=t(67619),o=t(48786);async function n({paradigm:e,userId:r,dbName:t,tableName:n,payload:i,payloadType:l}){let u={};try{let a=`${process.env.DSQL_USER_DB_PREFIX}${r}_${t.replace(/ /g,"")}`;switch(e){case"export":let c=await (0,o.A)(`SELECT * FROM \`${a}\`.\`${n}\``);u.tableData=c;break;case"import":let d="base64"==l?Buffer.from(i,"base64").toString():i,p="object"===l?i:JSON.parse(d);for(let e=0;e<p.length;e++){let r=p[e],t=await (0,s.A)({data:r,dbFullName:a,tableName:n,dbContext:"Dsql User",paradigm:"Full Access",duplicateColumnName:"id",duplicateColumnValue:r?.id,update:!0});if(t.error)throw Error(t.error)}break;default:return null}return u}catch(e){return(0,a.A)({component:"/functions/backend/importExportTableDataFn",message:e.message}),null}}},69842:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(48786),a=t(95969),o=t(29021),n=t.n(o),i=t(89159);async function l(e,r,t){try{let{keyCookieName:o,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,a.A)({encryptedString:e.cookies[o]});if(!u)throw Error("Couldn't decrypt auth cookie!");let c=JSON.parse(u);if(!c.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!n().existsSync(`${d}/${c.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==c.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(c?.date&&Date.now()-c.date>6048e5)throw Error("Key expired!");return c}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),o&&(n+=`${o}_`),n+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=s;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:n,csrfCookieName:i,oneTimeCodeName:l+=a}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(29021),a=t.n(s);async function o({user:e,message:r,component:t,noMail:s,req:o}){let n=new Date,i=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],a=t||s||r||o.socket.remoteAddress;if(!a)return null;return String(a)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}
@ -13,4 +13,4 @@ Date: ${n.toDateString()}
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),a=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,n=t||process.env.DSQL_ENCRYPTION_SALT,i=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(!n?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=(0,s.scryptSync)(o,n,i),c=a.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",l,c);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[1251],()=>t(27310));module.exports=s})();
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),a=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,n=t||process.env.DSQL_ENCRYPTION_SALT,i=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(!n?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=(0,s.scryptSync)(o,n,i),u=a.Buffer.alloc(16,0),c=(0,s.createDecipheriv)("aes-192-cbc",l,u);try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[1251],()=>t(27310));module.exports=s})();

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,16 @@
"use strict";(()=>{var e={};e.id=3040,e.ids=[3040],e.modules={27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},61980:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>p,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>_});var o=t(89947),n=t(2706),a=t(96762),i=t(4820),u=t(67619),l=t(69842),c=t(27825),d=t.n(c),f=t(48786);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,l.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.query.dbUserId;e.query.delegated;try{if(!s)throw Error("No Root user Id Found!");let e=await (0,f.A)("SELECT * FROM datasquirel.delegated_user_tables WHERE delegated_user_id=? AND root_user_id=?",[String(t.id),String(s)]),o=(0,i.A)({userId:String(s)});if(!o)throw Error("Root user schema not found!");let n=[];e.forEach(e=>{let r=n.findIndex(r=>r.dbSlug===e.database),t=o.find(r=>r.dbSlug===e.database);if(t){let s=n[r]?n[r]:{...t,tables:[]},o=d().cloneDeep(t.tables).find(r=>r.tableName===e.table);o&&n[r]?n[r]={...s,tables:[...n[r].tables,o]}:o&&!n[r]&&n.push({...t,tables:[o]})}}),r.json({success:!0,payload:n})}catch(e){console.log("ERROR:",e.message),(0,u.A)({component:"/api/get-authorized-databases",message:e.message,user:t}),r.json({success:!1,msg:e.message})}}let p=(0,a.M)(s,"default"),E=(0,a.M)(s,"config"),S=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/get-authorized-databases",pathname:"/api/get-authorized-databases",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),o=t(95969),n=t(29021),a=t.n(n),i=t(89159);async function u(e,r,t){try{let{keyCookieName:n,csrfCookieName:u}=(0,i.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,o.A)({encryptedString:e.cookies[n]});if(!l)throw Error("Couldn't decrypt auth cookie!");let c=JSON.parse(l);if(!c.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",c),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!a().existsSync(`${d}/${c.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==c.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(c?.date&&Date.now()-c.date>6048e5)throw Error("Key expired!");return c}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:u+=o}}},4820:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(67619),o=t(29021),n=t.n(o),a=t(33873),i=t.n(a);function u({userId:e}){try{let r=i().resolve(process.cwd(),`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${e}/main.json`);return JSON.parse(n().readFileSync(r,"utf-8"))}catch(e){return(0,s.A)({component:"grabUserSchemaData",message:e.message}),null}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),o=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let a=new Date,i=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],o=t||s||r||n.socket.remoteAddress;if(!o)return null;return String(o)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=3040,e.ids=[3040],e.modules={27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},61980:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>p,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),o=t(2706),a=t(96762),i=t(4820),u=t(67619),l=t(69842),c=t(27825),d=t.n(c),f=t(48786);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,l.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.query.dbUserId;e.query.delegated;try{if(!s)throw Error("No Root user Id Found!");let e=await (0,f.A)("SELECT * FROM datasquirel.delegated_user_tables WHERE delegated_user_id=? AND root_user_id=?",[String(t.id),String(s)]),n=(0,i.A)({userId:String(s)});if(!n)throw Error("Root user schema not found!");let o=[];e.forEach(e=>{let r=o.findIndex(r=>r.dbSlug===e.database),t=n.find(r=>r.dbSlug===e.database);if(t){let s=o[r]?o[r]:{...t,tables:[]},n=d().cloneDeep(t.tables).find(r=>r.tableName===e.table);n&&o[r]?o[r]={...s,tables:[...o[r].tables,n]}:n&&!o[r]&&o.push({...t,tables:[n]})}}),r.json({success:!0,payload:o})}catch(e){console.log("ERROR:",e.message),(0,u.A)({component:"/api/get-authorized-databases",message:e.message,user:t}),r.json({success:!1,msg:e.message})}}let p=(0,a.M)(s,"default"),E=(0,a.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/get-authorized-databases",pathname:"/api/get-authorized-databases",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),a=t.n(o),i=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,i.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[o]});if(!l)throw Error("Couldn't decrypt auth cookie!");let c=JSON.parse(l);if(!c.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!a().existsSync(`${d}/${c.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==c.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(c?.date&&Date.now()-c.date>6048e5)throw Error("Key expired!");return c}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:u+=n}}},4820:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(67619),n=t(29021),o=t.n(n),a=t(33873),i=t.n(a);function u({userId:e}){try{let r=i().resolve(process.cwd(),`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${e}/main.json`);return JSON.parse(o().readFileSync(r,"utf-8"))}catch(e){return(0,s.A)({component:"grabUserSchemaData",message:e.message}),null}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(29021),n=t.n(s);async function o({user:e,message:r,component:t,noMail:s,req:o}){let a=new Date,i=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),n?.url&&(s+=`
URL: ${n.url}`),n?.body&&(s+=`
Request Body: ${JSON.stringify(n.body,null,4)}`),i&&(s+=`
User Email: ${e?.email}`),o?.url&&(s+=`
URL: ${o.url}`),o?.body&&(s+=`
Request Body: ${JSON.stringify(o.body,null,4)}`),i&&(s+=`
IP: ${i}`),s+=`
Date: ${a.toDateString()}
========================================`,o().existsSync("./.tmp/error.log")||o().writeFileSync("./.tmp/error.log","","utf-8");let u=o().readFileSync("./.tmp/error.log","utf-8");o().writeFileSync("./.tmp/error.log",s),o().appendFileSync("./.tmp/error.log",`
========================================`,n().existsSync("./.tmp/error.log")||n().writeFileSync("./.tmp/error.log","","utf-8");let u=n().readFileSync("./.tmp/error.log","utf-8");n().writeFileSync("./.tmp/error.log",s),n().appendFileSync("./.tmp/error.log",`
${u}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(55511),o=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,a=t||process.env.DSQL_ENCRYPTION_SALT,i=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,s.scryptSync)(n,a,i),l=o.Buffer.alloc(16,0),c=(0,s.createDecipheriv)("aes-192-cbc",u,l);try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=61980);module.exports=t})();
${u}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,a=t||process.env.DSQL_ENCRYPTION_SALT,i=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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,s.scryptSync)(o,a,i),l=n.Buffer.alloc(16,0),c=(0,s.createDecipheriv)("aes-192-cbc",u,l);try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=61980);module.exports=t})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=245,e.ids=[245],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},37811:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),a=t(2706),o=t(96762),i=t(69842),u=t(67619),l=t(48786);async function c(e,r){if("GET"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,i.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.query.dbSlug,n=e.query.dbOwnerId,a=e.query.delegatedUserId;try{let e=await (0,l.A)("SELECT id FROM user_databases WHERE user_id=? AND db_slug=?",[n,s]);if(!e||!e[0])return r.json({success:!1,msg:"Database not found"});let t=await (0,l.A)("SELECT table_name,table_slug FROM user_database_tables WHERE user_id=? AND db_id=?",[n,e[0].id]),o=await (0,l.A)("SELECT `database`,`table` FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=?",[n,a]);r.json({success:!0,tables:t,accessed_tables:o})}catch(e){(0,u.A)({component:"/api/getDatabaseTables/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}let d=(0,o.M)(s,"default"),_=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getDatabaseTables",pathname:"/api/getDatabaseTables",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function u(e,r,t){try{let{keyCookieName:a,csrfCookieName:u}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let c=JSON.parse(l);if(!c.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",c),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${c.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==c.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(c?.date&&Date.now()-c.date>6048e5)throw Error("Key expired!");return c}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),a&&(u+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:u+=n}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),n=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||a.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=245,e.ids=[245],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},37811:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),a=t(2706),o=t(96762),i=t(69842),u=t(67619),l=t(48786);async function c(e,r){if("GET"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,i.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.query.dbSlug,n=e.query.dbOwnerId,a=e.query.delegatedUserId;try{let e=await (0,l.A)("SELECT id FROM user_databases WHERE user_id=? AND db_slug=?",[n,s]);if(!e||!e[0])return r.json({success:!1,msg:"Database not found"});let t=await (0,l.A)("SELECT table_name,table_slug FROM user_database_tables WHERE user_id=? AND db_id=?",[n,e[0].id]),o=await (0,l.A)("SELECT `database`,`table` FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=?",[n,a]);r.json({success:!0,tables:t,accessed_tables:o})}catch(e){(0,u.A)({component:"/api/getDatabaseTables/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}let d=(0,o.M)(s,"default"),_=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getDatabaseTables",pathname:"/api/getDatabaseTables",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function u(e,r,t){try{let{keyCookieName:a,csrfCookieName:u}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let c=JSON.parse(l);if(!c.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${c.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==c.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(c?.date&&Date.now()-c.date>6048e5)throw Error("Key expired!");return c}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),a&&(u+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:u+=n}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),n=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||a.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=8282,e.ids=[8282],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},19991:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>_,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>d});var o=t(89947),n=t(2706),a=t(96762),i=t(48786),l=t(68829),c=t(67619),u=t(69842);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.body.rootUserId,o=e.body.priviledges,n=e.body.database;try{let e=await (0,i.A)("SELECT * FROM user_users WHERE user_id=? AND invited_user_id=? AND MATCH(database_access) AGAINST(?)",[s,t.id,n]);if(!e||!e[0])throw Error(`user with id ${t.id} has no access to ${n} database belonging to user ${s}`);let a=(await (0,i.A)("SELECT * FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=? AND `database`=?",[s,t.id,n])).map(e=>e.table),c=await (0,i.A)("SELECT * FROM users WHERE id=?",[s]),u={rootUserId:s,rootUserName:`${c[0].first_name} ${c[0].last_name}`,rootUserEmail:c[0].email,rootUserImage:c[0].image_thumbnail,delegatedUserId:t.id,databaseFullName:`datasquirel_user_${s}_${n}`,databaseSlug:n,allowedTables:a,priviledges:o,dateCreated:Date.now()},d=(0,l.A)({data:JSON.stringify(u)}),_=`${process.env.DSQL_USER_DB_PREFIX}${u.rootUserId}_${n}`,E=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${_}`;r.setHeader("Set-Cookie",[`${E}=${d};path=/`]),r.json({success:!0,msg:"Processed Successfully"})}catch(e){return console.log("ERROR:",e.message),(0,c.A)({component:"/api/getDelegatedDatabaseToken/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Unauthorized"})}}let _=(0,a.M)(s,"default"),E=(0,a.M)(s,"config"),f=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/getDelegatedDatabaseToken",pathname:"/api/getDelegatedDatabaseToken",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(48786),o=t(95969),n=t(29021),a=t.n(n),i=t(89159);async function l(e,r,t){try{let{keyCookieName:n,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[n]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!a().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=s;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),n&&(l+=`${n}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:l+=o}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),o=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let a=new Date,i=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],o=t||s||r||n.socket.remoteAddress;if(!o)return null;return String(o)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=8282,e.ids=[8282],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},19991:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>_,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>d});var o=t(89947),n=t(2706),a=t(96762),i=t(48786),l=t(68829),c=t(67619),u=t(69842);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.body.rootUserId,o=e.body.priviledges,n=e.body.database;try{let e=await (0,i.A)("SELECT * FROM user_users WHERE user_id=? AND invited_user_id=? AND MATCH(database_access) AGAINST(?)",[s,t.id,n]);if(!e||!e[0])throw Error(`user with id ${t.id} has no access to ${n} database belonging to user ${s}`);let a=(await (0,i.A)("SELECT * FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=? AND `database`=?",[s,t.id,n])).map(e=>e.table),c=await (0,i.A)("SELECT * FROM users WHERE id=?",[s]),u={rootUserId:s,rootUserName:`${c[0].first_name} ${c[0].last_name}`,rootUserEmail:c[0].email,rootUserImage:c[0].image_thumbnail,delegatedUserId:t.id,databaseFullName:`datasquirel_user_${s}_${n}`,databaseSlug:n,allowedTables:a,priviledges:o,dateCreated:Date.now()},d=(0,l.A)({data:JSON.stringify(u)}),_=`${process.env.DSQL_USER_DB_PREFIX}${u.rootUserId}_${n}`,E=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${_}`;r.setHeader("Set-Cookie",[`${E}=${d};path=/`]),r.json({success:!0,msg:"Processed Successfully"})}catch(e){return console.log("ERROR:",e.message),(0,c.A)({component:"/api/getDelegatedDatabaseToken/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Unauthorized"})}}let _=(0,a.M)(s,"default"),E=(0,a.M)(s,"config"),f=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/getDelegatedDatabaseToken",pathname:"/api/getDelegatedDatabaseToken",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(48786),o=t(95969),n=t(29021),a=t.n(n),i=t(89159);async function l(e,r,t){try{let{keyCookieName:n,csrfCookieName:l}=(0,i.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[n]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!a().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=s;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),n&&(l+=`${n}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:l+=o}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),o=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let a=new Date,i=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],o=t||s||r||n.socket.remoteAddress;if(!o)return null;return String(o)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}

View File

@ -1,8 +1,8 @@
"use strict";(()=>{var e={};e.id=7258,e.ids=[7258],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,s){return s in r?r[s]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,s)):"function"==typeof r&&"default"===s?r:void 0}}})},45310:(e,r,s)=>{s.r(r),s.d(r,{config:()=>l,default:()=>d,routeModule:()=>c});var t={};s.r(t),s.d(t,{default:()=>_});var i=s(89947),n=s(2706),a=s(96762),o=s(48786),u=s(69842);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let s=await (0,u.A)(e,r);if(!s)return r.json({success:!1,msg:"Unauthorized"});let t=await (0,o.A)(`
"use strict";(()=>{var e={};e.id=7258,e.ids=[7258],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,s){return s in r?r[s]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,s)):"function"==typeof r&&"default"===s?r:void 0}}})},45310:(e,r,s)=>{s.r(r),s.d(r,{config:()=>l,default:()=>d,routeModule:()=>c});var t={};s.r(t),s.d(t,{default:()=>_});var i=s(89947),n=s(2706),a=s(96762),u=s(48786),o=s(69842);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let s=await (0,o.A)(e,r);if(!s)return r.json({success:!1,msg:"Unauthorized"});let t=await (0,u.A)(`
SELECT
user_users.user_id,user_users.database_access,user_users.user_id,user_users.user_priviledge,users.first_name,users.last_name,users.email,users.image_thumbnail
FROM
user_users JOIN users ON user_users.user_id=users.id
WHERE
user_users.invited_user_id='${s.id}'
`),i=[];if(t&&t[0])for(let e=0;e<t.length;e++){let r=t[e],{database_access:s,user_id:n,user_priviledge:a}=r;if(!s?.match(/./))continue;let u=await (0,o.A)(`SELECT * FROM user_databases WHERE (${s.split("|").map(e=>`db_slug='${e}'`).join(" OR ")}) AND user_id=${n}`);for(let e=0;e<u.length;e++){let s=u[e];i.push({id:s.id,user_id:r.user_id,first_name:r.first_name,last_name:r.last_name,email:r.email,image_thumbnail:r.image_thumbnail,db_name:s.db_name,db_slug:s.db_slug,db_full_name:s.db_full_name,db_image:s.db_image,db_description:s.db_description,date_created:s.date_created,user_priviledge:a})}}r.json({success:!0,databases:i})}let d=(0,a.M)(t,"default"),l=(0,a.M)(t,"config"),c=new i.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/getDelegatedDatabases",pathname:"/api/getDelegatedDatabases",bundlePath:"",filename:""},userland:t})},69842:(e,r,s)=>{s.d(r,{A:()=>u});var t=s(48786),i=s(95969),n=s(29021),a=s.n(n),o=s(89159);async function u(e,r,s){try{let{keyCookieName:n,csrfCookieName:u}=(0,o.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let _=(0,i.A)({encryptedString:e.cookies[n]});if(!_)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(_);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(s&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(s&&!a().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!s){let e=await (0,t.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,s)=>{s.d(r,{A:()=>t});function t(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",i=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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=t;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),{keyCookieName:a,csrfCookieName:o,oneTimeCodeName:u+=i}}},95969:(e,r,s)=>{s.d(r,{A:()=>n});var t=s(55511),i=s(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:s}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,a=s||process.env.DSQL_ENCRYPTION_SALT,o=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,t.scryptSync)(n,a,o),_=i.Buffer.alloc(16,0),d=(0,t.createDecipheriv)("aes-192-cbc",u,_);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,s)=>{s.d(r,{A:()=>t});async function t(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let s=await r.query(...e);return JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}});var s=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=r(r.s=45310);module.exports=s})();
`),i=[];if(t&&t[0])for(let e=0;e<t.length;e++){let r=t[e],{database_access:s,user_id:n,user_priviledge:a}=r;if(!s?.match(/./))continue;let o=await (0,u.A)(`SELECT * FROM user_databases WHERE (${s.split("|").map(e=>`db_slug='${e}'`).join(" OR ")}) AND user_id=${n}`);for(let e=0;e<o.length;e++){let s=o[e];i.push({id:s.id,user_id:r.user_id,first_name:r.first_name,last_name:r.last_name,email:r.email,image_thumbnail:r.image_thumbnail,db_name:s.db_name,db_slug:s.db_slug,db_full_name:s.db_full_name,db_image:s.db_image,db_description:s.db_description,date_created:s.date_created,user_priviledge:a})}}r.json({success:!0,databases:i})}let d=(0,a.M)(t,"default"),l=(0,a.M)(t,"config"),c=new i.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/getDelegatedDatabases",pathname:"/api/getDelegatedDatabases",bundlePath:"",filename:""},userland:t})},69842:(e,r,s)=>{s.d(r,{A:()=>o});var t=s(48786),i=s(95969),n=s(29021),a=s.n(n),u=s(89159);async function o(e,r,s){try{let{keyCookieName:n,csrfCookieName:o}=(0,u.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let _=(0,i.A)({encryptedString:e.cookies[n]});if(!_)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(_);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(s&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(s&&!a().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!s){let e=await (0,t.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,s)=>{s.d(r,{A:()=>t});function t(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",i=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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let u=r;e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),u+=t;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:u,oneTimeCodeName:o+=i}}},95969:(e,r,s)=>{s.d(r,{A:()=>n});var t=s(55511),i=s(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:s}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,a=s||process.env.DSQL_ENCRYPTION_SALT,u=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let o=(0,t.scryptSync)(n,a,u),_=i.Buffer.alloc(16,0),d=(0,t.createDecipheriv)("aes-192-cbc",o,_);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,s)=>{s.d(r,{A:()=>t});async function t(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let s=await r.query(...e);return JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}});var s=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=r(r.s=45310);module.exports=s})();

View File

@ -1,10 +1,10 @@
"use strict";(()=>{var e={};e.id=2139,e.ids=[2139],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},53662:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>p,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>E});var o=t(89947),n=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(33873),u=t.n(l),d=t(48786),_=t(67619),f=t(69842);async function E(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,f.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{"production".match(/production/);let e=await (0,d.A)(`
"use strict";(()=>{var e={};e.id=2139,e.ids=[2139],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},53662:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>p,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>E});var i=t(89947),n=t(2706),o=t(96762),a=t(29021),c=t.n(a),u=t(33873),l=t.n(u),d=t(48786),_=t(67619),f=t(69842);async function E(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,f.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{"production".match(/production/);let e=await (0,d.A)(`
SELECT table_schema,
SUM((data_length+index_length)/1024/1024) AS "mb" from
information_schema.tables
where table_schema like ?
group by table_schema
`,[`datasquirel_user_${t.id}%`]),o=(Array.isArray(e)?e:[]).reduce((e,r,t)=>e?.mb?e.mb+r.mb:e+r.mb,0),n=0,i=process.env.DSQL_STATIC_SERVER_DIR;if(!i)throw console.log("Static File ENV not Found!"),Error("No Static Path!");i||c().existsSync(i)||c().mkdirSync(i,{recursive:!0});let a=u().join(i,`images/user-images/user-${t.id}`);c().existsSync(a)||c().mkdirSync(a,{recursive:!0});let l=u().join(i,`images/user-images/user-${t.id}`),f=u().join(i,`videos/user-videos/user-${t.id}`);async function s(e){try{let r=c().readdirSync(e);for(let t=0;t<r.length;t++){let o=r[t],a=e+"/"+o;if(!o.match(/\..{3,4}$/)){await s(a);continue}if(c().existsSync(a)){let e=c().statSync(a);n+=e.size/1024/1024}else{if("production".match(/production/),!i)throw console.log("Static File ENV not Found!"),Error("No Static Path!");let e=a.replace(i,process.env.DSQL_STATIC_HOST||""),r=a.replace(i,"");await (0,d.A)("DELETE FROM user_media WHERE media_path = ? OR media_thumbnail_path = ? OR media_url=? OR media_thumbnail_url=?",[r,r,e,e]),console.log(`MEDIA => ${e} DELETED FROM DATABASE`)}}}catch(e){console.log("ERROR in getDiskUsage API route =>",e.message),(0,_.A)({component:"/api/getDiskUsage/lines-93-101",message:e.message})}}c().existsSync(f)||c().mkdirSync(f,{recursive:!0}),await s(l),await s(f);let E=n+o;r.json({success:!0,total:E})}catch(e){(0,_.A)({component:"/api/getDiskUsage/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Disk Usage Calculation Error!"})}}let p=(0,i.M)(s,"default"),m=(0,i.M)(s,"config"),S=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/getDiskUsage",pathname:"/api/getDiskUsage",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),o=t(95969),n=t(29021),i=t.n(n),a=t(89159);async function c(e,r,t){try{let{keyCookieName:n,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,o.A)({encryptedString:e.cookies[n]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=o}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),o=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let i=new Date,a=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],o=t||s||r||n.socket.remoteAddress;if(!o)return null;return String(o)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
`,[`datasquirel_user_${t.id}%`]),i=(Array.isArray(e)?e:[]).reduce((e,r,t)=>e?.mb?e.mb+r.mb:e+r.mb,0),n=0,o=process.env.DSQL_STATIC_SERVER_DIR;if(!o)throw console.log("Static File ENV not Found!"),Error("No Static Path!");o||c().existsSync(o)||c().mkdirSync(o,{recursive:!0});let a=l().join(o,`images/user-images/user-${t.id}`);c().existsSync(a)||c().mkdirSync(a,{recursive:!0});let u=l().join(o,`images/user-images/user-${t.id}`),f=l().join(o,`videos/user-videos/user-${t.id}`);async function s(e){try{let r=c().readdirSync(e);for(let t=0;t<r.length;t++){let i=r[t],a=e+"/"+i;if(!i.match(/\..{3,4}$/)){await s(a);continue}if(c().existsSync(a)){let e=c().statSync(a);n+=e.size/1024/1024}else{if("production".match(/production/),!o)throw console.log("Static File ENV not Found!"),Error("No Static Path!");let e=a.replace(o,process.env.DSQL_STATIC_HOST||""),r=a.replace(o,"");await (0,d.A)("DELETE FROM user_media WHERE media_path = ? OR media_thumbnail_path = ? OR media_url=? OR media_thumbnail_url=?",[r,r,e,e]),console.log(`MEDIA => ${e} DELETED FROM DATABASE`)}}}catch(e){console.log("ERROR in getDiskUsage API route =>",e.message),(0,_.A)({component:"/api/getDiskUsage/lines-93-101",message:e.message})}}c().existsSync(f)||c().mkdirSync(f,{recursive:!0}),await s(u),await s(f);let E=n+i;r.json({success:!0,total:E})}catch(e){(0,_.A)({component:"/api/getDiskUsage/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Disk Usage Calculation Error!"})}}let p=(0,o.M)(s,"default"),m=(0,o.M)(s,"config"),S=new i.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/getDiskUsage",pathname:"/api/getDiskUsage",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),i=t(95969),n=t(29021),o=t.n(n),a=t(89159);async function c(e,r,t){try{let{keyCookieName:n,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,i.A)({encryptedString:e.cookies[n]});if(!u)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(u);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",i=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+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:o,csrfCookieName:a,oneTimeCodeName:c+=i}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),i=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let o=new Date,a=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],i=t||s||r||n.socket.remoteAddress;if(!i)return null;return String(i)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}
@ -13,10 +13,10 @@ User Email: ${e?.email}`),n?.url&&(s+=`
URL: ${n.url}`),n?.body&&(s+=`
Request Body: ${JSON.stringify(n.body,null,4)}`),a&&(s+=`
IP: ${a}`),s+=`
Date: ${i.toDateString()}
========================================`,o().existsSync("./.tmp/error.log")||o().writeFileSync("./.tmp/error.log","","utf-8");let c=o().readFileSync("./.tmp/error.log","utf-8");o().writeFileSync("./.tmp/error.log",s),o().appendFileSync("./.tmp/error.log",`
Date: ${o.toDateString()}
========================================`,i().existsSync("./.tmp/error.log")||i().writeFileSync("./.tmp/error.log","","utf-8");let c=i().readFileSync("./.tmp/error.log","utf-8");i().writeFileSync("./.tmp/error.log",s),i().appendFileSync("./.tmp/error.log",`
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(55511),o=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.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,s.scryptSync)(n,i,a),l=o.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",c,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=53662);module.exports=t})();
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(55511),i=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=(0,s.scryptSync)(n,o,a),u=i.Buffer.alloc(16,0),l=(0,s.createDecipheriv)("aes-192-cbc",c,u);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=53662);module.exports=t})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=2312,e.ids=[2312],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},37075:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>d,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await (0,a.A)(`SELECT id, table_name, table_slug FROM user_database_tables WHERE user_id='${t.id}' AND db_id='${e.query.dbId}'`);r.json({success:!0,tables:s})}let d=(0,i.M)(s,"default"),l=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserDatabaseTables",pathname:"/api/getUserDatabaseTables",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 u=(0,s.scryptSync)(o,i,a),c=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=37075);module.exports=t})();
"use strict";(()=>{var e={};e.id=2312,e.ids=[2312],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},37075:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>d,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await (0,a.A)(`SELECT id, table_name, table_slug FROM user_database_tables WHERE user_id='${t.id}' AND db_id='${e.query.dbId}'`);r.json({success:!0,tables:s})}let d=(0,i.M)(s,"default"),l=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserDatabaseTables",pathname:"/api/getUserDatabaseTables",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 u=(0,s.scryptSync)(o,i,a),c=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=37075);module.exports=t})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=2,e.ids=[2],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},36857:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>d,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await (0,a.A)(`SELECT id,db_name,db_slug,db_full_name FROM user_databases WHERE user_id='${t.id}'`);r.json({success:!0,databases:s})}let d=(0,i.M)(s,"default"),l=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserDatabases",pathname:"/api/getUserDatabases",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 u=(0,s.scryptSync)(o,i,a),c=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=36857);module.exports=t})();
"use strict";(()=>{var e={};e.id=2,e.ids=[2],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},36857:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>l});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await (0,a.A)(`SELECT id,db_name,db_slug,db_full_name FROM user_databases WHERE user_id='${t.id}'`);r.json({success:!0,databases:s})}let d=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),l=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserDatabases",pathname:"/api/getUserDatabases",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${_}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 u=(0,s.scryptSync)(o,i,a),c=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=36857);module.exports=t})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=7664,e.ids=[7664],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},35179:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>d,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await (0,a.A)(`SELECT * FROM user_media WHERE user_id=${t.id} ORDER BY id DESC`);r.json({media:s})}let d=(0,i.M)(s,"default"),l=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserMedia",pathname:"/api/getUserMedia",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 u=(0,s.scryptSync)(o,i,a),c=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=35179);module.exports=t})();
"use strict";(()=>{var e={};e.id=7664,e.ids=[7664],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},35179:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>d,routeModule:()=>_});var n={};t.r(n),t.d(n,{default:()=>c});var s=t(89947),o=t(2706),i=t(96762),a=t(48786),u=t(69842);async function c(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,u.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let n=await (0,a.A)(`SELECT * FROM user_media WHERE user_id=${t.id} ORDER BY id DESC`);r.json({media:n})}let d=(0,i.M)(n,"default"),l=(0,i.M)(n,"config"),_=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserMedia",pathname:"/api/getUserMedia",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var n=t(48786),s=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,s.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=n;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=s}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),s=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 u=(0,n.scryptSync)(o,i,a),c=s.Buffer.alloc(16,0),d=(0,n.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=35179);module.exports=t})();

View File

@ -1,16 +1,16 @@
"use strict";(()=>{var e={};e.id=2221,e.ids=[2221],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},22133:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>_,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>d});var n=t(89947),o=t(2706),a=t(96762),i=t(29021),c=t.n(i),u=t(67619),l=t(69842);async function d(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,l.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{let e=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`,s=JSON.parse(c().readFileSync(e,"utf8"));r.json({success:!0,schemaData:s})}catch(e){(0,u.A)({component:"/api/getUserSchemaData/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Couldn't read schema data"})}}let _=(0,a.M)(s,"default"),f=(0,a.M)(s,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserSchemaData",pathname:"/api/getUserSchemaData",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),n=t(95969),o=t(29021),a=t.n(o),i=t(89159);async function c(e,r,t){try{let{keyCookieName:o,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,n.A)({encryptedString:e.cookies[o]});if(!u)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(u);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",l),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!a().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:c+=n}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(29021),n=t.n(s);async function o({user:e,message:r,component:t,noMail:s,req:o}){let a=new Date,i=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=2221,e.ids=[2221],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},22133:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>f,routeModule:()=>p});var n={};t.r(n),t.d(n,{default:()=>d});var s=t(89947),o=t(2706),i=t(96762),a=t(29021),c=t.n(a),u=t(67619),l=t(69842);async function d(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,l.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{let e=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`,n=JSON.parse(c().readFileSync(e,"utf8"));r.json({success:!0,schemaData:n})}catch(e){(0,u.A)({component:"/api/getUserSchemaData/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Couldn't read schema data"})}}let f=(0,i.M)(n,"default"),_=(0,i.M)(n,"config"),p=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserSchemaData",pathname:"/api/getUserSchemaData",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function c(e,r,t){try{let{keyCookieName:o,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,s.A)({encryptedString:e.cookies[o]});if(!u)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(u);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=s}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),s=t.n(n);async function o({user:e,message:r,component:t,noMail:n,req:o}){let i=new Date,a=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||o.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),o?.url&&(s+=`
URL: ${o.url}`),o?.body&&(s+=`
Request Body: ${JSON.stringify(o.body,null,4)}`),i&&(s+=`
IP: ${i}`),s+=`
Date: ${a.toDateString()}
========================================`,n().existsSync("./.tmp/error.log")||n().writeFileSync("./.tmp/error.log","","utf-8");let c=n().readFileSync("./.tmp/error.log","utf-8");n().writeFileSync("./.tmp/error.log",s),n().appendFileSync("./.tmp/error.log",`
User Email: ${e?.email}`),o?.url&&(n+=`
URL: ${o.url}`),o?.body&&(n+=`
Request Body: ${JSON.stringify(o.body,null,4)}`),a&&(n+=`
IP: ${a}`),n+=`
Date: ${i.toDateString()}
========================================`,s().existsSync("./.tmp/error.log")||s().writeFileSync("./.tmp/error.log","","utf-8");let c=s().readFileSync("./.tmp/error.log","utf-8");s().writeFileSync("./.tmp/error.log",n),s().appendFileSync("./.tmp/error.log",`
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,a=t||process.env.DSQL_ENCRYPTION_SALT,i=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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=(0,s.scryptSync)(o,a,i),u=n.Buffer.alloc(16,0),l=(0,s.createDecipheriv)("aes-192-cbc",c,u);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=22133);module.exports=t})();
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),s=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 c=(0,n.scryptSync)(o,i,a),u=s.Buffer.alloc(16,0),l=(0,n.createDecipheriv)("aes-192-cbc",c,u);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=22133);module.exports=t})();

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=3382,e.ids=[3382],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},84612:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>E,routeModule:()=>A});var s={};t.r(s),t.d(s,{default:()=>p});var o=t(89947),n=t(2706),a=t(96762),i=t(29021),u=t.n(i),c=t(33873),d=t.n(c),l=t(67619),_=t(69842),f=t(76856);async function p(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,_.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{database:s,fileBase64:o}=e.body;s?.db_full_name?.match(/datasquirel_user_.*/)||r.json({success:!1,msg:"Unauthorized"});try{let e=Buffer.from(o,"base64").toString("utf-8"),n=JSON.parse(e),a=d().resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${t.id}/main.json`);if(!u().existsSync(a))return r.end();let i=JSON.parse(u().readFileSync(a,"utf-8")),c=i.find(e=>e.dbFullName==s.db_full_name);if(!c)throw Error("Database not found!");c.tables=n.tables,u().writeFileSync(a,JSON.stringify(i),"utf-8"),await (0,f.A)({userId:t.id,targetDatabase:s.db_full_name}),r.json({success:!0})}catch(e){console.log("JSON import ERROR =>",e.message),(0,l.A)({component:"/api/importDatabase/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Import Failed!"})}}let E=(0,a.M)(s,"default"),S=(0,a.M)(s,"config"),A=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/importDatabaseSchema",pathname:"/api/importDatabaseSchema",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),o=t(95969),n=t(29021),a=t.n(n),i=t(89159);async function u(e,r,t){try{let{keyCookieName:n,csrfCookieName:u}=(0,i.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[n]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!a().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:u+=o}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[2282],()=>t(84612));module.exports=s})();
"use strict";(()=>{var e={};e.id=3382,e.ids=[3382],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},84612:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>E,routeModule:()=>A});var s={};t.r(s),t.d(s,{default:()=>p});var o=t(89947),n=t(2706),a=t(96762),i=t(29021),u=t.n(i),c=t(33873),d=t.n(c),l=t(67619),_=t(69842),f=t(76856);async function p(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,_.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{database:s,fileBase64:o}=e.body;s?.db_full_name?.match(/datasquirel_user_.*/)||r.json({success:!1,msg:"Unauthorized"});try{let e=Buffer.from(o,"base64").toString("utf-8"),n=JSON.parse(e),a=d().resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${t.id}/main.json`);if(!u().existsSync(a))return r.end();let i=JSON.parse(u().readFileSync(a,"utf-8")),c=i.find(e=>e.dbFullName==s.db_full_name);if(!c)throw Error("Database not found!");c.tables=n.tables,u().writeFileSync(a,JSON.stringify(i),"utf-8"),await (0,f.A)({userId:t.id,targetDatabase:s.db_full_name}),r.json({success:!0})}catch(e){console.log("JSON import ERROR =>",e.message),(0,l.A)({component:"/api/importDatabase/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Import Failed!"})}}let E=(0,a.M)(s,"default"),S=(0,a.M)(s,"config"),A=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/importDatabaseSchema",pathname:"/api/importDatabaseSchema",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),o=t(95969),n=t(29021),a=t.n(n),i=t(89159);async function u(e,r,t){try{let{keyCookieName:n,csrfCookieName:u}=(0,i.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[n]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!a().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:u+=o}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[2282],()=>t(84612));module.exports=s})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=2127,e.ids=[2127],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},63311:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>l,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>d});var o=t(89947),n=t(2706),i=t(96762),a=t(29021),c=t.n(a),u=t(69842);async function d(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{let s=JSON.parse(e.body).path.replace(/ /g,"").replace(/\.\./g,"");if(s?.match(/\.\./))return r.json({success:!1,msg:"Error!",error:"Invalid url"});let o=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id.toString().replace(/\//g,"")}`,n=s.replace(/\@/,o);c().createReadStream(n).pipe(r)}catch(e){console.log("ERROR in getPrivateMedia api route:",e.message),r.json({success:!1,msg:"Error!",error:e})}}let l=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),f=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/media/getPrivateMedia",pathname:"/api/media/getPrivateMedia",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),o=t(95969),n=t(29021),i=t.n(n),a=t(89159);async function c(e,r,t){try{let{keyCookieName:n,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,o.A)({encryptedString:e.cookies[n]});if(!u)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(u);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(55511),o=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.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,s.scryptSync)(n,i,a),u=o.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",c,u);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=63311);module.exports=t})();
"use strict";(()=>{var e={};e.id=2127,e.ids=[2127],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},63311:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>l,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>d});var o=t(89947),n=t(2706),i=t(96762),a=t(29021),c=t.n(a),u=t(69842);async function d(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Failed!"});let t=await (0,u.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{let s=JSON.parse(e.body).path.replace(/ /g,"").replace(/\.\./g,"");if(s?.match(/\.\./))return r.json({success:!1,msg:"Error!",error:"Invalid url"});let o=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id.toString().replace(/\//g,"")}`,n=s.replace(/\@/,o);c().createReadStream(n).pipe(r)}catch(e){console.log("ERROR in getPrivateMedia api route:",e.message),r.json({success:!1,msg:"Error!",error:e})}}let l=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),f=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/media/getPrivateMedia",pathname:"/api/media/getPrivateMedia",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),o=t(95969),n=t(29021),i=t.n(n),a=t(89159);async function c(e,r,t){try{let{keyCookieName:n,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,o.A)({encryptedString:e.cookies[n]});if(!u)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(u);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(55511),o=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.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,s.scryptSync)(n,i,a),u=o.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",c,u);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=63311);module.exports=t})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=3338,e.ids=[3338],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},670:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>E,routeModule:()=>S});var o={};t.r(o),t.d(o,{default:()=>f});var s=t(89947),n=t(2706),i=t(96762),c=t(29021),a=t.n(c),u=t(48786),l=t(69842),d=t(33873),_=t.n(d);async function f(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await (0,l.A)(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{paradigm:t,payload:o}=e.body;try{console.log("Deleting media =>",o.id);let e=o.media_url,t=process.env.DSQL_STATIC_SERVER_DIR,s=process.env.DSQL_STATIC_HOST;if(!t){console.log("No Static Root Path"),r.json({success:!1,msg:"No Static Root Path"});return}let n=e.replace(s,""),i=_().join(t,n),c=a().existsSync(i);if(console.log("relativePath",n),console.log("STATIC_ROOT",t),console.log("STATIC_HOST",s),console.log("filePath",i),console.log("fileExist",c),c){r.json({success:!1});return}}catch(e){console.log("File verification Error =>",e.message),console.log("File Truly doesn't exist, cotinuing ...")}"user_media"===t&&await (0,u.A)(`DELETE FROM user_media WHERE id='${o.id}'`),r.json({success:!0})}let E=(0,i.M)(o,"default"),p=(0,i.M)(o,"config"),S=new s.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/purgeDb",pathname:"/api/purgeDb",bundlePath:"",filename:""},userland:o})},69842:(e,r,t)=>{t.d(r,{A:()=>a});var o=t(48786),s=t(95969),n=t(29021),i=t.n(n),c=t(89159);async function a(e,r,t){try{let{keyCookieName:n,csrfCookieName:a}=(0,c.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,s.A)({encryptedString:e.cookies[n]});if(!u)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(u);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",l),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,o.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>o});function o(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",o=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let c=r;e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),c+=o;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:i,csrfCookieName:c,oneTimeCodeName:a+=s}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var o=t(55511),s=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let a=(0,o.scryptSync)(n,i,c),u=s.Buffer.alloc(16,0),l=(0,o.createDecipheriv)("aes-192-cbc",a,u);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>o});async function o(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=670);module.exports=t})();
"use strict";(()=>{var e={};e.id=3338,e.ids=[3338],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},670:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>E,routeModule:()=>S});var o={};t.r(o),t.d(o,{default:()=>f});var s=t(89947),n=t(2706),i=t(96762),c=t(29021),a=t.n(c),u=t(48786),l=t(69842),d=t(33873),_=t.n(d);async function f(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await (0,l.A)(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{paradigm:t,payload:o}=e.body;try{console.log("Deleting media =>",o.id);let e=o.media_url,t=process.env.DSQL_STATIC_SERVER_DIR,s=process.env.DSQL_STATIC_HOST;if(!t){console.log("No Static Root Path"),r.json({success:!1,msg:"No Static Root Path"});return}let n=e.replace(s,""),i=_().join(t,n),c=a().existsSync(i);if(console.log("relativePath",n),console.log("STATIC_ROOT",t),console.log("STATIC_HOST",s),console.log("filePath",i),console.log("fileExist",c),c){r.json({success:!1});return}}catch(e){console.log("File verification Error =>",e.message),console.log("File Truly doesn't exist, cotinuing ...")}"user_media"===t&&await (0,u.A)(`DELETE FROM user_media WHERE id='${o.id}'`),r.json({success:!0})}let E=(0,i.M)(o,"default"),p=(0,i.M)(o,"config"),S=new s.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/purgeDb",pathname:"/api/purgeDb",bundlePath:"",filename:""},userland:o})},69842:(e,r,t)=>{t.d(r,{A:()=>a});var o=t(48786),s=t(95969),n=t(29021),i=t.n(n),c=t(89159);async function a(e,r,t){try{let{keyCookieName:n,csrfCookieName:a}=(0,c.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,s.A)({encryptedString:e.cookies[n]});if(!u)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(u);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,o.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>o});function o(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",o=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let c=r;e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),c+=o;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:i,csrfCookieName:c,oneTimeCodeName:a+=s}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var o=t(55511),s=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let a=(0,o.scryptSync)(n,i,c),u=s.Buffer.alloc(16,0),l=(0,o.createDecipheriv)("aes-192-cbc",a,u);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>o});async function o(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=670);module.exports=t})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=2101,e.ids=[2101],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},85607:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>f});var n={};t.r(n),t.d(n,{default:()=>u});var s=t(89947),a=t(2706),o=t(96762),i=t(67619),c=t(69842),l=t(30944);async function u(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,c.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let n=e.query.table,s=e.query.db,a=e.query.field,o=String(e.query.term),u=e.query.operator;try{let e=s?.toString()?.replace(/[^a-z0-9_]/g,""),t=`SELECT * FROM \`${e}\`.\`${n}\` WHERE LOWER(\`${a}\`) ${u?.toString()?.match(/equal/i)?"=":" LIKE "}? ORDER BY id DESC LIMIT 20`,i=[u?.toString()?.match(/equal/i)?o.toLowerCase():"%"+o.toLowerCase()+"%"],c=await (0,l.A)({database:e,queryString:t,queryValuesArray:i}),d=await (0,l.A)({database:e,queryString:t.replace(/\*/,"COUNT(id) AS count").replace(/ ORDER BY .*/,""),queryValuesArray:i});r.json({success:!0,result:c,count:d?.[0]?.count})}catch(e){(0,i.A)({component:"/api/queryEntriesSearchTerm/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Failed!"})}}let d=(0,o.M)(n,"default"),_=(0,o.M)(n,"config"),f=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/queryEntriesSearchTerm",pathname:"/api/queryEntriesSearchTerm",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function c(e,r,t){try{let{keyCookieName:a,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),a&&(c+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:c+=s}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(s))continue;let c=o[t];("number"==typeof c||c)&&a?.encrypted&&c?.match(/./)&&(o[t]=(0,n.A)({encryptedString:c}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=2101,e.ids=[2101],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},85607:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>f});var n={};t.r(n),t.d(n,{default:()=>u});var s=t(89947),a=t(2706),o=t(96762),i=t(67619),c=t(69842),l=t(30944);async function u(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await (0,c.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let n=e.query.table,s=e.query.db,a=e.query.field,o=String(e.query.term),u=e.query.operator;try{let e=s?.toString()?.replace(/[^a-z0-9_]/g,""),t=`SELECT * FROM \`${e}\`.\`${n}\` WHERE LOWER(\`${a}\`) ${u?.toString()?.match(/equal/i)?"=":" LIKE "}? ORDER BY id DESC LIMIT 20`,i=[u?.toString()?.match(/equal/i)?o.toLowerCase():"%"+o.toLowerCase()+"%"],c=await (0,l.A)({database:e,queryString:t,queryValuesArray:i}),d=await (0,l.A)({database:e,queryString:t.replace(/\*/,"COUNT(id) AS count").replace(/ ORDER BY .*/,""),queryValuesArray:i});r.json({success:!0,result:c,count:d?.[0]?.count})}catch(e){(0,i.A)({component:"/api/queryEntriesSearchTerm/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Failed!"})}}let d=(0,o.M)(n,"default"),_=(0,o.M)(n,"config"),f=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/queryEntriesSearchTerm",pathname:"/api/queryEntriesSearchTerm",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function c(e,r,t){try{let{keyCookieName:a,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),a&&(c+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:c+=s}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(s))continue;let c=o[t];("number"==typeof c||c)&&a?.encrypted&&c?.match(/./)&&(o[t]=(0,n.A)({encryptedString:c}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=2998,e.ids=[2998],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},55896:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>S,routeModule:()=>g});var n={};t.r(n),t.d(n,{default:()=>E});var s=t(89947),i=t(2706),o=t(96762),a=t(69842),l=t(29021),c=t.n(l),u=t(67619),d=t(48786),_=t(68829),f=t(89159);async function p({userId:e,res:r,csrf:t}){try{let n=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!n)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;let s=await (0,d.A)("SELECT * FROM users WHERE id=?",[e]);c().unlinkSync(`${n}/${t}`);let i=Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2),o={id:s[0].id,stripe_id:s[0].stripe_id||"",first_name:s[0].first_name,last_name:s[0].last_name,email:s[0].email,social_id:s[0].social_id,image:s[0].image,image_thumbnail:s[0].image_thumbnail,verification_status:s[0].verification_status,social_login:s[0].social_login,social_platform:s[0].social_platform,csrf_k:i,logged_in_status:!0,date:Date.now()},a=(0,_.A)({data:JSON.stringify(o)});c().writeFileSync(`${n}/${i}`,JSON.stringify(o));let{keyCookieName:l,csrfCookieName:u}=(0,f.A)();return r.setHeader("Set-Cookie",[`${l}=${a};samesite=strict;path=/;HttpOnly=true;Secure=true`,`${u}=${i};samesite=strict;path=/;HttpOnly=true;Secure=true`,"user_refresh=1"]),o}catch(r){return(0,u.A)({component:"reAuthUser",message:r.message,user:{id:e}}),null}}async function E(e,r){"POST"!==e.method&&r.json({msg:"Failed!"});let t=await (0,a.A)(e,r,!0);if(!t){console.log("No user Found"),r.redirect(307,"/logout");return}let n=await p({userId:t.id,res:r,csrf:t.csrf_k}),s={status:!!n,csrf:n?.csrf_k,user:n};r.json(s)}let S=(0,o.M)(n,"default"),m=(0,o.M)(n,"config"),g=new s.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/reAuthenticateUser",pathname:"/api/reAuthenticateUser",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(48786),s=t(95969),i=t(29021),o=t.n(i),a=t(89159);async function l(e,r,t){try{let{keyCookieName:i,csrfCookieName:l}=(0,a.A)();if(!e.cookies?.[i]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,s.A)({encryptedString:e.cookies[i]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=n;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),i&&(l+=`${i}_`),{keyCookieName:o,csrfCookieName:a,oneTimeCodeName:l+=s}}},67619:(e,r,t)=>{t.d(r,{A:()=>i});var n=t(29021),s=t.n(n);async function i({user:e,message:r,component:t,noMail:n,req:i}){let o=new Date,a=(()=>{if(!i)return null;try{let e=i.headers["x-forwarded-for"],r=i.headers["x-real-ip"],t=i.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||i.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=2998,e.ids=[2998],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},55896:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>S,routeModule:()=>g});var n={};t.r(n),t.d(n,{default:()=>E});var s=t(89947),i=t(2706),o=t(96762),a=t(69842),l=t(29021),c=t.n(l),u=t(67619),_=t(48786),d=t(68829),f=t(89159);async function p({userId:e,res:r,csrf:t}){try{let n=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!n)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;let s=await (0,_.A)("SELECT * FROM users WHERE id=?",[e]);c().unlinkSync(`${n}/${t}`);let i=Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2),o={id:s[0].id,stripe_id:s[0].stripe_id||"",first_name:s[0].first_name,last_name:s[0].last_name,email:s[0].email,social_id:s[0].social_id,image:s[0].image,image_thumbnail:s[0].image_thumbnail,verification_status:s[0].verification_status,social_login:s[0].social_login,social_platform:s[0].social_platform,csrf_k:i,logged_in_status:!0,date:Date.now()},a=(0,d.A)({data:JSON.stringify(o)});c().writeFileSync(`${n}/${i}`,JSON.stringify(o));let{keyCookieName:l,csrfCookieName:u}=(0,f.A)();return r.setHeader("Set-Cookie",[`${l}=${a};samesite=strict;path=/;HttpOnly=true;Secure=true`,`${u}=${i};samesite=strict;path=/;HttpOnly=true;Secure=true`,"user_refresh=1"]),o}catch(r){return(0,u.A)({component:"reAuthUser",message:r.message,user:{id:e}}),null}}async function E(e,r){"POST"!==e.method&&r.json({msg:"Failed!"});let t=await (0,a.A)(e,r,!0);if(!t){console.log("No user Found"),r.redirect(307,"/logout");return}let n=await p({userId:t.id,res:r,csrf:t.csrf_k}),s={status:!!n,csrf:n?.csrf_k,user:n};r.json(s)}let S=(0,o.M)(n,"default"),m=(0,o.M)(n,"config"),g=new s.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/reAuthenticateUser",pathname:"/api/reAuthenticateUser",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(48786),s=t(95969),i=t(29021),o=t.n(i),a=t(89159);async function l(e,r,t){try{let{keyCookieName:i,csrfCookieName:l}=(0,a.A)();if(!e.cookies?.[i]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,s.A)({encryptedString:e.cookies[i]});if(!c)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(c);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${_}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=n;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),i&&(l+=`${i}_`),{keyCookieName:o,csrfCookieName:a,oneTimeCodeName:l+=s}}},67619:(e,r,t)=>{t.d(r,{A:()=>i});var n=t(29021),s=t.n(n);async function i({user:e,message:r,component:t,noMail:n,req:i}){let o=new Date,a=(()=>{if(!i)return null;try{let e=i.headers["x-forwarded-for"],r=i.headers["x-real-ip"],t=i.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||i.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=2896,e.ids=[2896],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},2875:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>f,routeModule:()=>p});var n={};t.r(n),t.d(n,{default:()=>d});var s=t(89947),a=t(2706),o=t(96762),i=t(30944),c=t(67619),l=t(69842),u=t(95969);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,l.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{table:n,db:s,id:a}=e.body,o=e.body.schema;try{let e=`SELECT * FROM \`${s?.toString()||""}\`.\`${n}\` WHERE id=?`,t=[a?.toString()||""],c=await (0,i.A)({database:s?.toString()||"",queryString:e,queryValuesArray:t});if(!c||!c[0])return r.json({success:!1,msg:"Entry not found"});let l=JSON.parse(o||"{}");try{for(let e=0;e<l.fields.length;e++){let r=l.fields[e];r.encrypted&&r.fieldName&&(c[0][r.fieldName]=(0,u.A)({encryptedString:c[0][r.fieldName]}))}}catch(e){console.log("Error in parsing and decrypting fields in 'UpdateDbEntry' API ROute =>",e.message)}r.json({success:!0,entry:c[0]})}catch(e){(0,c.A)({component:"/api/refreshEntry/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Deletion Failed!"})}}let f=(0,o.M)(n,"default"),_=(0,o.M)(n,"config"),p=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/refreshEntry",pathname:"/api/refreshEntry",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function c(e,r,t){try{let{keyCookieName:a,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),a&&(c+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:c+=s}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(s))continue;let c=o[t];("number"==typeof c||c)&&a?.encrypted&&c?.match(/./)&&(o[t]=(0,n.A)({encryptedString:c}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=2896,e.ids=[2896],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},2875:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>f,routeModule:()=>p});var n={};t.r(n),t.d(n,{default:()=>d});var s=t(89947),a=t(2706),o=t(96762),i=t(30944),c=t(67619),l=t(69842),u=t(95969);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await (0,l.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{table:n,db:s,id:a}=e.body,o=e.body.schema;try{let e=`SELECT * FROM \`${s?.toString()||""}\`.\`${n}\` WHERE id=?`,t=[a?.toString()||""],c=await (0,i.A)({database:s?.toString()||"",queryString:e,queryValuesArray:t});if(!c||!c[0])return r.json({success:!1,msg:"Entry not found"});let l=JSON.parse(o||"{}");try{for(let e=0;e<l.fields.length;e++){let r=l.fields[e];r.encrypted&&r.fieldName&&(c[0][r.fieldName]=(0,u.A)({encryptedString:c[0][r.fieldName]}))}}catch(e){console.log("Error in parsing and decrypting fields in 'UpdateDbEntry' API ROute =>",e.message)}r.json({success:!0,entry:c[0]})}catch(e){(0,c.A)({component:"/api/refreshEntry/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Deletion Failed!"})}}let f=(0,o.M)(n,"default"),_=(0,o.M)(n,"config"),p=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/refreshEntry",pathname:"/api/refreshEntry",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function c(e,r,t){try{let{keyCookieName:a,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),a&&(c+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:c+=s}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(s))continue;let c=o[t];("number"==typeof c||c)&&a?.encrypted&&c?.match(/./)&&(o[t]=(0,n.A)({encryptedString:c}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=9659,e.ids=[9659],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},52262:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>c,routeModule:()=>l});var s={};t.r(s),t.d(s,{default:()=>u});var o=t(89947),n=t(2706),i=t(96762),a=t(69842);async function u(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await (0,a.A)(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{userId:t,dbSlug:s}=e.body,o=`${process.env.DSQL_USER_DB_PREFIX}${t}_${s}`,n=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${o}`;r.setHeader("Set-Cookie",[`${n}=null;path=/;max-age=0`]),r.json({success:!0,msg:"Processed Successfully"})}let c=(0,i.M)(s,"default"),d=(0,i.M)(s,"config"),l=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/resetDelegatedDatabaseToken",pathname:"/api/resetDelegatedDatabaseToken",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),o=t(95969),n=t(29021),i=t.n(n),a=t(89159);async function u(e,r,t){try{let{keyCookieName:n,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,o.A)({encryptedString:e.cookies[n]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=o}}},95969:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(55511),o=t(79428);function n({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=(0,s.scryptSync)(n,i,a),c=o.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=52262);module.exports=t})();
"use strict";(()=>{var e={};e.id=9659,e.ids=[9659],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},52262:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>c,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>u});var n=t(89947),o=t(2706),i=t(96762),a=t(69842);async function u(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await (0,a.A)(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{userId:t,dbSlug:s}=e.body,n=`${process.env.DSQL_USER_DB_PREFIX}${t}_${s}`,o=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${n}`;r.setHeader("Set-Cookie",[`${o}=null;path=/;max-age=0`]),r.json({success:!0,msg:"Processed Successfully"})}let c=(0,i.M)(s,"default"),d=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/resetDelegatedDatabaseToken",pathname:"/api/resetDelegatedDatabaseToken",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${_}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(55511),n=t(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=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 u=(0,s.scryptSync)(o,i,a),c=n.Buffer.alloc(16,0),d=(0,s.createDecipheriv)("aes-192-cbc",u,c);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=52262);module.exports=t})();

View File

@ -1,16 +1,16 @@
"use strict";(()=>{var e={};e.id=8563,e.ids=[8563],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},51397:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>u});var n=t(89947),a=t(2706),o=t(96762),i=t(69842),c=t(67619),l=t(30944);async function u(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,i.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{database:s,query:n,tables:a}=e.body;try{let e=await (0,l.A)({database:`datasquirel_user_${t.id}_${s}`,queryString:n});if(!e)return r.json({success:!1,msg:"Query Failed!"});r.json({success:!0,result:e})}catch(e){(0,c.A)({component:"/api/runUserDbQuery/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}let d=(0,o.M)(s,"default"),_=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/runUserDbQuery",pathname:"/api/runUserDbQuery",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),n=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function c(e,r,t){try{let{keyCookieName:a,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),a&&(c+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:c+=n}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(95969);let n=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(n))continue;let c=o[t];("number"==typeof c||c)&&a?.encrypted&&c?.match(/./)&&(o[t]=(0,s.A)({encryptedString:c}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),n=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||a.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=8563,e.ids=[8563],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},51397:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>f});var n={};t.r(n),t.d(n,{default:()=>u});var s=t(89947),a=t(2706),o=t(96762),i=t(69842),c=t(67619),l=t(30944);async function u(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,i.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{database:n,query:s,tables:a}=e.body;try{let e=await (0,l.A)({database:`datasquirel_user_${t.id}_${n}`,queryString:s});if(!e)return r.json({success:!1,msg:"Query Failed!"});r.json({success:!0,result:e})}catch(e){(0,c.A)({component:"/api/runUserDbQuery/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}let d=(0,o.M)(n,"default"),_=(0,o.M)(n,"config"),f=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/runUserDbQuery",pathname:"/api/runUserDbQuery",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(48786),s=t(95969),a=t(29021),o=t.n(a),i=t(89159);async function c(e,r,t){try{let{keyCookieName:a,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,s.A)({encryptedString:e.cookies[a]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=n;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),a&&(c+=`${a}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:c+=s}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(s))continue;let c=o[t];("number"==typeof c||c)&&a?.encrypted&&c?.match(/./)&&(o[t]=(0,n.A)({encryptedString:c}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),a?.url&&(s+=`
URL: ${a.url}`),a?.body&&(s+=`
Request Body: ${JSON.stringify(a.body,null,4)}`),i&&(s+=`
IP: ${i}`),s+=`
User Email: ${e?.email}`),a?.url&&(n+=`
URL: ${a.url}`),a?.body&&(n+=`
Request Body: ${JSON.stringify(a.body,null,4)}`),i&&(n+=`
IP: ${i}`),n+=`
Date: ${o.toDateString()}
========================================`,n().existsSync("./.tmp/error.log")||n().writeFileSync("./.tmp/error.log","","utf-8");let c=n().readFileSync("./.tmp/error.log","utf-8");n().writeFileSync("./.tmp/error.log",s),n().appendFileSync("./.tmp/error.log",`
========================================`,s().existsSync("./.tmp/error.log")||s().writeFileSync("./.tmp/error.log","","utf-8");let c=s().readFileSync("./.tmp/error.log","utf-8");s().writeFileSync("./.tmp/error.log",n),s().appendFileSync("./.tmp/error.log",`
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(43775),n=t(67619),a=t(48786),o=t(37275),i=t(7971);async function c({queryString:e,queryValuesArray:r,database:t,tableSchema:c,useLocal:l}){let u;let d=!!l||!!t?.match(/^datasquirel$/),_=l?i.A:d?a.A:o.A;try{u=e&&r&&Array.isArray(r)&&r[0]?d?await _(e,r):await _({paradigm:"Full Access",queryString:e,queryValues:r}):d?await _(e):await _({paradigm:"Full Access",queryString:e})}catch(e){console.log(`varDatabaseDbHandler Error: ${e.message}`),(0,n.A)({component:"varDatabaseDbHandler/lines-29-32",message:e.message})}if(u&&c)try{let e=u;return await (0,s.A)({unparsedResults:e,tableSchema:c})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),(0,n.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(u)return u;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(55511),n=t(79428);function a({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=t||process.env.DSQL_ENCRYPTION_SALT,i=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=(0,s.scryptSync)(a,o,i),l=n.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",c,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},37275:(e,r,t)=>{async function s(e,r,t){try{if("string"==typeof r){let s=await e.query(n(r),t);return JSON.parse(JSON.stringify(s))}if("object"!=typeof r)return null;{let t=[];for(let s=0;s<r.length;s++)try{let a=r[s],o=await e.query(n(a.query),a.values);t.push(JSON.parse(JSON.stringify(o)))}catch(e){t.push(null)}return t}}catch(e){return null}finally{e.end()}}function n(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}async function a({paradigm:e,queryString:r,queryValues:t}){try{switch(e){case"Read Only":return await s(global.DSQL_READ_ONLY_DB_CONN,r,t);case"Full Access":case"FA":return await s(global.DSQL_FULL_ACCESS_DB_CONN,r,t);default:return null}}catch(e){return console.log(`DSQL_USER_DB_HANDLER Error: ${e.message}`),null}}t.d(r,{A:()=>a})},7971:(e,r,t)=>{t.d(r,{A:()=>i});var s=t(9973),n=t.n(s),a=t(29021),o=t.n(a);async function i(...e){let r=n()({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:function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!o().existsSync(r)){console.log(`${r} does not exist`);return}return{ca:o().readFileSync(`${e}/ca-cert.pem`),rejectUnauthorized:!1}}()},onConnect:()=>{console.log("Connection Successful!")},onConnectError:e=>{console.log("Connection Error",e.message)},onError:e=>{console.log("Client Error",e.message)}});console.log("Querying ...");try{let t=await r.query(...e);return await r.end(),JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e.message),{success:!1,error:e.message}}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=51397);module.exports=t})();
${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>c});var n=t(43775),s=t(67619),a=t(48786),o=t(37275),i=t(7971);async function c({queryString:e,queryValuesArray:r,database:t,tableSchema:c,useLocal:l}){let u;let d=!!l||!!t?.match(/^datasquirel$/),_=l?i.A:d?a.A:o.A;try{u=e&&r&&Array.isArray(r)&&r[0]?d?await _(e,r):await _({paradigm:"Full Access",queryString:e,queryValues:r}):d?await _(e):await _({paradigm:"Full Access",queryString:e})}catch(e){console.log(`varDatabaseDbHandler Error: ${e.message}`),(0,s.A)({component:"varDatabaseDbHandler/lines-29-32",message:e.message})}if(u&&c)try{let e=u;return await (0,n.A)({unparsedResults:e,tableSchema:c})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),(0,s.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(u)return u;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(55511),s=t(79428);function a({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=t||process.env.DSQL_ENCRYPTION_SALT,i=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=(0,n.scryptSync)(a,o,i),l=s.Buffer.alloc(16,0),u=(0,n.createDecipheriv)("aes-192-cbc",c,l);try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});async function n(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},37275:(e,r,t)=>{async function n(e,r,t){try{if("string"==typeof r){let n=await e.query(s(r),t);return JSON.parse(JSON.stringify(n))}if("object"!=typeof r)return null;{let t=[];for(let n=0;n<r.length;n++)try{let a=r[n],o=await e.query(s(a.query),a.values);t.push(JSON.parse(JSON.stringify(o)))}catch(e){t.push(null)}return t}}catch(e){return null}finally{e.end()}}function s(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}async function a({paradigm:e,queryString:r,queryValues:t}){try{switch(e){case"Read Only":return await n(global.DSQL_READ_ONLY_DB_CONN,r,t);case"Full Access":case"FA":return await n(global.DSQL_FULL_ACCESS_DB_CONN,r,t);default:return null}}catch(e){return console.log(`DSQL_USER_DB_HANDLER Error: ${e.message}`),null}}t.d(r,{A:()=>a})},7971:(e,r,t)=>{t.d(r,{A:()=>i});var n=t(9973),s=t.n(n),a=t(29021),o=t.n(a);async function i(...e){let r=s()({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:function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!o().existsSync(r)){console.log(`${r} does not exist`);return}return{ca:o().readFileSync(`${e}/ca-cert.pem`),rejectUnauthorized:!1}}()},onConnect:()=>{console.log("Connection Successful!")},onConnectError:e=>{console.log("Connection Error",e.message)},onError:e=>{console.log("Client Error",e.message)}});console.log("Querying ...");try{let t=await r.query(...e);return await r.end(),JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e.message),{success:!1,error:e.message}}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=51397);module.exports=t})();

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=7889,e.ids=[7889],e.modules={60818:e=>{e.exports=require("dotenv")},47795:e=>{e.exports=require("generate-password")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},52795:(e,r,s)=>{s.r(r),s.d(r,{config:()=>f,default:()=>h,routeModule:()=>E});var t={};s.r(t),s.d(t,{default:()=>g});var a=s(89947),i=s(2706),o=s(96762),u=s(47795),n=s.n(u),d=s(69842),l=s(67619),c=s(48786),m=s(68829),p=s(5437);async function g(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let s=await (0,d.A)(e,r,!0);if(!s)return r.json({success:!1,msg:"Unauthorized"});let{data:t,edit:a,grants:i}=e.body;try{let e=process.env.DSQL_DB_HOST||"127.0.0.1",a=s?.id==Number(process.env.DSQL_SU_USER_ID),{host:o,password:u,username:d}=t,l=a&&d?.match(/./)?d:`dsql_user_${s.id}`;if(!o.match(/./))throw Error("Invalid host");let g=String(o).replace(/[^a-zA-Z0-9-\.\:\/\%]/g,""),h=u?.match(/./)?u:n().generate({length:16,numbers:!0,symbols:!0,uppercase:!0,exclude:"*#.'`\""}),f=await (0,c.A)("SELECT * FROM mysql.user WHERE User = ? AND (Host = ? OR Host = ?)",[l,g,e]);if(f?.[0]?.User)throw Error("SQL User already exists. Remember if you have the '%' host on your primary user, it catches all other hosts.");let E=await (0,c.A)("SELECT COUNT(*) FROM mariadb_users WHERE user_id = ?",[s.id]);if(E?.[0]?.["COUNT(*)"]>=10)throw Error("User limit reached");let S=(0,m.A)({data:h}),A=await (0,c.A)("INSERT INTO mariadb_users (user_id, username, host, password, grants) VALUES (?, ?, ?, ?, ?)",[s.id,l,g,S,JSON.stringify(i)]);if(!A?.insertId)throw Error("Error in adding SQL user");await (0,p.A)({userId:s.id,mariadbUsername:l,mariadbUserHost:g}),r.json({success:!0})}catch(e){console.log("Create MariaDB user ERROR:",e.message),(0,l.A)({component:"/api/acceptUserInvitation/catch-error",message:e.message,user:s}),r.json({success:!1,msg:"Error in adding SQL user =>"+e.message,err:e.message})}}let h=(0,o.M)(t,"default"),f=(0,o.M)(t,"config"),E=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/sql-users/create",pathname:"/api/sql-users/create",bundlePath:"",filename:""},userland:t})}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[3496],()=>s(52795));module.exports=t})();
"use strict";(()=>{var e={};e.id=7889,e.ids=[7889],e.modules={60818:e=>{e.exports=require("dotenv")},47795:e=>{e.exports=require("generate-password")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},52795:(e,r,s)=>{s.r(r),s.d(r,{config:()=>f,default:()=>h,routeModule:()=>E});var t={};s.r(t),s.d(t,{default:()=>g});var a=s(89947),i=s(2706),o=s(96762),u=s(47795),n=s.n(u),d=s(69842),l=s(67619),c=s(48786),m=s(68829),p=s(5437);async function g(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let s=await (0,d.A)(e,r,!0);if(!s)return r.json({success:!1,msg:"Unauthorized"});let{data:t,edit:a,grants:i}=e.body;try{process.env.DSQL_DB_HOST;let e=s?.id==Number(process.env.DSQL_SU_USER_ID),{host:a,password:o,username:u}=t,d=e&&u?.match(/./)?u:`dsql_user_${s.id}`;if(!a.match(/./))throw Error("Invalid host");let l=String(a).replace(/[^a-zA-Z0-9-\.\:\/\%]/g,""),g=o?.match(/./)?o:n().generate({length:16,numbers:!0,symbols:!0,uppercase:!0,exclude:"*#.'`\""}),h=await (0,c.A)("SELECT * FROM mysql.user WHERE User=? AND Host=?",[d,l]);if(h?.[0]?.User)throw Error("SQL User already exists. Remember if you have the '%' host on your primary user, it catches all other hosts.");let f=await (0,c.A)("SELECT COUNT(*) FROM mariadb_users WHERE user_id = ?",[s.id]);if(f?.[0]?.["COUNT(*)"]>=10)throw Error("User limit reached");let E=(0,m.A)({data:g}),S=await (0,c.A)("INSERT INTO mariadb_users (user_id, username, host, password, grants) VALUES (?, ?, ?, ?, ?)",[s.id,d,l,E,JSON.stringify(i)]);if(!S?.insertId)throw Error("Error in adding SQL user");await (0,p.A)({userId:s.id,mariadbUsername:d,mariadbUserHost:l}),r.json({success:!0})}catch(e){console.log("Create MariaDB user ERROR:",e.message),(0,l.A)({component:"/api/acceptUserInvitation/catch-error",message:e.message,user:s}),r.json({success:!1,msg:"Error in adding SQL user =>"+e.message,err:e.message})}}let h=(0,o.M)(t,"default"),f=(0,o.M)(t,"config"),E=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/sql-users/create",pathname:"/api/sql-users/create",bundlePath:"",filename:""},userland:t})}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[3496],()=>s(52795));module.exports=t})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=536,e.ids=[536],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},56625:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>d,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>l});var n=t(89947),o=t(2706),i=t(96762),a=t(69842),u=t(67619),c=t(48786);async function l(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,a.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{id:s}=e.body;try{let e=await (0,c.A)("SELECT * FROM mariadb_users WHERE id = ? AND user_id = ?",[s,t.id]),n=e?.[0];if(!n?.id)throw Error("Active User couldn't be verified");if(String(n.primary)?.match(/1/))throw Error("Cannot Delete Primary User");let o=n.username,i=n.host;await (0,c.A)("DELETE FROM mariadb_users WHERE user_id = ? AND id = ?",[t.id,n.id]),await (0,c.A)(`DROP USER '${o}'@'${i}'`),r.json({success:!0})}catch(e){(0,u.A)({component:"/api/acceptUserInvitation/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Error in adding SQL user =>"+e.message,err:e.message})}}let d=(0,i.M)(s,"default"),f=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/sql-users/delete",pathname:"/api/sql-users/delete",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(c);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",l),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(29021),n=t.n(s);async function o({user:e,message:r,component:t,noMail:s,req:o}){let i=new Date,a=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=536,e.ids=[536],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},56625:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>d,routeModule:()=>_});var s={};t.r(s),t.d(s,{default:()=>l});var n=t(89947),o=t(2706),i=t(96762),a=t(69842),u=t(67619),c=t(48786);async function l(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,a.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{id:s}=e.body;try{let e=await (0,c.A)("SELECT * FROM mariadb_users WHERE id = ? AND user_id = ?",[s,t.id]),n=e?.[0];if(!n?.id)throw Error("Active User couldn't be verified");if(String(n.primary)?.match(/1/))throw Error("Cannot Delete Primary User");let o=n.username,i=n.host;await (0,c.A)("DELETE FROM mariadb_users WHERE user_id = ? AND id = ?",[t.id,n.id]),await (0,c.A)(`DROP USER '${o}'@'${i}'`),r.json({success:!0})}catch(e){(0,u.A)({component:"/api/acceptUserInvitation/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Error in adding SQL user =>"+e.message,err:e.message})}}let d=(0,i.M)(s,"default"),f=(0,i.M)(s,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/sql-users/delete",pathname:"/api/sql-users/delete",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),n=t(95969),o=t(29021),i=t.n(o),a=t(89159);async function u(e,r,t){try{let{keyCookieName:o,csrfCookieName:u}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,n.A)({encryptedString:e.cookies[o]});if(!c)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(c);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:u+=n}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(29021),n=t.n(s);async function o({user:e,message:r,component:t,noMail:s,req:o}){let i=new Date,a=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=294,e.ids=[294],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},7522:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>c,routeModule:()=>f});var t={};s.r(t),s.d(t,{default:()=>l});var i=s(89947),o=s(2706),a=s(96762),n=s(48786),d=s(69842),u=s(98e3);async function l(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let s=await (0,d.A)(e,r,!0);if(!s)return r.json({success:!1,msg:"Unauthorized"});let{userObject:t,database_access:i,user_priviledge:o,db_tables:a,inv_user_id:l}=e.body,c=await (0,n.A)("UPDATE user_users SET database_access = ? ,user_priviledge = ? WHERE user_id = ? AND email = ?",[i,o,s.id,t.email]),_=a.split("|");await (0,n.A)(`DELETE FROM delegated_user_tables WHERE root_user_id='${s.id}' AND delegated_user_id='${l}'`);for(let e=0;e<_.length;e++){let[r,t]=_[e].split("-");await (0,u.A)({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:l,root_user_id:s.id,database:r,table:t,priviledge:o}})}r.json({success:!!c?.affectedRows})}let c=(0,a.M)(t,"default"),_=(0,a.M)(t,"config"),f=new i.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/updateAdminUserAccess",pathname:"/api/updateAdminUserAccess",bundlePath:"",filename:""},userland:t})},69842:(e,r,s)=>{s.d(r,{A:()=>d});var t=s(48786),i=s(95969),o=s(29021),a=s.n(o),n=s(89159);async function d(e,r,s){try{let{keyCookieName:o,csrfCookieName:d}=(0,n.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,i.A)({encryptedString:e.cookies[o]});if(!u)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(u);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(s&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",l),Error("Deep Auth Failed. `csrf` key not found in request headers!");let c=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(s&&!a().existsSync(`${c}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!s){let e=await (0,t.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,s)=>{s.d(r,{A:()=>t});function t(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",i=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;let n=r;e?.userId&&(n+=`user_${e.userId}_`),o&&(n+=`${o}_`),n+=t;let d=r;return e?.userId&&(d+=`user_${e.userId}_`),o&&(d+=`${o}_`),{keyCookieName:a,csrfCookieName:n,oneTimeCodeName:d+=i}}},95969:(e,r,s)=>{s.d(r,{A:()=>o});var t=s(55511),i=s(79428);function o({encryptedString:e,encryptionKey:r,encryptionSalt:s}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=r||process.env.DSQL_ENCRYPTION_PASSWORD,a=s||process.env.DSQL_ENCRYPTION_SALT,n=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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,t.scryptSync)(o,a,n),u=i.Buffer.alloc(16,0),l=(0,t.createDecipheriv)("aes-192-cbc",d,u);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[1251],()=>s(7522));module.exports=t})();
"use strict";(()=>{var e={};e.id=294,e.ids=[294],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},7522:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>c,routeModule:()=>f});var t={};s.r(t),s.d(t,{default:()=>l});var i=s(89947),a=s(2706),o=s(96762),n=s(48786),d=s(69842),u=s(98e3);async function l(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let s=await (0,d.A)(e,r,!0);if(!s)return r.json({success:!1,msg:"Unauthorized"});let{userObject:t,database_access:i,user_priviledge:a,db_tables:o,inv_user_id:l}=e.body,c=await (0,n.A)("UPDATE user_users SET database_access = ? ,user_priviledge = ? WHERE user_id = ? AND email = ?",[i,a,s.id,t.email]),_=o.split("|");await (0,n.A)(`DELETE FROM delegated_user_tables WHERE root_user_id='${s.id}' AND delegated_user_id='${l}'`);for(let e=0;e<_.length;e++){let[r,t]=_[e].split("-");await (0,u.A)({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:l,root_user_id:s.id,database:r,table:t,priviledge:a}})}r.json({success:!!c?.affectedRows})}let c=(0,o.M)(t,"default"),_=(0,o.M)(t,"config"),f=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/updateAdminUserAccess",pathname:"/api/updateAdminUserAccess",bundlePath:"",filename:""},userland:t})},69842:(e,r,s)=>{s.d(r,{A:()=>d});var t=s(48786),i=s(95969),a=s(29021),o=s.n(a),n=s(89159);async function d(e,r,s){try{let{keyCookieName:a,csrfCookieName:d}=(0,n.A)();if(!e.cookies?.[a]?.match(/./))throw Error("Request Cookies not Found!");let u=(0,i.A)({encryptedString:e.cookies[a]});if(!u)throw Error("Couldn't decrypt auth cookie!");let l=JSON.parse(u);if(!l.csrf_k)throw Error("No `csrf_k` present in user Object!");if(s&&!Object.keys(e.headers).find(e=>e.includes(l.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let c=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(s&&!o().existsSync(`${c}/${l.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==l.verification_status&&!s){let e=await (0,t.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(l?.date&&Date.now()-l.date>6048e5)throw Error("Key expired!");return l}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,s)=>{s.d(r,{A:()=>t});function t(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",i=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",a=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),o+=s;let n=r;e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),n+=t;let d=r;return e?.userId&&(d+=`user_${e.userId}_`),a&&(d+=`${a}_`),{keyCookieName:o,csrfCookieName:n,oneTimeCodeName:d+=i}}},95969:(e,r,s)=>{s.d(r,{A:()=>a});var t=s(55511),i=s(79428);function a({encryptedString:e,encryptionKey:r,encryptionSalt:s}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=s||process.env.DSQL_ENCRYPTION_SALT,n=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,t.scryptSync)(a,o,n),u=i.Buffer.alloc(16,0),l=(0,t.createDecipheriv)("aes-192-cbc",d,u);try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[1251],()=>s(7522));module.exports=t})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=4105,e.ids=[4105],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},55096:(e,r,t)=>{t.r(r),t.d(r,{config:()=>A,default:()=>h,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var a=t(89947),n=t(2706),o=t(96762),i=t(29021),u=t.n(i),c=t(69842),d=t(67619),l=t(48786),_=t(33873),f=t.n(_),E=t(76856);async function p(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,c.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.body.schema,a=e.body.dbId;try{let e=await (0,l.A)("SELECT * FROM user_databases WHERE user_id = ? AND id = ?",[t.id,a]);if(!e?.[0])throw Error("Invalid Database");let n=e[0],o=f().resolve(process.cwd(),`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`),i=JSON.parse(u().readFileSync(o,"utf-8")),c=i.find(e=>e.dbFullName==n.db_full_name);if(!c)throw Error("This Database doesn't exist");if(c.tables=s.tables,c.childrenDatabases)for(let e=0;e<c.childrenDatabases.length;e++){let{dbFullName:r}=c.childrenDatabases[e],t=i.find(e=>e.dbFullName===r);if(!t||!t.tables){c.childrenDatabases?.splice(e,1);continue}t.tables=s.tables}u().writeFileSync(`${o}`,JSON.stringify(i),"utf8"),await (0,E.A)({userId:t.id,targetDatabase:n.db_full_name}),r.json({success:!0})}catch(s){(0,d.A)({component:"/api/acceptUserInvitation/catch-error",message:s.message,user:t,req:e}),r.json({success:!1})}}let h=(0,o.M)(s,"default"),A=(0,o.M)(s,"config"),S=new a.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/user-schema/replace-database-schema",pathname:"/api/user-schema/replace-database-schema",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),a=t(95969),n=t(29021),o=t.n(n),i=t(89159);async function u(e,r,t){try{let{keyCookieName:n,csrfCookieName:u}=(0,i.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let c=(0,a.A)({encryptedString:e.cookies[n]});if(!c)throw Error("Couldn't decrypt auth cookie!");let d=JSON.parse(c);if(!d.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(d.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",d),Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${l}/${d.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==d.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(d?.date&&Date.now()-d.date>6048e5)throw Error("Key expired!");return d}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=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+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=t;let i=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),{keyCookieName:o,csrfCookieName:i,oneTimeCodeName:u+=a}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[2282],()=>t(55096));module.exports=s})();
"use strict";(()=>{var e={};e.id=4105,e.ids=[4105],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},55096:(e,r,t)=>{t.r(r),t.d(r,{config:()=>A,default:()=>h,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var a=t(89947),n=t(2706),i=t(96762),o=t(29021),u=t.n(o),d=t(69842),c=t(67619),l=t(48786),_=t(33873),f=t.n(_),E=t(76856);async function p(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await (0,d.A)(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.body.schema,a=e.body.dbId;try{let e=await (0,l.A)("SELECT * FROM user_databases WHERE user_id = ? AND id = ?",[t.id,a]);if(!e?.[0])throw Error("Invalid Database");let n=e[0],i=f().resolve(process.cwd(),`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`),o=JSON.parse(u().readFileSync(i,"utf-8")),d=o.find(e=>e.dbFullName==n.db_full_name);if(!d)throw Error("This Database doesn't exist");if(d.tables=s.tables,d.childrenDatabases)for(let e=0;e<d.childrenDatabases.length;e++){let{dbFullName:r}=d.childrenDatabases[e],t=o.find(e=>e.dbFullName===r);if(!t||!t.tables){d.childrenDatabases?.splice(e,1);continue}t.tables=s.tables}u().writeFileSync(`${i}`,JSON.stringify(o),"utf8"),await (0,E.A)({userId:t.id,targetDatabase:n.db_full_name}),r.json({success:!0})}catch(s){(0,c.A)({component:"/api/acceptUserInvitation/catch-error",message:s.message,user:t,req:e}),r.json({success:!1})}}let h=(0,i.M)(s,"default"),A=(0,i.M)(s,"config"),S=new a.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/user-schema/replace-database-schema",pathname:"/api/user-schema/replace-database-schema",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>u});var s=t(48786),a=t(95969),n=t(29021),i=t.n(n),o=t(89159);async function u(e,r,t){try{let{keyCookieName:n,csrfCookieName:u}=(0,o.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let d=(0,a.A)({encryptedString:e.cookies[n]});if(!d)throw Error("Couldn't decrypt auth cookie!");let c=JSON.parse(d);if(!c.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let l=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${l}/${c.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==c.verification_status&&!t){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(c?.date&&Date.now()-c.date>6048e5)throw Error("Key expired!");return c}catch(r){return console.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=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=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=s;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),{keyCookieName:i,csrfCookieName:o,oneTimeCodeName:u+=a}}},48786:(e,r,t)=>{t.d(r,{A:()=>s});async function s(...e){let r=global.DSQL_DB_CONN;try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let t=await r.query(...e);return JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[2282],()=>t(55096));module.exports=s})();

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/blog-8c70d46c8352664e.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_buildManifest.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/blog","query":{},"buildId":"Vwi6iXhX7A60Ca2R9JTQV","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/blog-8c70d46c8352664e.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_buildManifest.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/blog","query":{},"buildId":"BYGBoTeiBrkCn0j6XrihZ","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/contact-f2a4f3c2e97b25fb.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_buildManifest.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/contact","query":{},"buildId":"Vwi6iXhX7A60Ca2R9JTQV","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/contact-f2a4f3c2e97b25fb.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_buildManifest.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/contact","query":{},"buildId":"BYGBoTeiBrkCn0j6XrihZ","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><link rel="preload" href="/_next/static/css/60c48dd4b3301227.css" as="style"/><link rel="stylesheet" href="/_next/static/css/60c48dd4b3301227.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/3298-73758aefe44233a6.js" defer=""></script><script src="/_next/static/chunks/pages/index-d8f75819eb449ffc.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_buildManifest.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"Vwi6iXhX7A60Ca2R9JTQV","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><link rel="preload" href="/_next/static/css/60c48dd4b3301227.css" as="style"/><link rel="stylesheet" href="/_next/static/css/60c48dd4b3301227.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/3298-73758aefe44233a6.js" defer=""></script><script src="/_next/static/chunks/pages/index-d8f75819eb449ffc.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_buildManifest.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"BYGBoTeiBrkCn0j6XrihZ","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/redirect-28627072d73850c2.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_buildManifest.js" defer=""></script><script src="/_next/static/Vwi6iXhX7A60Ca2R9JTQV/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div class="flex flex-col gap-4 items-center justify-center w-full h-screen p-6 bg-slate-100"><div class="flex flex-col items-center justify-center gap-4 px-6 py-20 bg-white rounded shadow-sm max-w-2xl w-full"><img src="/images/logo-icon-alt-2.webp" alt="Datasquirel Logo" width="60"/><div class="w-10 h-10 flex flex-col items-center justify-center"><div class=" top-0 left-0 w-full h-full flex items-center justify-center gap-4 bg-white/80 dark:bg-slate-800/80 z-50 absolute" style="position:relative;z-index:20000"><span class="general_loader" style="width:25px;height:25px;min-width:25px;border-width:4px"></span></div></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/redirect","query":{},"buildId":"Vwi6iXhX7A60Ca2R9JTQV","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width, initial-scale=1" data-next-head=""/><meta name="author" content="Datasquirel"/><meta name="Copyright" content="Copyright (c) 2025 Datasquirel"/><meta name="robots" content="noindex,nofollow"/><link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin="anonymous"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter"/><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono"/><script src="/scripts/themeSelector.js"></script><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta property="og:site_name" content="DATASQUIREL"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary"/><meta property="og:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta itemProp="image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><meta name="twitter:image" content="https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"/><link rel="stylesheet" href="/styles/prism.css"/><script src="/scripts/prism.js" async=""></script><script>var DSQL = {}</script><link rel="preload" href="/_next/static/css/40a7197d287e4ac0.css" as="style"/><link rel="stylesheet" href="/_next/static/css/40a7197d287e4ac0.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-5381863dc66a9c32.js" defer=""></script><script src="/_next/static/chunks/framework-5f43af1a76a0211a.js" defer=""></script><script src="/_next/static/chunks/main-96e9b4333635008a.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f20525907c2f070a.js" defer=""></script><script src="/_next/static/chunks/pages/redirect-28627072d73850c2.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_buildManifest.js" defer=""></script><script src="/_next/static/BYGBoTeiBrkCn0j6XrihZ/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div class="flex flex-col gap-4 items-center justify-center w-full h-screen p-6 bg-slate-100"><div class="flex flex-col items-center justify-center gap-4 px-6 py-20 bg-white rounded shadow-sm max-w-2xl w-full"><img src="/images/logo-icon-alt-2.webp" alt="Datasquirel Logo" width="60"/><div class="w-10 h-10 flex flex-col items-center justify-center"><div class=" top-0 left-0 w-full h-full flex items-center justify-center gap-4 bg-white/80 dark:bg-slate-800/80 z-50 absolute" style="position:relative;z-index:20000"><span class="general_loader" style="width:25px;height:25px;min-width:25px;border-width:4px"></span></div></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/redirect","query":{},"buildId":"BYGBoTeiBrkCn0j6XrihZ","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More