This commit is contained in:
Benjamin Toby 2024-12-15 12:27:16 +01:00
parent d9d32a4643
commit bc037e839f
314 changed files with 10191 additions and 408 deletions

View File

@ -1 +1 @@
HcU1grNdeICz9zVVD_7aa
1gOSN7HLWCIumskNUJc1E

View File

@ -5,8 +5,8 @@
"devFiles": [],
"ampDevFiles": [],
"lowPriorityFiles": [
"static/HcU1grNdeICz9zVVD_7aa/_buildManifest.js",
"static/HcU1grNdeICz9zVVD_7aa/_ssgManifest.js"
"static/1gOSN7HLWCIumskNUJc1E/_buildManifest.js",
"static/1gOSN7HLWCIumskNUJc1E/_ssgManifest.js"
],
"rootMainFiles": [],
"rootMainFilesTree": {},
@ -35,7 +35,7 @@
"static/chunks/webpack-5381863dc66a9c32.js",
"static/chunks/framework-898697981b1ca118.js",
"static/chunks/main-36f93e1764e6ea94.js",
"static/css/59f9d939bb2b7c23.css",
"static/css/40a7197d287e4ac0.css",
"static/chunks/pages/_app-946b7f00d529ca86.js"
],
"/_error": [
@ -338,7 +338,7 @@
"static/chunks/main-36f93e1764e6ea94.js",
"static/chunks/9799-abc615966398fac4.js",
"static/chunks/5256-56bdbb8f4109cb29.js",
"static/chunks/pages/admin/[user_id]/media-56c4ebe221b1b677.js"
"static/chunks/pages/admin/[user_id]/media-c292bf65621dcbd2.js"
],
"/admin/[user_id]/media/[...folder]": [
"static/chunks/webpack-5381863dc66a9c32.js",
@ -346,7 +346,7 @@
"static/chunks/main-36f93e1764e6ea94.js",
"static/chunks/9799-abc615966398fac4.js",
"static/chunks/5256-56bdbb8f4109cb29.js",
"static/chunks/pages/admin/[user_id]/media/[...folder]-44784f384aec9c72.js"
"static/chunks/pages/admin/[user_id]/media/[...folder]-f5953875292f54bb.js"
],
"/admin/[user_id]/schema": [
"static/chunks/webpack-5381863dc66a9c32.js",

View File

@ -1,7 +1,7 @@
{
"telemetry": {
"notifiedAt": "1733747119453",
"anonymousId": "0d240eb9f14eaa71752d03fb94b38bdbf327d425c1660e5bb6a61296a1b46901",
"salt": "4c9776bfc00f4c0417be0db8eac0efba"
"notifiedAt": "1734261936298",
"anonymousId": "ebafc3d19bc9fe4ccb439101988f90af2135dc7f7c7e64afad9454ef419293f8",
"salt": "58b09a75c3239fe3358c2d88a9b4cb44"
}
}

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":{"/docs/gui-reference/getting-started":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/gui-reference/getting-started.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/gui-reference/upload-media":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/gui-reference/upload-media.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference/get":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/api-reference/get.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference/post":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/api-reference/post.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference/data-types":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/database-reference/data-types.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference/querying-data":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/database-reference/querying-data.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/quick-start":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/quick-start.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/gui-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/gui-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/api-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/getting-started":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/getting-started.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/database-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]}},"dynamicRoutes":{"/docs/[page]/[sub-page]":{"routeRegex":"^/docs/([^/]+?)/([^/]+?)(?:/)?$","dataRoute":"/_next/data/HcU1grNdeICz9zVVD_7aa/docs/[page]/[sub-page].json","fallback":false,"dataRouteRegex":"^/_next/data/HcU1grNdeICz9zVVD_7aa/docs/([^/]+?)/([^/]+?)\\.json$","allowHeader":["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/HcU1grNdeICz9zVVD_7aa/docs/[page].json","fallback":false,"dataRouteRegex":"^/_next/data/HcU1grNdeICz9zVVD_7aa/docs/([^/]+?)\\.json$","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]}},"notFoundRoutes":[],"preview":{"previewModeId":"a805016cf83270186839684a138780ee","previewModeSigningKey":"1b0002c6ca112190a6bd0a900e3e1e37a08fd13354da11f39700d7ecacb16732","previewModeEncryptionKey":"603376905223e0a4b2f44939e6587fd6ee8f060e632f07e883a8eece6f6c489d"}}
{"version":4,"routes":{"/docs/quick-start":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/quick-start.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/gui-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/gui-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/api-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/getting-started":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/getting-started.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/database-reference.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/gui-reference/getting-started":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/gui-reference/getting-started.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/gui-reference/upload-media":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/gui-reference/upload-media.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference/get":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/api-reference/get.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/api-reference/post":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/api-reference/post.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference/data-types":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/database-reference/data-types.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]},"/docs/database-reference/querying-data":{"initialRevalidateSeconds":false,"srcRoute":"/docs/[page]/[sub-page]","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/database-reference/querying-data.json","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]}},"dynamicRoutes":{"/docs/[page]":{"routeRegex":"^/docs/([^/]+?)(?:/)?$","dataRoute":"/_next/data/1gOSN7HLWCIumskNUJc1E/docs/[page].json","fallback":false,"dataRouteRegex":"^/_next/data/1gOSN7HLWCIumskNUJc1E/docs/([^/]+?)\\.json$","allowHeader":["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/1gOSN7HLWCIumskNUJc1E/docs/[page]/[sub-page].json","fallback":false,"dataRouteRegex":"^/_next/data/1gOSN7HLWCIumskNUJc1E/docs/([^/]+?)/([^/]+?)\\.json$","allowHeader":["x-matched-path","x-prerender-revalidate","x-prerender-revalidate-if-generated","x-next-revalidated-tags","x-next-revalidate-tag-token"]}},"notFoundRoutes":[],"preview":{"previewModeId":"c70c0ec8ad2d68a566a0ad1266e5c0c4","previewModeSigningKey":"215d09a75fec81925d47db09522c71a0af8901474c66a13ae46b0fec6ace4bb7","previewModeEncryptionKey":"1eb13a32a76fa5d0bce8a2feb8566378958809a5651e21fcd5c37f19160491ae"}}

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,16 +1,16 @@
"use strict";exports.id=8540,exports.ids=[8540],exports.modules={77619:(e,t,r)=>{let a=r(29021),l=r(72835);e.exports=({key:e,database:t,table:r,user_id:n})=>{if(!e||!n)return null;try{let s=process.env.DSQL_API_KEYS_PATH;if(!s)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");let i=l({encryptedString:e}),o=JSON.parse(i||""),u=a.existsSync(`${s}/${o.sign}`);if(String(o.user_id)!==String(n)||!u)return null;if(!o.target_database)return o;if(!t&&o.target_database)return null;let c=o.target_database?.split(",").includes(String(t));if(c&&!o.target_table)return o;if(c&&!r&&o.target_table)return null;if(o.target_table?.split(",").includes(String(r)))return o;return null}catch(e){return console.log(`api-cred ERROR: ${e.message}`),null}}},64122:(e,t,r)=>{let a=r(51348),l=r(21339),n=r(44900);async function s({dbContext:e,paradigm:t,dbFullName:r,tableName:s,identifierColumnName:i,identifierValue:o,useLocal:u}){try{let c=!!u||!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),d=u?n:c?a:l,p=`DELETE FROM ${s} WHERE \`${i}\`=?`;return c?await d(p,[o]):await d({paradigm:t,queryString:p,database:r,queryValues:[o]})}catch(e){return null}}e.exports=s},8238:(e,t,r)=>{r(29021),r(44900);let a=r(94709),l=r(96064),n=r(48225),s=r(47670),i=r(33364),o=r(64122);r(6061);let u=r(33872);async function c({dbFullName:e,query:t,readOnly:r,dbSchema:c,queryValuesArray:d,tableName:p,local:m}){let g,f,y;if(c)try{let e=p||("string"==typeof t?null:t?t?.table:null);if(!e)throw Error("No table name provided");y=c.tables.filter(t=>t?.tableName===e)[0]}catch(e){}try{if("string"==typeof t){let n=u(t);if(r&&n.match(/^alter|^delete|information_schema|^create/i))throw Error("Wrong Input!");g=r?await l({queryString:n,queryValuesArray:d?.map(e=>String(e)),database:e,tableSchema:y,useLocal:m}):await a({queryString:n,queryValuesArray:d?.map(e=>String(e)),database:e,tableSchema:y,local:m})}else if("object"==typeof t){let{data:r,action:a,table:l,identifierColumnName:n,identifierValue:u,update:c,duplicateColumnName:d,duplicateColumnValue:p}=t;switch(a.toLowerCase()){case"insert":g=await s({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,data:r,update:c,duplicateColumnName:d,duplicateColumnValue:p,tableSchema:y,useLocal:m}),g?.insertId||(f=Error("Couldn't insert data"));break;case"update":g=await i({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,data:r,identifierColumnName:n,identifierValue:u,tableSchema:y,useLocal:m});break;case"delete":g=await o({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,identifierColumnName:n,identifierValue:u,tableSchema:y,useLocal:m});break;default:g=null}}}catch(e){n({component:"functions/backend/runQuery",message:e.message}),g=null,e=e.message}return{result:g,error:f}}e.exports=c},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},94709:(e,t,r)=>{let a=r(21339),l=r(44900),n=r(6061),s=r(48225);e.exports=async function({queryString:e,database:t,tableSchema:r,queryValuesArray:i,local:o}){let u;try{u=o?await l(e,i):await a({paradigm:"Full Access",database:t,queryString:e,queryValues:i})}catch(e){return s({component:"fullAccessDbHandler",message:e.message}),e.message}if(u&&r){let e=u;return await n({unparsedResults:e,tableSchema:r})}return u||null}},6061:(e,t,r)=>{let a=r(72835),l=r(30003);e.exports=async function({unparsedResults:e,tableSchema:t}){let r=[];try{for(let n=0;n<e.length;n++){let s=e[n],i=Object.keys(s);for(let e=0;e<i.length;e++){let r=i[e],n=t?.fields[e];if(r?.match(l))continue;let o=s[r];("number"==typeof o||o)&&n?.encrypted&&o?.match(/./)&&(s[r]=a({encryptedString:o}))}r.push(s)}return r}catch(t){return console.log("ERROR in parseDbResults Function =>",t.message),e}}},48225:(e,t,r)=>{let a=r(29021),{IncomingMessage:l}=r(81630);e.exports=async function({user:e,message:t,component:r,noMail:l,req:n}){let s=new Date,i=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],t=n.headers["x-real-ip"],r=n.headers["cf-connecting-ip"],a=Array.isArray(e)?e[0]:e?.split(",")[0],l=r||a||t||n.socket.remoteAddress;if(!l)return null;return String(l)}catch(e){return null}})();try{let l=`🚀 SERVER ERROR ===========================
"use strict";exports.id=8540,exports.ids=[8540],exports.modules={77619:(e,t,r)=>{let a=r(29021),l=r(72835);e.exports=({key:e,database:t,table:r,user_id:s,media:n})=>{if(!e||!s)return null;try{let i=process.env.DSQL_API_KEYS_PATH;if(!i)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");let o=l({encryptedString:e}),c=JSON.parse(o||""),u=a.existsSync(`${i}/${c.sign}`);if(String(c.user_id)!==String(s)||!u)return null;if(!c.target_database||n)return c;if(!t&&c.target_database)return null;let d=c.target_database?.split(",").includes(String(t));if(d&&!c.target_table)return c;if(d&&!r&&c.target_table)return null;if(c.target_table?.split(",").includes(String(r)))return c;return null}catch(e){return console.log(`api-cred ERROR: ${e.message}`),{error:`api-cred ERROR: ${e.message}`}}}},64122:(e,t,r)=>{let a=r(51348),l=r(21339),s=r(44900);async function n({dbContext:e,paradigm:t,dbFullName:r,tableName:n,identifierColumnName:i,identifierValue:o,useLocal:c}){try{let u=!!c||!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),d=c?s:u?a:l,p=`DELETE FROM ${n} WHERE \`${i}\`=?`;return u?await d(p,[o]):await d({paradigm:t,queryString:p,database:r,queryValues:[o]})}catch(e){return null}}e.exports=n},8238:(e,t,r)=>{r(29021),r(44900);let a=r(94709),l=r(96064),s=r(48225),n=r(47670),i=r(33364),o=r(64122);r(6061);let c=r(33872);async function u({dbFullName:e,query:t,readOnly:r,dbSchema:u,queryValuesArray:d,tableName:p,local:m}){let g,f,y;if(u)try{let e=p||("string"==typeof t?null:t?t?.table:null);if(!e)throw Error("No table name provided");y=u.tables.filter(t=>t?.tableName===e)[0]}catch(e){}try{if("string"==typeof t){let s=c(t);if(r&&s.match(/^alter|^delete|information_schema|^create/i))throw Error("Wrong Input!");g=r?await l({queryString:s,queryValuesArray:d?.map(e=>String(e)),database:e,tableSchema:y,useLocal:m}):await a({queryString:s,queryValuesArray:d?.map(e=>String(e)),database:e,tableSchema:y,local:m})}else if("object"==typeof t){let{data:r,action:a,table:l,identifierColumnName:s,identifierValue:c,update:u,duplicateColumnName:d,duplicateColumnValue:p}=t;switch(a.toLowerCase()){case"insert":g=await n({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,data:r,update:u,duplicateColumnName:d,duplicateColumnValue:p,tableSchema:y,useLocal:m}),g?.insertId||(f=Error("Couldn't insert data"));break;case"update":g=await i({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,data:r,identifierColumnName:s,identifierValue:c,tableSchema:y,useLocal:m});break;case"delete":g=await o({dbContext:m?"Master":"Dsql User",paradigm:"Full Access",dbFullName:e,tableName:l,identifierColumnName:s,identifierValue:c,tableSchema:y,useLocal:m});break;default:g=null}}}catch(e){s({component:"functions/backend/runQuery",message:e.message}),g=null,e=e.message}return{result:g,error:f}}e.exports=u},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},94709:(e,t,r)=>{let a=r(21339),l=r(44900),s=r(6061),n=r(48225);e.exports=async function({queryString:e,database:t,tableSchema:r,queryValuesArray:i,local:o}){let c;try{c=o?await l(e,i):await a({paradigm:"Full Access",database:t,queryString:e,queryValues:i})}catch(e){return n({component:"fullAccessDbHandler",message:e.message}),e.message}if(c&&r){let e=c;return await s({unparsedResults:e,tableSchema:r})}return c||null}},6061:(e,t,r)=>{let a=r(72835),l=r(30003);e.exports=async function({unparsedResults:e,tableSchema:t}){let r=[];try{for(let s=0;s<e.length;s++){let n=e[s],i=Object.keys(n);for(let e=0;e<i.length;e++){let r=i[e],s=t?.fields[e];if(r?.match(l))continue;let o=n[r];("number"==typeof o||o)&&s?.encrypted&&o?.match(/./)&&(n[r]=a({encryptedString:o}))}r.push(n)}return r}catch(t){return console.log("ERROR in parseDbResults Function =>",t.message),e}}},48225:(e,t,r)=>{let a=r(29021),{IncomingMessage:l}=r(81630);e.exports=async function({user:e,message:t,component:r,noMail:l,req:s}){let n=new Date,i=(()=>{if(!s)return null;try{let e=s.headers["x-forwarded-for"],t=s.headers["x-real-ip"],r=s.headers["cf-connecting-ip"],a=Array.isArray(e)?e[0]:e?.split(",")[0],l=r||a||t||s.socket.remoteAddress;if(!l)return null;return String(l)}catch(e){return null}})();try{let l=`🚀 SERVER ERROR ===========================
Error Message: ${t}
Component: ${r}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(l+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),n?.url&&(l+=`
URL: ${n.url}`),n?.body&&(l+=`
Request Body: ${JSON.stringify(n.body,null,4)}`),i&&(l+=`
User Email: ${e?.email}`),s?.url&&(l+=`
URL: ${s.url}`),s?.body&&(l+=`
Request Body: ${JSON.stringify(s.body,null,4)}`),i&&(l+=`
IP: ${i}`),l+=`
Date: ${s.toDateString()}
Date: ${n.toDateString()}
========================================`,a.existsSync("./.tmp/error.log")||a.writeFileSync("./.tmp/error.log","","utf-8");let o=a.readFileSync("./.tmp/error.log","utf-8");a.writeFileSync("./.tmp/error.log",l),a.appendFileSync("./.tmp/error.log",`
${o}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},96064:(e,t,r)=>{r(29021);let a=r(48225),l=r(6061),n=r(21339),s=r(44900);e.exports=async function({queryString:e,database:t,queryValuesArray:r,tableSchema:i,useLocal:o}){let u;try{u=o?await s(e,r):await n({paradigm:"Read Only",database:t,queryString:e,queryValues:r})}catch(e){return a({component:"varReadOnlyDatabaseDbHandler",message:e.message,noMail:!0}),e.message}if(!u)return null;{let e=u;return await l({unparsedResults:e,tableSchema:i})}}},72835:(e,t,r)=>{let{scryptSync:a,createDecipheriv:l}=r(55511),{Buffer:n}=r(79428);e.exports=({encryptedString:e,encryptionKey:t,encryptionSalt:r})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let s=t||process.env.DSQL_ENCRYPTION_PASSWORD,i=r||process.env.DSQL_ENCRYPTION_SALT,o=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=l("aes-192-cbc",a(s,i,o),n.alloc(16,0));try{let t=u.update(e,"hex","utf8");return t+=u.final("utf8")}catch(t){return console.log("Error in decrypting =>",t.message),e}}},33872:(e,t,r)=>{r(55591),r(81630),e.exports=function(e){return e.replace(/\n|\r|\n\r|\r\n/gm," ").replace(/ {2,}/g," ").trim()}}};
${o}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},96064:(e,t,r)=>{r(29021);let a=r(48225),l=r(6061),s=r(21339),n=r(44900);e.exports=async function({queryString:e,database:t,queryValuesArray:r,tableSchema:i,useLocal:o}){let c;try{c=o?await n(e,r):await s({paradigm:"Read Only",database:t,queryString:e,queryValues:r})}catch(e){return a({component:"varReadOnlyDatabaseDbHandler",message:e.message,noMail:!0}),e.message}if(!c)return null;{let e=c;return await l({unparsedResults:e,tableSchema:i})}}},72835:(e,t,r)=>{let{scryptSync:a,createDecipheriv:l}=r(55511),{Buffer:s}=r(79428);e.exports=({encryptedString:e,encryptionKey:t,encryptionSalt:r})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=t||process.env.DSQL_ENCRYPTION_PASSWORD,i=r||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(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=l("aes-192-cbc",a(n,i,o),s.alloc(16,0));try{let t=c.update(e,"hex","utf8");return t+=c.final("utf8")}catch(t){return console.log("Error in decrypting =>",t.message),e}}},33872:(e,t,r)=>{r(55591),r(81630),e.exports=function(e){return e.replace(/\n|\r|\n\r|\r\n/gm," ").replace(/ {2,}/g," ").trim()}}};

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) 2024 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/59f9d939bb2b7c23.css" as="style"/><link rel="stylesheet" href="/_next/static/css/59f9d939bb2b7c23.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-898697981b1ca118.js" defer=""></script><script src="/_next/static/chunks/main-36f93e1764e6ea94.js" defer=""></script><script src="/_next/static/chunks/pages/_app-946b7f00d529ca86.js" defer=""></script><script src="/_next/static/chunks/pages/404-1eace598915739ef.js" defer=""></script><script src="/_next/static/HcU1grNdeICz9zVVD_7aa/_buildManifest.js" defer=""></script><script src="/_next/static/HcU1grNdeICz9zVVD_7aa/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/404","query":{},"buildId":"HcU1grNdeICz9zVVD_7aa","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) 2024 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-898697981b1ca118.js" defer=""></script><script src="/_next/static/chunks/main-36f93e1764e6ea94.js" defer=""></script><script src="/_next/static/chunks/pages/_app-946b7f00d529ca86.js" defer=""></script><script src="/_next/static/chunks/pages/404-1eace598915739ef.js" defer=""></script><script src="/_next/static/1gOSN7HLWCIumskNUJc1E/_buildManifest.js" defer=""></script><script src="/_next/static/1gOSN7HLWCIumskNUJc1E/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/404","query":{},"buildId":"1gOSN7HLWCIumskNUJc1E","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) 2024 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/59f9d939bb2b7c23.css" as="style"/><link rel="stylesheet" href="/_next/static/css/59f9d939bb2b7c23.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-898697981b1ca118.js" defer=""></script><script src="/_next/static/chunks/main-36f93e1764e6ea94.js" defer=""></script><script src="/_next/static/chunks/pages/_app-946b7f00d529ca86.js" defer=""></script><script src="/_next/static/chunks/pages/500-f40435ff099c3bec.js" defer=""></script><script src="/_next/static/HcU1grNdeICz9zVVD_7aa/_buildManifest.js" defer=""></script><script src="/_next/static/HcU1grNdeICz9zVVD_7aa/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/500","query":{},"buildId":"HcU1grNdeICz9zVVD_7aa","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) 2024 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-898697981b1ca118.js" defer=""></script><script src="/_next/static/chunks/main-36f93e1764e6ea94.js" defer=""></script><script src="/_next/static/chunks/pages/_app-946b7f00d529ca86.js" defer=""></script><script src="/_next/static/chunks/pages/500-f40435ff099c3bec.js" defer=""></script><script src="/_next/static/1gOSN7HLWCIumskNUJc1E/_buildManifest.js" defer=""></script><script src="/_next/static/1gOSN7HLWCIumskNUJc1E/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/500","query":{},"buildId":"1gOSN7HLWCIumskNUJc1E","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) 2024 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/59f9d939bb2b7c23.css" as="style"/><link rel="stylesheet" href="/_next/static/css/59f9d939bb2b7c23.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-898697981b1ca118.js" defer=""></script><script src="/_next/static/chunks/main-36f93e1764e6ea94.js" defer=""></script><script src="/_next/static/chunks/pages/_app-946b7f00d529ca86.js" defer=""></script><script src="/_next/static/chunks/9654-a0de90f5592a8262.js" defer=""></script><script src="/_next/static/chunks/pages/about-35029bb377afcb90.js" defer=""></script><script src="/_next/static/HcU1grNdeICz9zVVD_7aa/_buildManifest.js" defer=""></script><script src="/_next/static/HcU1grNdeICz9zVVD_7aa/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/about","query":{},"buildId":"HcU1grNdeICz9zVVD_7aa","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) 2024 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-898697981b1ca118.js" defer=""></script><script src="/_next/static/chunks/main-36f93e1764e6ea94.js" defer=""></script><script src="/_next/static/chunks/pages/_app-946b7f00d529ca86.js" defer=""></script><script src="/_next/static/chunks/9654-a0de90f5592a8262.js" defer=""></script><script src="/_next/static/chunks/pages/about-35029bb377afcb90.js" defer=""></script><script src="/_next/static/1gOSN7HLWCIumskNUJc1E/_buildManifest.js" defer=""></script><script src="/_next/static/1gOSN7HLWCIumskNUJc1E/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/about","query":{},"buildId":"1gOSN7HLWCIumskNUJc1E","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

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=9326,e.ids=[9326],e.modules={53088:(e,t,s)=>{s.r(t),s.d(t,{config:()=>W,default:()=>R,getServerSideProps:()=>I,getStaticPaths:()=>H,getStaticProps:()=>k,reportWebVitals:()=>B,routeModule:()=>X,unstable_getServerProps:()=>U,unstable_getServerSideProps:()=>G,unstable_getStaticParams:()=>Q,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>$});var r={};s.r(r),s.d(r,{MediaContext:()=>T,default:()=>D,getServerSideProps:()=>V});var a=s(63865),i=s(9455),n=s(30671),d=s(49407),o=s(89600),l=s(8732),u=s(82015),c=s.n(u),p=s(95222),x=s(20048),m=s.n(x),g=s(58548),S=s(55158),j=s(24671),h=s(82747),f=s(62506);function b(e){let{media:t,setTargetMedia:s,user:r,folders:a,staticHost:i}=c().useContext(T);return(0,l.jsxs)(c().Fragment,{children:[(0,l.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,l.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,l.jsx)("h1",{className:"text-3xl m-0",children:"Media"}),(0,l.jsxs)(f.A,{children:[(0,l.jsxs)("button",{className:"flex items-center gap-2",onClick:e=>{(0,S.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Media"})]}),(0,l.jsxs)("button",{className:"flex items-center gap-2 outlined gray",onClick:e=>{(0,S.PB)("add-folder-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Folder"})]})]})]}),(0,l.jsx)(g.A,{user:r})]}),r?.verification_status?.toString().match(/1/)?(0,l.jsxs)(c().Fragment,{children:[(0,l.jsx)(h.A,{media:t,setTargetMedia:s,folders:a,staticHost:i,user:r}),t&&t[0]&&(0,l.jsxs)("a",{className:"border-dotted border-slate-400 border-2 px-4 py-3 w-full rounded flex items-center hover:border-primary/50 gap-2 cursor-pointer justify-center",onClick:e=>{(0,S.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{className:"",children:"Add Media"})]})]}):(0,l.jsx)(j.A,{})]})}var P=s(83531),M=s(81156),v=s(98009),A=s(30180),_=s(31700),N=s(99486),w=s(32415),y=s(67216),q=s.n(y),F=s(33873),C=s.n(F),E=s(65693);let L=s(29021),T=c().createContext({});function D({user:e,media:t,folders:s,staticHost:r}){let a=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[i,n]=c().useState(null),[d,o]=c().useState(null),[u,x]=c().useState(null),[m,g]=c().useState(!1),[S,j]=c().useState(null);return(0,l.jsx)(p.A,{head:a,user:e,children:(0,l.jsxs)(T.Provider,{value:{user:e,media:t,targetMedia:S,setTargetMedia:j,folders:s,staticHost:r},children:[m&&(0,l.jsx)(w.A,{screen:!0,title:"Processing Files ..."}),(0,l.jsx)(b,{}),(0,l.jsx)(P.A,{setNewMedia:n,setLoading:g}),(0,l.jsx)(_.A,{setNewFile:o,setLoading:g}),(0,l.jsx)(E.A,{setNewVideo:x,setLoading:g}),(0,l.jsx)(M.A,{newMedia:i,setNewMedia:n,newFile:d,setNewFile:o,newVideo:u,setNewVideo:x}),(0,l.jsx)(v.A,{targetMedia:S,setTargetMedia:j,staticHost:r,media:t}),(0,l.jsx)(A.A,{}),(0,l.jsx)(N.A,{user:e})]})})}async function V({req:e,res:t,query:s}){let r=await m()(e,t);if(!r?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let a=await q()(`SELECT * FROM user_media WHERE user_id='${r.id}' AND folder IS NULL`),i=process.env.DSQL_STATIC_SERVER_DIR;if(!i)return console.log("Static File ENV not Found!"),{redirect:{destination:"/admin",permanent:!1}};let n=C().join(i,`images/user-images/user-${r.id}/`);return L.existsSync(n)?{props:{user:r,media:a,folders:L.readdirSync(n).filter(e=>!e.match(/\..{3,4}$/)),staticHost:process.env.DSQL_STATIC_HOST||""}}:{redirect:{destination:"/admin",permanent:!1}}}let R=(0,n.M)(r,"default"),k=(0,n.M)(r,"getStaticProps"),H=(0,n.M)(r,"getStaticPaths"),I=(0,n.M)(r,"getServerSideProps"),W=(0,n.M)(r,"config"),B=(0,n.M)(r,"reportWebVitals"),$=(0,n.M)(r,"unstable_getStaticProps"),O=(0,n.M)(r,"unstable_getStaticPaths"),Q=(0,n.M)(r,"unstable_getStaticParams"),U=(0,n.M)(r,"unstable_getServerProps"),G=(0,n.M)(r,"unstable_getServerSideProps"),X=new a.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/admin/[user_id]/media",pathname:"/admin/[user_id]/media",bundlePath:"",filename:""},components:{App:o.default,Document:d.default},userland:r})},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[883,9821,9600,7070,7640],()=>s(53088));module.exports=r})();
"use strict";(()=>{var e={};e.id=9326,e.ids=[9326],e.modules={53088:(e,t,s)=>{s.r(t),s.d(t,{config:()=>W,default:()=>R,getServerSideProps:()=>I,getStaticPaths:()=>H,getStaticProps:()=>k,reportWebVitals:()=>B,routeModule:()=>X,unstable_getServerProps:()=>U,unstable_getServerSideProps:()=>G,unstable_getStaticParams:()=>Q,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>$});var r={};s.r(r),s.d(r,{MediaContext:()=>T,default:()=>D,getServerSideProps:()=>V});var a=s(63865),i=s(9455),n=s(30671),d=s(49407),o=s(89600),l=s(8732),u=s(82015),c=s.n(u),p=s(95222),x=s(20048),m=s.n(x),g=s(58548),S=s(55158),j=s(24671),h=s(82747),f=s(62506);function b(e){let{media:t,setTargetMedia:s,user:r,folders:a,staticHost:i}=c().useContext(T);return(0,l.jsxs)(c().Fragment,{children:[(0,l.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,l.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,l.jsx)("h1",{className:"text-3xl m-0",children:"Media"}),(0,l.jsxs)(f.A,{children:[(0,l.jsxs)("button",{className:"flex items-center gap-2",onClick:e=>{(0,S.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Media"})]}),(0,l.jsxs)("button",{className:"flex items-center gap-2 outlined gray",onClick:e=>{(0,S.PB)("add-folder-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Folder"})]})]})]}),(0,l.jsx)(g.A,{user:r})]}),r?.verification_status?.toString().match(/1/)?(0,l.jsxs)(c().Fragment,{children:[(0,l.jsx)(h.A,{media:t,setTargetMedia:s,folders:a,staticHost:i,user:r}),t&&t[0]&&(0,l.jsxs)("a",{className:"border-dotted border-slate-400 border-2 px-4 py-3 w-full rounded flex items-center hover:border-primary/50 gap-2 cursor-pointer justify-center",onClick:e=>{(0,S.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{className:"",children:"Add Media"})]})]}):(0,l.jsx)(j.A,{})]})}var P=s(83531),M=s(81156),v=s(98009),A=s(30180),_=s(31700),N=s(99486),w=s(32415),y=s(67216),q=s.n(y),F=s(33873),C=s.n(F),E=s(65693);let L=s(29021),T=c().createContext({});function D({user:e,media:t,folders:s,staticHost:r}){let a=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[i,n]=c().useState(null),[d,o]=c().useState(null),[u,x]=c().useState(null),[m,g]=c().useState(!1),[S,j]=c().useState(null);return(0,l.jsxs)(c().Fragment,{children:[(0,l.jsx)(p.A,{head:a,user:e,children:(0,l.jsxs)(T.Provider,{value:{user:e,media:t,targetMedia:S,setTargetMedia:j,folders:s,staticHost:r},children:[m&&(0,l.jsx)(w.A,{screen:!0,title:"Processing Files ..."}),(0,l.jsx)(b,{}),(0,l.jsx)(P.A,{setNewMedia:n,setLoading:g}),(0,l.jsx)(_.A,{setNewFile:o,setLoading:g}),(0,l.jsx)(E.A,{setNewVideo:x,setLoading:g})]})}),(0,l.jsx)(M.A,{newMedia:i,setNewMedia:n,newFile:d,setNewFile:o,newVideo:u,setNewVideo:x}),(0,l.jsx)(v.A,{targetMedia:S,setTargetMedia:j,staticHost:r,media:t}),(0,l.jsx)(A.A,{}),(0,l.jsx)(N.A,{user:e})]})}async function V({req:e,res:t,query:s}){let r=await m()(e,t);if(!r?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let a=await q()(`SELECT * FROM user_media WHERE user_id='${r.id}' AND folder IS NULL`),i=process.env.DSQL_STATIC_SERVER_DIR;if(!i)return console.log("Static File ENV not Found!"),{redirect:{destination:"/admin",permanent:!1}};let n=C().join(i,`images/user-images/user-${r.id}/`);return L.existsSync(n)?{props:{user:r,media:a,folders:L.readdirSync(n).filter(e=>!e.match(/\..{3,4}$/)),staticHost:process.env.DSQL_STATIC_HOST||""}}:{redirect:{destination:"/admin",permanent:!1}}}let R=(0,n.M)(r,"default"),k=(0,n.M)(r,"getStaticProps"),H=(0,n.M)(r,"getStaticPaths"),I=(0,n.M)(r,"getServerSideProps"),W=(0,n.M)(r,"config"),B=(0,n.M)(r,"reportWebVitals"),$=(0,n.M)(r,"unstable_getStaticProps"),O=(0,n.M)(r,"unstable_getStaticPaths"),Q=(0,n.M)(r,"unstable_getStaticParams"),U=(0,n.M)(r,"unstable_getServerProps"),G=(0,n.M)(r,"unstable_getServerSideProps"),X=new a.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/admin/[user_id]/media",pathname:"/admin/[user_id]/media",bundlePath:"",filename:""},components:{App:o.default,Document:d.default},userland:r})},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")}};var t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[883,9821,9600,7070,7640],()=>s(53088));module.exports=r})();

File diff suppressed because one or more lines are too long

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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},27118:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>v,routeModule:()=>h});var s={};t.r(s),t.d(s,{default:()=>g});var i=t(89947),a=t(2706),n=t(96762),l=t(6420),o=t.n(l),u=t(48225),d=t.n(u),_=t(27825),c=t.n(_),p=t(51348),m=t.n(p),f=t(47670),E=t.n(f);async function g(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await o()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=c().cloneDeep(e.body),i=s.inviting_user_id,a=s.invited_user_email,n=s.database_access,l=s.priviledge;try{let e=await m()("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 E()({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:i,invited_user_id:t.id,database_access:n,user_priviledge:l,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 m()("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[i,a]);let o=await m()("SELECT db_tables_data FROM invitations WHERE inviting_user_id=?",[i]);if(await m()(`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 E()({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:t.id,root_user_id:i,database:s,table:a,priviledge:l}})}}r.json({success:!!s?.insertId})}catch(s){d()({component:"/api/acceptUserInvitation/catch-error",message:s.message,user:t,req:e}),r.json({success:!1})}}t(29021);let v=(0,n.M)(s,"default"),S=(0,n.M)(s,"config"),h=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/acceptUserInvitation",pathname:"/api/acceptUserInvitation",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),i=t(72835),a=t(29021),n=t(31341);async function l(e,r,t,l){let{keyCookieName:o,csrfCookieName:u}=n();if(!e.cookies?.[o]?.match(/./))return null;let d=i({encryptedString:e.cookies[o]});if(!d)return null;let _=JSON.parse(d);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let c=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${c}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=l},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=t;let n=r;return e?.userId&&(n+=`user_${e.userId}_`),i&&(n+=`${i}_`),{keyCookieName:a,csrfCookieName:n+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:i}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:i,req:a}){let n=new Date,l=(()=>{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 i=`🚀 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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},27118:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>v,routeModule:()=>N});var s={};t.r(s),t.d(s,{default:()=>g});var i=t(89947),a=t(2706),n=t(96762),l=t(6420),o=t.n(l),u=t(48225),d=t.n(u),_=t(27825),c=t.n(_),p=t(51348),m=t.n(p),E=t(47670),f=t.n(E);async function g(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await o()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=c().cloneDeep(e.body),i=s.inviting_user_id,a=s.invited_user_email,n=s.database_access,l=s.priviledge;try{let e=await m()("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 f()({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:i,invited_user_id:t.id,database_access:n,user_priviledge:l,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 m()("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[i,a]);let o=await m()("SELECT db_tables_data FROM invitations WHERE inviting_user_id=?",[i]);if(await m()(`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 f()({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:t.id,root_user_id:i,database:s,table:a,priviledge:l}})}}r.json({success:!!s?.insertId})}catch(s){d()({component:"/api/acceptUserInvitation/catch-error",message:s.message,user:t,req:e}),r.json({success:!1})}}t(29021);let v=(0,n.M)(s,"default"),S=(0,n.M)(s,"config"),N=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/acceptUserInvitation",pathname:"/api/acceptUserInvitation",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),i=t(72835),a=t(29021),n=t(31341);async function l(e,r,t,l){let{keyCookieName:o,csrfCookieName:u}=n();if(!e.cookies?.[o]?.match(/./))return null;let d=i({encryptedString:e.cookies[o]});if(!d)return null;let _=JSON.parse(d);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let c=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${c}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=l},31341:e=>{e.exports=function(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 l=r;e?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),l+=s;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),{keyCookieName:n,csrfCookieName:l,oneTimeCodeName:o+=i}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:i}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:i,req:a}){let n=new Date,l=(()=>{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 i=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(i+=`
User Id: ${e?.id}

View File

@ -1,16 +1,16 @@
"use strict";(()=>{var e={};e.id=9785,e.ids=[9785],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},81764:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>c,routeModule:()=>p});var i={};t.r(i),t.d(i,{default:()=>_});var s=t(89947),a=t(2706),n=t(96762),l=t(6420),o=t.n(l),d=t(44767),u=t.n(d);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await o()(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 u()({query:e.body.query,user:t});r.json({success:!0,result:i})}let c=(0,n.M)(i,"default"),m=(0,n.M)(i,"config"),p=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/addAdminUserUser",pathname:"/api/addAdminUserUser",bundlePath:"",filename:""},userland:i})},6420:(e,r,t)=>{t(81630);let i=t(51348),s=t(72835),a=t(29021),n=t(31341);async function l(e,r,t,l){let{keyCookieName:o,csrfCookieName:d}=n();if(!e.cookies?.[o]?.match(/./))return null;let u=s({encryptedString:e.cookies[o]});if(!u)return null;let _=JSON.parse(u);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let c=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${c}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await i(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=l},44767:(e,r,t)=>{let i=t(48225),s=t(51348),a=t(47670),n=t(44900);e.exports=async function({query:e,user:r,useLocal:t}){try{let i=t?n:s,{invite:l,database_access:o,priviledge:d,email:u}=e,_=[l,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 m=[l],p=await i("SELECT first_name,last_name,email FROM users WHERE id=?",m);if(p?.[0]){let e=await i("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[l,r.id,u]);if(e?.[0])console.log("User already added");else{a({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:l,invited_user_id:r.id,database_access:o,first_name:r.first_name,last_name:r.last_name,phone:r.phone,email:r.email,username:r.username,user_type:"admin",user_priviledge:d,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=?",[l,u]);if(await i("DELETE FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=?",[l,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 a({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:r.id,root_user_id:l,database:s,table:n,priviledge:d},useLocal:t})}}}await i("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[l,u])}}catch(e){i({component:"addAdminUserOnLogin",message:e.message,user:r})}}},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),s&&(a+=`${s}_`),a+=t;let n=r;return e?.userId&&(n+=`user_${e.userId}_`),s&&(n+=`${s}_`),{keyCookieName:a,csrfCookieName:n+=i}}},48225:(e,r,t)=>{let i=t(29021),{IncomingMessage:s}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:s,req:a}){let n=new Date,l=(()=>{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 s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=9785,e.ids=[9785],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},81764:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>c,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>_});var i=t(89947),a=t(2706),n=t(96762),l=t(6420),o=t.n(l),d=t(44767),u=t.n(d);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await o()(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 u()({query:e.body.query,user:t});r.json({success:!0,result:s})}let c=(0,n.M)(s,"default"),m=(0,n.M)(s,"config"),p=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/addAdminUserUser",pathname:"/api/addAdminUserUser",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),i=t(72835),a=t(29021),n=t(31341);async function l(e,r,t,l){let{keyCookieName:o,csrfCookieName:d}=n();if(!e.cookies?.[o]?.match(/./))return null;let u=i({encryptedString:e.cookies[o]});if(!u)return null;let _=JSON.parse(u);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let c=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${c}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=l},44767:(e,r,t)=>{let s=t(48225),i=t(51348),a=t(47670),n=t(44900);e.exports=async function({query:e,user:r,useLocal:t}){try{let s=t?n:i,{invite:l,database_access:o,priviledge:d,email:u}=e,_=[l,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 m=[l],p=await s("SELECT first_name,last_name,email FROM users WHERE id=?",m);if(p?.[0]){let e=await s("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[l,r.id,u]);if(e?.[0])console.log("User already added");else{a({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:l,invited_user_id:r.id,database_access:o,first_name:r.first_name,last_name:r.last_name,phone:r.phone,email:r.email,username:r.username,user_type:"admin",user_priviledge:d,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=?",[l,u]);if(await s("DELETE FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=?",[l,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 a({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:r.id,root_user_id:l,database:i,table:n,priviledge:d},useLocal:t})}}}await s("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[l,u])}}catch(e){s({component:"addAdminUserOnLogin",message:e.message,user:r})}}},31341:e=>{e.exports=function(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 l=r;e?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),l+=s;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),a&&(o+=`${a}_`),{keyCookieName:n,csrfCookieName:l,oneTimeCodeName:o+=i}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:i}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:i,req:a}){let n=new Date,l=(()=>{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 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)}`),l&&(s+=`
IP: ${l}`),s+=`
User Email: ${e?.email}`),a?.url&&(i+=`
URL: ${a.url}`),a?.body&&(i+=`
Request Body: ${JSON.stringify(a.body,null,4)}`),l&&(i+=`
IP: ${l}`),i+=`
Date: ${n.toDateString()}
========================================`,i.existsSync("./.tmp/error.log")||i.writeFileSync("./.tmp/error.log","","utf-8");let o=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 o=s.readFileSync("./.tmp/error.log","utf-8");s.writeFileSync("./.tmp/error.log",i),s.appendFileSync("./.tmp/error.log",`
${o}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},72835:(e,r,t)=>{let{scryptSync:i,createDecipheriv:s}=t(55511),{Buffer:a}=t(79428);e.exports=({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,l=t||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(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=s("aes-192-cbc",i(n,l,o),a.alloc(16,0));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),i=r.X(0,[4050],()=>t(81764));module.exports=i})();
${o}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:i}=t(55511),{Buffer:a}=t(79428);e.exports=({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,l=t||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(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=i("aes-192-cbc",s(n,l,o),a.alloc(16,0));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,[4050],()=>t(81764));module.exports=s})();

View File

@ -1,16 +1,16 @@
"use strict";(()=>{var e={};e.id=1385,e.ids=[1385],e.modules={47795:e=>{e.exports=require("generate-password")},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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},87256:(e,r,t)=>{t.r(r),t.d(r,{config:()=>h,default:()=>E,routeModule:()=>v});var s={};t.r(s),t.d(s,{default:()=>y});var n=t(89947),i=t(2706),a=t(96762),o=t(20503),l=t.n(o),u=t(48225),c=t.n(u),d=t(6420),p=t.n(d),_=t(47670),f=t.n(_);let m=t(29021);t(33873);let{execSync:S}=t(79646),g=t(47795);async function y(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await p()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{api_key_name:s,api_key_slug:n,api_key_scope:i,target_database:a,target_table:o}=e.body;if(!s?.match(/./)||!n?.match(/./)||!i?.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");m.existsSync(e)||m.mkdirSync(e,{recursive:!0});let u=g.generate({length:24,numbers:!0,uppercase:!0,lowercase:!0,symbols:"-"})+"-"+Date.now(),c={user_id:t.id,date_code:Date.now(),sign:u,target_database:a,target_table:o};"fullAccess"==i&&(c={...c,full_access:!0});let d=l()({data:JSON.stringify(c)});if(!d)return r.json({success:!1,msg:"Couldn't encrypt API key"});let p=l()({data:d}),_={dbFullName:"datasquirel",tableName:"api_keys",data:{user_id:t.id,name:s,slug:n,key:p,scope:i}};u&&(_.data.csrf=u);let S=await f()(_);if(!S.insertId)throw Error(S?.error||"Api Key Couldn't be added");m.writeFileSync(`${e}/${u}`,JSON.stringify(c),"utf-8"),r.json({success:!0})}catch(e){c()({component:"/api/addApiKey/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!"})}}let E=(0,a.M)(s,"default"),h=(0,a.M)(s,"config"),v=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addApiKey",pathname:"/api/addApiKey",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),a=t(31341);async function o(e,r,t,o){let{keyCookieName:l,csrfCookieName:u}=a();if(!e.cookies?.[l]?.match(/./))return null;let c=n({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=o},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:i,csrfCookieName:a+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,req:i}){let a=new Date,o=(()=>{if(!i)return null;try{let e=i.headers["x-forwarded-for"],r=i.headers["x-real-ip"],t=i.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||i.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=1385,e.ids=[1385],e.modules={47795:e=>{e.exports=require("generate-password")},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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},87256:(e,r,t)=>{t.r(r),t.d(r,{config:()=>h,default:()=>y,routeModule:()=>v});var s={};t.r(s),t.d(s,{default:()=>g});var n=t(89947),a=t(2706),i=t(96762),o=t(20503),l=t.n(o),u=t(48225),c=t.n(u),d=t(6420),p=t.n(d),_=t(47670),f=t.n(_);let m=t(29021);t(33873);let{execSync:S}=t(79646),E=t(47795);async function g(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await p()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{api_key_name:s,api_key_slug:n,api_key_scope:a,target_database:i,target_table:o}=e.body;if(!s?.match(/./)||!n?.match(/./)||!a?.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");m.existsSync(e)||m.mkdirSync(e,{recursive:!0});let u=E.generate({length:24,numbers:!0,uppercase:!0,lowercase:!0,symbols:"-"})+"-"+Date.now(),c={user_id:t.id,date_code:Date.now(),sign:u,target_database:i,target_table:o};"fullAccess"==a&&(c={...c,full_access:!0});let d=l()({data:JSON.stringify(c)});if(!d)return r.json({success:!1,msg:"Couldn't encrypt API key"});let p=l()({data:d}),_={dbFullName:"datasquirel",tableName:"api_keys",data:{user_id:t.id,name:s,slug:n,key:p,scope:a}};u&&(_.data.csrf=u);let S=await f()(_);if(!S.insertId)throw Error(S?.error||"Api Key Couldn't be added");m.writeFileSync(`${e}/${u}`,JSON.stringify(c),"utf-8"),r.json({success:!0})}catch(e){c()({component:"/api/addApiKey/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!"})}}let y=(0,i.M)(s,"default"),h=(0,i.M)(s,"config"),v=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/addApiKey",pathname:"/api/addApiKey",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),i=t(31341);async function o(e,r,t,o){let{keyCookieName:l,csrfCookieName:u}=i();if(!e.cookies?.[l]?.match(/./))return null;let c=n({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=o},31341:e=>{e.exports=function(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+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=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:i,csrfCookieName:o,oneTimeCodeName:l+=n}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,req:a}){let i=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],n=t||s||r||a.socket.remoteAddress;if(!n)return null;return String(n)}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}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),i?.url&&(n+=`
URL: ${i.url}`),i?.body&&(n+=`
Request Body: ${JSON.stringify(i.body,null,4)}`),o&&(n+=`
User Email: ${e?.email}`),a?.url&&(n+=`
URL: ${a.url}`),a?.body&&(n+=`
Request Body: ${JSON.stringify(a.body,null,4)}`),o&&(n+=`
IP: ${o}`),n+=`
Date: ${a.toDateString()}
Date: ${i.toDateString()}
========================================`,s.existsSync("./.tmp/error.log")||s.writeFileSync("./.tmp/error.log","","utf-8");let l=s.readFileSync("./.tmp/error.log","utf-8");s.writeFileSync("./.tmp/error.log",n),s.appendFileSync("./.tmp/error.log",`
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:i}=t(79428);e.exports=({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,l=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 u=n("aes-192-cbc",s(a,o,l),i.alloc(16,0));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,[4050],()=>t(87256));module.exports=s})();
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:a}=t(79428);e.exports=({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,l=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=n("aes-192-cbc",s(i,o,l),a.alloc(16,0));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,[4050],()=>t(87256));module.exports=s})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=9187,e.ids=[9187],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},49915:(e,r,s)=>{s.r(r),s.d(r,{config:()=>m,default:()=>f,routeModule:()=>S});var t={};s.r(t),s.d(t,{default:()=>_});var a=s(89947),i=s(2706),n=s(96762),o=s(14533),l=s.n(o),u=s(6420),d=s.n(u),c=s(47670),p=s.n(c);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await d()(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{payload:s,dbFullName:t,dbId:a}=e.body,i=await p()({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=l()({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 f=(0,n.M)(t,"default"),m=(0,n.M)(t,"config"),S=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addDbUser",pathname:"/api/addDbUser",bundlePath:"",filename:""},userland:t})},6420:(e,r,s)=>{s(81630);let t=s(51348),a=s(72835),i=s(29021),n=s(31341);async function o(e,r,s,o){let{keyCookieName:l,csrfCookieName:u}=n();if(!e.cookies?.[l]?.match(/./))return null;let d=a({encryptedString:e.cookies[l]});if(!d)return null;let c=JSON.parse(d);if(!c.csrf_k||s&&!e.headers["x-csrf-auth"]?.match(RegExp(`${c.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(s&&!i.existsSync(`${p}/${c.csrf_k}`))return null;if(0==c.verification_status&&!s){let e=await t(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return c?.date&&Date.now()-c.date>6048e5?null:c}e.exports=o},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=s;let n=r;return e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),{keyCookieName:i,csrfCookieName:n+=t}}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:a}=s(55511),{Buffer:i}=s(79428);e.exports=({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,o=s||process.env.DSQL_ENCRYPTION_SALT,l=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 u=a("aes-192-cbc",t(n,o,l),i.alloc(16,0));try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},14533:(e,r,s)=>{let{createHmac:t}=s(55511);e.exports=function({password:e,encryptionKey:r}){let s=r||process.env.DSQL_ENCRYPTION_PASSWORD;if(!s?.match(/.{8,}/))throw Error("Encryption key is invalid");let a=t("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,[4050],()=>s(49915));module.exports=t})();
"use strict";(()=>{var e={};e.id=9187,e.ids=[9187],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},49915:(e,r,s)=>{s.r(r),s.d(r,{config:()=>m,default:()=>f,routeModule:()=>E});var t={};s.r(t),s.d(t,{default:()=>p});var a=s(89947),i=s(2706),n=s(96762),o=s(14533),l=s.n(o),u=s(6420),d=s.n(u),c=s(47670),_=s.n(c);async function p(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await d()(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{payload:s,dbFullName:t,dbId:a}=e.body,i=await _()({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=l()({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 f=(0,n.M)(t,"default"),m=(0,n.M)(t,"config"),E=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addDbUser",pathname:"/api/addDbUser",bundlePath:"",filename:""},userland:t})},6420:(e,r,s)=>{s(81630);let t=s(51348),a=s(72835),i=s(29021),n=s(31341);async function o(e,r,s,o){let{keyCookieName:l,csrfCookieName:u}=n();if(!e.cookies?.[l]?.match(/./))return null;let d=a({encryptedString:e.cookies[l]});if(!d)return null;let c=JSON.parse(d);if(!c.csrf_k||s&&!e.headers["x-csrf-auth"]?.match(RegExp(`${c.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(s&&!i.existsSync(`${_}/${c.csrf_k}`))return null;if(0==c.verification_status&&!s){let e=await t(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return c?.date&&Date.now()-c.date>6048e5?null:c}e.exports=o},31341:e=>{e.exports=function(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+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),i&&(n+=`${i}_`),n+=s;let o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=t;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),i&&(l+=`${i}_`),{keyCookieName:n,csrfCookieName:o,oneTimeCodeName:l+=a}}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:a}=s(55511),{Buffer:i}=s(79428);e.exports=({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,o=s||process.env.DSQL_ENCRYPTION_SALT,l=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 u=a("aes-192-cbc",t(n,o,l),i.alloc(16,0));try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},14533:(e,r,s)=>{let{createHmac:t}=s(55511);e.exports=function({password:e,encryptionKey:r}){let s=r||process.env.DSQL_ENCRYPTION_PASSWORD;if(!s?.match(/.{8,}/))throw Error("Encryption key is invalid");let a=t("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,[4050],()=>s(49915));module.exports=t})();

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
"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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},25858:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>_,routeModule:()=>m});var s={};t.r(s),t.d(s,{default:()=>f});var n=t(89947),o=t(2706),i=t(96762),a=t(48225),l=t.n(a),c=t(6420),u=t.n(c);let p=t(29021);t(33873);let{execSync:d}=t(79646);async function f(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await u()(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`;p.existsSync(e)||p.writeFileSync(e,"{}","utf8");let n=JSON.parse(p.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,p.writeFileSync(e,JSON.stringify(n,null,4),"utf-8"),r.json({success:!0})}catch(e){console.log(e.message),l()({component:"/api/addSocialLogin/catch-error",message:e.message,user:t}),r.json({success:!1,msg:e.message})}}let _=(0,i.M)(s,"default"),S=(0,i.M)(s,"config"),m=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/addSocialLogin",pathname:"/api/addSocialLogin",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:l,csrfCookieName:c}=i();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${d}/${p.csrf_k}`))return null;if(0==p.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 n=`🚀 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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},25858:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>f,routeModule:()=>m});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),o=t(2706),i=t(96762),a=t(48225),l=t.n(a),c=t(6420),u=t.n(c);let p=t(29021);t(33873);let{execSync:d}=t(79646);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await u()(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`;p.existsSync(e)||p.writeFileSync(e,"{}","utf8");let n=JSON.parse(p.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,p.writeFileSync(e,JSON.stringify(n,null,4),"utf-8"),r.json({success:!0})}catch(e){console.log(e.message),l()({component:"/api/addSocialLogin/catch-error",message:e.message,user:t}),r.json({success:!1,msg:e.message})}}let f=(0,i.M)(s,"default"),S=(0,i.M)(s,"config"),m=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/addSocialLogin",pathname:"/api/addSocialLogin",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:l,csrfCookieName:c}=i();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${d}/${p.csrf_k}`))return null;if(0==p.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=a},31341:e=>{e.exports=function(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 l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:l+=n}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 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

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={27825:e=>{e.exports=require("lodash")},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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},21110:(e,s,t)=>{t.r(s),t.d(s,{config:()=>h,default:()=>g,routeModule:()=>E});var r={};t.r(r),t.d(r,{default:()=>S});var a=t(89947),i=t(2706),n=t(96762),l=t(59474),o=t.n(l),d=t(6420),u=t.n(d),c=t(47670),_=t.n(c),p=t(51348),m=t.n(p),f=t(14533),v=t.n(f);async function S(e,s){if("POST"!==e.method)return s.json({msg:"Failed!"});let t=await u()(e,s,!0);if(!t)return s.json({success:!1,msg:"Unauthorized"});let r=e.body,a=r.paradigm;if(a?.match(/database/)){let e=await _()({dbFullName:"datasquirel",tableName:"user_users",data:(()=>{let e=Object.keys(r),s={};return e.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(s[e]=r[e])}),s.user_id=t.id,s.password=v()({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:r.password}),s.user_type="database",s.email=r.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(t?.email===r.email_address)return s.json({success:!1,msg:"Can't Invite yourself"});let e=await m()("SELECT * FROM invitations WHERE invited_user_email=? AND inviting_user_id=?",[r.email_address,t.id]);if(e&&e[0])return s.json({success:!1,msg:"User Already Invited"});await _()({dbFullName:"datasquirel",tableName:"invitations",data:{inviting_user_id:t.id,invited_user_email:r.email_address,database_access:r.database_access,priviledge:r.priviledge,db_tables_data:r.db_tables}});let a=await o()({to:r.email_address,subject:`${t.first_name} ${t.last_name} Invited you`,text:`${t.first_name} ${t.last_name} has invited you to manage a datasquirel account`,html:`
<h2>${t.first_name} ${t.last_name} has invited you to manage a datasquirel account.</h2>
<a href="${process.env.DSQL_HOST}/create-account?invite=${t.id}&database_access=${r.database_access}&priviledge=${r.priviledge}&email=${r.email_address}">Accept Invitation</a>
`});s.json({success:!!a?.accepted,msg:"This is an invitation request"})}}let g=(0,n.M)(r,"default"),h=(0,n.M)(r,"config"),E=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addUserUser",pathname:"/api/addUserUser",bundlePath:"",filename:""},userland:r})},6420:(e,s,t)=>{t(81630);let r=t(51348),a=t(72835),i=t(29021),n=t(31341);async function l(e,s,t,l){let{keyCookieName:o,csrfCookieName:d}=n();if(!e.cookies?.[o]?.match(/./))return null;let u=a({encryptedString:e.cookies[o]});if(!u)return null;let c=JSON.parse(u);if(!c.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${c.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${_}/${c.csrf_k}`))return null;if(0==c.verification_status&&!t){let e=await r(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&s.setHeader("Set-Cookie",["user_refresh=1"])}return c?.date&&Date.now()-c.date>6048e5?null:c}e.exports=l},31341:e=>{e.exports=function(e){let s=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",r=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=s;e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),i+=t;let n=s;return e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),{keyCookieName:i,csrfCookieName:n+=r}}},59474:(e,s,t)=>{let r=t(29021),a=t(21572).createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});e.exports=async function({to:e,subject:s,text:t,html:i,alias:n}){let l;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let o=(n?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!r.existsSync("./email/index.html"))return;let d=r.readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,i||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let r={};r.from=`"Datasquirel" <${o}>`,r.sender=o,n&&(r["replyTo "]=o),r.to=e,r.subject=s,r.text=t,r.html=d,l=await a.sendMail(r)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return l}},72835:(e,s,t)=>{let{scryptSync:r,createDecipheriv:a}=t(55511),{Buffer:i}=t(79428);e.exports=({encryptedString:e,encryptionKey:s,encryptionSalt:t})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=s||process.env.DSQL_ENCRYPTION_PASSWORD,l=t||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(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=a("aes-192-cbc",r(n,l,o),i.alloc(16,0));try{let s=d.update(e,"hex","utf8");return s+=d.final("utf8")}catch(s){return console.log("Error in decrypting =>",s.message),e}}},14533:(e,s,t)=>{let{createHmac:r}=t(55511);e.exports=function({password:e,encryptionKey:s}){let t=s||process.env.DSQL_ENCRYPTION_PASSWORD;if(!t?.match(/.{8,}/))throw Error("Encryption key is invalid");let a=r("sha512",t);return a.update(e),a.digest("base64")}}};var s=require("../../webpack-api-runtime.js");s.C(e);var t=e=>s(s.s=e),r=s.X(0,[4050],()=>t(21110));module.exports=r})();
"use strict";(()=>{var e={};e.id=3812,e.ids=[3812],e.modules={27825:e=>{e.exports=require("lodash")},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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},21110:(e,s,r)=>{r.r(s),r.d(s,{config:()=>g,default:()=>E,routeModule:()=>h});var t={};r.r(t),r.d(t,{default:()=>S});var a=r(89947),i=r(2706),n=r(96762),l=r(59474),o=r.n(l),d=r(6420),u=r.n(d),c=r(47670),_=r.n(c),p=r(51348),m=r.n(p),v=r(14533),f=r.n(v);async function S(e,s){if("POST"!==e.method)return s.json({msg:"Failed!"});let r=await u()(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 _()({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=f()({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 m()("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 _()({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 o()({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 E=(0,n.M)(t,"default"),g=(0,n.M)(t,"config"),h=new a.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addUserUser",pathname:"/api/addUserUser",bundlePath:"",filename:""},userland:t})},6420:(e,s,r)=>{r(81630);let t=r(51348),a=r(72835),i=r(29021),n=r(31341);async function l(e,s,r,l){let{keyCookieName:o,csrfCookieName:d}=n();if(!e.cookies?.[o]?.match(/./))return null;let u=a({encryptedString:e.cookies[o]});if(!u)return null;let c=JSON.parse(u);if(!c.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${c.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!i.existsSync(`${_}/${c.csrf_k}`))return null;if(0==c.verification_status&&!r){let e=await t(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&s.setHeader("Set-Cookie",["user_refresh=1"])}return c?.date&&Date.now()-c.date>6048e5?null:c}e.exports=l},31341:e=>{e.exports=function(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 l=s;e?.userId&&(l+=`user_${e.userId}_`),i&&(l+=`${i}_`),l+=t;let o=s;return e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),{keyCookieName:n,csrfCookieName:l,oneTimeCodeName:o+=a}}},59474:(e,s,r)=>{let t=r(29021),a=r(21572).createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});e.exports=async function({to:e,subject:s,text:r,html:i,alias:n}){let l;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let o=(n?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!t.existsSync("./email/index.html"))return;let d=t.readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,i||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let t={};t.from=`"Datasquirel" <${o}>`,t.sender=o,n&&(t["replyTo "]=o),t.to=e,t.subject=s,t.text=r,t.html=d,l=await a.sendMail(t)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return l}},72835:(e,s,r)=>{let{scryptSync:t,createDecipheriv:a}=r(55511),{Buffer:i}=r(79428);e.exports=({encryptedString:e,encryptionKey:s,encryptionSalt:r})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=s||process.env.DSQL_ENCRYPTION_PASSWORD,l=r||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(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=a("aes-192-cbc",t(n,l,o),i.alloc(16,0));try{let s=d.update(e,"hex","utf8");return s+=d.final("utf8")}catch(s){return console.log("Error in decrypting =>",s.message),e}}},14533:(e,s,r)=>{let{createHmac:t}=r(55511);e.exports=function({password:e,encryptionKey:s}){let r=s||process.env.DSQL_ENCRYPTION_PASSWORD;if(!r?.match(/.{8,}/))throw Error("Encryption key is invalid");let a=t("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,[4050],()=>r(21110));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=4785,e.ids=[4785],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")},81630:e=>{e.exports=require("http")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,o){return o in r?r[o]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,o)):"function"==typeof r&&"default"===o?r:void 0}}})},6126:(e,r,o)=>{o.r(r),o.d(r,{config:()=>_,default:()=>p,routeModule:()=>f});var t={};o.r(t),o.d(t,{default:()=>d});var n=o(89947),s=o(2706),i=o(96762),u=o(19131),l=o.n(u);let{execSync:c}=o(79646),a=o(29021);async function d(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let o=await l()(e);if(!o?.logged_in_status)return r.json({success:!1,log:"No Logs"});a.writeFileSync("./.tmp/error.log","","utf-8"),r.json({success:!0})}let p=(0,i.M)(t,"default"),_=(0,i.M)(t,"config"),f=new n.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/admin/clearErrorLogs",pathname:"/api/admin/clearErrorLogs",bundlePath:"",filename:""},userland:t})},19131:(e,r,o)=>{let{IncomingMessage:t}=o(81630),n=o(72835),s=o(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:o}=s(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let i=n({encryptedString:e.cookies[t]});if(!i)return console.log("No user payload found"),null;let u=JSON.parse(i);return u.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):u.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):u}},31341:e=>{e.exports=function(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",o=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),s=r;e?.userId&&(s+=`user_${e.userId}_`),n&&(s+=`${n}_`),s+=o;let i=r;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:s,csrfCookieName:i+=t}}},72835:(e,r,o)=>{let{scryptSync:t,createDecipheriv:n}=o(55511),{Buffer:s}=o(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:o})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let i=r||process.env.DSQL_ENCRYPTION_PASSWORD,u=o||process.env.DSQL_ENCRYPTION_SALT,l=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(!u?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",t(i,u,l),s.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var o;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return o}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(o||(o={}))},89947:(e,r,o)=>{e.exports=o(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var o=r(r.s=6126);module.exports=o})();
"use strict";(()=>{var e={};e.id=4785,e.ids=[4785],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")},81630:e=>{e.exports=require("http")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,o){return o in r?r[o]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,o)):"function"==typeof r&&"default"===o?r:void 0}}})},6126:(e,r,o)=>{o.r(r),o.d(r,{config:()=>p,default:()=>_,routeModule:()=>E});var s={};o.r(s),o.d(s,{default:()=>d});var t=o(89947),n=o(2706),u=o(96762),i=o(19131),l=o.n(i);let{execSync:c}=o(79646),a=o(29021);async function d(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let o=await l()(e);if(!o?.logged_in_status)return r.json({success:!1,log:"No Logs"});a.writeFileSync("./.tmp/error.log","","utf-8"),r.json({success:!0})}let _=(0,u.M)(s,"default"),p=(0,u.M)(s,"config"),E=new t.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/admin/clearErrorLogs",pathname:"/api/admin/clearErrorLogs",bundlePath:"",filename:""},userland:s})},19131:(e,r,o)=>{let{IncomingMessage:s}=o(81630),t=o(72835),n=o(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:o}=n(),s=`${r}_su`;if(!e.cookies?.[s])return console.log("No auth key cookie found"),null;let u=t({encryptedString:e.cookies[s]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",o=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",t=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+_/,""),u=r;e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),u+=o;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:u,csrfCookieName:i,oneTimeCodeName:l+=t}}},72835:(e,r,o)=>{let{scryptSync:s,createDecipheriv:t}=o(55511),{Buffer:n}=o(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:o})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=o||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=t("aes-192-cbc",s(u,i,l),n.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var o;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return o}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(o||(o={}))},89947:(e,r,o)=>{e.exports=o(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var o=r(r.s=6126);module.exports=o})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=9885,e.ids=[9885],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")},81630:e=>{e.exports=require("http")},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}}})},75865:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>y,routeModule:()=>E});var s={};t.r(s),t.d(s,{default:()=>f});var n=t(89947),o=t(2706),a=t(96762),l=t(93209),i=t.n(l),c=t(48225),u=t.n(c),p=t(19131),d=t.n(p);let S=t(29021),m=t(21820),{execSync:_}=t(79646);async function f(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Failed"});let t=await d()(e);if(!t?.logged_in_status)return r.json({success:!1,log:"No Logs"});let s="./.tmp/backups";S.existsSync(s)||S.mkdirSync("./.tmp/backups");let n=Date.now().toString();S.mkdirSync(`${s}/${n}`);let o=m.platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{let e={cwd:process.cwd()},t=`${s}/${n}/datasquirel.sql`;m.platform().match(/win/i)&&(e.shell="bash.exe");let a=`${o} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} datasquirel > ${t}`;console.log(`createNewBackup.js exe => ${a}`),_(a,e),S.copyFileSync("./jsonData/dbSchemas/main.json",`${s}/${n}/datasquirelSchema.json`),i()({rootFolderPath:`${process.env.DSQL_USER_DB_SCHEMA_PATH}`,destinationFolderPath:`${s}/${n}/userSchemas`}),r.json({success:!0})}catch(e){r.json({success:!1}),u()({component:"/api/admin/createNewBackup/lines-73-90",message:e.message})}}let y=(0,a.M)(s,"default"),g=(0,a.M)(s,"config"),E=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/createNewBackup",pathname:"/api/admin/createNewBackup",bundlePath:"",filename:""},userland:s})},93209:(e,r,t)=>{let s=t(29021);e.exports=function({rootFolderPath:e,destinationFolderPath:r}){try{return s.mkdirSync(r),function e(r,t){let n=s.readdirSync(r);for(let o=0;o<n.length;o++){let a=n[o];a?.match(/\..{2,5}$/)?s.copyFileSync(`${r}/${a}`,`${t}/${a}`):(s.mkdirSync(`${t}/${a}`,{recursive:!0}),e(`${r}/${a}`,`${t}/${a}`))}}(e,r),!0}catch(e){return console.log(e.message),!1}}},19131:(e,r,t)=>{let{IncomingMessage:s}=t(81630),n=t(72835),o=t(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:t}=o(),s=`${r}_su`;if(!e.cookies?.[s])return console.log("No auth key cookie found"),null;let a=n({encryptedString:e.cookies[s]});if(!a)return console.log("No user payload found"),null;let l=JSON.parse(a);return l.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):l.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):l}},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:o,csrfCookieName:a+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,req:o}){let a=new Date,l=(()=>{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 n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=9885,e.ids=[9885],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")},81630:e=>{e.exports=require("http")},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}}})},75865:(e,r,t)=>{t.r(r),t.d(r,{config:()=>y,default:()=>E,routeModule:()=>g});var s={};t.r(s),t.d(s,{default:()=>f});var n=t(89947),o=t(2706),a=t(96762),l=t(93209),i=t.n(l),c=t(48225),u=t.n(c),d=t(19131),p=t.n(d);let _=t(29021),S=t(21820),{execSync:m}=t(79646);async function f(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Failed"});let t=await p()(e);if(!t?.logged_in_status)return r.json({success:!1,log:"No Logs"});let s="./.tmp/backups";_.existsSync(s)||_.mkdirSync("./.tmp/backups");let n=Date.now().toString();_.mkdirSync(`${s}/${n}`);let o=S.platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{let e={cwd:process.cwd()},t=`${s}/${n}/datasquirel.sql`;S.platform().match(/win/i)&&(e.shell="bash.exe");let a=`${o} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} datasquirel > ${t}`;console.log(`createNewBackup.js exe => ${a}`),m(a,e),_.copyFileSync("./jsonData/dbSchemas/main.json",`${s}/${n}/datasquirelSchema.json`),i()({rootFolderPath:`${process.env.DSQL_USER_DB_SCHEMA_PATH}`,destinationFolderPath:`${s}/${n}/userSchemas`}),r.json({success:!0})}catch(e){r.json({success:!1}),u()({component:"/api/admin/createNewBackup/lines-73-90",message:e.message})}}let E=(0,a.M)(s,"default"),y=(0,a.M)(s,"config"),g=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/createNewBackup",pathname:"/api/admin/createNewBackup",bundlePath:"",filename:""},userland:s})},93209:(e,r,t)=>{let s=t(29021);e.exports=function({rootFolderPath:e,destinationFolderPath:r}){try{return s.mkdirSync(r),function e(r,t){let n=s.readdirSync(r);for(let o=0;o<n.length;o++){let a=n[o];a?.match(/\..{2,5}$/)?s.copyFileSync(`${r}/${a}`,`${t}/${a}`):(s.mkdirSync(`${t}/${a}`,{recursive:!0}),e(`${r}/${a}`,`${t}/${a}`))}}(e,r),!0}catch(e){return console.log(e.message),!1}}},19131:(e,r,t)=>{let{IncomingMessage:s}=t(81630),n=t(72835),o=t(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:t}=o(),s=`${r}_su`;if(!e.cookies?.[s])return console.log("No auth key cookie found"),null;let a=n({encryptedString:e.cookies[s]});if(!a)return console.log("No user payload found"),null;let l=JSON.parse(a);return l.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):l.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):l}},31341:e=>{e.exports=function(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 l=r;e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),l+=s;let i=r;return e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),{keyCookieName:a,csrfCookieName:l,oneTimeCodeName:i+=n}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,req:o}){let a=new Date,l=(()=>{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 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,4 +1,4 @@
"use strict";(()=>{var e={};e.id=5905,e.ids=[5905],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},62347:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>d,routeModule:()=>S});var t={};s.r(t),s.d(t,{default:()=>p});var n=s(89947),o=s(2706),a=s(96762),c=s(57638),l=s.n(c);s(48225);var i=s(19131),u=s.n(i);async function p(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await u()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let{database:t}=e.query;try{let e=await l()({database:"string"==typeof t?t:"",queryString:`SHOW TABLES FROM ${t}`});if(!e)return r.json({success:!1,msg:"Query Failed!"});r.json({success:!0,tables:e.map(e=>Object.values(e)[0])})}catch(e){console.log(e.message),r.json({success:!1})}}s(29021);let d=(0,a.M)(t,"default"),_=(0,a.M)(t,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/getTablesForUserDatabase",pathname:"/api/admin/getTablesForUserDatabase",bundlePath:"",filename:""},userland:t})},19131:(e,r,s)=>{let{IncomingMessage:t}=s(81630),n=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let a=n({encryptedString:e.cookies[t]});if(!a)return console.log("No user payload found"),null;let c=JSON.parse(a);return c.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):c.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):c}},31341:e=>{e.exports=function(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",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=s;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:o,csrfCookieName:a+=t}}},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},6061:(e,r,s)=>{let t=s(72835),n=s(30003);e.exports=async function({unparsedResults:e,tableSchema:r}){let s=[];try{for(let o=0;o<e.length;o++){let a=e[o],c=Object.keys(a);for(let e=0;e<c.length;e++){let s=c[e],o=r?.fields[e];if(s?.match(n))continue;let l=a[s];("number"==typeof l||l)&&o?.encrypted&&l?.match(/./)&&(a[s]=t({encryptedString:l}))}s.push(a)}return s}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},48225:(e,r,s)=>{let t=s(29021),{IncomingMessage:n}=s(81630);e.exports=async function({user:e,message:r,component:s,noMail:n,req:o}){let a=new Date,c=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],s=o.headers["cf-connecting-ip"],t=Array.isArray(e)?e[0]:e?.split(",")[0],n=s||t||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=5905,e.ids=[5905],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},62347:(e,r,s)=>{s.r(r),s.d(r,{config:()=>d,default:()=>_,routeModule:()=>S});var t={};s.r(t),s.d(t,{default:()=>p});var n=s(89947),o=s(2706),a=s(96762),c=s(57638),l=s.n(c);s(48225);var i=s(19131),u=s.n(i);async function p(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await u()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let{database:t}=e.query;try{let e=await l()({database:"string"==typeof t?t:"",queryString:`SHOW TABLES FROM ${t}`});if(!e)return r.json({success:!1,msg:"Query Failed!"});r.json({success:!0,tables:e.map(e=>Object.values(e)[0])})}catch(e){console.log(e.message),r.json({success:!1})}}s(29021);let _=(0,a.M)(t,"default"),d=(0,a.M)(t,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/getTablesForUserDatabase",pathname:"/api/admin/getTablesForUserDatabase",bundlePath:"",filename:""},userland:t})},19131:(e,r,s)=>{let{IncomingMessage:t}=s(81630),n=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let a=n({encryptedString:e.cookies[t]});if(!a)return console.log("No user payload found"),null;let c=JSON.parse(a);return c.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):c.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):c}},31341:e=>{e.exports=function(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",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+=s;let c=r;e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),c+=t;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:a,csrfCookieName:c,oneTimeCodeName:l+=n}}},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},6061:(e,r,s)=>{let t=s(72835),n=s(30003);e.exports=async function({unparsedResults:e,tableSchema:r}){let s=[];try{for(let o=0;o<e.length;o++){let a=e[o],c=Object.keys(a);for(let e=0;e<c.length;e++){let s=c[e],o=r?.fields[e];if(s?.match(n))continue;let l=a[s];("number"==typeof l||l)&&o?.encrypted&&l?.match(/./)&&(a[s]=t({encryptedString:l}))}s.push(a)}return s}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},48225:(e,r,s)=>{let t=s(29021),{IncomingMessage:n}=s(81630);e.exports=async function({user:e,message:r,component:s,noMail:n,req:o}){let a=new Date,c=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],s=o.headers["cf-connecting-ip"],t=Array.isArray(e)?e[0]:e?.split(",")[0],n=s||t||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${s}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}
@ -13,4 +13,4 @@ Date: ${a.toDateString()}
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},57638:(e,r,s)=>{s(29021);let t=s(6061),n=s(48225),o=s(51348),a=s(21339),c=s(44900);e.exports=async function({queryString:e,queryValuesArray:r,database:s,tableSchema:l,useLocal:i}){let u;let p=!!i||!!s?.match(/^datasquirel$/),d=i?c:p?o:a;try{u=e&&r&&Array.isArray(r)&&r[0]?p?await d(e,r):await d({paradigm:"Full Access",database:s,queryString:e,queryValues:r}):p?await d(e):await d({paradigm:"Full Access",database:s,queryString:e})}catch(e){n({component:"varDatabaseDbHandler/lines-29-32",message:e.message})}if(u&&l)try{let e=u;return await t({unparsedResults:e,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",s,e),n({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(u)return u;else return null}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:n}=s(55511),{Buffer:o}=s(79428);e.exports=({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,c=s||process.env.DSQL_ENCRYPTION_SALT,l=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(!c?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let i=n("aes-192-cbc",t(a,c,l),o.alloc(16,0));try{let r=i.update(e,"hex","utf8");return r+=i.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,s)=>{let t=s(9973),n=s(21580),o=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()}});async function a(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21339:(e,r,s)=>{let t=s(29021);s(33873);let n=s(9973),o=s(21580),a=n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,charset:"utf8mb4",ssl:o()}});e.exports=function({paradigm:e,database:r,queryString:s,queryValues:c}){try{return new Promise((l,i)=>{let u=!!e?.match(/full.access|^fa$/i);try{function p(e){a.end(),l(JSON.parse(JSON.stringify(e)))}function d(e){a.end(),l({error:e.message,queryStringGenerated:s,queryValuesGenerated:c,sql:e.sql})}a=u?n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,database:r,ssl:o()}}):n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,database:r,ssl:o()}}),c&&Array.isArray(c)&&c[0]?a.query(s,c).then(p).catch(d):a.query(s).then(p).catch(d)}catch(e){t.appendFileSync("./.tmp/dbErrorLogs.txt",e.message+"\n"+Date()+"\n\n\n","utf8"),l({error:e.message})}})}catch(e){return{success:!1,error:e.message}}}},44900:(e,r,s)=>{let t=s(9973),n=s(21580);async function o(...e){let r=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()},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 s=await r.query(...e);return await r.end(),JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e.message),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,s)=>{let t=s(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!t.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:t.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=62347);module.exports=s})();
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},57638:(e,r,s)=>{s(29021);let t=s(6061),n=s(48225),o=s(51348),a=s(21339),c=s(44900);e.exports=async function({queryString:e,queryValuesArray:r,database:s,tableSchema:l,useLocal:i}){let u;let p=!!i||!!s?.match(/^datasquirel$/),_=i?c:p?o:a;try{u=e&&r&&Array.isArray(r)&&r[0]?p?await _(e,r):await _({paradigm:"Full Access",database:s,queryString:e,queryValues:r}):p?await _(e):await _({paradigm:"Full Access",database:s,queryString:e})}catch(e){n({component:"varDatabaseDbHandler/lines-29-32",message:e.message})}if(u&&l)try{let e=u;return await t({unparsedResults:e,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",s,e),n({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(u)return u;else return null}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:n}=s(55511),{Buffer:o}=s(79428);e.exports=({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,c=s||process.env.DSQL_ENCRYPTION_SALT,l=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(!c?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let i=n("aes-192-cbc",t(a,c,l),o.alloc(16,0));try{let r=i.update(e,"hex","utf8");return r+=i.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,s)=>{let t=s(9973),n=s(21580),o=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()}});async function a(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21339:(e,r,s)=>{let t=s(29021);s(33873);let n=s(9973),o=s(21580),a=n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,charset:"utf8mb4",ssl:o()}});e.exports=function({paradigm:e,database:r,queryString:s,queryValues:c}){try{return new Promise((l,i)=>{let u=!!e?.match(/full.access|^fa$/i);try{function p(e){a.end(),l(JSON.parse(JSON.stringify(e)))}function _(e){a.end(),l({error:e.message,queryStringGenerated:s,queryValuesGenerated:c,sql:e.sql})}a=u?n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,database:r,ssl:o()}}):n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,database:r,ssl:o()}}),c&&Array.isArray(c)&&c[0]?a.query(s,c).then(p).catch(_):a.query(s).then(p).catch(_)}catch(e){t.appendFileSync("./.tmp/dbErrorLogs.txt",e.message+"\n"+Date()+"\n\n\n","utf8"),l({error:e.message})}})}catch(e){return{success:!1,error:e.message}}}},44900:(e,r,s)=>{let t=s(9973),n=s(21580);async function o(...e){let r=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()},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 s=await r.query(...e);return await r.end(),JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e.message),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,s)=>{let t=s(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!t.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:t.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=62347);module.exports=s})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=525,e.ids=[525],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")},81630:e=>{e.exports=require("http")},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}}})},42513:(e,r,s)=>{s.r(r),s.d(r,{config:()=>p,default:()=>d,routeModule:()=>_});var t={};s.r(t),s.d(t,{default:()=>a});var n=s(89947),o=s(2706),u=s(96762),i=s(19131),c=s.n(i);let l=s(29021);async function a(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await c()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let t=e.body.user.id.toString().replace(/[^0-9]/g,"").replace(/\//g,""),n=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t}/backups`;l.existsSync(n)||l.mkdirSync(n);let o=l.readdirSync(n);r.json({success:!0,backups:o})}let d=(0,u.M)(t,"default"),p=(0,u.M)(t,"config"),_=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/getUserBackups",pathname:"/api/admin/getUserBackups",bundlePath:"",filename:""},userland:t})},19131:(e,r,s)=>{let{IncomingMessage:t}=s(81630),n=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let u=n({encryptedString:e.cookies[t]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(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",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),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:o,csrfCookieName:u+=t}}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:n}=s(55511),{Buffer:o}=s(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:s})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=s||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=n("aes-192-cbc",t(u,i,c),o.alloc(16,0));try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=42513);module.exports=s})();
"use strict";(()=>{var e={};e.id=525,e.ids=[525],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")},81630:e=>{e.exports=require("http")},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}}})},42513:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>d,routeModule:()=>p});var t={};s.r(t),s.d(t,{default:()=>a});var n=s(89947),o=s(2706),u=s(96762),i=s(19131),c=s.n(i);let l=s(29021);async function a(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await c()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let t=e.body.user.id.toString().replace(/[^0-9]/g,"").replace(/\//g,""),n=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t}/backups`;l.existsSync(n)||l.mkdirSync(n);let o=l.readdirSync(n);r.json({success:!0,backups:o})}let d=(0,u.M)(t,"default"),_=(0,u.M)(t,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/getUserBackups",pathname:"/api/admin/getUserBackups",bundlePath:"",filename:""},userland:t})},19131:(e,r,s)=>{let{IncomingMessage:t}=s(81630),n=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let u=n({encryptedString:e.cookies[t]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(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",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+_/,""),u=r;e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),u+=s;let i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:u,csrfCookieName:i,oneTimeCodeName:c+=n}}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:n}=s(55511),{Buffer:o}=s(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:s})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=s||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=n("aes-192-cbc",t(u,i,c),o.alloc(16,0));try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=42513);module.exports=s})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=9664,e.ids=[9664],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")},81630:e=>{e.exports=require("http")},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}}})},29249:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>_,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>d});var o=t(89947),n=t(2706),a=t(96762),i=t(51348),c=t.n(i),u=t(19131),l=t.n(u);let p=t(29021);async function d(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let t=await l()(e);if(!t?.logged_in_status)return r.json({success:!1,log:"No Logs"});let s=e.body.user,o=s?.id.toString().replace(/[^0-9]/g,"").replace(/\//g,""),n=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${o}`,a=[];!function e({originArray:r,rootPath:t}){let s=p.readdirSync(t);for(let o=0;o<s.length;o++){let n=s[o];if(n?.match(/\..{2,5}$/))r.push({name:n,type:"file",root:t});else{let s={name:n,type:"folder",root:t,content:[]};e({originArray:s.content,rootPath:`${t}/${n}`}),r.push(s)}}}({originArray:a,rootPath:n});let i=await c()(`SHOW databases LIKE 'datasquirel_user_${s.id}_%'`);r.json({success:!0,data:a,databases:i.map(e=>Object.values(e)[0])})}let _=(0,a.M)(s,"default"),f=(0,a.M)(s,"config"),S=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/admin/getUserData",pathname:"/api/admin/getUserData",bundlePath:"",filename:""},userland:s})},19131:(e,r,t)=>{let{IncomingMessage:s}=t(81630),o=t(72835),n=t(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:t}=n(),s=`${r}_su`;if(!e.cookies?.[s])return console.log("No auth key cookie found"),null;let a=o({encryptedString:e.cookies[s]});if(!a)return console.log("No user payload found"),null;let i=JSON.parse(a);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),o&&(n+=`${o}_`),n+=t;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),{keyCookieName:n,csrfCookieName:a+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:o}=t(55511),{Buffer:n}=t(79428);e.exports=({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,i=t||process.env.DSQL_ENCRYPTION_SALT,c=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(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=o("aes-192-cbc",s(a,i,c),n.alloc(16,0));try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),o=t(21580),n=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:o()}});async function a(...e){try{let r=await n.query(...e);return await n.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=29249);module.exports=t})();
"use strict";(()=>{var e={};e.id=9664,e.ids=[9664],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")},81630:e=>{e.exports=require("http")},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}}})},29249:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>p});var o=t(89947),n=t(2706),a=t(96762),i=t(51348),u=t.n(i),c=t(19131),l=t.n(c);let _=t(29021);async function p(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let t=await l()(e);if(!t?.logged_in_status)return r.json({success:!1,log:"No Logs"});let s=e.body.user,o=s?.id.toString().replace(/[^0-9]/g,"").replace(/\//g,""),n=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${o}`,a=[];!function e({originArray:r,rootPath:t}){let s=_.readdirSync(t);for(let o=0;o<s.length;o++){let n=s[o];if(n?.match(/\..{2,5}$/))r.push({name:n,type:"file",root:t});else{let s={name:n,type:"folder",root:t,content:[]};e({originArray:s.content,rootPath:`${t}/${n}`}),r.push(s)}}}({originArray:a,rootPath:n});let i=await u()(`SHOW databases LIKE 'datasquirel_user_${s.id}_%'`);r.json({success:!0,data:a,databases:i.map(e=>Object.values(e)[0])})}let d=(0,a.M)(s,"default"),S=(0,a.M)(s,"config"),f=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/admin/getUserData",pathname:"/api/admin/getUserData",bundlePath:"",filename:""},userland:s})},19131:(e,r,t)=>{let{IncomingMessage:s}=t(81630),o=t(72835),n=t(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:t}=n(),s=`${r}_su`;if(!e.cookies?.[s])return console.log("No auth key cookie found"),null;let a=o({encryptedString:e.cookies[s]});if(!a)return console.log("No user payload found"),null;let i=JSON.parse(a);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(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}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:o}=t(55511),{Buffer:n}=t(79428);e.exports=({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,i=t||process.env.DSQL_ENCRYPTION_SALT,u=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(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=o("aes-192-cbc",s(a,i,u),n.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),o=t(21580),n=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:o()}});async function a(...e){try{let r=await n.query(...e);return await n.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=29249);module.exports=t})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=2266,e.ids=[2266],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")},81630:e=>{e.exports=require("http")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,n){return n in r?r[n]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,n)):"function"==typeof r&&"default"===n?r:void 0}}})},89995:(e,r,n)=>{n.r(r),n.d(r,{config:()=>p,default:()=>d,routeModule:()=>_});var t={};n.r(t),n.d(t,{default:()=>l});var s=n(89947),o=n(2706),u=n(96762),i=n(19131),a=n.n(i);let c=n(29021);async function l(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Failed"});let n=await a()(e);if(!n?.logged_in_status)return r.json({success:!1,log:"No Logs"});let t="./.tmp/backups";c.existsSync(t)||c.mkdirSync(t);let s=c.readdirSync(t);r.json({success:!0,backups:s})}let d=(0,u.M)(t,"default"),p=(0,u.M)(t,"config"),_=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/grabBackups",pathname:"/api/admin/grabBackups",bundlePath:"",filename:""},userland:t})},19131:(e,r,n)=>{let{IncomingMessage:t}=n(81630),s=n(72835),o=n(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:n}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let u=s({encryptedString:e.cookies[t]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",n=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),s&&(o+=`${s}_`),o+=n;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),{keyCookieName:o,csrfCookieName:u+=t}}},72835:(e,r,n)=>{let{scryptSync:t,createDecipheriv:s}=n(55511),{Buffer:o}=n(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:n})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=n||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=s("aes-192-cbc",t(u,i,a),o.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var n;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return n}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(n||(n={}))},89947:(e,r,n)=>{e.exports=n(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var n=r(r.s=89995);module.exports=n})();
"use strict";(()=>{var e={};e.id=2266,e.ids=[2266],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")},81630:e=>{e.exports=require("http")},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}}})},89995:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>d,routeModule:()=>p});var n={};s.r(n),s.d(n,{default:()=>c});var t=s(89947),o=s(2706),u=s(96762),i=s(19131),a=s.n(i);let l=s(29021);async function c(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Failed"});let s=await a()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let n="./.tmp/backups";l.existsSync(n)||l.mkdirSync(n);let t=l.readdirSync(n);r.json({success:!0,backups:t})}let d=(0,u.M)(n,"default"),_=(0,u.M)(n,"config"),p=new t.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/grabBackups",pathname:"/api/admin/grabBackups",bundlePath:"",filename:""},userland:n})},19131:(e,r,s)=>{let{IncomingMessage:n}=s(81630),t=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),n=`${r}_su`;if(!e.cookies?.[n])return console.log("No auth key cookie found"),null;let u=t({encryptedString:e.cookies[n]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",t=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+_/,""),u=r;e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),u+=s;let i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=n;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),{keyCookieName:u,csrfCookieName:i,oneTimeCodeName:a+=t}}},72835:(e,r,s)=>{let{scryptSync:n,createDecipheriv:t}=s(55511),{Buffer:o}=s(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:s})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=s||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=t("aes-192-cbc",n(u,i,a),o.alloc(16,0));try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=89995);module.exports=s})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=5120,e.ids=[5120],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")},81630:e=>{e.exports=require("http")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,o){return o in r?r[o]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,o)):"function"==typeof r&&"default"===o?r:void 0}}})},22955:(e,r,o)=>{o.r(r),o.d(r,{config:()=>p,default:()=>d,routeModule:()=>_});var t={};o.r(t),o.d(t,{default:()=>c});var s=o(89947),n=o(2706),u=o(96762),i=o(19131),l=o.n(i);let a=o(29021);async function c(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Failed"});let o=await l()(e);if(!o?.logged_in_status)return r.json({success:!1,log:"No Logs"});if(!a.existsSync("./.tmp/error.log"))return r.json({success:!0,log:"No Logs Yet."});let t=a.readFileSync("./.tmp/error.log","utf-8");r.json({success:!0,log:t})}let d=(0,u.M)(t,"default"),p=(0,u.M)(t,"config"),_=new s.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/admin/grabErrorLogs",pathname:"/api/admin/grabErrorLogs",bundlePath:"",filename:""},userland:t})},19131:(e,r,o)=>{let{IncomingMessage:t}=o(81630),s=o(72835),n=o(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:o}=n(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let u=s({encryptedString:e.cookies[t]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",o=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),s&&(n+=`${s}_`),n+=o;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),{keyCookieName:n,csrfCookieName:u+=t}}},72835:(e,r,o)=>{let{scryptSync:t,createDecipheriv:s}=o(55511),{Buffer:n}=o(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:o})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=o||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let a=s("aes-192-cbc",t(u,i,l),n.alloc(16,0));try{let r=a.update(e,"hex","utf8");return r+=a.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var o;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return o}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(o||(o={}))},89947:(e,r,o)=>{e.exports=o(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var o=r(r.s=22955);module.exports=o})();
"use strict";(()=>{var e={};e.id=5120,e.ids=[5120],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")},81630:e=>{e.exports=require("http")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,o){return o in r?r[o]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,o)):"function"==typeof r&&"default"===o?r:void 0}}})},22955:(e,r,o)=>{o.r(r),o.d(r,{config:()=>_,default:()=>d,routeModule:()=>p});var s={};o.r(s),o.d(s,{default:()=>c});var t=o(89947),n=o(2706),u=o(96762),i=o(19131),l=o.n(i);let a=o(29021);async function c(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Failed"});let o=await l()(e);if(!o?.logged_in_status)return r.json({success:!1,log:"No Logs"});if(!a.existsSync("./.tmp/error.log"))return r.json({success:!0,log:"No Logs Yet."});let s=a.readFileSync("./.tmp/error.log","utf-8");r.json({success:!0,log:s})}let d=(0,u.M)(s,"default"),_=(0,u.M)(s,"config"),p=new t.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/admin/grabErrorLogs",pathname:"/api/admin/grabErrorLogs",bundlePath:"",filename:""},userland:s})},19131:(e,r,o)=>{let{IncomingMessage:s}=o(81630),t=o(72835),n=o(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:o}=n(),s=`${r}_su`;if(!e.cookies?.[s])return console.log("No auth key cookie found"),null;let u=t({encryptedString:e.cookies[s]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",o=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",t=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+_/,""),u=r;e?.userId&&(u+=`user_${e.userId}_`),n&&(u+=`${n}_`),u+=o;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:u,csrfCookieName:i,oneTimeCodeName:l+=t}}},72835:(e,r,o)=>{let{scryptSync:s,createDecipheriv:t}=o(55511),{Buffer:n}=o(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:o})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=o||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let a=t("aes-192-cbc",s(u,i,l),n.alloc(16,0));try{let r=a.update(e,"hex","utf8");return r+=a.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var o;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return o}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(o||(o={}))},89947:(e,r,o)=>{e.exports=o(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var o=r(r.s=22955);module.exports=o})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=7375,e.ids=[7375],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")},81630:e=>{e.exports=require("http")},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}}})},15570:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>_});var n={};t.r(n),t.d(n,{default:()=>c});var s=t(89947),o=t(2706),u=t(96762),i=t(19131),a=t.n(i);let l=t(29021);async function c(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let t=await a()(e);if(!t?.logged_in_status)return r.json({success:!1,log:"No Logs"});let{type:n,path:s}=e.body;if(e.body.user,!s?.match(/^\.\/jsonData\/dbSchemas\/users/))return r.json({success:!1,msg:"Invalid Path"});let o=s.replace(/\//g,"\\\\"),u=l.readFileSync(o,"utf-8");r.json({success:!0,data:u})}let d=(0,u.M)(n,"default"),p=(0,u.M)(n,"config"),_=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/grabFile",pathname:"/api/admin/grabFile",bundlePath:"",filename:""},userland:n})},19131:(e,r,t)=>{let{IncomingMessage:n}=t(81630),s=t(72835),o=t(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:t}=o(),n=`${r}_su`;if(!e.cookies?.[n])return console.log("No auth key cookie found"),null;let u=s({encryptedString:e.cookies[n]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),s&&(o+=`${s}_`),o+=t;let u=r;return e?.userId&&(u+=`user_${e.userId}_`),s&&(u+=`${s}_`),{keyCookieName:o,csrfCookieName:u+=n}}},72835:(e,r,t)=>{let{scryptSync:n,createDecipheriv:s}=t(55511),{Buffer:o}=t(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:t})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=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(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=s("aes-192-cbc",n(u,i,a),o.alloc(16,0));try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=15570);module.exports=t})();
"use strict";(()=>{var e={};e.id=7375,e.ids=[7375],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")},81630:e=>{e.exports=require("http")},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}}})},15570:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>d,routeModule:()=>p});var t={};s.r(t),s.d(t,{default:()=>c});var n=s(89947),o=s(2706),u=s(96762),i=s(19131),a=s.n(i);let l=s(29021);async function c(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await a()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let{type:t,path:n}=e.body;if(e.body.user,!n?.match(/^\.\/jsonData\/dbSchemas\/users/))return r.json({success:!1,msg:"Invalid Path"});let o=n.replace(/\//g,"\\\\"),u=l.readFileSync(o,"utf-8");r.json({success:!0,data:u})}let d=(0,u.M)(t,"default"),_=(0,u.M)(t,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/grabFile",pathname:"/api/admin/grabFile",bundlePath:"",filename:""},userland:t})},19131:(e,r,s)=>{let{IncomingMessage:t}=s(81630),n=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let u=n({encryptedString:e.cookies[t]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(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",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+_/,""),u=r;e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),u+=s;let i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),{keyCookieName:u,csrfCookieName:i,oneTimeCodeName:a+=n}}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:n}=s(55511),{Buffer:o}=s(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:s})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=s||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=n("aes-192-cbc",t(u,i,a),o.alloc(16,0));try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=15570);module.exports=s})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=5467,e.ids=[5467],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")},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}}})},76386:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>E});var n={};t.r(n),t.d(n,{default:()=>_});var s=t(89947),o=t(2706),i=t(96762),u=t(31341),a=t.n(u),c=t(20503),l=t.n(c);async function _(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Failed"});let{email:t,password:n,authKey:s}=e.body;if(n!==process.env.DSQL_USER_KEY||s!==process.env.DSQL_SPECIAL_KEY)return r.json({success:!1});let o=l()({data:JSON.stringify({email:t,password:process.env.DSQL_USER_KEY,authKey:process.env.DSQL_SPECIAL_KEY,logged_in_status:!0,date:Date.now()})}),{keyCookieName:i,csrfCookieName:u}=a()();r.setHeader("Set-Cookie",[`${i}_su=${o};samesite=strict;path=/;HttpOnly=true;Secure=true`]),r.json({success:!0})}let d=(0,i.M)(n,"default"),p=(0,i.M)(n,"config"),E=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/loginSuUser",pathname:"/api/admin/loginSuUser",bundlePath:"",filename:""},userland:n})},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),s&&(o+=`${s}_`),o+=t;let i=r;return e?.userId&&(i+=`user_${e.userId}_`),s&&(i+=`${s}_`),{keyCookieName:o,csrfCookieName:i+=n}}},20503:(e,r,t)=>{let{scryptSync:n,createCipheriv:s}=t(55511),{Buffer:o}=t(79428);e.exports=({data:e,encryptionKey:r,encryptionSalt:t})=>{if(!e?.match(/./))return console.log("Encryption string is invalid"),e;let i=r||process.env.DSQL_ENCRYPTION_PASSWORD,u=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("Encryption key is invalid"),e;if(!u?.match(/.{8,}/))return console.log("Encryption salt is invalid"),e;let c=s("aes-192-cbc",n(i,u,a),o.alloc(16,0));try{let r=c.update(e,"utf8","hex");return r+=c.final("hex")}catch(r){return console.log("Error in encrypting =>",r.message),e}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=76386);module.exports=t})();
"use strict";(()=>{var e={};e.id=5467,e.ids=[5467],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")},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}}})},76386:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>E});var n={};t.r(n),t.d(n,{default:()=>l});var s=t(89947),o=t(2706),i=t(96762),u=t(31341),a=t.n(u),_=t(20503),c=t.n(_);async function l(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Failed"});let{email:t,password:n,authKey:s}=e.body;if(n!==process.env.DSQL_USER_KEY||s!==process.env.DSQL_SPECIAL_KEY)return r.json({success:!1});let o=c()({data:JSON.stringify({email:t,password:process.env.DSQL_USER_KEY,authKey:process.env.DSQL_SPECIAL_KEY,logged_in_status:!0,date:Date.now()})}),{keyCookieName:i,csrfCookieName:u}=a()();r.setHeader("Set-Cookie",[`${i}_su=${o};samesite=strict;path=/;HttpOnly=true;Secure=true`]),r.json({success:!0})}let d=(0,i.M)(n,"default"),p=(0,i.M)(n,"config"),E=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/loginSuUser",pathname:"/api/admin/loginSuUser",bundlePath:"",filename:""},userland:n})},31341:e=>{e.exports=function(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 u=r;e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),u+=n;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),{keyCookieName:i,csrfCookieName:u,oneTimeCodeName:a+=s}}},20503:(e,r,t)=>{let{scryptSync:n,createCipheriv:s}=t(55511),{Buffer:o}=t(79428);e.exports=({data:e,encryptionKey:r,encryptionSalt:t})=>{if(!e?.match(/./))return console.log("Encryption string is invalid"),e;let i=r||process.env.DSQL_ENCRYPTION_PASSWORD,u=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("Encryption key is invalid"),e;if(!u?.match(/.{8,}/))return console.log("Encryption salt is invalid"),e;let _=s("aes-192-cbc",n(i,u,a),o.alloc(16,0));try{let r=_.update(e,"utf8","hex");return r+=_.final("hex")}catch(r){return console.log("Error in encrypting =>",r.message),e}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=76386);module.exports=t})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=6799,e.ids=[6799],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},89496:(e,r,s)=>{s.r(r),s.d(r,{config:()=>g,default:()=>S,routeModule:()=>D});var t={};s.r(t),s.d(t,{default:()=>_});var n=s(89947),o=s(2706),a=s(96762),c=s(57638),l=s.n(c),i=s(48225),u=s.n(i),p=s(19131),d=s.n(p);async function _(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await d()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let{database:t,query:n}=e.body;e.body.user;try{let e=await l()({database:t,queryString:n});if(!e)return r.json({success:!1,msg:"Query Failed!"});r.json({success:!0,result:e})}catch(e){console.log(e.message),u()({component:"/api/runUserDbQuery/main-catch-error",message:e.message}),r.json({success:!1})}}s(29021);let S=(0,a.M)(t,"default"),g=(0,a.M)(t,"config"),D=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/runUserDbQuery",pathname:"/api/admin/runUserDbQuery",bundlePath:"",filename:""},userland:t})},19131:(e,r,s)=>{let{IncomingMessage:t}=s(81630),n=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let a=n({encryptedString:e.cookies[t]});if(!a)return console.log("No user payload found"),null;let c=JSON.parse(a);return c.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):c.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):c}},31341:e=>{e.exports=function(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",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=s;let a=r;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:o,csrfCookieName:a+=t}}},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},6061:(e,r,s)=>{let t=s(72835),n=s(30003);e.exports=async function({unparsedResults:e,tableSchema:r}){let s=[];try{for(let o=0;o<e.length;o++){let a=e[o],c=Object.keys(a);for(let e=0;e<c.length;e++){let s=c[e],o=r?.fields[e];if(s?.match(n))continue;let l=a[s];("number"==typeof l||l)&&o?.encrypted&&l?.match(/./)&&(a[s]=t({encryptedString:l}))}s.push(a)}return s}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},48225:(e,r,s)=>{let t=s(29021),{IncomingMessage:n}=s(81630);e.exports=async function({user:e,message:r,component:s,noMail:n,req:o}){let a=new Date,c=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],s=o.headers["cf-connecting-ip"],t=Array.isArray(e)?e[0]:e?.split(",")[0],n=s||t||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=6799,e.ids=[6799],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},89496:(e,r,s)=>{s.r(r),s.d(r,{config:()=>D,default:()=>S,routeModule:()=>m});var t={};s.r(t),s.d(t,{default:()=>d});var n=s(89947),o=s(2706),a=s(96762),c=s(57638),l=s.n(c),u=s(48225),i=s.n(u),p=s(19131),_=s.n(p);async function d(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await _()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let{database:t,query:n}=e.body;e.body.user;try{let e=await l()({database:t,queryString:n});if(!e)return r.json({success:!1,msg:"Query Failed!"});r.json({success:!0,result:e})}catch(e){console.log(e.message),i()({component:"/api/runUserDbQuery/main-catch-error",message:e.message}),r.json({success:!1})}}s(29021);let S=(0,a.M)(t,"default"),D=(0,a.M)(t,"config"),m=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/runUserDbQuery",pathname:"/api/admin/runUserDbQuery",bundlePath:"",filename:""},userland:t})},19131:(e,r,s)=>{let{IncomingMessage:t}=s(81630),n=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let a=n({encryptedString:e.cookies[t]});if(!a)return console.log("No user payload found"),null;let c=JSON.parse(a);return c.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):c.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):c}},31341:e=>{e.exports=function(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",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+=s;let c=r;e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),c+=t;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:a,csrfCookieName:c,oneTimeCodeName:l+=n}}},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},6061:(e,r,s)=>{let t=s(72835),n=s(30003);e.exports=async function({unparsedResults:e,tableSchema:r}){let s=[];try{for(let o=0;o<e.length;o++){let a=e[o],c=Object.keys(a);for(let e=0;e<c.length;e++){let s=c[e],o=r?.fields[e];if(s?.match(n))continue;let l=a[s];("number"==typeof l||l)&&o?.encrypted&&l?.match(/./)&&(a[s]=t({encryptedString:l}))}s.push(a)}return s}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},48225:(e,r,s)=>{let t=s(29021),{IncomingMessage:n}=s(81630);e.exports=async function({user:e,message:r,component:s,noMail:n,req:o}){let a=new Date,c=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],s=o.headers["cf-connecting-ip"],t=Array.isArray(e)?e[0]:e?.split(",")[0],n=s||t||r||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${s}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}
@ -13,4 +13,4 @@ Date: ${a.toDateString()}
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},57638:(e,r,s)=>{s(29021);let t=s(6061),n=s(48225),o=s(51348),a=s(21339),c=s(44900);e.exports=async function({queryString:e,queryValuesArray:r,database:s,tableSchema:l,useLocal:i}){let u;let p=!!i||!!s?.match(/^datasquirel$/),d=i?c:p?o:a;try{u=e&&r&&Array.isArray(r)&&r[0]?p?await d(e,r):await d({paradigm:"Full Access",database:s,queryString:e,queryValues:r}):p?await d(e):await d({paradigm:"Full Access",database:s,queryString:e})}catch(e){n({component:"varDatabaseDbHandler/lines-29-32",message:e.message})}if(u&&l)try{let e=u;return await t({unparsedResults:e,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",s,e),n({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(u)return u;else return null}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:n}=s(55511),{Buffer:o}=s(79428);e.exports=({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,c=s||process.env.DSQL_ENCRYPTION_SALT,l=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(!c?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let i=n("aes-192-cbc",t(a,c,l),o.alloc(16,0));try{let r=i.update(e,"hex","utf8");return r+=i.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,s)=>{let t=s(9973),n=s(21580),o=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()}});async function a(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21339:(e,r,s)=>{let t=s(29021);s(33873);let n=s(9973),o=s(21580),a=n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,charset:"utf8mb4",ssl:o()}});e.exports=function({paradigm:e,database:r,queryString:s,queryValues:c}){try{return new Promise((l,i)=>{let u=!!e?.match(/full.access|^fa$/i);try{function p(e){a.end(),l(JSON.parse(JSON.stringify(e)))}function d(e){a.end(),l({error:e.message,queryStringGenerated:s,queryValuesGenerated:c,sql:e.sql})}a=u?n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,database:r,ssl:o()}}):n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,database:r,ssl:o()}}),c&&Array.isArray(c)&&c[0]?a.query(s,c).then(p).catch(d):a.query(s).then(p).catch(d)}catch(e){t.appendFileSync("./.tmp/dbErrorLogs.txt",e.message+"\n"+Date()+"\n\n\n","utf8"),l({error:e.message})}})}catch(e){return{success:!1,error:e.message}}}},44900:(e,r,s)=>{let t=s(9973),n=s(21580);async function o(...e){let r=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()},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 s=await r.query(...e);return await r.end(),JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e.message),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,s)=>{let t=s(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!t.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:t.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=89496);module.exports=s})();
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},57638:(e,r,s)=>{s(29021);let t=s(6061),n=s(48225),o=s(51348),a=s(21339),c=s(44900);e.exports=async function({queryString:e,queryValuesArray:r,database:s,tableSchema:l,useLocal:u}){let i;let p=!!u||!!s?.match(/^datasquirel$/),_=u?c:p?o:a;try{i=e&&r&&Array.isArray(r)&&r[0]?p?await _(e,r):await _({paradigm:"Full Access",database:s,queryString:e,queryValues:r}):p?await _(e):await _({paradigm:"Full Access",database:s,queryString:e})}catch(e){n({component:"varDatabaseDbHandler/lines-29-32",message:e.message})}if(i&&l)try{let e=i;return await t({unparsedResults:e,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",s,e),n({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(i)return i;else return null}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:n}=s(55511),{Buffer:o}=s(79428);e.exports=({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,c=s||process.env.DSQL_ENCRYPTION_SALT,l=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(!c?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=n("aes-192-cbc",t(a,c,l),o.alloc(16,0));try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,s)=>{let t=s(9973),n=s(21580),o=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()}});async function a(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21339:(e,r,s)=>{let t=s(29021);s(33873);let n=s(9973),o=s(21580),a=n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,charset:"utf8mb4",ssl:o()}});e.exports=function({paradigm:e,database:r,queryString:s,queryValues:c}){try{return new Promise((l,u)=>{let i=!!e?.match(/full.access|^fa$/i);try{function p(e){a.end(),l(JSON.parse(JSON.stringify(e)))}function _(e){a.end(),l({error:e.message,queryStringGenerated:s,queryValuesGenerated:c,sql:e.sql})}a=i?n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,database:r,ssl:o()}}):n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,database:r,ssl:o()}}),c&&Array.isArray(c)&&c[0]?a.query(s,c).then(p).catch(_):a.query(s).then(p).catch(_)}catch(e){t.appendFileSync("./.tmp/dbErrorLogs.txt",e.message+"\n"+Date()+"\n\n\n","utf8"),l({error:e.message})}})}catch(e){return{success:!1,error:e.message}}}},44900:(e,r,s)=>{let t=s(9973),n=s(21580);async function o(...e){let r=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()},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 s=await r.query(...e);return await r.end(),JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e.message),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,s)=>{let t=s(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!t.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:t.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=89496);module.exports=s})();

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=5989,e.ids=[5989],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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},89106:(e,r,t)=>{t.r(r),t.d(r,{config:()=>P,default:()=>g,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>E});var n=t(89947),o=t(2706),u=t(96762),i=t(33873),c=t.n(i),l=t(19131),a=t.n(l),p=t(27825),d=t.n(p);let{execSync:_}=t(79646),f=t(29021);async function E(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let t=await a()(e);if(!t?.logged_in_status)return r.json({success:!1,log:"No Logs"});try{let t=c().join(process.cwd(),".env"),s=f.readFileSync(t,"utf-8"),n=RegExp(`${d().escapeRegExp(e.body.key)}=.*`);s.match(n);let o=s.replace(n,`${e.body.key}=${e.body.value}`);f.writeFileSync(t,o,"utf-8"),r.json({success:!0})}catch(e){console.log("updating Env error =>",e.message),r.json({success:!1,error:e.message})}}let g=(0,u.M)(s,"default"),P=(0,u.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/updateEnv",pathname:"/api/admin/updateEnv",bundlePath:"",filename:""},userland:s})},19131:(e,r,t)=>{let{IncomingMessage:s}=t(81630),n=t(72835),o=t(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:t}=o(),s=`${r}_su`;if(!e.cookies?.[s])return console.log("No auth key cookie found"),null;let u=n({encryptedString:e.cookies[s]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),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:o,csrfCookieName:u+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:t})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=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(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=n("aes-192-cbc",s(u,i,c),o.alloc(16,0));try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=89106);module.exports=t})();
"use strict";(()=>{var e={};e.id=5989,e.ids=[5989],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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},89106:(e,r,s)=>{s.r(r),s.d(r,{config:()=>P,default:()=>g,routeModule:()=>S});var t={};s.r(t),s.d(t,{default:()=>f});var n=s(89947),o=s(2706),u=s(96762),i=s(33873),l=s.n(i),a=s(19131),c=s.n(a),d=s(27825),p=s.n(d);let{execSync:_}=s(79646),E=s(29021);async function f(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await c()(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});try{let s=l().join(process.cwd(),".env"),t=E.readFileSync(s,"utf-8"),n=RegExp(`${p().escapeRegExp(e.body.key)}=.*`);t.match(n);let o=t.replace(n,`${e.body.key}=${e.body.value}`);E.writeFileSync(s,o,"utf-8"),r.json({success:!0})}catch(e){console.log("updating Env error =>",e.message),r.json({success:!1,error:e.message})}}let g=(0,u.M)(t,"default"),P=(0,u.M)(t,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/admin/updateEnv",pathname:"/api/admin/updateEnv",bundlePath:"",filename:""},userland:t})},19131:(e,r,s)=>{let{IncomingMessage:t}=s(81630),n=s(72835),o=s(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:s}=o(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let u=n({encryptedString:e.cookies[t]});if(!u)return console.log("No user payload found"),null;let i=JSON.parse(u);return i.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):i.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):i}},31341:e=>{e.exports=function(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",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+_/,""),u=r;e?.userId&&(u+=`user_${e.userId}_`),o&&(u+=`${o}_`),u+=s;let i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;let l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:u,csrfCookieName:i,oneTimeCodeName:l+=n}}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:n}=s(55511),{Buffer:o}=s(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:s})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let u=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=s||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!u?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let a=n("aes-192-cbc",t(u,i,l),o.alloc(16,0));try{let r=a.update(e,"hex","utf8");return r+=a.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=89106);module.exports=s})();

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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},82651:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>d,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),o=t(2706),i=t(96762),c=t(33873),u=t.n(c),a=t(6420),l=t.n(a);let _=t(29021);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(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=u().join(o,`images/user-images/user-${t.id}/${n?n+"/":""}`),c=_.existsSync(i+s);r.json({success:c})}let d=(0,i.M)(s,"default"),f=(0,i.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/checkExistingFolder",pathname:"/api/checkExistingFolder",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function c(e,r,t,c){let{keyCookieName:u,csrfCookieName:a}=i();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=c},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,c=t||process.env.DSQL_ENCRYPTION_SALT,u=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(!c?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let a=n("aes-192-cbc",s(i,c,u),o.alloc(16,0));try{let r=a.update(e,"hex","utf8");return r+=a.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=82651);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},82651:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>d,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),o=t(2706),i=t(96762),c=t(33873),u=t.n(c),a=t(6420),l=t.n(a);let _=t(29021);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(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=u().join(o,`images/user-images/user-${t.id}/${n?n+"/":""}`),c=_.existsSync(i+s);r.json({success:c})}let d=(0,i.M)(s,"default"),f=(0,i.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/checkExistingFolder",pathname:"/api/checkExistingFolder",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function c(e,r,t,c){let{keyCookieName:u,csrfCookieName:a}=i();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=c},31341:e=>{e.exports=function(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}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,c=t||process.env.DSQL_ENCRYPTION_SALT,u=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(!c?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let a=n("aes-192-cbc",s(i,c,u),o.alloc(16,0));try{let r=a.update(e,"hex","utf8");return r+=a.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=82651);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},7616:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>l,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>u});var n=t(89947),o=t(2706),i=t(96762),a=t(6420),c=t.n(a);async function u(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await c()(e,r,!0);r.json({user:t})}let l=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/clientSideAuth",pathname:"/api/clientSideAuth",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:c,csrfCookieName:u}=i();if(!e.cookies?.[c]?.match(/./))return null;let l=n({encryptedString:e.cookies[c]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,a=t||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!i?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=n("aes-192-cbc",s(i,a,c),o.alloc(16,0));try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=7616);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},7616:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>l,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762),u=t(6420),a=t.n(u);async function c(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await a()(e,r,!0);r.json({user:t})}let l=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/clientSideAuth",pathname:"/api/clientSideAuth",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function u(e,r,t,u){let{keyCookieName:a,csrfCookieName:c}=i();if(!e.cookies?.[a]?.match(/./))return null;let l=n({encryptedString:e.cookies[a]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=u},31341:e=>{e.exports=function(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 a=r;return e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),{keyCookieName:i,csrfCookieName:u,oneTimeCodeName:a+=n}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,u=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(!u?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(i,u,a),o.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=7616);module.exports=t})();

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=7539,e.ids=[7539],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")},81630:e=>{e.exports=require("http")},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}}})},8953:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>_,routeModule:()=>P});var n={};t.r(n),t.d(n,{default:()=>m});var i=t(89947),s=t(2706),o=t(96762),a=t(48225),l=t.n(a),u=t(77619),c=t.n(u),d=t(72835),p=t.n(d),f=t(33873),g=t.n(f);let S=t(29021);async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=e.body,{url:n,key:i,database:s,dbSchema:o,type:a}=t;try{let e=c()({key:i,database:s?.db_slug,user_id:t.user_id});if(!e?.user_id)throw Error("Api Credentials invalid!");let n=p()({encryptedString:i}),{user_id:o,full_access:a,csrf:l}=n?JSON.parse(n):null;if(!a||!l)return r.json({success:!1,msg:"Unauthorized"});let u=g().resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${o}`,"main.json");if(!S.existsSync(u))throw Error("User Shcema data file doesn't exist!");let d=JSON.parse(S.readFileSync(u,"utf-8"));r.json({success:!0,payload:d})}catch(e){console.log("Connect Verification Error, =>",e.message),l()({component:"/api/connect/main-catch-error",message:e.message}),r.json({success:!1,msg:"Connect Verification Operation Failed!"})}}let _=(0,o.M)(n,"default"),E=(0,o.M)(n,"config"),P=new i.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/connect",pathname:"/api/connect",bundlePath:"",filename:""},userland:n})},77619:(e,r,t)=>{let n=t(29021),i=t(72835);e.exports=({key:e,database:r,table:t,user_id:s})=>{if(!e||!s)return null;try{let o=process.env.DSQL_API_KEYS_PATH;if(!o)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");let a=i({encryptedString:e}),l=JSON.parse(a||""),u=n.existsSync(`${o}/${l.sign}`);if(String(l.user_id)!==String(s)||!u)return null;if(!l.target_database)return l;if(!r&&l.target_database)return null;let c=l.target_database?.split(",").includes(String(r));if(c&&!l.target_table)return l;if(c&&!t&&l.target_table)return null;if(l.target_table?.split(",").includes(String(t)))return l;return null}catch(e){return console.log(`api-cred ERROR: ${e.message}`),null}}},48225:(e,r,t)=>{let n=t(29021),{IncomingMessage:i}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:i,req:s}){let o=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"],n=Array.isArray(e)?e[0]:e?.split(",")[0],i=t||n||r||s.socket.remoteAddress;if(!i)return null;return String(i)}catch(e){return null}})();try{let i=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=7539,e.ids=[7539],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")},81630:e=>{e.exports=require("http")},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}}})},8953:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>_,routeModule:()=>P});var n={};t.r(n),t.d(n,{default:()=>m});var i=t(89947),s=t(2706),o=t(96762),a=t(48225),l=t.n(a),c=t(77619),u=t.n(c),d=t(72835),p=t.n(d),f=t(33873),g=t.n(f);let S=t(29021);async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=e.body,{url:n,key:i,database:s,dbSchema:o,type:a}=t;try{let e=u()({key:i,database:s?.db_slug,user_id:t.user_id});if(!e?.user_id)throw Error("Api Credentials invalid!");let n=p()({encryptedString:i}),{user_id:o,full_access:a,csrf:l}=n?JSON.parse(n):null;if(!a||!l)return r.json({success:!1,msg:"Unauthorized"});let c=g().resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${o}`,"main.json");if(!S.existsSync(c))throw Error("User Shcema data file doesn't exist!");let d=JSON.parse(S.readFileSync(c,"utf-8"));r.json({success:!0,payload:d})}catch(e){console.log("Connect Verification Error, =>",e.message),l()({component:"/api/connect/main-catch-error",message:e.message}),r.json({success:!1,msg:"Connect Verification Operation Failed!"})}}let _=(0,o.M)(n,"default"),E=(0,o.M)(n,"config"),P=new i.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/connect",pathname:"/api/connect",bundlePath:"",filename:""},userland:n})},77619:(e,r,t)=>{let n=t(29021),i=t(72835);e.exports=({key:e,database:r,table:t,user_id:s,media:o})=>{if(!e||!s)return null;try{let a=process.env.DSQL_API_KEYS_PATH;if(!a)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");let l=i({encryptedString:e}),c=JSON.parse(l||""),u=n.existsSync(`${a}/${c.sign}`);if(String(c.user_id)!==String(s)||!u)return null;if(!c.target_database||o)return c;if(!r&&c.target_database)return null;let d=c.target_database?.split(",").includes(String(r));if(d&&!c.target_table)return c;if(d&&!t&&c.target_table)return null;if(c.target_table?.split(",").includes(String(t)))return c;return null}catch(e){return console.log(`api-cred ERROR: ${e.message}`),{error:`api-cred ERROR: ${e.message}`}}}},48225:(e,r,t)=>{let n=t(29021),{IncomingMessage:i}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:i,req:s}){let o=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"],n=Array.isArray(e)?e[0]:e?.split(",")[0],i=t||n||r||s.socket.remoteAddress;if(!i)return null;return String(i)}catch(e){return null}})();try{let i=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(i+=`
User Id: ${e?.id}
@ -13,4 +13,4 @@ Date: ${o.toDateString()}
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},72835:(e,r,t)=>{let{scryptSync:n,createDecipheriv:i}=t(55511),{Buffer:s}=t(79428);e.exports=({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,l=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=i("aes-192-cbc",n(o,a,l),s.alloc(16,0));try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=8953);module.exports=t})();
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},72835:(e,r,t)=>{let{scryptSync:n,createDecipheriv:i}=t(55511),{Buffer:s}=t(79428);e.exports=({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,l=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=i("aes-192-cbc",n(o,a,l),s.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=8953);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},79551:e=>{e.exports=require("url")},28354:e=>{e.exports=require("util")},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}}})},94871:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>m,routeModule:()=>h});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),o=t(2706),i=t(96762),a=t(83634),c=t.n(a),l=t(48225),u=t.n(l),p=t(6420),d=t.n(p);t(29021),t(28354);let{URL:f}=t(79551);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await d()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{url:s,key:n,database:o,dbSchema:i,type:a}=e.body;try{let{hostname:e,port:t,protocol:o}=new f(s),i=await c()({scheme:o,headers:{Authorization:n},hostname:e,port:t,path:"/api/connect",method:"POST",body:{url:s,key:n}}),a=JSON.parse(i);if(!a?.success)throw Error(a.msg||"Remote request failed");r.json({success:!0,payload:a.payload})}catch(e){console.log("Connect Verification Initialtor Error, =>",e.message),u()({component:"/api/connect/verify/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Operation Failed!"})}}let m=(0,i.M)(s,"default"),S=(0,i.M)(s,"config"),h=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/connect/verify",pathname:"/api/connect/verify",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:c,csrfCookieName:l}=i();if(!e.cookies?.[c]?.match(/./))return null;let u=n({encryptedString:e.cookies[c]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${d}/${p.csrf_k}`))return null;if(0==p.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},83634:(e,r,t)=>{let s=t(55591),n=t(81630),{URL:o}=t(79551);e.exports=function({url:e,method:r,hostname:t,path:i,headers:a,body:c,port:l,scheme:u}){let p=c?JSON.stringify(c):null,d=e?new o(e):null,f={method:r||"GET",hostname:d?d.hostname:t,port:u?.match(/https/i)?443:d?d.protocol?.match(/https/i)?443:d.port:l?Number(l):80,headers:{}};return i&&(f.path=i),a&&(f.headers=a),c&&(f.headers["Content-Type"]="application/json",f.headers["Content-Length"]=p?Buffer.from(p).length:void 0),new Promise((e,r)=>{let t=(u?.match(/https/i)?s:d?.protocol?.match(/https/i)?s:n).request(f,t=>{var s="";t.on("data",function(e){s+=e}),t.on("end",function(){e(s)}),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(p),t.on("error",e=>{console.log("HTTPS request ERROR =>",e.message),r(`HTTP request error =>, ${e.message}`)}),t.end()})}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 n=`🚀 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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},55591:e=>{e.exports=require("https")},79551:e=>{e.exports=require("url")},28354:e=>{e.exports=require("util")},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}}})},94871:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>m,routeModule:()=>E});var s={};t.r(s),t.d(s,{default:()=>f});var n=t(89947),o=t(2706),i=t(96762),a=t(83634),c=t.n(a),l=t(48225),u=t.n(l),p=t(6420),d=t.n(p);t(29021),t(28354);let{URL:_}=t(79551);async function f(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await d()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{url:s,key:n,database:o,dbSchema:i,type:a}=e.body;try{let{hostname:e,port:t,protocol:o}=new _(s),i=await c()({scheme:o,headers:{Authorization:n},hostname:e,port:t,path:"/api/connect",method:"POST",body:{url:s,key:n}}),a=JSON.parse(i);if(!a?.success)throw Error(a.msg||"Remote request failed");r.json({success:!0,payload:a.payload})}catch(e){console.log("Connect Verification Initialtor Error, =>",e.message),u()({component:"/api/connect/verify/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Operation Failed!"})}}let m=(0,i.M)(s,"default"),S=(0,i.M)(s,"config"),E=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/connect/verify",pathname:"/api/connect/verify",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:c,csrfCookieName:l}=i();if(!e.cookies?.[c]?.match(/./))return null;let u=n({encryptedString:e.cookies[c]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${d}/${p.csrf_k}`))return null;if(0==p.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=a},31341:e=>{e.exports=function(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}}},83634:(e,r,t)=>{let s=t(55591),n=t(81630),{URL:o}=t(79551);e.exports=function({url:e,method:r,hostname:t,path:i,headers:a,body:c,port:l,scheme:u}){let p=c?JSON.stringify(c):null,d=e?new o(e):null,_={method:r||"GET",hostname:d?d.hostname:t,port:u?.match(/https/i)?443:d?d.protocol?.match(/https/i)?443:d.port:l?Number(l):80,headers:{}};return i&&(_.path=i),a&&(_.headers=a),c&&(_.headers["Content-Type"]="application/json",_.headers["Content-Length"]=p?Buffer.from(p).length:void 0),new Promise((e,r)=>{let t=(u?.match(/https/i)?s:d?.protocol?.match(/https/i)?s:n).request(_,t=>{var s="";t.on("data",function(e){s+=e}),t.on("end",function(){e(s)}),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(p),t.on("error",e=>{console.log("HTTPS request ERROR =>",e.message),r(`HTTP request error =>, ${e.message}`)}),t.end()})}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 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=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")},81630:e=>{e.exports=require("http")},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}}})},80061:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>p,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),a=t(2706),o=t(96762),c=t(57638),i=t.n(c),l=t(6420),u=t.n(l);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await u()(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{dbFullName:t,userId:s}=e.body;await i()({database:t,queryString:"DELETE FROM users WHERE id = ?",queryValuesArray:[s]}),r.json({success:!0,msg:"User Deleted!"})}t(29021);let p=(0,o.M)(s,"default"),d=(0,o.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteDbUser",pathname:"/api/deleteDbUser",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function c(e,r,t,c){let{keyCookieName:i,csrfCookieName:l}=o();if(!e.cookies?.[i]?.match(/./))return null;let u=n({encryptedString:e.cookies[i]});if(!u)return null;let _=JSON.parse(u);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=c},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:o+=s}}},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},6061:(e,r,t)=>{let s=t(72835),n=t(30003);e.exports=async function({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],c=Object.keys(o);for(let e=0;e<c.length;e++){let t=c[e],a=r?.fields[e];if(t?.match(n))continue;let i=o[t];("number"==typeof i||i)&&a?.encrypted&&i?.match(/./)&&(o[t]=s({encryptedString:i}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,c=(()=>{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 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")},81630:e=>{e.exports=require("http")},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}}})},80061:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),a=t(2706),o=t(96762),c=t(57638),i=t.n(c),l=t(6420),u=t.n(l);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});if(!await u()(e,r,!0))return r.json({success:!1,msg:"Unauthorized"});let{dbFullName:t,userId:s}=e.body;await i()({database:t,queryString:"DELETE FROM users WHERE id = ?",queryValuesArray:[s]}),r.json({success:!0,msg:"User Deleted!"})}t(29021);let d=(0,o.M)(s,"default"),p=(0,o.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteDbUser",pathname:"/api/deleteDbUser",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function c(e,r,t,c){let{keyCookieName:i,csrfCookieName:l}=o();if(!e.cookies?.[i]?.match(/./))return null;let u=n({encryptedString:e.cookies[i]});if(!u)return null;let _=JSON.parse(u);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=c},31341:e=>{e.exports=function(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 c=r;e?.userId&&(c+=`user_${e.userId}_`),a&&(c+=`${a}_`),c+=s;let i=r;return e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),{keyCookieName:o,csrfCookieName:c,oneTimeCodeName:i+=n}}},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},6061:(e,r,t)=>{let s=t(72835),n=t(30003);e.exports=async function({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],c=Object.keys(o);for(let e=0;e<c.length;e++){let t=c[e],a=r?.fields[e];if(t?.match(n))continue;let i=o[t];("number"==typeof i||i)&&a?.encrypted&&i?.match(/./)&&(o[t]=s({encryptedString:i}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,c=(()=>{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 n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}
@ -13,4 +13,4 @@ Date: ${o.toDateString()}
${i}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},57638:(e,r,t)=>{t(29021);let s=t(6061),n=t(48225),a=t(51348),o=t(21339),c=t(44900);e.exports=async function({queryString:e,queryValuesArray:r,database:t,tableSchema:i,useLocal:l}){let u;let _=!!l||!!t?.match(/^datasquirel$/),p=l?c:_?a:o;try{u=e&&r&&Array.isArray(r)&&r[0]?_?await p(e,r):await p({paradigm:"Full Access",database:t,queryString:e,queryValues:r}):_?await p(e):await p({paradigm:"Full Access",database:t,queryString:e})}catch(e){n({component:"varDatabaseDbHandler/lines-29-32",message:e.message})}if(u&&i)try{let e=u;return await s({unparsedResults:e,tableSchema:i})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),n({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(u)return u;else return null}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:a}=t(79428);e.exports=({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,c=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(!c?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=n("aes-192-cbc",s(o,c,i),a.alloc(16,0));try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),a=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:n()}});async function o(...e){try{let r=await a.query(...e);return await a.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21339:(e,r,t)=>{let s=t(29021);t(33873);let n=t(9973),a=t(21580),o=n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,charset:"utf8mb4",ssl:a()}});e.exports=function({paradigm:e,database:r,queryString:t,queryValues:c}){try{return new Promise((i,l)=>{let u=!!e?.match(/full.access|^fa$/i);try{function _(e){o.end(),i(JSON.parse(JSON.stringify(e)))}function p(e){o.end(),i({error:e.message,queryStringGenerated:t,queryValuesGenerated:c,sql:e.sql})}o=u?n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,database:r,ssl:a()}}):n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,database:r,ssl:a()}}),c&&Array.isArray(c)&&c[0]?o.query(t,c).then(_).catch(p):o.query(t).then(_).catch(p)}catch(e){s.appendFileSync("./.tmp/dbErrorLogs.txt",e.message+"\n"+Date()+"\n\n\n","utf8"),i({error:e.message})}})}catch(e){return{success:!1,error:e.message}}}},44900:(e,r,t)=>{let s=t(9973),n=t(21580);async function a(...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:n()},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}}}e.exports=a},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=80061);module.exports=t})();
${i}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},57638:(e,r,t)=>{t(29021);let s=t(6061),n=t(48225),a=t(51348),o=t(21339),c=t(44900);e.exports=async function({queryString:e,queryValuesArray:r,database:t,tableSchema:i,useLocal:l}){let u;let _=!!l||!!t?.match(/^datasquirel$/),d=l?c:_?a:o;try{u=e&&r&&Array.isArray(r)&&r[0]?_?await d(e,r):await d({paradigm:"Full Access",database:t,queryString:e,queryValues:r}):_?await d(e):await d({paradigm:"Full Access",database:t,queryString:e})}catch(e){n({component:"varDatabaseDbHandler/lines-29-32",message:e.message})}if(u&&i)try{let e=u;return await s({unparsedResults:e,tableSchema:i})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),n({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(u)return u;else return null}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:a}=t(79428);e.exports=({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,c=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(!c?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=n("aes-192-cbc",s(o,c,i),a.alloc(16,0));try{let r=l.update(e,"hex","utf8");return r+=l.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),a=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:n()}});async function o(...e){try{let r=await a.query(...e);return await a.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21339:(e,r,t)=>{let s=t(29021);t(33873);let n=t(9973),a=t(21580),o=n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,charset:"utf8mb4",ssl:a()}});e.exports=function({paradigm:e,database:r,queryString:t,queryValues:c}){try{return new Promise((i,l)=>{let u=!!e?.match(/full.access|^fa$/i);try{function _(e){o.end(),i(JSON.parse(JSON.stringify(e)))}function d(e){o.end(),i({error:e.message,queryStringGenerated:t,queryValuesGenerated:c,sql:e.sql})}o=u?n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,database:r,ssl:a()}}):n({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,database:r,ssl:a()}}),c&&Array.isArray(c)&&c[0]?o.query(t,c).then(_).catch(d):o.query(t).then(_).catch(d)}catch(e){s.appendFileSync("./.tmp/dbErrorLogs.txt",e.message+"\n"+Date()+"\n\n\n","utf8"),i({error:e.message})}})}catch(e){return{success:!1,error:e.message}}}},44900:(e,r,t)=>{let s=t(9973),n=t(21580);async function a(...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:n()},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}}}e.exports=a},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=80061);module.exports=t})();

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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},50667:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),i=t(2706),o=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});await u()("DELETE FROM invitations WHERE id = ? AND inviting_user_id = ?",[e.body.id,t.id]),r.json({success:!0})}let d=(0,o.M)(s,"default"),p=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/deleteInvitation",pathname:"/api/deleteInvitation",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),o=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=o();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:i,csrfCookieName:o+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:i}=t(79428);e.exports=({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,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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(o,a,u),i.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),i=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:n()}});async function o(...e){try{let r=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=50667);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},50667:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),i=t(2706),o=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});await u()("DELETE FROM invitations WHERE id = ? AND inviting_user_id = ?",[e.body.id,t.id]),r.json({success:!0})}let d=(0,o.M)(s,"default"),p=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/deleteInvitation",pathname:"/api/deleteInvitation",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),o=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=o();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:i}=t(79428);e.exports=({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,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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(o,a,u),i.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),i=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:n()}});async function o(...e){try{let r=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=50667);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},30976:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>m,routeModule:()=>y});var s={};t.r(s),t.d(s,{default:()=>E});var n=t(89947),o=t(2706),a=t(96762),i=t(51348),c=t.n(i),l=t(48225),u=t.n(l),d=t(6420),p=t.n(d),_=t(33873),S=t.n(_);let f=t(29021);async function E(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await p()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{folder:s}=e.body;try{async function n({path:e}){try{let r=f.readdirSync(e);for(let t=0;t<r.length;t++){let s=r[t];if(!s.match(/\..{3,4}$/)){await n({path:e+s+"/"});continue}let o=e.replace(/.*user-images\/user-\d+\/|.*jsonData\/dbSchemas\/users\/user-\d+\/media\//,"").replace(/\/+$/,""),a=await c()(`SELECT * FROM user_media WHERE folder=? && media_url LIKE '%${s}'`,[o]);a&&a[0]&&await c()("DELETE FROM user_media WHERE id = ?",[a[0].id]);try{f.unlinkSync(e+s)}catch(r){try{f.rmdirSync(e+s)}catch(e){}}}f.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=S().join(e,`images/user-images/user-${t.id}/`),a=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/media/`,i=o+(s?s.replace(/\.| /g,"")+"/":""),l=a+(s?s.replace(/\.| /g,"")+"/":"");await n({path:i}),await n({path:l}),r.json({success:!0})}catch(e){u()({component:"/api/deleteMediaFolder/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}let m=(0,a.M)(s,"default"),g=(0,a.M)(s,"config"),y=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/deleteMediaFolder",pathname:"/api/deleteMediaFolder",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),a=t(31341);async function i(e,r,t,i){let{keyCookieName:c,csrfCookieName:l}=a();if(!e.cookies?.[c]?.match(/./))return null;let u=n({encryptedString:e.cookies[c]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:o,csrfCookieName:a+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,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 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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},30976:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>m,routeModule:()=>y});var s={};t.r(s),t.d(s,{default:()=>E});var n=t(89947),o=t(2706),a=t(96762),i=t(51348),c=t.n(i),l=t(48225),u=t.n(l),d=t(6420),_=t.n(d),p=t(33873),S=t.n(p);let f=t(29021);async function E(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await _()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{folder:s}=e.body;try{async function n({path:e}){try{let r=f.readdirSync(e);for(let t=0;t<r.length;t++){let s=r[t];if(!s.match(/\..{3,4}$/)){await n({path:e+s+"/"});continue}let o=e.replace(/.*user-images\/user-\d+\/|.*jsonData\/dbSchemas\/users\/user-\d+\/media\//,"").replace(/\/+$/,""),a=await c()(`SELECT * FROM user_media WHERE folder=? && media_url LIKE '%${s}'`,[o]);a&&a[0]&&await c()("DELETE FROM user_media WHERE id = ?",[a[0].id]);try{f.unlinkSync(e+s)}catch(r){try{f.rmdirSync(e+s)}catch(e){}}}f.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=S().join(e,`images/user-images/user-${t.id}/`),a=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/media/`,i=o+(s?s.replace(/\.| /g,"")+"/":""),l=a+(s?s.replace(/\.| /g,"")+"/":"");await n({path:i}),await n({path:l}),r.json({success:!0})}catch(e){u()({component:"/api/deleteMediaFolder/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}let m=(0,a.M)(s,"default"),g=(0,a.M)(s,"config"),y=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/deleteMediaFolder",pathname:"/api/deleteMediaFolder",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),a=t(31341);async function i(e,r,t,i){let{keyCookieName:c,csrfCookieName:l}=a();if(!e.cookies?.[c]?.match(/./))return null;let u=n({encryptedString:e.cookies[c]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${_}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,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 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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},47389:(e,r,t)=>{t.r(r),t.d(r,{config:()=>D,default:()=>E,routeModule:()=>g});var s={};t.r(s),t.d(s,{default:()=>m});var n=t(89947),a=t(2706),o=t(96762),i=t(51348),l=t.n(i),c=t(48225),u=t.n(c),d=t(6420),p=t.n(d),_=t(51926),f=t.n(_);let S=t(29021);async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await p()(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 f()(`DROP DATABASE \`${a}\``),await l()("DELETE FROM user_databases WHERE id = ?",[s]),await l()("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(S.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),S.writeFileSync(`${s}`,JSON.stringify(n),"utf8"),r.json({success:!0})}catch(e){u()({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"),D=(0,o.M)(s,"config"),g=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteUserDatabase",pathname:"/api/deleteUserDatabase",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:c}=o();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:o+=s}}},51926:(e,r,t)=>{let s=t(29021),n=t(48225),a=t(45356);e.exports=async function(e){let r;"production".match(/dev/)&&s.appendFileSync("./.tmp/sqlQuery.sql",e+"\n"+Date()+"\n\n\n","utf8");try{r=await a(e)}catch(e){n({component:"noDatabaseDbHandler",message:e.message}),console.log("ERROR in noDatabaseDbHandler =>",e.message)}return r||null}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 n=`🚀 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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},47389:(e,r,t)=>{t.r(r),t.d(r,{config:()=>D,default:()=>m,routeModule:()=>g});var s={};t.r(s),t.d(s,{default:()=>E});var n=t(89947),a=t(2706),o=t(96762),i=t(51348),l=t.n(i),c=t(48225),u=t.n(c),d=t(6420),_=t.n(d),p=t(51926),f=t.n(p);let S=t(29021);async function E(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await _()(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 f()(`DROP DATABASE \`${a}\``),await l()("DELETE FROM user_databases WHERE id = ?",[s]),await l()("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(S.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),S.writeFileSync(`${s}`,JSON.stringify(n),"utf8"),r.json({success:!0})}catch(e){u()({component:"/api/deleteUserDatabase/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"File Updates Failed"})}}let m=(0,o.M)(s,"default"),D=(0,o.M)(s,"config"),g=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteUserDatabase",pathname:"/api/deleteUserDatabase",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:c}=o();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${_}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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}}},51926:(e,r,t)=>{let s=t(29021),n=t(48225),a=t(45356);e.exports=async function(e){let r;"production".match(/dev/)&&s.appendFileSync("./.tmp/sqlQuery.sql",e+"\n"+Date()+"\n\n\n","utf8");try{r=await a(e)}catch(e){n({component:"noDatabaseDbHandler",message:e.message}),console.log("ERROR in noDatabaseDbHandler =>",e.message)}return r||null}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 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 +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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},83246:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>E});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),i=t(2706),o=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await l()(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:a}=s;await u()("DELETE FROM user_users WHERE id=?",[s.id]),n?.match(/admin/i)&&(await u()("DELETE FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",[t.id,o]),await u()("DELETE FROM delegated_user_tables WHERE delegated_user_id=? AND root_user_id=?",[a,t.id])),r.json({success:!0,msg:"User Deleted!"})}t(29021);let d=(0,o.M)(s,"default"),p=(0,o.M)(s,"config"),E=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/deleteUserUser",pathname:"/api/deleteUserUser",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),o=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=o();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:i,csrfCookieName:o+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:i}=t(79428);e.exports=({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,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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(o,a,u),i.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),i=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:n()}});async function o(...e){try{let r=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=83246);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},83246:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>d,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),i=t(2706),o=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await l()(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:a}=s;await u()("DELETE FROM user_users WHERE id=?",[s.id]),n?.match(/admin/i)&&(await u()("DELETE FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",[t.id,o]),await u()("DELETE FROM delegated_user_tables WHERE delegated_user_id=? AND root_user_id=?",[a,t.id])),r.json({success:!0,msg:"User Deleted!"})}t(29021);let d=(0,o.M)(s,"default"),E=(0,o.M)(s,"config"),p=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/deleteUserUser",pathname:"/api/deleteUserUser",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),o=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=o();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:i}=t(79428);e.exports=({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,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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(o,a,u),i.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),i=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:n()}});async function o(...e){try{let r=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=83246);module.exports=t})();

View File

@ -1,4 +1,4 @@
"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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},21820:e=>{e.exports=require("os")},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}}})},3535:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),o=t(2706),i=t(96762);t(17029);var a=t(6420),l=t.n(a);let c=t(29021),u=t(33873);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbName:s}=e.query;try{let e=u.resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${t.id}/main.json`);if(!c.existsSync(e))return r.end();let n=JSON.parse(c.readFileSync(e,"utf-8")).find(e=>e.dbFullName==s);if(!n)throw Error("Database not found!");let o=u.resolve(process.cwd(),"./.tmp/_tmp.json");c.writeFileSync(o,JSON.stringify(n),"utf-8");let i=c.createReadStream(o);i.pipe(r),i.on("close",()=>{c.unlinkSync(o)})}catch(e){return console.log(e),r.end()}}let d=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/downloadDatabaseSchema",pathname:"/api/downloadDatabaseSchema",bundlePath:"",filename:""},userland:s})},17029:(e,r,t)=>{let s=t(29021),n=t(21820),{execSync:o}=t(79646),i=t(48225),{ServerResponse:a}=t(81630);e.exports=async function({dbName:e,user:r,res:t}){let a=n.platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{let i={cwd:process.cwd()},l=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r.id}/export.sql`;n.platform().match(/win/i)&&(i.shell="bash.exe");let c=`${a} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} ${e} > ${l}`;console.log(`exportDb.js exe => ${c}`),o(c,i),t.setHeader("Content-Type","application/zip"),t.setHeader("Content-Disposition","attachment; filename=export.sql"),s.createReadStream(l).pipe(t)}catch(e){i({component:"/functions/backend/exportDb/lines-30-46",message:e.message,user:r})}}},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:l,csrfCookieName:c}=i();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${d}/${p.csrf_k}`))return null;if(0==p.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 n=`🚀 SERVER ERROR ===========================
"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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},21820:e=>{e.exports=require("os")},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}}})},3535:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),o=t(2706),i=t(96762);t(17029);var a=t(6420),l=t.n(a);let c=t(29021),u=t(33873);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbName:s}=e.query;try{let e=u.resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${t.id}/main.json`);if(!c.existsSync(e))return r.end();let n=JSON.parse(c.readFileSync(e,"utf-8")).find(e=>e.dbFullName==s);if(!n)throw Error("Database not found!");let o=u.resolve(process.cwd(),"./.tmp/_tmp.json");c.writeFileSync(o,JSON.stringify(n),"utf-8");let i=c.createReadStream(o);i.pipe(r),i.on("close",()=>{c.unlinkSync(o)})}catch(e){return console.log(e),r.end()}}let d=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/downloadDatabaseSchema",pathname:"/api/downloadDatabaseSchema",bundlePath:"",filename:""},userland:s})},17029:(e,r,t)=>{let s=t(29021),n=t(21820),{execSync:o}=t(79646),i=t(48225),{ServerResponse:a}=t(81630);e.exports=async function({dbName:e,user:r,res:t}){let a=n.platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{let i={cwd:process.cwd()},l=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r.id}/export.sql`;n.platform().match(/win/i)&&(i.shell="bash.exe");let c=`${a} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} ${e} > ${l}`;console.log(`exportDb.js exe => ${c}`),o(c,i),t.setHeader("Content-Type","application/zip"),t.setHeader("Content-Disposition","attachment; filename=export.sql"),s.createReadStream(l).pipe(t)}catch(e){i({component:"/functions/backend/exportDb/lines-30-46",message:e.message,user:r})}}},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:l,csrfCookieName:c}=i();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${d}/${p.csrf_k}`))return null;if(0==p.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=a},31341:e=>{e.exports=function(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 l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:l+=n}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 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=7402,e.ids=[7402],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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},46897:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>_,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),o=t(2706),i=t(96762),a=t(17029),l=t.n(a),c=t(6420),u=t.n(c);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await u()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbName:s}=e.query;await l()({dbName:s?.toString()||"",res:r,user:t})}let _=(0,i.M)(s,"default"),d=(0,i.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/exportDatabase",pathname:"/api/exportDatabase",bundlePath:"",filename:""},userland:s})},17029:(e,r,t)=>{let s=t(29021),n=t(21820),{execSync:o}=t(79646),i=t(48225),{ServerResponse:a}=t(81630);e.exports=async function({dbName:e,user:r,res:t}){let a=n.platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{let i={cwd:process.cwd()},l=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r.id}/export.sql`;n.platform().match(/win/i)&&(i.shell="bash.exe");let c=`${a} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} ${e} > ${l}`;console.log(`exportDb.js exe => ${c}`),o(c,i),t.setHeader("Content-Type","application/zip"),t.setHeader("Content-Disposition","attachment; filename=export.sql"),s.createReadStream(l).pipe(t)}catch(e){i({component:"/functions/backend/exportDb/lines-30-46",message:e.message,user:r})}}},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:l,csrfCookieName:c}=i();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${_}/${p.csrf_k}`))return null;if(0==p.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 n=`🚀 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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},46897:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>_,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),o=t(2706),i=t(96762),a=t(17029),l=t.n(a),c=t(6420),u=t.n(c);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await u()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{dbName:s}=e.query;await l()({dbName:s?.toString()||"",res:r,user:t})}let _=(0,i.M)(s,"default"),d=(0,i.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/exportDatabase",pathname:"/api/exportDatabase",bundlePath:"",filename:""},userland:s})},17029:(e,r,t)=>{let s=t(29021),n=t(21820),{execSync:o}=t(79646),i=t(48225),{ServerResponse:a}=t(81630);e.exports=async function({dbName:e,user:r,res:t}){let a=n.platform().match(/win/i)?"'C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe'":"mysqldump";try{let i={cwd:process.cwd()},l=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r.id}/export.sql`;n.platform().match(/win/i)&&(i.shell="bash.exe");let c=`${a} -u ${process.env.DSQL_DB_USERNAME} -h ${process.env.DSQL_DB_HOST} -p${process.env.DSQL_DB_PASSWORD} ${e} > ${l}`;console.log(`exportDb.js exe => ${c}`),o(c,i),t.setHeader("Content-Type","application/zip"),t.setHeader("Content-Disposition","attachment; filename=export.sql"),s.createReadStream(l).pipe(t)}catch(e){i({component:"/functions/backend/exportDb/lines-30-46",message:e.message,user:r})}}},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:l,csrfCookieName:c}=i();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let p=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${_}/${p.csrf_k}`))return null;if(0==p.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return p?.date&&Date.now()-p.date>6048e5?null:p}e.exports=a},31341:e=>{e.exports=function(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 l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:l+=n}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 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=4727,e.ids=[4727],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},724:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>p,routeModule:()=>m});var s={};t.r(s),t.d(s,{config:()=>c,default:()=>d});var a=t(89947),n=t(2706),i=t(96762),o=t(6420),l=t.n(o),u=t(27444);let c={api:{responseLimit:"1mb",bodyParser:{sizeLimit:"200mb"}}};async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{paradigm:s,dbName:a,tableName:n,payload:i}=e.body;try{let e=await (0,u.A)({dbName:a,paradigm:s,payload:i,tableName:n,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 p=(0,i.M)(s,"default"),f=(0,i.M)(s,"config"),m=new a.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/exportTableData",pathname:"/api/exportTableData",bundlePath:"",filename:""},userland:s})},27444:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(47670),a=t.n(s);let n=t(48225),i=t(51348);async function o({paradigm:e,userId:r,dbName:t,tableName:s,payload:o,payloadType:l}){let u={};try{let n=`${process.env.DSQL_USER_DB_PREFIX}${r}_${t.replace(/ /g,"")}`;switch(e){case"export":let c=await i(`SELECT * FROM \`${n}\`.\`${s}\``);u.tableData=c;break;case"import":let d="base64"==l?Buffer.from(o,"base64").toString():o,p="object"===l?o:JSON.parse(d);for(let e=0;e<p.length;e++){let r=p[e],t=await a()({data:r,dbFullName:n,tableName:s,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 n({component:"/functions/backend/importExportTableDataFn",message:e.message}),null}}},6420:(e,r,t)=>{t(81630);let s=t(51348),a=t(72835),n=t(29021),i=t(31341);async function o(e,r,t,o){let{keyCookieName:l,csrfCookieName:u}=i();if(!e.cookies?.[l]?.match(/./))return null;let c=a({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!n.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=o},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),n+=t;let i=r;return e?.userId&&(i+=`user_${e.userId}_`),a&&(i+=`${a}_`),{keyCookieName:n,csrfCookieName:i+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:a}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:a,req:n}){let i=new Date,o=(()=>{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],a=t||s||r||n.socket.remoteAddress;if(!a)return null;return String(a)}catch(e){return null}})();try{let a=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=4727,e.ids=[4727],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},724:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>p,routeModule:()=>f});var s={};t.r(s),t.d(s,{config:()=>c,default:()=>d});var a=t(89947),n=t(2706),i=t(96762),o=t(6420),l=t.n(o),u=t(27444);let c={api:{responseLimit:"1mb",bodyParser:{sizeLimit:"200mb"}}};async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{paradigm:s,dbName:a,tableName:n,payload:i}=e.body;try{let e=await (0,u.A)({dbName:a,paradigm:s,payload:i,tableName:n,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 p=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),f=new a.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/exportTableData",pathname:"/api/exportTableData",bundlePath:"",filename:""},userland:s})},27444:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(47670),a=t.n(s);let n=t(48225),i=t(51348);async function o({paradigm:e,userId:r,dbName:t,tableName:s,payload:o,payloadType:l}){let u={};try{let n=`${process.env.DSQL_USER_DB_PREFIX}${r}_${t.replace(/ /g,"")}`;switch(e){case"export":let c=await i(`SELECT * FROM \`${n}\`.\`${s}\``);u.tableData=c;break;case"import":let d="base64"==l?Buffer.from(o,"base64").toString():o,p="object"===l?o:JSON.parse(d);for(let e=0;e<p.length;e++){let r=p[e],t=await a()({data:r,dbFullName:n,tableName:s,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 n({component:"/functions/backend/importExportTableDataFn",message:e.message}),null}}},6420:(e,r,t)=>{t(81630);let s=t(51348),a=t(72835),n=t(29021),i=t(31341);async function o(e,r,t,o){let{keyCookieName:l,csrfCookieName:u}=i();if(!e.cookies?.[l]?.match(/./))return null;let c=a({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!n.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=o},31341:e=>{e.exports=function(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 l=r;return e?.userId&&(l+=`user_${e.userId}_`),n&&(l+=`${n}_`),{keyCookieName:i,csrfCookieName:o,oneTimeCodeName:l+=a}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:a}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:a,req:n}){let i=new Date,o=(()=>{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],a=t||s||r||n.socket.remoteAddress;if(!a)return null;return String(a)}catch(e){return null}})();try{let a=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(a+=`
User Id: ${e?.id}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
"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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},0:(e,r,t)=>{t.r(r),t.d(r,{config:()=>h,default:()=>m,routeModule:()=>y});var s={};t.r(s),t.d(s,{default:()=>g});var n=t(89947),o=t(2706),a=t(96762),i=t(2258),l=t(48225),u=t.n(l),c=t(6420),d=t.n(c),p=t(27825),_=t.n(p),f=t(51348),S=t.n(f);t(29021),t(33873);let{execSync:E}=t(79646);async function g(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await d()(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 S()("SELECT * FROM datasquirel.delegated_user_tables WHERE delegated_user_id=? AND root_user_id=?",[String(t.id),String(s)]),n=(0,i.default)({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=_().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),u()({component:"/api/get-authorized-databases",message:e.message,user:t}),r.json({success:!1,msg:e.message})}}let m=(0,a.M)(s,"default"),h=(0,a.M)(s,"config"),y=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/get-authorized-databases",pathname:"/api/get-authorized-databases",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),a=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:u}=a();if(!e.cookies?.[l]?.match(/./))return null;let c=n({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:o,csrfCookieName:a+=s}}},2258:(e,r,t)=>{t.r(r),t.d(r,{default:()=>a});let s=t(48225),n=t(29021),o=t(33873);function a({userId:e}){try{let r=o.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 s({component:"grabUserSchemaData",message:e.message}),null}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,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 n=`🚀 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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},0:(e,r,t)=>{t.r(r),t.d(r,{config:()=>y,default:()=>h,routeModule:()=>D});var s={};t.r(s),t.d(s,{default:()=>g});var n=t(89947),o=t(2706),a=t(96762),i=t(2258),l=t.n(i),u=t(48225),c=t.n(u),d=t(6420),_=t.n(d),p=t(27825),f=t.n(p),S=t(51348),E=t.n(S);t(29021),t(33873);let{execSync:m}=t(79646);async function g(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await _()(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 E()("SELECT * FROM datasquirel.delegated_user_tables WHERE delegated_user_id=? AND root_user_id=?",[String(t.id),String(s)]),n=l()({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=f().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),c()({component:"/api/get-authorized-databases",message:e.message,user:t}),r.json({success:!1,msg:e.message})}}let h=(0,a.M)(s,"default"),y=(0,a.M)(s,"config"),D=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/get-authorized-databases",pathname:"/api/get-authorized-databases",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),a=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:u}=a();if(!e.cookies?.[l]?.match(/./))return null;let c=n({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${_}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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 l=r;return e?.userId&&(l+=`user_${e.userId}_`),o&&(l+=`${o}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:l+=n}}},2258:(e,r,t)=>{let s=t(48225),n=t(29021),o=t(33873);e.exports=function({userId:e}){try{let r=o.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 s({component:"grabUserSchemaData",message:e.message}),null}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,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 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=245,e.ids=[245],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")},81630:e=>{e.exports=require("http")},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}}})},34029:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>f,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),a=t(2706),o=t(96762),i=t(6420),l=t.n(i),u=t(48225),c=t.n(u),d=t(51348),_=t.n(d);async function p(e,r){if("GET"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await l()(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 _()("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 _()("SELECT table_name,table_slug FROM user_database_tables WHERE user_id=? AND db_id=?",[n,e[0].id]),o=await _()("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){c()({component:"/api/getDatabaseTables/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}t(29021);let f=(0,o.M)(s,"default"),E=(0,o.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getDatabaseTables",pathname:"/api/getDatabaseTables",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:u}=o();if(!e.cookies?.[l]?.match(/./))return null;let c=n({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${_}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:o+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 n=`🚀 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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},34029:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>f,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),a=t(2706),o=t(96762),i=t(6420),l=t.n(i),u=t(48225),c=t.n(u),d=t(51348),_=t.n(d);async function p(e,r){if("GET"!==e.method)return r.json({user:null,msg:"Registration Failed!"});let t=await l()(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 _()("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 _()("SELECT table_name,table_slug FROM user_database_tables WHERE user_id=? AND db_id=?",[n,e[0].id]),o=await _()("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){c()({component:"/api/getDatabaseTables/main-catch-error",message:e.message,user:t}),r.json({success:!1})}}t(29021);let f=(0,o.M)(s,"default"),E=(0,o.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getDatabaseTables",pathname:"/api/getDatabaseTables",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:u}=o();if(!e.cookies?.[l]?.match(/./))return null;let c=n({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${_}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 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=8282,e.ids=[8282],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")},81630:e=>{e.exports=require("http")},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}}})},94057:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>f,routeModule:()=>m});var s={};t.r(s),t.d(s,{default:()=>S});var n=t(89947),a=t(2706),o=t(96762),i=t(51348),l=t.n(i),c=t(20503),u=t.n(c),d=t(48225),_=t.n(d),p=t(6420),E=t.n(p);async function S(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await E()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.body.rootUserId,n=e.body.priviledges,a=e.body.database;try{let e=await l()("SELECT * FROM user_users WHERE user_id=? AND invited_user_id=? AND MATCH(database_access) AGAINST(?)",[s,t.id,a]);if(!e||!e[0])throw Error(`user with id ${t.id} has no access to ${a} database belonging to user ${s}`);let o=(await l()("SELECT * FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=? AND `database`=?",[s,t.id,a])).map(e=>e.table),i=await l()("SELECT * FROM users WHERE id=?",[s]),c={rootUserId:s,rootUserName:`${i[0].first_name} ${i[0].last_name}`,rootUserEmail:i[0].email,rootUserImage:i[0].image_thumbnail,delegatedUserId:t.id,databaseFullName:`datasquirel_user_${s}_${a}`,databaseSlug:a,allowedTables:o,priviledges:n,dateCreated:Date.now()},d=u()({data:JSON.stringify(c)}),_=`${process.env.DSQL_USER_DB_PREFIX}${c.rootUserId}_${a}`,p=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${_}`;r.setHeader("Set-Cookie",[`${p}=${d};path=/`]),r.json({success:!0,msg:"Processed Successfully"})}catch(e){return console.log("ERROR:",e.message),_()({component:"/api/getDelegatedDatabaseToken/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Unauthorized"})}}let f=(0,o.M)(s,"default"),g=(0,o.M)(s,"config"),m=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getDelegatedDatabaseToken",pathname:"/api/getDelegatedDatabaseToken",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:c}=o();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${_}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:o+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 n=`🚀 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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},94057:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>f,routeModule:()=>m});var s={};t.r(s),t.d(s,{default:()=>S});var n=t(89947),a=t(2706),o=t(96762),i=t(51348),l=t.n(i),c=t(20503),u=t.n(c),d=t(48225),_=t.n(d),p=t(6420),E=t.n(p);async function S(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await E()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.body.rootUserId,n=e.body.priviledges,a=e.body.database;try{let e=await l()("SELECT * FROM user_users WHERE user_id=? AND invited_user_id=? AND MATCH(database_access) AGAINST(?)",[s,t.id,a]);if(!e||!e[0])throw Error(`user with id ${t.id} has no access to ${a} database belonging to user ${s}`);let o=(await l()("SELECT * FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=? AND `database`=?",[s,t.id,a])).map(e=>e.table),i=await l()("SELECT * FROM users WHERE id=?",[s]),c={rootUserId:s,rootUserName:`${i[0].first_name} ${i[0].last_name}`,rootUserEmail:i[0].email,rootUserImage:i[0].image_thumbnail,delegatedUserId:t.id,databaseFullName:`datasquirel_user_${s}_${a}`,databaseSlug:a,allowedTables:o,priviledges:n,dateCreated:Date.now()},d=u()({data:JSON.stringify(c)}),_=`${process.env.DSQL_USER_DB_PREFIX}${c.rootUserId}_${a}`,p=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${_}`;r.setHeader("Set-Cookie",[`${p}=${d};path=/`]),r.json({success:!0,msg:"Processed Successfully"})}catch(e){return console.log("ERROR:",e.message),_()({component:"/api/getDelegatedDatabaseToken/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Unauthorized"})}}let f=(0,o.M)(s,"default"),g=(0,o.M)(s,"config"),m=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getDelegatedDatabaseToken",pathname:"/api/getDelegatedDatabaseToken",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:c}=o();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${_}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 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,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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},96762:(e,s)=>{Object.defineProperty(s,"M",{enumerable:!0,get:function(){return function e(s,r){return r in s?s[r]:"then"in s&&"function"==typeof s.then?s.then(s=>e(s,r)):"function"==typeof s&&"default"===r?s:void 0}}})},1199:(e,s,r)=>{r.r(s),r.d(s,{config:()=>p,default:()=>d,routeModule:()=>f});var t={};r.r(t),r.d(t,{default:()=>c});var n=r(89947),i=r(2706),a=r(96762),u=r(51348),o=r.n(u),_=r(6420),l=r.n(_);async function c(e,s){if("GET"!==e.method)return s.json({msg:"Failed!"});let r=await l()(e,s);if(!r)return s.json({success:!1,msg:"Unauthorized"});let t=await o()(`
"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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},96762:(e,s)=>{Object.defineProperty(s,"M",{enumerable:!0,get:function(){return function e(s,r){return r in s?s[r]:"then"in s&&"function"==typeof s.then?s.then(s=>e(s,r)):"function"==typeof s&&"default"===r?s:void 0}}})},1199:(e,s,r)=>{r.r(s),r.d(s,{config:()=>p,default:()=>d,routeModule:()=>f});var t={};r.r(t),r.d(t,{default:()=>c});var n=r(89947),i=r(2706),a=r(96762),u=r(51348),_=r.n(u),o=r(6420),l=r.n(o);async function c(e,s){if("GET"!==e.method)return s.json({msg:"Failed!"});let r=await l()(e,s);if(!r)return s.json({success:!1,msg:"Unauthorized"});let t=await _()(`
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='${r.id}'
`),n=[];if(t&&t[0])for(let e=0;e<t.length;e++){let s=t[e],{database_access:r,user_id:i,user_priviledge:a}=s;if(!r?.match(/./))continue;let u=await o()(`SELECT * FROM user_databases WHERE (${r.split("|").map(e=>`db_slug='${e}'`).join(" OR ")}) AND user_id=${i}`);for(let e=0;e<u.length;e++){let r=u[e];n.push({id:r.id,user_id:s.user_id,first_name:s.first_name,last_name:s.last_name,email:s.email,image_thumbnail:s.image_thumbnail,db_name:r.db_name,db_slug:r.db_slug,db_full_name:r.db_full_name,db_image:r.db_image,db_description:r.db_description,date_created:r.date_created,user_priviledge:a})}}s.json({success:!0,databases:n})}let d=(0,a.M)(t,"default"),p=(0,a.M)(t,"config"),f=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/getDelegatedDatabases",pathname:"/api/getDelegatedDatabases",bundlePath:"",filename:""},userland:t})},6420:(e,s,r)=>{r(81630);let t=r(51348),n=r(72835),i=r(29021),a=r(31341);async function u(e,s,r,u){let{keyCookieName:o,csrfCookieName:_}=a();if(!e.cookies?.[o]?.match(/./))return null;let l=n({encryptedString:e.cookies[o]});if(!l)return null;let c=JSON.parse(l);if(!c.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${c.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!i.existsSync(`${d}/${c.csrf_k}`))return null;if(0==c.verification_status&&!r){let e=await t(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&s.setHeader("Set-Cookie",["user_refresh=1"])}return c?.date&&Date.now()-c.date>6048e5?null:c}e.exports=u},31341:e=>{e.exports=function(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",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=s;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=r;let a=s;return e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:i,csrfCookieName:a+=t}}},72835:(e,s,r)=>{let{scryptSync:t,createDecipheriv:n}=r(55511),{Buffer:i}=r(79428);e.exports=({encryptedString:e,encryptionKey:s,encryptionSalt:r})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=s||process.env.DSQL_ENCRYPTION_PASSWORD,u=r||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(!u?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=n("aes-192-cbc",t(a,u,o),i.alloc(16,0));try{let s=_.update(e,"hex","utf8");return s+=_.final("utf8")}catch(s){return console.log("Error in decrypting =>",s.message),e}}},51348:(e,s,r)=>{let t=r(9973),n=r(21580),i=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()}});async function a(...e){try{let s=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21580:(e,s,r)=>{let t=r(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let s=`${e}/ca-cert.pem`;if(!t.existsSync(s)){console.log(`${s} does not exist`);return}return{ca:t.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,s)=>{var r;Object.defineProperty(s,"A",{enumerable:!0,get:function(){return r}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(r||(r={}))},89947:(e,s,r)=>{e.exports=r(75600)}};var s=require("../../webpack-api-runtime.js");s.C(e);var r=s(s.s=1199);module.exports=r})();
`),n=[];if(t&&t[0])for(let e=0;e<t.length;e++){let s=t[e],{database_access:r,user_id:i,user_priviledge:a}=s;if(!r?.match(/./))continue;let u=await _()(`SELECT * FROM user_databases WHERE (${r.split("|").map(e=>`db_slug='${e}'`).join(" OR ")}) AND user_id=${i}`);for(let e=0;e<u.length;e++){let r=u[e];n.push({id:r.id,user_id:s.user_id,first_name:s.first_name,last_name:s.last_name,email:s.email,image_thumbnail:s.image_thumbnail,db_name:r.db_name,db_slug:r.db_slug,db_full_name:r.db_full_name,db_image:r.db_image,db_description:r.db_description,date_created:r.date_created,user_priviledge:a})}}s.json({success:!0,databases:n})}let d=(0,a.M)(t,"default"),p=(0,a.M)(t,"config"),f=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/getDelegatedDatabases",pathname:"/api/getDelegatedDatabases",bundlePath:"",filename:""},userland:t})},6420:(e,s,r)=>{r(81630);let t=r(51348),n=r(72835),i=r(29021),a=r(31341);async function u(e,s,r,u){let{keyCookieName:_,csrfCookieName:o}=a();if(!e.cookies?.[_]?.match(/./))return null;let l=n({encryptedString:e.cookies[_]});if(!l)return null;let c=JSON.parse(l);if(!c.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${c.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!i.existsSync(`${d}/${c.csrf_k}`))return null;if(0==c.verification_status&&!r){let e=await t(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&s.setHeader("Set-Cookie",["user_refresh=1"])}return c?.date&&Date.now()-c.date>6048e5?null:c}e.exports=u},31341:e=>{e.exports=function(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",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+_/,""),a=s;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=r;let u=s;e?.userId&&(u+=`user_${e.userId}_`),i&&(u+=`${i}_`),u+=t;let _=s;return e?.userId&&(_+=`user_${e.userId}_`),i&&(_+=`${i}_`),{keyCookieName:a,csrfCookieName:u,oneTimeCodeName:_+=n}}},72835:(e,s,r)=>{let{scryptSync:t,createDecipheriv:n}=r(55511),{Buffer:i}=r(79428);e.exports=({encryptedString:e,encryptionKey:s,encryptionSalt:r})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let a=s||process.env.DSQL_ENCRYPTION_PASSWORD,u=r||process.env.DSQL_ENCRYPTION_SALT,_=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(!u?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let o=n("aes-192-cbc",t(a,u,_),i.alloc(16,0));try{let s=o.update(e,"hex","utf8");return s+=o.final("utf8")}catch(s){return console.log("Error in decrypting =>",s.message),e}}},51348:(e,s,r)=>{let t=r(9973),n=r(21580),i=t({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:n()}});async function a(...e){try{let s=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21580:(e,s,r)=>{let t=r(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let s=`${e}/ca-cert.pem`;if(!t.existsSync(s)){console.log(`${s} does not exist`);return}return{ca:t.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,s)=>{var r;Object.defineProperty(s,"A",{enumerable:!0,get:function(){return r}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(r||(r={}))},89947:(e,s,r)=>{e.exports=r(75600)}};var s=require("../../webpack-api-runtime.js");s.C(e);var r=s(s.s=1199);module.exports=r})();

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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},12155:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>E,routeModule:()=>h});var s={};t.r(s),t.d(s,{default:()=>f});var n=t(89947),i=t(2706),o=t(96762),a=t(51348),c=t.n(a),l=t(48225),u=t.n(l),d=t(6420),p=t.n(d);let _=t(29021),S=t(33873),{execSync:m}=t(79646);async function f(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await p()(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{"production".match(/production/);let e=(await c()(`
"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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},12155:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>f,routeModule:()=>h});var s={};t.r(s),t.d(s,{default:()=>E});var n=t(89947),i=t(2706),o=t(96762),a=t(51348),c=t.n(a),l=t(48225),u=t.n(l),_=t(6420),d=t.n(_);let p=t(29021),S=t(33873),{execSync:m}=t(79646);async function E(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await d()(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});try{"production".match(/production/);let e=(await c()(`
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}%`])).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||_.existsSync(i)||_.mkdirSync(i,{recursive:!0});let o=S.join(i,`images/user-images/user-${t.id}`);_.existsSync(o)||_.mkdirSync(o,{recursive:!0});let a=S.join(i,`images/user-images/user-${t.id}`),l=S.join(i,`videos/user-videos/user-${t.id}`);async function s(e){try{let r=_.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(_.existsSync(a)){let e=_.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 c()("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),u()({component:"/api/getDiskUsage/lines-93-101",message:e.message})}}_.existsSync(l)||_.mkdirSync(l,{recursive:!0}),await s(a),await s(l);let d=n+e;r.json({success:!0,total:d})}catch(e){u()({component:"/api/getDiskUsage/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Disk Usage Calculation Error!"})}}let E=(0,o.M)(s,"default"),g=(0,o.M)(s,"config"),h=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/getDiskUsage",pathname:"/api/getDiskUsage",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),o=t(31341);async function a(e,r,t,a){let{keyCookieName:c,csrfCookieName:l}=o();if(!e.cookies?.[c]?.match(/./))return null;let u=n({encryptedString:e.cookies[c]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:i,csrfCookieName:o+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||i.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
`,[`datasquirel_user_${t.id}%`])).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||p.existsSync(i)||p.mkdirSync(i,{recursive:!0});let o=S.join(i,`images/user-images/user-${t.id}`);p.existsSync(o)||p.mkdirSync(o,{recursive:!0});let a=S.join(i,`images/user-images/user-${t.id}`),l=S.join(i,`videos/user-videos/user-${t.id}`);async function s(e){try{let r=p.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(p.existsSync(a)){let e=p.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 c()("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),u()({component:"/api/getDiskUsage/lines-93-101",message:e.message})}}p.existsSync(l)||p.mkdirSync(l,{recursive:!0}),await s(a),await s(l);let _=n+e;r.json({success:!0,total:_})}catch(e){u()({component:"/api/getDiskUsage/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Disk Usage Calculation Error!"})}}let f=(0,o.M)(s,"default"),g=(0,o.M)(s,"config"),h=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/getDiskUsage",pathname:"/api/getDiskUsage",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),o=t(31341);async function a(e,r,t,a){let{keyCookieName:c,csrfCookieName:l}=o();if(!e.cookies?.[c]?.match(/./))return null;let u=n({encryptedString:e.cookies[c]});if(!u)return null;let _=JSON.parse(u);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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 c=r;return e?.userId&&(c+=`user_${e.userId}_`),i&&(c+=`${i}_`),{keyCookieName:o,csrfCookieName:a,oneTimeCodeName:c+=n}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||i.socket.remoteAddress;if(!n)return null;return String(n)}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=2312,e.ids=[2312],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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},34132:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>d,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),o=t(2706),i=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);t(29021),t(33873);let{execSync:_}=t(79646);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await u()(`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"),f=(0,i.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserDatabaseTables",pathname:"/api/getUserDatabaseTables",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=i();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,a=t||process.env.DSQL_ENCRYPTION_SALT,u=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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(i,a,u),o.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=34132);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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},34132:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>p,routeModule:()=>E});var s={};t.r(s),t.d(s,{default:()=>d});var n=t(89947),o=t(2706),i=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);t(29021),t(33873);let{execSync:_}=t(79646);async function d(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await u()(`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 p=(0,i.M)(s,"default"),f=(0,i.M)(s,"config"),E=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserDatabaseTables",pathname:"/api/getUserDatabaseTables",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=i();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,a=t||process.env.DSQL_ENCRYPTION_SALT,u=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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(i,a,u),o.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=34132);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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},31829:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>d,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),o=t(2706),i=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);t(29021),t(33873);let{execSync:_}=t(79646);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await u()(`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"),f=(0,i.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserDatabases",pathname:"/api/getUserDatabases",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=i();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,a=t||process.env.DSQL_ENCRYPTION_SALT,u=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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(i,a,u),o.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=31829);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")},9973:e=>{e.exports=require("serverless-mysql")},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")},81630:e=>{e.exports=require("http")},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}}})},31829:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>p,routeModule:()=>E});var s={};t.r(s),t.d(s,{default:()=>d});var n=t(89947),o=t(2706),i=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);t(29021),t(33873);let{execSync:_}=t(79646);async function d(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await u()(`SELECT id,db_name,db_slug,db_full_name FROM user_databases WHERE user_id='${t.id}'`);r.json({success:!0,databases:s})}let p=(0,i.M)(s,"default"),f=(0,i.M)(s,"config"),E=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/getUserDatabases",pathname:"/api/getUserDatabases",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=i();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,a=t||process.env.DSQL_ENCRYPTION_SALT,u=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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(i,a,u),o.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=31829);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},77148:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),i=t(2706),o=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await u()(`SELECT * FROM user_media WHERE user_id=${t.id} ORDER BY id DESC`);r.json({media:s})}let d=(0,o.M)(s,"default"),p=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/getUserMedia",pathname:"/api/getUserMedia",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),o=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=o();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:i,csrfCookieName:o+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:i}=t(79428);e.exports=({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,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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(o,a,u),i.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),i=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:n()}});async function o(...e){try{let r=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=77148);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},77148:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),i=t(2706),o=t(96762),a=t(51348),u=t.n(a),c=t(6420),l=t.n(c);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=await u()(`SELECT * FROM user_media WHERE user_id=${t.id} ORDER BY id DESC`);r.json({media:s})}let d=(0,o.M)(s,"default"),p=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/getUserMedia",pathname:"/api/getUserMedia",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),i=t(29021),o=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=o();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!i.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:i}=t(79428);e.exports=({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,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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(o,a,u),i.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),i=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:n()}});async function o(...e){try{let r=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=77148);module.exports=t})();

View File

@ -1,4 +1,4 @@
"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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},58301:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>_,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>p});var n=t(89947),a=t(2706),o=t(96762);t(39831);var i=t(48225),l=t.n(i),c=t(6420),u=t.n(c);let d=t(29021);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await u()(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(d.readFileSync(e,"utf8"));r.json({success:!0,schemaData:s})}catch(e){l()({component:"/api/getUserSchemaData/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Couldn't read schema data"})}}let _=(0,o.M)(s,"default"),S=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getUserSchemaData",pathname:"/api/getUserSchemaData",bundlePath:"",filename:""},userland:s})},39831:(e,r,t)=>{t(81630);let s=t(72835);e.exports=async function({request:e,databaseSlug:r,user:t,query:n}){try{let a=t.id,o=null;if(!n?.delegated)return{dbUserId:a};let i=n.dbUserId,l=`${process.env.DSQL_USER_DB_PREFIX}${i}_${r}`,c=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${l}`;try{if(!e.cookies?.[c])throw Error("Cookie not present");let t=s({encryptedString:e.cookies[c]});if(!t)throw Error("Invalid Token");if((o=JSON.parse(t)).databaseSlug===r)return{dbUserId:a=o.rootUserId,rootUserId:o.rootUserId,rootUserName:o.rootUserName,rootUserEmail:o.rootUserEmail,rootUserImage:o.rootUserImage,databaseFullName:o.databaseFullName,databaseSlug:o.databaseSlug,allowedTables:o.allowedTables,priviledges:o.priviledges,database:o.databaseSlug,delegated:!0}}catch(e){}return{dbUserId:a}}catch(e){return null}}},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:c}=o();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${p}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:o+=s}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 n=`🚀 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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},58301:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>p,routeModule:()=>f});var s={};t.r(s),t.d(s,{default:()=>_});var n=t(89947),a=t(2706),o=t(96762);t(39831);var i=t(48225),l=t.n(i),c=t(6420),u=t.n(c);let d=t(29021);async function _(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let t=await u()(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(d.readFileSync(e,"utf8"));r.json({success:!0,schemaData:s})}catch(e){l()({component:"/api/getUserSchemaData/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Couldn't read schema data"})}}let p=(0,o.M)(s,"default"),S=(0,o.M)(s,"config"),f=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getUserSchemaData",pathname:"/api/getUserSchemaData",bundlePath:"",filename:""},userland:s})},39831:(e,r,t)=>{t(81630);let s=t(72835);e.exports=async function({request:e,databaseSlug:r,user:t,query:n}){try{let a=t.id,o=null;if(!n?.delegated)return{dbUserId:a};let i=n.dbUserId,l=`${process.env.DSQL_USER_DB_PREFIX}${i}_${r}`,c=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${l}`;try{if(!e.cookies?.[c])throw Error("Cookie not present");let t=s({encryptedString:e.cookies[c]});if(!t)throw Error("Invalid Token");if((o=JSON.parse(t)).databaseSlug===r)return{dbUserId:a=o.rootUserId,rootUserId:o.rootUserId,rootUserName:o.rootUserName,rootUserEmail:o.rootUserEmail,rootUserImage:o.rootUserImage,databaseFullName:o.databaseFullName,databaseSlug:o.databaseSlug,allowedTables:o.allowedTables,priviledges:o.priviledges,database:o.databaseSlug,delegated:!0}}catch(e){}return{dbUserId:a}}catch(e){return null}}},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:l,csrfCookieName:c}=o();if(!e.cookies?.[l]?.match(/./))return null;let u=n({encryptedString:e.cookies[l]});if(!u)return null;let d=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let _=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${_}/${d.csrf_k}`))return null;if(0==d.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return d?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(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}}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({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"],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 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=3382,e.ids=[3382],e.modules={60818:e=>{e.exports=require("dotenv")},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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},21820:e=>{e.exports=require("os")},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}}})},56807:(e,r,t)=>{t.r(r),t.d(r,{config:()=>P,default:()=>E,routeModule:()=>v});var s={};t.r(s),t.d(s,{default:()=>m});var n=t(89947),a=t(2706),o=t(96762),i=t(48225),u=t.n(i),c=t(6420),l=t.n(c),_=t(19261),p=t.n(_);let d=t(29021),f=t(33873);t(21820);let{execSync:S}=t(79646);async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{database:s,fileBase64:n}=e.body;s?.db_full_name?.match(/datasquirel_user_.*/)||r.json({success:!1,msg:"Unauthorized"});try{let e=Buffer.from(n,"base64").toString("utf-8"),a=JSON.parse(e),o=f.resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${t.id}/main.json`);if(!d.existsSync(o))return r.end();let i=JSON.parse(d.readFileSync(o,"utf-8")),u=i.find(e=>e.dbFullName==s.db_full_name);if(!u)throw Error("Database not found!");u.tables=a.tables,d.writeFileSync(o,JSON.stringify(i),"utf-8"),await p()({userId:t.id,targetDatabase:s.db_full_name}),r.json({success:!0})}catch(e){console.log("JSON import ERROR =>",e.message),u()({component:"/api/importDatabase/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Import Failed!"})}}let E=(0,o.M)(s,"default"),P=(0,o.M)(s,"config"),v=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/importDatabaseSchema",pathname:"/api/importDatabaseSchema",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:u,csrfCookieName:c}=o();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=i},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;let o=r;return e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:o+=s}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),a=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:n()}});async function o(...e){try{let r=await a.query(...e);return await a.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},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,[2451],()=>t(56807));module.exports=s})();
"use strict";(()=>{var e={};e.id=3382,e.ids=[3382],e.modules={60818:e=>{e.exports=require("dotenv")},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")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},21820:e=>{e.exports=require("os")},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}}})},56807:(e,r,t)=>{t.r(r),t.d(r,{config:()=>D,default:()=>E,routeModule:()=>v});var s={};t.r(s),t.d(s,{default:()=>m});var n=t(89947),a=t(2706),o=t(96762),i=t(48225),u=t.n(i),c=t(6420),l=t.n(c),_=t(19261),d=t.n(_);let p=t(29021),f=t(33873);t(21820);let{execSync:S}=t(79646);async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let t=await l()(e,r,!0);if(!t)return r.json({success:!1,msg:"Unauthorized"});let{database:s,fileBase64:n}=e.body;s?.db_full_name?.match(/datasquirel_user_.*/)||r.json({success:!1,msg:"Unauthorized"});try{let e=Buffer.from(n,"base64").toString("utf-8"),a=JSON.parse(e),o=f.resolve(String(process.env.DSQL_USER_DB_SCHEMA_PATH),`user-${t.id}/main.json`);if(!p.existsSync(o))return r.end();let i=JSON.parse(p.readFileSync(o,"utf-8")),u=i.find(e=>e.dbFullName==s.db_full_name);if(!u)throw Error("Database not found!");u.tables=a.tables,p.writeFileSync(o,JSON.stringify(i),"utf-8"),await d()({userId:t.id,targetDatabase:s.db_full_name}),r.json({success:!0})}catch(e){console.log("JSON import ERROR =>",e.message),u()({component:"/api/importDatabase/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Import Failed!"})}}let E=(0,o.M)(s,"default"),D=(0,o.M)(s,"config"),v=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/importDatabaseSchema",pathname:"/api/importDatabaseSchema",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),a=t(29021),o=t(31341);async function i(e,r,t,i){let{keyCookieName:u,csrfCookieName:c}=o();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${d}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=i},31341:e=>{e.exports=function(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}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),a=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:n()}});async function o(...e){try{let r=await a.query(...e);return await a.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=o},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},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,[2451],()=>t(56807));module.exports=s})();

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
"use strict";(()=>{var e={};e.id=3303,e.ids=[3303],e.modules={27825:e=>{e.exports=require("lodash")},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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},95122:(e,r,t)=>{t.r(r),t.d(r,{config:()=>b,default:()=>D,routeModule:()=>R});var s={};t.r(s),t.d(s,{default:()=>A});var i=t(89947),a=t(2706),n=t(96762),o=t(51348),l=t.n(o),u=t(44767),d=t.n(u),_=t(48225),m=t.n(_),c=t(59474),p=t.n(c),g=t(91766),f=t.n(g),S=t(31341),E=t.n(S),h=t(14533),y=t.n(h);let L=t(29021),v=t(20503);async function A(e,r){if("POST"===e.method){let t=e.body,s=t.email,i=t.password,a=t.query;if(s.match(/ /))return r.json({user:null,msg:"Invalid Email"});try{let t=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!t)throw Error("loginUser error: process.env.DSQL_USER_LOGIN_KEYS_PATH not present");L.existsSync(t)||L.mkdirSync(t,{recursive:!0});let n=e.headers["x-real-ip"]||e.headers["x-forwarded-for"]||e.connection.remoteAddress,o=process.env.DSQL_HOST||"https://datasquirel.com",u=y()({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:i});if(i?.match(/ /)||s?.match(/ /))return r.json({msg:"Failed!",user:null});let _=await l()("SELECT * FROM users WHERE email=? OR username=?",[s,s]);if(!_||!_[0])return r.json({msg:"No user found",user:null});let m=!1;if(_&&_[0]&&(m=u===_[0].password),!m)return await f()(),p()({to:process.env.DSQL_CONTACT_EMAIL,subject:`Failed Login from ${s}`,html:`<h1><u>${s}</u> tried to login with a wrong password</h1><p><b>${s}</b> attempted a login on ${o} from ${n} with a wrong password.</p>`}),r.json({msg:"Wrong Password, Wrong Social Media Credentials",user:null});let c=Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2),g={id:_[0].id,stripe_id:_[0].stripe_id||"",first_name:_[0].first_name,last_name:_[0].last_name,username:_[0].username,email:_[0].email,social_id:_[0].social_id,image:_[0].image,image_thumbnail:_[0].image_thumbnail,verification_status:_[0].verification_status,social_login:_[0].social_login,social_platform:_[0].social_platform,csrf_k:c,logged_in_status:!0,date:Date.now()},S=v({data:JSON.stringify(g)}),{keyCookieName:h,csrfCookieName:A}=E()();r.setHeader("Set-Cookie",[`${h}=${S};samesite=strict;path=/;HttpOnly=true;Secure=true`,`${A}=${c};samesite=strict;path=/;HttpOnly=true`]),L.appendFile("./.tmp/userLoginLogs.log",`${_[0].first_name} ${_[0].last_name} Logged in from ${_[0].social_login?_[0].social_platform:"Regular Email Login"} at ${Date()}
"use strict";(()=>{var e={};e.id=3303,e.ids=[3303],e.modules={27825:e=>{e.exports=require("lodash")},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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},95122:(e,r,t)=>{t.r(r),t.d(r,{config:()=>O,default:()=>D,routeModule:()=>$});var s={};t.r(s),t.d(s,{default:()=>A});var i=t(89947),a=t(2706),n=t(96762),o=t(51348),l=t.n(o),u=t(44767),d=t.n(u),_=t(48225),m=t.n(_),c=t(59474),p=t.n(c),g=t(91766),f=t.n(g),E=t(31341),S=t.n(E),h=t(14533),L=t.n(h);let v=t(29021),y=t(20503);async function A(e,r){if("POST"===e.method){let t=e.body,s=t.email,i=t.password,a=t.query;if(s.match(/ /))return r.json({user:null,msg:"Invalid Email"});try{let t=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!t)throw Error("loginUser error: process.env.DSQL_USER_LOGIN_KEYS_PATH not present");v.existsSync(t)||v.mkdirSync(t,{recursive:!0});let n=e.headers["x-real-ip"]||e.headers["x-forwarded-for"]||e.connection.remoteAddress,o=process.env.DSQL_HOST||"https://datasquirel.com",u=L()({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:i});if(i?.match(/ /)||s?.match(/ /))return r.json({msg:"Failed!",user:null});let _=await l()("SELECT * FROM users WHERE email=? OR username=?",[s,s]);if(!_||!_[0])return r.json({msg:"No user found",user:null});let m=!1;if(_&&_[0]&&(m=u===_[0].password),!m)return await f()(),p()({to:process.env.DSQL_CONTACT_EMAIL,subject:`Failed Login from ${s}`,html:`<h1><u>${s}</u> tried to login with a wrong password</h1><p><b>${s}</b> attempted a login on ${o} from ${n} with a wrong password.</p>`}),r.json({msg:"Wrong Password, Wrong Social Media Credentials",user:null});let c=Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2),g={id:_[0].id,stripe_id:_[0].stripe_id||"",first_name:_[0].first_name,last_name:_[0].last_name,username:_[0].username,email:_[0].email,social_id:_[0].social_id,image:_[0].image,image_thumbnail:_[0].image_thumbnail,verification_status:_[0].verification_status,social_login:_[0].social_login,social_platform:_[0].social_platform,csrf_k:c,logged_in_status:!0,date:Date.now()},E=y({data:JSON.stringify(g)}),{keyCookieName:h,csrfCookieName:A}=S()();r.setHeader("Set-Cookie",[`${h}=${E};samesite=strict;path=/;HttpOnly=true;Secure=true`,`${A}=${c};samesite=strict;path=/;HttpOnly=true`]),v.appendFile("./.tmp/userLoginLogs.log",`${_[0].first_name} ${_[0].last_name} Logged in from ${_[0].social_login?_[0].social_platform:"Regular Email Login"} at ${Date()}
`,"utf8",e=>{e&&console.log("Loging log write error")}),L.writeFileSync(`${t}/${c}`,JSON.stringify(g)),a?.invite&&d()({query:a,user:{...g,phone:_[0].phone}}),await f()(),p()({to:process.env.DSQL_CONTACT_EMAIL,subject:`${s} Logged in successfully`,html:`<h1><u>${s}</u> successfully logged in</h1><p><b>${s}</b> successfully logged in on ${o} from ${n} on ${Date().substring(0,16)}.</p>`}),r.json({msg:"User Found",user:{auth:!0,userid:_[0].id,csrf_k:c,stripe_id:_[0].stripe_id||""},userPayload:g})}catch(e){console.log("Login Error =>",e.message),m()({component:"/api/loginUser/main-catch-error",message:e.message,user:{email:s}})}}else r.json({msg:"Oops ..."})}let D=(0,n.M)(s,"default"),b=(0,n.M)(s,"config"),R=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/loginUser",pathname:"/api/loginUser",bundlePath:"",filename:""},userland:s})},91766:e=>{e.exports=async function(e){return await new Promise((r,t)=>{setTimeout(()=>{r(!0)},e||1e3)}),!0}},44767:(e,r,t)=>{let s=t(48225),i=t(51348),a=t(47670),n=t(44900);e.exports=async function({query:e,user:r,useLocal:t}){try{let s=t?n:i,{invite:o,database_access:l,priviledge:u,email:d}=e,_=[o,d],m=await s("SELECT date_created_code FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",_);if(!m||!m[0])throw Error("No Invitation Found");let c=[o],p=await s("SELECT first_name,last_name,email FROM users WHERE id=?",c);if(p?.[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,d]);if(e?.[0])console.log("User already added");else{a({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:o,invited_user_id:r.id,database_access:l,first_name:r.first_name,last_name:r.last_name,phone:r.phone,email:r.email,username:r.username,user_type:"admin",user_priviledge:u,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,d]);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 a({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:r.id,root_user_id:o,database:i,table:n,priviledge:u},useLocal:t})}}}await s("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[o,d])}}catch(e){s({component:"addAdminUserOnLogin",message:e.message,user:r})}}},31341:e=>{e.exports=function(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=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=t;let n=r;return e?.userId&&(n+=`user_${e.userId}_`),i&&(n+=`${i}_`),{keyCookieName:a,csrfCookieName:n+=s}}},59474:(e,r,t)=>{let s=t(29021),i=t(21572).createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});e.exports=async function({to:e,subject:r,text:t,html:a,alias:n}){let o;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let l=(n?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!s.existsSync("./email/index.html"))return;let u=s.readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,a||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let s={};s.from=`"Datasquirel" <${l}>`,s.sender=l,n&&(s["replyTo "]=l),s.to=e,s.subject=r,s.text=t,s.html=u,o=await i.sendMail(s)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return o}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:i}=t(81630);e.exports=async function({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"],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 i=`🚀 SERVER ERROR ===========================
`,"utf8",e=>{e&&console.log("Loging log write error")}),v.writeFileSync(`${t}/${c}`,JSON.stringify(g)),a?.invite&&d()({query:a,user:{...g,phone:_[0].phone}}),await f()(),p()({to:process.env.DSQL_CONTACT_EMAIL,subject:`${s} Logged in successfully`,html:`<h1><u>${s}</u> successfully logged in</h1><p><b>${s}</b> successfully logged in on ${o} from ${n} on ${Date().substring(0,16)}.</p>`}),r.json({msg:"User Found",user:{auth:!0,userid:_[0].id,csrf_k:c,stripe_id:_[0].stripe_id||""},userPayload:g})}catch(e){console.log("Login Error =>",e.message),m()({component:"/api/loginUser/main-catch-error",message:e.message,user:{email:s}})}}else r.json({msg:"Oops ..."})}let D=(0,n.M)(s,"default"),O=(0,n.M)(s,"config"),$=new i.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/loginUser",pathname:"/api/loginUser",bundlePath:"",filename:""},userland:s})},91766:e=>{e.exports=async function(e){return await new Promise((r,t)=>{setTimeout(()=>{r(!0)},e||1e3)}),!0}},44767:(e,r,t)=>{let s=t(48225),i=t(51348),a=t(47670),n=t(44900);e.exports=async function({query:e,user:r,useLocal:t}){try{let s=t?n:i,{invite:o,database_access:l,priviledge:u,email:d}=e,_=[o,d],m=await s("SELECT date_created_code FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",_);if(!m||!m[0])throw Error("No Invitation Found");let c=[o],p=await s("SELECT first_name,last_name,email FROM users WHERE id=?",c);if(p?.[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,d]);if(e?.[0])console.log("User already added");else{a({dbFullName:"datasquirel",tableName:"user_users",data:{user_id:o,invited_user_id:r.id,database_access:l,first_name:r.first_name,last_name:r.last_name,phone:r.phone,email:r.email,username:r.username,user_type:"admin",user_priviledge:u,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,d]);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 a({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:r.id,root_user_id:o,database:i,table:n,priviledge:u},useLocal:t})}}}await s("UPDATE invitations SET invitation_status='Accepted' WHERE inviting_user_id=? AND invited_user_email=?",[o,d])}}catch(e){s({component:"addAdminUserOnLogin",message:e.message,user:r})}}},31341:e=>{e.exports=function(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}}},59474:(e,r,t)=>{let s=t(29021),i=t(21572).createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});e.exports=async function({to:e,subject:r,text:t,html:a,alias:n}){let o;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let l=(n?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!s.existsSync("./email/index.html"))return;let u=s.readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,a||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let s={};s.from=`"Datasquirel" <${l}>`,s.sender=l,n&&(s["replyTo "]=l),s.to=e,s.subject=r,s.text=t,s.html=u,o=await i.sendMail(s)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return o}},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:i}=t(81630);e.exports=async function({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"],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 i=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(i+=`
User Id: ${e?.id}

View File

@ -1 +1 @@
"use strict";(()=>{var e={};e.id=528,e.ids=[528],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")},81630:e=>{e.exports=require("http")},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}}})},22380:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>l,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762);t(6420);var a=t(31341),u=t.n(a);async function c(e,r){if("GET"!==e.method)return r.json({msg:"Logout Error"});{let{keyCookieName:e,csrfCookieName:t}=u()();r.setHeader("Set-Cookie",[`${e}=null;max-age=0`,`${t}=null;max-age=0`]),r.json({msg:"Logged Out"})}}t(29021);let l=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/logoutUser",pathname:"/api/logoutUser",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:u,csrfCookieName:c}=i();if(!e.cookies?.[u]?.match(/./))return null;let l=n({encryptedString:e.cookies[u]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,a=t||process.env.DSQL_ENCRYPTION_SALT,u=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(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(i,a,u),o.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=22380);module.exports=t})();
"use strict";(()=>{var e={};e.id=528,e.ids=[528],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")},81630:e=>{e.exports=require("http")},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}}})},22380:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>l,routeModule:()=>p});var s={};t.r(s),t.d(s,{default:()=>c});var n=t(89947),o=t(2706),i=t(96762);t(6420);var u=t(31341),a=t.n(u);async function c(e,r){if("GET"!==e.method)return r.json({msg:"Logout Error"});{let{keyCookieName:e,csrfCookieName:t}=a()();r.setHeader("Set-Cookie",[`${e}=null;max-age=0`,`${t}=null;max-age=0`]),r.json({msg:"Logged Out"})}}t(29021);let l=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),p=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/logoutUser",pathname:"/api/logoutUser",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function u(e,r,t,u){let{keyCookieName:a,csrfCookieName:c}=i();if(!e.cookies?.[a]?.match(/./))return null;let l=n({encryptedString:e.cookies[a]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=u},31341:e=>{e.exports=function(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 a=r;return e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),{keyCookieName:i,csrfCookieName:u,oneTimeCodeName:a+=n}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,u=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(!u?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(i,u,a),o.alloc(16,0));try{let r=c.update(e,"hex","utf8");return r+=c.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=22380);module.exports=t})();

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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},97243:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>_,routeModule:()=>d});var s={};t.r(s),t.d(s,{default:()=>l});var n=t(89947),o=t(2706),i=t(96762),a=t(6420),c=t.n(a);let u=t(29021);async function l(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Failed!"});let t=await c()(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 n=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id.toString().replace(/\//g,"")}`,o=s.replace(/\@/,n);u.createReadStream(o).pipe(r)}catch(e){console.log("ERROR in getPrivateMedia api route:",e.message),r.json({success:!1,msg:"Error!",error:e})}}let _=(0,i.M)(s,"default"),p=(0,i.M)(s,"config"),d=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/media/getPrivateMedia",pathname:"/api/media/getPrivateMedia",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:c,csrfCookieName:u}=i();if(!e.cookies?.[c]?.match(/./))return null;let l=n({encryptedString:e.cookies[c]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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=e?.database||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;return e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),{keyCookieName:o,csrfCookieName:i+=s}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,a=t||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!i?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=n("aes-192-cbc",s(i,a,c),o.alloc(16,0));try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=97243);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")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},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}}})},97243:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>_,routeModule:()=>d});var s={};t.r(s),t.d(s,{default:()=>l});var n=t(89947),o=t(2706),i=t(96762),a=t(6420),c=t.n(a);let u=t(29021);async function l(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Failed!"});let t=await c()(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 n=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id.toString().replace(/\//g,"")}`,o=s.replace(/\@/,n);u.createReadStream(o).pipe(r)}catch(e){console.log("ERROR in getPrivateMedia api route:",e.message),r.json({success:!1,msg:"Error!",error:e})}}let _=(0,i.M)(s,"default"),p=(0,i.M)(s,"config"),d=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/media/getPrivateMedia",pathname:"/api/media/getPrivateMedia",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);let s=t(51348),n=t(72835),o=t(29021),i=t(31341);async function a(e,r,t,a){let{keyCookieName:c,csrfCookieName:u}=i();if(!e.cookies?.[c]?.match(/./))return null;let l=n({encryptedString:e.cookies[c]});if(!l)return null;let _=JSON.parse(l);if(!_.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${p}/${_.csrf_k}`))return null;if(0==_.verification_status&&!t){let e=await s(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return _?.date&&Date.now()-_.date>6048e5?null:_}e.exports=a},31341:e=>{e.exports=function(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}}},72835:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:o}=t(79428);e.exports=({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,a=t||process.env.DSQL_ENCRYPTION_SALT,c=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!i?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=n("aes-192-cbc",s(i,a,c),o.alloc(16,0));try{let r=u.update(e,"hex","utf8");return r+=u.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},51348:(e,r,t)=>{let s=t(9973),n=t(21580),o=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:n()}});async function i(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{let s=t(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var t;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=97243);module.exports=t})();

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
"use strict";(()=>{var e={};e.id=2562,e.ids=[2562],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},82453:(e,r,t)=>{t.r(r),t.d(r,{config:()=>x,default:()=>$,routeModule:()=>R});var i={};t.r(i),t.d(i,{config:()=>E,default:()=>v});var s=t(89947),a=t(2706),n=t(96762),l=t(33873),o=t.n(l),u=t(47670),d=t.n(u),c=t(64122),m=t.n(c),p=t(48227),f=t.n(p),g=t(48225),_=t.n(g),S=t(77619),y=t.n(S);let h=t(29021),E={api:{bodyParser:{sizeLimit:"50mb"}}};async function v(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});try{let t=e.headers.authorization;if(!t)return r.json({success:!1,msg:"Unauthorized"});let i=y()({key:t,user_id:String(e.query.user_id)});if(!i?.user_id)throw Error("Api Credentials invalid!");let{user_id:s,full_access:a}=i;if(!a)return r.json({success:!1,msg:"Unauthorized"});let{fileData:n,fileName:l,mimeType:u,folder:c,isPrivate:p}=e.body,g=process.env.DSQL_STATIC_SERVER_DIR;if(!g)throw console.log("Static File ENV not Found!"),Error("No Static Path!");if(c){let e=o().join(g,`images/user-images/user-${s}/${c?.toString().replace(/\.\./g,"")}`);h.existsSync(e)||h.mkdirSync(e,{recursive:!0})}let _=f()({folder:c,isPrivate:p,user:i});if(!_)throw Error("Couldn't Grab Image URLs");let{fileRootPath:S,urlRootPath:E}=_,v=u?.match(/csv/i)?".csv":u?.match(/pdf/i)?".pdf":u?.match(/xlsx/)?".xlsx":u?.match(/json/i)?".json":".txt",$=E+l+v;h.writeFileSync(S+l+v,n,"base64"),await m()({dbFullName:"datasquirel",tableName:"user_media",identifierColumnName:"media_url",identifierValue:$}),await d()({dbFullName:"datasquirel",tableName:"user_media",data:{user_id:s,media_name:l,media_url:$,media_thumbnail_url:$,folder:c||"",media_type:"file",private:p?"1":null}}),r.json({success:!0,payload:{urlPath:$}})}catch(t){console.log("File write error:",t),_()({component:"/api/query/add-file/main-catch-error",message:t.message,req:e}),r.json({success:!1,msg:"Add File Error!",error:t.message})}}let $=(0,n.M)(i,"default"),x=(0,n.M)(i,"config"),R=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/query/[user_id]/add-file",pathname:"/api/query/[user_id]/add-file",bundlePath:"",filename:""},userland:i})},48227:(e,r,t)=>{let i=t(29021),s=t(33873);e.exports=function({isPrivate:e,user:r,folder:t,video:a,pathOnly:n}){"production".match(/production/);let l=r?.id||r?.user_id,o=process.env.DSQL_STATIC_SERVER_DIR;if(!o)return console.log("Static File ENV not Found!"),null;let u=e?`@/${a?"videos":"media"}/${t?t+"/":""}`:a?`/videos/user-videos/user-${l}/${t?t+"/":""}`:`/images/user-images/user-${l}/${t?t+"/":""}`,d=e?`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${l}/media/${t?t+"/":""}`:s.join(o,u);return i.existsSync(d)||n||i.mkdirSync(d,{recursive:!0}),{fileRootPath:d,urlRootPath:e?`@/media/${t?t+"/":""}`:`${process.env.DSQL_STATIC_HOST}${u}`,relativePath:u}}},77619:(e,r,t)=>{let i=t(29021),s=t(72835);e.exports=({key:e,database:r,table:t,user_id:a})=>{if(!e||!a)return null;try{let n=process.env.DSQL_API_KEYS_PATH;if(!n)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");let l=s({encryptedString:e}),o=JSON.parse(l||""),u=i.existsSync(`${n}/${o.sign}`);if(String(o.user_id)!==String(a)||!u)return null;if(!o.target_database)return o;if(!r&&o.target_database)return null;let d=o.target_database?.split(",").includes(String(r));if(d&&!o.target_table)return o;if(d&&!t&&o.target_table)return null;if(o.target_table?.split(",").includes(String(t)))return o;return null}catch(e){return console.log(`api-cred ERROR: ${e.message}`),null}}},64122:(e,r,t)=>{let i=t(51348),s=t(21339),a=t(44900);async function n({dbContext:e,paradigm:r,dbFullName:t,tableName:n,identifierColumnName:l,identifierValue:o,useLocal:u}){try{let d=!!u||!e?.match(/dsql.user/i)&&(!t||!!t.match(/^datasquirel$/)),c=u?a:d?i:s,m=`DELETE FROM ${n} WHERE \`${l}\`=?`;return d?await c(m,[o]):await c({paradigm:r,queryString:m,database:t,queryValues:[o]})}catch(e){return null}}e.exports=n},48225:(e,r,t)=>{let i=t(29021),{IncomingMessage:s}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:s,req:a}){let n=new Date,l=(()=>{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 s=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=2562,e.ids=[2562],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},82453:(e,r,t)=>{t.r(r),t.d(r,{config:()=>$,default:()=>R,routeModule:()=>x});var i={};t.r(i),t.d(i,{config:()=>E,default:()=>v});var s=t(89947),a=t(2706),n=t(96762),l=t(33873),o=t.n(l),u=t(47670),d=t.n(u),c=t(64122),m=t.n(c),p=t(48227),g=t.n(p),f=t(48225),_=t.n(f),S=t(77619),y=t.n(S);let h=t(29021),E={api:{bodyParser:{sizeLimit:"50mb"}}};async function v(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});try{let t=e.headers.authorization;if(!t)return r.json({success:!1,msg:"Unauthorized"});let i=y()({key:t,user_id:String(e.query.user_id)});if(!i?.user_id)throw Error("Api Credentials invalid!");let{user_id:s,full_access:a}=i;if(!a)return r.json({success:!1,msg:"Unauthorized"});let{fileData:n,fileName:l,mimeType:u,folder:c,isPrivate:p}=e.body,f=process.env.DSQL_STATIC_SERVER_DIR;if(!f)throw console.log("Static File ENV not Found!"),Error("No Static Path!");if(c){let e=o().join(f,`images/user-images/user-${s}/${c?.toString().replace(/\.\./g,"")}`);h.existsSync(e)||h.mkdirSync(e,{recursive:!0})}let _=g()({folder:c,isPrivate:p,userId:i.user_id});if(!_)throw Error("Couldn't Grab Image URLs");let{fileRootPath:S,urlRootPath:E}=_,v=u?.match(/csv/i)?".csv":u?.match(/pdf/i)?".pdf":u?.match(/xlsx/)?".xlsx":u?.match(/json/i)?".json":".txt",R=E+l+v;h.writeFileSync(S+l+v,n,"base64"),await m()({dbFullName:"datasquirel",tableName:"user_media",identifierColumnName:"media_url",identifierValue:R}),await d()({dbFullName:"datasquirel",tableName:"user_media",data:{user_id:s,media_name:l,media_url:R,media_thumbnail_url:R,folder:c||"",media_type:"file",private:p?"1":null}}),r.json({success:!0,payload:{urlPath:R}})}catch(t){console.log("File write error:",t),_()({component:"/api/query/add-file/main-catch-error",message:t.message,req:e}),r.json({success:!1,msg:"Add File Error!",error:t.message})}}let R=(0,n.M)(i,"default"),$=(0,n.M)(i,"config"),x=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/query/[user_id]/add-file",pathname:"/api/query/[user_id]/add-file",bundlePath:"",filename:""},userland:i})},48227:(e,r,t)=>{let i=t(29021),s=t(33873);e.exports=function({isPrivate:e,userId:r,folder:t,video:a,pathOnly:n}){"production".match(/production/);let l=process.env.DSQL_STATIC_SERVER_DIR;if(!l)return console.log("Static File ENV not Found!"),null;let o=e?`@/${a?"videos":"media"}/${t?t+"/":""}`:a?`/videos/user-videos/user-${r}/${t?t+"/":""}`:`/images/user-images/user-${r}/${t?t+"/":""}`,u=e?`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r}/media/${t?t+"/":""}`:s.join(l,o);return i.existsSync(u)||n||i.mkdirSync(u,{recursive:!0}),{fileRootPath:u,urlRootPath:e?`@/media/${t?t+"/":""}`:`${process.env.DSQL_STATIC_HOST}${o}`,relativePath:o}}},77619:(e,r,t)=>{let i=t(29021),s=t(72835);e.exports=({key:e,database:r,table:t,user_id:a,media:n})=>{if(!e||!a)return null;try{let l=process.env.DSQL_API_KEYS_PATH;if(!l)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");let o=s({encryptedString:e}),u=JSON.parse(o||""),d=i.existsSync(`${l}/${u.sign}`);if(String(u.user_id)!==String(a)||!d)return null;if(!u.target_database||n)return u;if(!r&&u.target_database)return null;let c=u.target_database?.split(",").includes(String(r));if(c&&!u.target_table)return u;if(c&&!t&&u.target_table)return null;if(u.target_table?.split(",").includes(String(t)))return u;return null}catch(e){return console.log(`api-cred ERROR: ${e.message}`),{error:`api-cred ERROR: ${e.message}`}}}},64122:(e,r,t)=>{let i=t(51348),s=t(21339),a=t(44900);async function n({dbContext:e,paradigm:r,dbFullName:t,tableName:n,identifierColumnName:l,identifierValue:o,useLocal:u}){try{let d=!!u||!e?.match(/dsql.user/i)&&(!t||!!t.match(/^datasquirel$/)),c=u?a:d?i:s,m=`DELETE FROM ${n} WHERE \`${l}\`=?`;return d?await c(m,[o]):await c({paradigm:r,queryString:m,database:t,queryValues:[o]})}catch(e){return null}}e.exports=n},48225:(e,r,t)=>{let i=t(29021),{IncomingMessage:s}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:s,req:a}){let n=new Date,l=(()=>{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 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,4 +1,4 @@
"use strict";(()=>{var e={};e.id=7918,e.ids=[7918],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")},81630:e=>{e.exports=require("http")},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}}})},50145:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>D,routeModule:()=>y});var s={};t.r(s),t.d(s,{config:()=>g,default:()=>m});var n=t(89947),o=t(2706),a=t(96762),i=t(51348),c=t.n(i),l=t(64122),u=t.n(l),p=t(48225),d=t.n(p),S=t(77619),_=t.n(S);let f=t(29021),g={api:{bodyParser:{sizeLimit:"50mb"}}};async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});try{let t=e.headers.authorization;if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=_()({key:t,user_id:String(e.query.user_id)});if(!s?.user_id)throw Error("Api Credentials invalid!");let{user_id:n,full_access:o}=s;if(!o)return r.json({success:!1,msg:"Unauthorized"});let{url:a}=e.body,i=await c()("SELECT * FROM user_media WHERE media_url = ?",[a]);if(!i?.length)return r.json({success:!1,msg:"Media not found!"});let{id:l,folder:p,media_url:d,media_thumbnail_url:S,media_type:g}=i[0],m=process.env.DSQL_STATIC_SERVER_DIR;if(!m)throw console.log("Static File ENV not Found!"),Error("No Static Path!");let D=e=>!e||e?.match(/\.\./)?"":e?.match(/^\@/)?e.replace(/@\/media\//,`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${n}/media/`):e.replace(process.env.DSQL_STATIC_HOST||"",m),E=D(d),y=D(S);if(!E?.match(/./))return r.json({success:!1,msg:"Invalid path!"});try{f.unlinkSync(E),f.unlinkSync(y),await u()({dbFullName:"datasquirel",tableName:"user_media",identifierColumnName:"id",identifierValue:l}),r.json({success:!0,payload:{url:a}})}catch(e){console.log("File delete error:",e.message),r.json({success:!1,payload:{url:a},error:e.message})}}catch(t){console.log("File write error:",t),d()({component:"/api/query/delete-file/main-catch-error",message:t.message,req:e}),r.json({success:!1,msg:"Delete File Error!",error:t.message})}}let D=(0,a.M)(s,"default"),E=(0,a.M)(s,"config"),y=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/query/[user_id]/delete-file",pathname:"/api/query/[user_id]/delete-file",bundlePath:"",filename:""},userland:s})},77619:(e,r,t)=>{let s=t(29021),n=t(72835);e.exports=({key:e,database:r,table:t,user_id:o})=>{if(!e||!o)return null;try{let a=process.env.DSQL_API_KEYS_PATH;if(!a)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");let i=n({encryptedString:e}),c=JSON.parse(i||""),l=s.existsSync(`${a}/${c.sign}`);if(String(c.user_id)!==String(o)||!l)return null;if(!c.target_database)return c;if(!r&&c.target_database)return null;let u=c.target_database?.split(",").includes(String(r));if(u&&!c.target_table)return c;if(u&&!t&&c.target_table)return null;if(c.target_table?.split(",").includes(String(t)))return c;return null}catch(e){return console.log(`api-cred ERROR: ${e.message}`),null}}},64122:(e,r,t)=>{let s=t(51348),n=t(21339),o=t(44900);async function a({dbContext:e,paradigm:r,dbFullName:t,tableName:a,identifierColumnName:i,identifierValue:c,useLocal:l}){try{let u=!!l||!e?.match(/dsql.user/i)&&(!t||!!t.match(/^datasquirel$/)),p=l?o:u?s:n,d=`DELETE FROM ${a} WHERE \`${i}\`=?`;return u?await p(d,[c]):await p({paradigm:r,queryString:d,database:t,queryValues:[c]})}catch(e){return null}}e.exports=a},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,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 n=`🚀 SERVER ERROR ===========================
"use strict";(()=>{var e={};e.id=7918,e.ids=[7918],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")},81630:e=>{e.exports=require("http")},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}}})},50145:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>D,routeModule:()=>y});var s={};t.r(s),t.d(s,{config:()=>f,default:()=>m});var n=t(89947),o=t(2706),a=t(96762),i=t(51348),c=t.n(i),l=t(64122),u=t.n(l),p=t(48225),d=t.n(p),S=t(77619),_=t.n(S);let g=t(29021),f={api:{bodyParser:{sizeLimit:"50mb"}}};async function m(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});try{let t=e.headers.authorization;if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=_()({key:t,user_id:String(e.query.user_id)});if(!s?.user_id)throw Error("Api Credentials invalid!");let{user_id:n,full_access:o}=s;if(!o)return r.json({success:!1,msg:"Unauthorized"});let{url:a}=e.body,i=await c()("SELECT * FROM user_media WHERE media_url = ?",[a]);if(!i?.length)return r.json({success:!1,msg:"Media not found!"});let{id:l,folder:p,media_url:d,media_thumbnail_url:S,media_type:f}=i[0],m=process.env.DSQL_STATIC_SERVER_DIR;if(!m)throw console.log("Static File ENV not Found!"),Error("No Static Path!");let D=e=>!e||e?.match(/\.\./)?"":e?.match(/^\@/)?e.replace(/@\/media\//,`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${n}/media/`):e.replace(process.env.DSQL_STATIC_HOST||"",m),E=D(d),y=D(S);if(!E?.match(/./))return r.json({success:!1,msg:"Invalid path!"});try{g.unlinkSync(E),g.unlinkSync(y),await u()({dbFullName:"datasquirel",tableName:"user_media",identifierColumnName:"id",identifierValue:l}),r.json({success:!0,payload:{url:a}})}catch(e){console.log("File delete error:",e.message),r.json({success:!1,payload:{url:a},error:e.message})}}catch(t){console.log("File write error:",t),d()({component:"/api/query/delete-file/main-catch-error",message:t.message,req:e}),r.json({success:!1,msg:"Delete File Error!",error:t.message})}}let D=(0,a.M)(s,"default"),E=(0,a.M)(s,"config"),y=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/query/[user_id]/delete-file",pathname:"/api/query/[user_id]/delete-file",bundlePath:"",filename:""},userland:s})},77619:(e,r,t)=>{let s=t(29021),n=t(72835);e.exports=({key:e,database:r,table:t,user_id:o,media:a})=>{if(!e||!o)return null;try{let i=process.env.DSQL_API_KEYS_PATH;if(!i)throw Error("process.env.DSQL_API_KEYS_PATH variable not found");let c=n({encryptedString:e}),l=JSON.parse(c||""),u=s.existsSync(`${i}/${l.sign}`);if(String(l.user_id)!==String(o)||!u)return null;if(!l.target_database||a)return l;if(!r&&l.target_database)return null;let p=l.target_database?.split(",").includes(String(r));if(p&&!l.target_table)return l;if(p&&!t&&l.target_table)return null;if(l.target_table?.split(",").includes(String(t)))return l;return null}catch(e){return console.log(`api-cred ERROR: ${e.message}`),{error:`api-cred ERROR: ${e.message}`}}}},64122:(e,r,t)=>{let s=t(51348),n=t(21339),o=t(44900);async function a({dbContext:e,paradigm:r,dbFullName:t,tableName:a,identifierColumnName:i,identifierValue:c,useLocal:l}){try{let u=!!l||!e?.match(/dsql.user/i)&&(!t||!!t.match(/^datasquirel$/)),p=l?o:u?s:n,d=`DELETE FROM ${a} WHERE \`${i}\`=?`;return u?await p(d,[c]):await p({paradigm:r,queryString:d,database:t,queryValues:[c]})}catch(e){return null}}e.exports=a},48225:(e,r,t)=>{let s=t(29021),{IncomingMessage:n}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:n,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 n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}

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