13 lines
2.5 KiB
JavaScript
13 lines
2.5 KiB
JavaScript
"use strict";(()=>{var e={};e.id=4396,e.ids=[4396],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")},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}}})},24351:(e,r,t)=>{t.r(r),t.d(r,{config:()=>c,default:()=>u,routeModule:()=>d});var n={};t.r(n),t.d(n,{default:()=>l});var s=t(89947),i=t(2706),o=t(96762);t(59474);let a=t(29021);async function l(e,r){if("POST"!==e.method)return r.json({user:null,msg:"Failed"});let{component:t,message:n,user:s}=e.body,i=`💻 CLIENT ERROR ===========================
|
|
User Id: ${s?.id}
|
|
User Name: ${s?.first_name} ${s?.last_name}
|
|
User Email: ${s?.email}
|
|
Error Message: ${n}
|
|
Component: ${t}
|
|
Date: ${Date()}
|
|
========================================`,o=a.readFileSync("./.tmp/error.log","utf-8");a.writeFileSync("./.tmp/error.log",i),a.appendFileSync("./.tmp/error.log",`
|
|
|
|
|
|
|
|
|
|
${o}`),r.json({success:!0})}let u=(0,o.M)(n,"default"),c=(0,o.M)(n,"config"),d=new s.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/admin/clientError",pathname:"/api/admin/clientError",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:i,alias:o}){let a;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let l=(o?.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}}/,i||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let n={};n.from=`"Datasquirel" <${l}>`,n.sender=l,o&&(n["replyTo "]=l),n.to=e,n.subject=r,n.text=t,n.html=u,a=await s.sendMail(n)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return a}},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=24351);module.exports=t})(); |