2024-12-09 12:27:08 +00:00
|
|
|
"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 ===========================
|
2024-12-09 12:27:08 +00:00
|
|
|
${i}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},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 a=r||process.env.DSQL_ENCRYPTION_PASSWORD,l=t||process.env.DSQL_ENCRYPTION_SALT,i=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=n("aes-192-cbc",s(a,l,i),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 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=75865);module.exports=t})();
|