dsql-admin/dsql-app/.local_dist/server/pages/api/admin/grabBackups.js

1 line
2.3 KiB
JavaScript
Raw Normal View History

2024-12-05 07:03:33 +00:00
"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,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},89995:(e,t,r)=>{r.r(t),r.d(t,{config:()=>p,default:()=>d,routeModule:()=>f});var n={};r.r(n),r.d(n,{default:()=>c});var o=r(89947),s=r(2706),u=r(96762),a=r(19131),i=r.n(a);let l=r(29021);async function c(e,t){if("GET"!==e.method)return t.json({success:!1,msg:"Failed"});let r=await i()(e);if(!r?.logged_in_status)return t.json({success:!1,log:"No Logs"});let n="./.tmp/backups";l.existsSync(n)||l.mkdirSync(n);let o=l.readdirSync(n);t.json({success:!0,backups:o})}let d=(0,u.M)(n,"default"),p=(0,u.M)(n,"config"),f=new o.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/admin/grabBackups",pathname:"/api/admin/grabBackups",bundlePath:"",filename:""},userland:n})},19131:(e,t,r)=>{let{IncomingMessage:n}=r(81630),o=r(72907);e.exports=async function(e){if(!e.cookies?.datasquirelSuAdminUserAuthKey)return console.log("No auth key cookie found"),null;let t=o(e.cookies.datasquirelSuAdminUserAuthKey);if(!t)return console.log("No user payload found"),null;let r=JSON.parse(t);return r.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):r.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):r}},72907:(e,t,r)=>{let{scryptSync:n,createDecipheriv:o}=r(55511),{Buffer:s}=r(79428);e.exports=e=>{let t=o("aes-192-cbc",n(process.env.DSQL_ENCRYPTION_PASSWORD||"",process.env.DSQL_ENCRYPTION_SALT||"",24),s.alloc(16,0));try{let r=t.update(e,"hex","utf8");return r+=t.final("utf8")}catch(e){return null}}},2706:(e,t)=>{var r;Object.defineProperty(t,"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,t,r)=>{e.exports=r(75600)}};var t=require("../../../webpack-api-runtime.js");t.C(e);var r=t(t.s=89995);module.exports=r})();