2021-09-28 13:00:19 +00:00
|
|
|
import type { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
|
|
|
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
2021-10-25 15:16:42 +00:00
|
|
|
const apiKey = req.headers.authorization || req.query.apiKey;
|
2021-09-28 13:00:19 +00:00
|
|
|
if (process.env.CRON_API_KEY !== apiKey) {
|
2021-10-25 15:16:42 +00:00
|
|
|
res.status(401).json({ message: "Not authenticated" });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (req.method !== "POST") {
|
|
|
|
res.status(405).json({ message: "Invalid method" });
|
|
|
|
return;
|
2021-09-28 13:00:19 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 00:59:06 +00:00
|
|
|
/**
|
|
|
|
* TODO:
|
2022-12-08 23:20:24 +00:00
|
|
|
* Remove this endpoint
|
2021-12-21 00:59:06 +00:00
|
|
|
*/
|
|
|
|
|
2021-09-28 13:00:19 +00:00
|
|
|
res.json({ ok: true });
|
|
|
|
}
|