"use strict";(()=>{var e={};e.id=5116,e.ids=[5116],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},21572:e=>{e.exports=require("nodemailer")},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}}})},57646:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>d,routeModule:()=>f});var n={};t.r(n),t.d(n,{default:()=>p});var s=t(89947),a=t(2706),i=t(96762),o=t(59474),l=t.n(o),u=t(48225),c=t.n(u);async function p(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});try{await l()({alias:"support",html:"<h1>Test Mail</h1><p>Hi there DSQL. Firing up on all systems now.</p>",subject:"Test Mail",text:"Test Mail",to:"dexomediaorg@gmail.com"}),r.json({success:!0})}catch(e){c()({component:"/api/addUserMedia/catch-error",message:e.message}),r.json({success:!1,msg:"Database Files could not be written!"})}}let d=(0,i.M)(n,"default"),m=(0,i.M)(n,"config"),f=new s.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/test/mail",pathname:"/api/test/mail",bundlePath:"",filename:""},userland:n})},59474:(e,r,t)=>{let n=t(29021),s=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:i}){let o;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let l=(i?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!n.existsSync("./email/index.html"))return;let u=n.readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,a||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let n={};n.from=`"Datasquirel" <${l}>`,n.sender=l,i&&(n["replyTo "]=l),n.to=e,n.subject=r,n.text=t,n.html=u,o=await s.sendMail(n)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return o}},48225:(e,r,t)=>{let n=t(29021),{IncomingMessage:s}=t(81630);e.exports=async function({user:e,message:r,component:t,noMail:s,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"],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 s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
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)}`),o&&(s+=`
IP: ${o}`),s+=`
Date: ${i.toDateString()}
========================================`,n.existsSync("./.tmp/error.log")||n.writeFileSync("./.tmp/error.log","","utf-8");let l=n.readFileSync("./.tmp/error.log","utf-8");n.writeFileSync("./.tmp/error.log",s),n.appendFileSync("./.tmp/error.log",`




${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},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=57646);module.exports=t})();