"use strict";(()=>{vare={};e.id=5122,e.ids=[5122],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")},96762:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){returnfunctione(t,o){returnoint?t[o]:"then"int&&"function"==typeoft.then?t.then(t=>e(t,o)):"function"==typeoft&&"default"===o?t:void0}}})},61660:(e,t,o)=>{o.r(t),o.d(t,{config:()=>h,default:()=>P,routeModule:()=>A});varn={};o.r(n),o.d(n,{default:()=>g});varr=o(89947),s=o(2706),i=o(96762),u=o(33873),a=o.n(u),l=o(29021),d=o.n(l),c=o(55511);letp=process.env.DSQL_GITHUB_WEBHOOK_SECRET||"",f=e=>{console.log(e.headers);lett=(0,c.createHmac)("sha256",p).update(JSON.stringify(e.body)).digest("hex");returnconsole.log(t),`sha256=${t}`===e.headers["x-hub-signature-256"]};asyncfunctiong(e,t){if("POST"!==e.method)returnt.json({msg:"Failed!"});if(!f(e)){console.log("Authorization failed"),t.status(401).send("Unauthorized");return}leto=e.body;try{console.log("Request Recieved");lete=o.ref;if(!e?.match(/main/)){console.log("Not Main Branch"),t.json({success:!0});return}d().writeFileSync(a().resolve(process.cwd(),"./.dist","REDEPLOY_FLAG"),String(Date.now()),"utf-8"),console.log("Deploy Flag Triggered. Now Redeploying ..."),t.json({success:!0})}catch(e){console.log(e),t.json({msg:"Not Handled Yet"})}}letP=(0,i.M)(n,"default"),h=(0,i.M)(n,"config"),A=newr.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/webhooks/github-push",pathname:"/api/webhooks/github-push",bundlePath:"",filename:""},userland:n})},2706:(e,t)=>{Object.defineProperty(t,"A",{enumerable:!0,get:function(){returno}});varo=function(e){returne.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,t,o)=>{e.exports=o(75600)}};vart=require("../../../webpack-api-runtime.js");t.C(e);varo=t(t.s=61660);module.exports=o})();