dsql-admin/dsql-app/.local_dist/server/pages/api/admin/grabErrorLogs.js
Benjamin Toby 8b7ea057d0 Updates
2024-12-06 14:24:26 +01:00

1 line
3.0 KiB
JavaScript

"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:()=>d,default:()=>p,routeModule:()=>f});var n={};o.r(n),o.d(n,{default:()=>a});var t=o(89947),s=o(2706),i=o(96762),l=o(19131),u=o.n(l);let c=o(29021);async function a(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Failed"});let o=await u()(e);if(!o?.logged_in_status)return r.json({success:!1,log:"No Logs"});if(!c.existsSync("./.tmp/error.log"))return r.json({success:!0,log:"No Logs Yet."});let n=c.readFileSync("./.tmp/error.log","utf-8");r.json({success:!0,log:n})}let p=(0,i.M)(n,"default"),d=(0,i.M)(n,"config"),f=new t.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/admin/grabErrorLogs",pathname:"/api/admin/grabErrorLogs",bundlePath:"",filename:""},userland:n})},19131:(e,r,o)=>{let{IncomingMessage:n}=o(81630),t=o(72835),s=o(31341);e.exports=async function(e){let{keyCookieName:r,csrfCookieName:o}=s(),n=`${r}_su`;if(!e.cookies?.[n])return console.log("No auth key cookie found"),null;let i=t({encryptedString:e.cookies[n]});if(!i)return console.log("No user payload found"),null;let l=JSON.parse(i);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(){let e=process.env.DSQL_COOKIES_PREFIX||"dsql_";return{keyCookieName:e+(process.env.DSQL_COOKIES_KEY_NAME||"key"),csrfCookieName:e+(process.env.DSQL_COOKIES_CSRF_NAME||"csrf")}}},72835:(e,r,o)=>{let{scryptSync:n,createDecipheriv:t}=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,l=o||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(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=t("aes-192-cbc",n(i,l,u),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=22955);module.exports=o})();