Updates
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
"use strict";(()=>{var e={};e.id=8078,e.ids=[8078],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},31483:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>p,routeModule:()=>D});var n={};t.r(n),t.d(n,{default:()=>d});var s=t(89947),a=t(2706),o=t(96762),l=t(67619),i=t(56081),u=t(61932),c=t(30944);async function _({dbFullName:e,deletedUserId:r}){let t=`SELECT * FROM ${e}.users WHERE id = ?`,n=await (0,c.A)({queryString:t,queryValuesArray:[r],database:e});return n?.[0]?{success:!0,result:await (0,u.A)({dbContext:"Dsql User",dbFullName:e,tableName:"users",identifierColumnName:"id",identifierValue:r})}:{success:!1,msg:"User not found"}}async function d(e,r){if("POST"!==e.method)return r.json({success:!1,payload:null,msg:"Failed!"});try{let t=e.headers.authorization,{deletedUserId:n,database:s}=e.body,a=(0,i.A)({key:t,database:s?.db_slug,user_id:String(e.query.user_id)});if(!a?.user_id)throw Error("Api Credentials invalid!");if(!a.full_access||!a.sign)return r.json({success:!1,msg:"Unauthorized"});let o=`datasquirel_user_${a.user_id}_${s}`,l=await _({dbFullName:o,deletedUserId:n});r.json(l)}catch(t){(0,l.A)({component:"/api/user/delete-user/main-catch-error",message:t.message,user:{},req:e}),r.json({success:!1,msg:"Wrong Credentials"})}}let p=(0,o.M)(n,"default"),S=(0,o.M)(n,"config"),D=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/user/[user_id]/delete-user",pathname:"/api/user/[user_id]/delete-user",bundlePath:"",filename:""},userland:n})},56081:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),s=t.n(n),a=t(95969);let o=({key:e,database:r,table:t,user_id:n,media:o})=>{if(!e||!n)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 i=(0,a.A)({encryptedString:e}),u=JSON.parse(i||""),c=s().existsSync(`${l}/${u.sign}`);if(String(u.user_id)!==String(n)||!c)return null;if(!u.target_database||o)return u;if(!r&&u.target_database)return null;let _=u.target_database?.split(",").includes(String(r));if(_&&!u.target_table)return u;if(_&&!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}`}}}},61932:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(52939),s=t(64292);async function a({dbContext:e,dbFullName:r,tableName:t,identifierColumnName:a,identifierValue:o,forceLocal:l}){try{let i=!!l||(0,n.A)({dbContext:e,dbFullName:r}),u=i?global.DSQL_DB_CONN:global.DSQL_FULL_ACCESS_DB_CONN||global.DSQL_DB_CONN;i?global.DSQL_DB_CONN:global.DSQL_READ_ONLY_DB_CONN||global.DSQL_DB_CONN;let c=`DELETE FROM ${i?"":`\`${r}\`.`}\`${t}\` WHERE \`${a}\`=?`;return await (0,s.A)(u,c,[o])}catch(e){return null}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],l=Object.keys(o);for(let e=0;e<l.length;e++){let t=l[e],a=r?.fields[e];if(t?.match(s))continue;let i=o[t];("number"==typeof i||i)&&a?.encrypted&&i?.match(/./)&&(o[t]=(0,n.A)({encryptedString:i}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,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"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
|
||||
"use strict";(()=>{var e={};e.id=8078,e.ids=[8078],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},31483:(e,r,t)=>{t.r(r),t.d(r,{config:()=>S,default:()=>p,routeModule:()=>D});var n={};t.r(n),t.d(n,{default:()=>d});var s=t(89947),a=t(2706),o=t(96762),l=t(67619),i=t(56081),u=t(61932),c=t(30944);async function _({dbFullName:e,deletedUserId:r}){let t=`SELECT * FROM ${e}.users WHERE id = ?`,n=await (0,c.A)({queryString:t,queryValuesArray:[r],database:e});return n?.[0]?{success:!0,result:await (0,u.A)({dbContext:"Dsql User",dbFullName:e,tableName:"users",identifierColumnName:"id",identifierValue:r})}:{success:!1,msg:"User not found"}}async function d(e,r){if("POST"!==e.method)return r.json({success:!1,payload:null,msg:"Failed!"});try{let t=e.headers.authorization,{deletedUserId:n,database:s}=e.body,a=(0,i.A)({key:t,database:s?.db_slug,user_id:String(e.query.user_id)});if(!a?.user_id)throw Error("Api Credentials invalid!");if(!a.full_access||!a.sign)return r.json({success:!1,msg:"Unauthorized"});let o=`datasquirel_user_${a.user_id}_${s}`,l=await _({dbFullName:o,deletedUserId:n});r.json(l)}catch(t){(0,l.A)({component:"/api/user/delete-user/main-catch-error",message:t.message,user:{},req:e}),r.json({success:!1,msg:"Wrong Credentials"})}}let p=(0,o.M)(n,"default"),S=(0,o.M)(n,"config"),D=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/user/[user_id]/delete-user",pathname:"/api/user/[user_id]/delete-user",bundlePath:"",filename:""},userland:n})},56081:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),s=t.n(n),a=t(95969);let o=({key:e,database:r,table:t,user_id:n,media:o})=>{if(!e||!n)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 i=(0,a.A)({encryptedString:e}),u=JSON.parse(i||""),c=s().existsSync(`${l}/${u.sign}`);if(String(u.user_id)!==String(n)||!c)return null;if(!u.target_database||o)return u;if(!r&&u.target_database)return null;let _=u.target_database?.split(",").includes(String(r));if(_&&!u.target_table)return u;if(_&&!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}`}}}},61932:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(52939),s=t(64292);async function a({dbContext:e,dbFullName:r,tableName:t,identifierColumnName:a,identifierValue:o,forceLocal:l}){try{let i=!!l||(0,n.A)({dbContext:e,dbFullName:r}),u=i?global.DSQL_DB_CONN:global.DSQL_FULL_ACCESS_DB_CONN||global.DSQL_DB_CONN;i?global.DSQL_DB_CONN:global.DSQL_READ_ONLY_DB_CONN||global.DSQL_DB_CONN;let c=`DELETE FROM ${i?"":`\`${r}\`.`}\`${t}\` WHERE \`${a}\`=?`;return await (0,s.A)(u,c,[o])}catch(e){return global.ERROR_CALLBACK?.("Error Deleting Entry",e),null}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],l=Object.keys(o);for(let e=0;e<l.length;e++){let t=l[e],a=r?.fields[e];if(t?.match(s))continue;let i=o[t];("number"==typeof i||i)&&a?.encrypted&&i?.match(/./)&&(o[t]=(0,n.A)({encryptedString:i}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,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"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
|
||||
Error Message: ${r}
|
||||
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
|
||||
User Id: ${e?.id}
|
||||
@@ -13,4 +13,4 @@ Date: ${o.toDateString()}
|
||||
|
||||
|
||||
|
||||
${i}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(43775),s=t(67619),a=t(7447),o=t(64292);async function l({queryString:e,queryValuesArray:r,database:t,tableSchema:l,debug:i}){let u=(0,a.A)({fa:!0});global.DSQL_USE_LOCAL&&(u=(0,a.A)({local:!0})),t?.match(/^datasquirel$/)&&(u=(0,a.A)()),i&&(console.log("varDatabaseDbHandler:query:",e),console.log("varDatabaseDbHandler:values:",r),console.log("varDatabaseDbHandler:CONNECTION:",u.getConfig()));let c=await (0,o.A)(u,e,r);if(i&&console.log("varDatabaseDbHandler:results:",c),c&&l)try{return await (0,n.A)({unparsedResults:c,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),(0,s.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(c)return c;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),s=t(79428),a=t(31542);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:o,salt:l,keyLen:i,algorithm:u,bufferAllocSize:c}=(0,a.A)({encryptionKey:r});if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=(0,n.scryptSync)(o,l,i),d=s.Buffer.alloc(c,0),p=(0,n.createDecipheriv)(u,_,d);try{let r=p.update(e,"hex","utf8");return r+=p.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},52939:(e,r,t)=>{t.d(r,{A:()=>n});function n({dbContext:e,dbFullName:r}){return!e?.match(/dsql.user/i)&&(!!global.DSQL_USE_LOCAL||!r||!!r.match(/^datasquirel$/))}},64292:(e,r,t)=>{async function n(e,r,t){try{if(!e)throw Error("No Connection Found!");if(!r)throw Error("Query String Required!");if("string"==typeof r){let n=await e.query(s(r),t);return JSON.parse(JSON.stringify(n))}if("object"!=typeof r)return null;{let t=[];for(let n=0;n<r.length;n++)try{let a=r[n],o=await e.query(s(a.query),a.values);t.push(JSON.parse(JSON.stringify(o)))}catch(e){console.log(`connDbHandler Query Error: ${e.message}`),t.push(null)}return t}}catch(r){return console.log(`connDbHandler Error: ${r.message}`),console.log(e?.config()),null}finally{e?.end()}}function s(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}t.d(r,{A:()=>n})},7447:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(9973),s=t.n(n);function a(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},31542:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(82535);function s(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=31483);module.exports=t})();
|
||||
${i}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(43775),s=t(67619),a=t(7447),o=t(64292);async function l({queryString:e,queryValuesArray:r,database:t,tableSchema:l,debug:i}){let u=(0,a.A)({fa:!0});global.DSQL_USE_LOCAL&&(u=(0,a.A)({local:!0})),t?.match(/^datasquirel$/)&&(u=(0,a.A)()),i&&(console.log("varDatabaseDbHandler:query:",e),console.log("varDatabaseDbHandler:values:",r),console.log("varDatabaseDbHandler:CONNECTION:",u.getConfig()));let c=await (0,o.A)(u,e,r);if(i&&console.log("varDatabaseDbHandler:results:",c),c&&l)try{return await (0,n.A)({unparsedResults:c,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),global.ERROR_CALLBACK?.("VarDb Handler Error",e),(0,s.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(c)return c;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),s=t(79428),a=t(31542);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:o,salt:l,keyLen:i,algorithm:u,bufferAllocSize:c}=(0,a.A)({encryptionKey:r});if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=(0,n.scryptSync)(o,l,i),d=s.Buffer.alloc(c,0),p=(0,n.createDecipheriv)(u,_,d);try{let r=p.update(e,"hex","utf8");return r+=p.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),global.ERROR_CALLBACK?.("Error Decrypting data",r),e}}},52939:(e,r,t)=>{t.d(r,{A:()=>n});function n({dbContext:e,dbFullName:r}){return!e?.match(/dsql.user/i)&&(!!global.DSQL_USE_LOCAL||!r||!!r.match(/^datasquirel$/))}},64292:(e,r,t)=>{async function n(e,r,t){try{if(!e)throw Error("No Connection Found!");if(!r)throw Error("Query String Required!");if("string"==typeof r){let n=await e.query(s(r),t);return JSON.parse(JSON.stringify(n))}if("object"!=typeof r)return null;{let t=[];for(let n=0;n<r.length;n++)try{let a=r[n],o=await e.query(s(a.query),a.values);t.push(JSON.parse(JSON.stringify(o)))}catch(e){global.ERROR_CALLBACK?.("Connection DB Handler Query Error",e),t.push(null)}return t}}catch(e){return global.ERROR_CALLBACK?.("Connection DB Handler Error",e),null}finally{e?.end()}}function s(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}t.d(r,{A:()=>n})},7447:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(9973),s=t.n(n);function a(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},31542:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(82535);function s(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=31483);module.exports=t})();
|
||||
@@ -13,4 +13,4 @@ Date: ${o.toDateString()}
|
||||
|
||||
|
||||
|
||||
${i}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(43775),s=t(67619),a=t(7447),o=t(64292);async function l({queryString:e,queryValuesArray:r,database:t,tableSchema:l,debug:i}){let u=(0,a.A)({fa:!0});global.DSQL_USE_LOCAL&&(u=(0,a.A)({local:!0})),t?.match(/^datasquirel$/)&&(u=(0,a.A)()),i&&(console.log("varDatabaseDbHandler:query:",e),console.log("varDatabaseDbHandler:values:",r),console.log("varDatabaseDbHandler:CONNECTION:",u.getConfig()));let c=await (0,o.A)(u,e,r);if(i&&console.log("varDatabaseDbHandler:results:",c),c&&l)try{return await (0,n.A)({unparsedResults:c,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),(0,s.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(c)return c;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),s=t(79428),a=t(31542);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:o,salt:l,keyLen:i,algorithm:u,bufferAllocSize:c}=(0,a.A)({encryptionKey:r});if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=(0,n.scryptSync)(o,l,i),d=s.Buffer.alloc(c,0),p=(0,n.createDecipheriv)(u,_,d);try{let r=p.update(e,"hex","utf8");return r+=p.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},64292:(e,r,t)=>{async function n(e,r,t){try{if(!e)throw Error("No Connection Found!");if(!r)throw Error("Query String Required!");if("string"==typeof r){let n=await e.query(s(r),t);return JSON.parse(JSON.stringify(n))}if("object"!=typeof r)return null;{let t=[];for(let n=0;n<r.length;n++)try{let a=r[n],o=await e.query(s(a.query),a.values);t.push(JSON.parse(JSON.stringify(o)))}catch(e){console.log(`connDbHandler Query Error: ${e.message}`),t.push(null)}return t}}catch(r){return console.log(`connDbHandler Error: ${r.message}`),console.log(e?.config()),null}finally{e?.end()}}function s(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}t.d(r,{A:()=>n})},7447:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(9973),s=t.n(n);function a(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},31542:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(82535);function s(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=54014);module.exports=t})();
|
||||
${i}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(43775),s=t(67619),a=t(7447),o=t(64292);async function l({queryString:e,queryValuesArray:r,database:t,tableSchema:l,debug:i}){let u=(0,a.A)({fa:!0});global.DSQL_USE_LOCAL&&(u=(0,a.A)({local:!0})),t?.match(/^datasquirel$/)&&(u=(0,a.A)()),i&&(console.log("varDatabaseDbHandler:query:",e),console.log("varDatabaseDbHandler:values:",r),console.log("varDatabaseDbHandler:CONNECTION:",u.getConfig()));let c=await (0,o.A)(u,e,r);if(i&&console.log("varDatabaseDbHandler:results:",c),c&&l)try{return await (0,n.A)({unparsedResults:c,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),global.ERROR_CALLBACK?.("VarDb Handler Error",e),(0,s.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(c)return c;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),s=t(79428),a=t(31542);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:o,salt:l,keyLen:i,algorithm:u,bufferAllocSize:c}=(0,a.A)({encryptionKey:r});if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=(0,n.scryptSync)(o,l,i),d=s.Buffer.alloc(c,0),p=(0,n.createDecipheriv)(u,_,d);try{let r=p.update(e,"hex","utf8");return r+=p.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),global.ERROR_CALLBACK?.("Error Decrypting data",r),e}}},64292:(e,r,t)=>{async function n(e,r,t){try{if(!e)throw Error("No Connection Found!");if(!r)throw Error("Query String Required!");if("string"==typeof r){let n=await e.query(s(r),t);return JSON.parse(JSON.stringify(n))}if("object"!=typeof r)return null;{let t=[];for(let n=0;n<r.length;n++)try{let a=r[n],o=await e.query(s(a.query),a.values);t.push(JSON.parse(JSON.stringify(o)))}catch(e){global.ERROR_CALLBACK?.("Connection DB Handler Query Error",e),t.push(null)}return t}}catch(e){return global.ERROR_CALLBACK?.("Connection DB Handler Error",e),null}finally{e?.end()}}function s(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}t.d(r,{A:()=>n})},7447:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(9973),s=t.n(n);function a(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},31542:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(82535);function s(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=54014);module.exports=t})();
|
||||
@@ -13,4 +13,4 @@ Date: ${s.toDateString()}
|
||||
|
||||
|
||||
|
||||
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(55511),i=t(79428),o=t(31542);function s({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:s,salt:a,keyLen:l,algorithm:u,bufferAllocSize:c}=(0,o.A)({encryptionKey:r});if(!s?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,n.scryptSync)(s,a,l),f=i.Buffer.alloc(c,0),p=(0,n.createDecipheriv)(u,d,f);try{let r=p.update(e,"hex","utf8");return r+=p.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},31542:(e,r,t)=>{t.d(r,{A:()=>i});var n=t(82535);function i(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=96487);module.exports=t})();
|
||||
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},95969:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(55511),i=t(79428),o=t(31542);function s({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:s,salt:a,keyLen:l,algorithm:u,bufferAllocSize:c}=(0,o.A)({encryptionKey:r});if(!s?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let d=(0,n.scryptSync)(s,a,l),f=i.Buffer.alloc(c,0),p=(0,n.createDecipheriv)(u,d,f);try{let r=p.update(e,"hex","utf8");return r+=p.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),global.ERROR_CALLBACK?.("Error Decrypting data",r),e}}},31542:(e,r,t)=>{t.d(r,{A:()=>i});var n=t(82535);function i(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=96487);module.exports=t})();
|
||||
File diff suppressed because one or more lines are too long
@@ -1,16 +1,16 @@
|
||||
"use strict";(()=>{var e={};e.id=4458,e.ids=[4458],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},42276:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>S});var n={};t.r(n),t.d(n,{default:()=>_});var s=t(89947),a=t(2706),o=t(96762),i=t(67619),l=t(56081),u=t(30944);async function c({existingUser:e,database:r,additionalFields:t}){let n=global.DSQL_USE_LOCAL?"":r?`${r}.`:"",s=e?.id&&e.id.toString().match(/./)?await (0,u.A)({queryString:`SELECT * FROM ${n}users WHERE id=?`,queryValuesArray:[e.id.toString()],database:r}):null;if(!s||!s[0])return{success:!1,payload:null,msg:"No user found"};let a=Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2),o={id:s[0].id,first_name:s[0].first_name,last_name:s[0].last_name,username:s[0].username,email:s[0].email,phone:s[0].phone,social_id:s[0].social_id,image:s[0].image,image_thumbnail:s[0].image_thumbnail,verification_status:s[0].verification_status,social_login:s[0].social_login,social_platform:s[0].social_platform,csrf_k:a,more_data:s[0].more_user_data,logged_in_status:!0,date:Date.now()};return t&&Array.isArray(t)&&t.length>0&&t.forEach(e=>{o[e]=s[0][e]}),{success:!0,msg:"Login Successful",payload:o,csrf:a}}async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});try{let{existingUser:t,database:n,additionalFields:s}=e.body,a=e.headers.authorization,o=(0,l.A)({key:a,database:n,user_id:String(e.query.user_id)});if(!o?.user_id)throw Error("Api Credentials invalid!");if(!o.full_access||!o.sign)return r.json({success:!1,msg:"Unauthorized"});let i=`datasquirel_user_${o.user_id}_${n}`.replace(/[^a-z0-9_]/g,""),u=await c({database:i,existingUser:t,additionalFields:s});r.json(u)}catch(t){(0,i.A)({component:"/api/user/reauth-user/main-catch-error",message:t.message,user:{},req:e}),r.json({success:!1,msg:"Login Failed"})}}let d=(0,o.M)(n,"default"),p=(0,o.M)(n,"config"),S=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/user/[user_id]/reauth-user",pathname:"/api/user/[user_id]/reauth-user",bundlePath:"",filename:""},userland:n})},56081:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),s=t.n(n),a=t(95969);let o=({key:e,database:r,table:t,user_id:n,media:o})=>{if(!e||!n)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 l=(0,a.A)({encryptedString:e}),u=JSON.parse(l||""),c=s().existsSync(`${i}/${u.sign}`);if(String(u.user_id)!==String(n)||!c)return null;if(!u.target_database||o)return u;if(!r&&u.target_database)return null;let _=u.target_database?.split(",").includes(String(r));if(_&&!u.target_table)return u;if(_&&!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}`}}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],a=r?.fields[e];if(t?.match(s))continue;let l=o[t];("number"==typeof l||l)&&a?.encrypted&&l?.match(/./)&&(o[t]=(0,n.A)({encryptedString:l}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),s=t.n(n);async function a({user:e,message:r,component:t,noMail:n,req:a}){let o=new Date,i=(()=>{if(!a)return null;try{let e=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
|
||||
"use strict";(()=>{var e={};e.id=4458,e.ids=[4458],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},42276:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>d,routeModule:()=>S});var n={};t.r(n),t.d(n,{default:()=>_});var a=t(89947),s=t(2706),o=t(96762),i=t(67619),l=t(56081),u=t(30944);async function c({existingUser:e,database:r,additionalFields:t}){let n=global.DSQL_USE_LOCAL?"":r?`${r}.`:"",a=e?.id&&e.id.toString().match(/./)?await (0,u.A)({queryString:`SELECT * FROM ${n}users WHERE id=?`,queryValuesArray:[e.id.toString()],database:r}):null;if(!a||!a[0])return{success:!1,payload:null,msg:"No user found"};let s=Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2),o={id:a[0].id,first_name:a[0].first_name,last_name:a[0].last_name,username:a[0].username,email:a[0].email,phone:a[0].phone,social_id:a[0].social_id,image:a[0].image,image_thumbnail:a[0].image_thumbnail,verification_status:a[0].verification_status,social_login:a[0].social_login,social_platform:a[0].social_platform,csrf_k:s,more_data:a[0].more_user_data,logged_in_status:!0,date:Date.now()};return t&&Array.isArray(t)&&t.length>0&&t.forEach(e=>{o[e]=a[0][e]}),{success:!0,msg:"Login Successful",payload:o,csrf:s}}async function _(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});try{let{existingUser:t,database:n,additionalFields:a}=e.body,s=e.headers.authorization,o=(0,l.A)({key:s,database:n,user_id:String(e.query.user_id)});if(!o?.user_id)throw Error("Api Credentials invalid!");if(!o.full_access||!o.sign)return r.json({success:!1,msg:"Unauthorized"});let i=`datasquirel_user_${o.user_id}_${n}`.replace(/[^a-z0-9_]/g,""),u=await c({database:i,existingUser:t,additionalFields:a});r.json(u)}catch(t){(0,i.A)({component:"/api/user/reauth-user/main-catch-error",message:t.message,user:{},req:e}),r.json({success:!1,msg:"Login Failed"})}}let d=(0,o.M)(n,"default"),p=(0,o.M)(n,"config"),S=new a.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/user/[user_id]/reauth-user",pathname:"/api/user/[user_id]/reauth-user",bundlePath:"",filename:""},userland:n})},56081:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),a=t.n(n),s=t(95969);let o=({key:e,database:r,table:t,user_id:n,media:o})=>{if(!e||!n)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 l=(0,s.A)({encryptedString:e}),u=JSON.parse(l||""),c=a().existsSync(`${i}/${u.sign}`);if(String(u.user_id)!==String(n)||!c)return null;if(!u.target_database||o)return u;if(!r&&u.target_database)return null;let _=u.target_database?.split(",").includes(String(r));if(_&&!u.target_table)return u;if(_&&!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}`}}}},43775:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(95969);let a=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function s({unparsedResults:e,tableSchema:r}){let t=[];try{for(let s=0;s<e.length;s++){let o=e[s],i=Object.keys(o);for(let e=0;e<i.length;e++){let t=i[e],s=r?.fields[e];if(t?.match(a))continue;let l=o[t];("number"==typeof l||l)&&s?.encrypted&&l?.match(/./)&&(o[t]=(0,n.A)({encryptedString:l}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(29021),a=t.n(n);async function s({user:e,message:r,component:t,noMail:n,req:s}){let o=new Date,i=(()=>{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],a=t||n||r||s.socket.remoteAddress;if(!a)return null;return String(a)}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}`),a?.url&&(n+=`
|
||||
URL: ${a.url}`),a?.body&&(n+=`
|
||||
Request Body: ${JSON.stringify(a.body,null,4)}`),i&&(n+=`
|
||||
User Email: ${e?.email}`),s?.url&&(n+=`
|
||||
URL: ${s.url}`),s?.body&&(n+=`
|
||||
Request Body: ${JSON.stringify(s.body,null,4)}`),i&&(n+=`
|
||||
IP: ${i}`),n+=`
|
||||
Date: ${o.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",`
|
||||
========================================`,a().existsSync("./.tmp/error.log")||a().writeFileSync("./.tmp/error.log","","utf-8");let l=a().readFileSync("./.tmp/error.log","utf-8");a().writeFileSync("./.tmp/error.log",n),a().appendFileSync("./.tmp/error.log",`
|
||||
|
||||
|
||||
|
||||
|
||||
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>i});var n=t(43775),s=t(67619),a=t(7447),o=t(64292);async function i({queryString:e,queryValuesArray:r,database:t,tableSchema:i,debug:l}){let u=(0,a.A)({fa:!0});global.DSQL_USE_LOCAL&&(u=(0,a.A)({local:!0})),t?.match(/^datasquirel$/)&&(u=(0,a.A)()),l&&(console.log("varDatabaseDbHandler:query:",e),console.log("varDatabaseDbHandler:values:",r),console.log("varDatabaseDbHandler:CONNECTION:",u.getConfig()));let c=await (0,o.A)(u,e,r);if(l&&console.log("varDatabaseDbHandler:results:",c),c&&i)try{return await (0,n.A)({unparsedResults:c,tableSchema:i})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),(0,s.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(c)return c;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),s=t(79428),a=t(31542);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:o,salt:i,keyLen:l,algorithm:u,bufferAllocSize:c}=(0,a.A)({encryptionKey:r});if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=(0,n.scryptSync)(o,i,l),d=s.Buffer.alloc(c,0),p=(0,n.createDecipheriv)(u,_,d);try{let r=p.update(e,"hex","utf8");return r+=p.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},64292:(e,r,t)=>{async function n(e,r,t){try{if(!e)throw Error("No Connection Found!");if(!r)throw Error("Query String Required!");if("string"==typeof r){let n=await e.query(s(r),t);return JSON.parse(JSON.stringify(n))}if("object"!=typeof r)return null;{let t=[];for(let n=0;n<r.length;n++)try{let a=r[n],o=await e.query(s(a.query),a.values);t.push(JSON.parse(JSON.stringify(o)))}catch(e){console.log(`connDbHandler Query Error: ${e.message}`),t.push(null)}return t}}catch(r){return console.log(`connDbHandler Error: ${r.message}`),console.log(e?.config()),null}finally{e?.end()}}function s(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}t.d(r,{A:()=>n})},7447:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(9973),s=t.n(n);function a(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},31542:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(82535);function s(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=42276);module.exports=t})();
|
||||
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>i});var n=t(43775),a=t(67619),s=t(7447),o=t(64292);async function i({queryString:e,queryValuesArray:r,database:t,tableSchema:i,debug:l}){let u=(0,s.A)({fa:!0});global.DSQL_USE_LOCAL&&(u=(0,s.A)({local:!0})),t?.match(/^datasquirel$/)&&(u=(0,s.A)()),l&&(console.log("varDatabaseDbHandler:query:",e),console.log("varDatabaseDbHandler:values:",r),console.log("varDatabaseDbHandler:CONNECTION:",u.getConfig()));let c=await (0,o.A)(u,e,r);if(l&&console.log("varDatabaseDbHandler:results:",c),c&&i)try{return await (0,n.A)({unparsedResults:c,tableSchema:i})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),global.ERROR_CALLBACK?.("VarDb Handler Error",e),(0,a.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(c)return c;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),a=t(79428),s=t(31542);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:o,salt:i,keyLen:l,algorithm:u,bufferAllocSize:c}=(0,s.A)({encryptionKey:r});if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=(0,n.scryptSync)(o,i,l),d=a.Buffer.alloc(c,0),p=(0,n.createDecipheriv)(u,_,d);try{let r=p.update(e,"hex","utf8");return r+=p.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),global.ERROR_CALLBACK?.("Error Decrypting data",r),e}}},64292:(e,r,t)=>{async function n(e,r,t){try{if(!e)throw Error("No Connection Found!");if(!r)throw Error("Query String Required!");if("string"==typeof r){let n=await e.query(a(r),t);return JSON.parse(JSON.stringify(n))}if("object"!=typeof r)return null;{let t=[];for(let n=0;n<r.length;n++)try{let s=r[n],o=await e.query(a(s.query),s.values);t.push(JSON.parse(JSON.stringify(o)))}catch(e){global.ERROR_CALLBACK?.("Connection DB Handler Query Error",e),t.push(null)}return t}}catch(e){return global.ERROR_CALLBACK?.("Connection DB Handler Error",e),null}finally{e?.end()}}function a(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}t.d(r,{A:()=>n})},7447:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(9973),a=t.n(n);function s(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||a()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||a()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||a()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||a()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},31542:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(82535);function a(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../../../webpack-api-runtime.js");r.C(e);var t=r(r.s=42276);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
Reference in New Issue
Block a user