"use strict";(()=>{var e={};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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},96762:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,o){return o in t?t[o]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,o)):"function"==typeof t&&"default"===o?t:void 0}}})},22394:(e,t,o)=>{o.r(t),o.d(t,{config:()=>h,default:()=>g,routeModule:()=>P});var r={};o.r(r),o.d(r,{default:()=>f});var n=o(89947),s=o(2706),i=o(96762),u=o(33873),a=o.n(u);o(81630);let l=o(29021),{createHmac:d}=o(55511),c=process.env.DSQL_GITHUB_WEBHOOK_SECRET||"",p=e=>{console.log(e.headers);let t=d("sha256",c).update(JSON.stringify(e.body)).digest("hex");return console.log(t),`sha256=${t}`===e.headers["x-hub-signature-256"]};async function f(e,t){if("POST"!==e.method)return t.json({msg:"Failed!"});if(!p(e)){console.log("Authorization failed"),t.status(401).send("Unauthorized");return}let o=e.body;try{console.log("Request Recieved");let e=o.ref;if(!e?.match(/main/)){console.log("Not Main Branch"),t.json({success:!0});return}l.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"})}}let g=(0,i.M)(r,"default"),h=(0,i.M)(r,"config"),P=new n.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/webhooks/github-push",pathname:"/api/webhooks/github-push",bundlePath:"",filename:""},userland:r})},2706:(e,t)=>{var o;Object.defineProperty(t,"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,t,o)=>{e.exports=o(75600)}};var t=require("../../../webpack-api-runtime.js");t.C(e);var o=t(t.s=22394);module.exports=o})();