check token on api post request
This commit is contained in:
@@ -3,6 +3,10 @@ import config from "@/config";
|
||||
|
||||
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (req.method === "POST") {
|
||||
if (req.headers.token !== config.token) {
|
||||
res.status(403).json({ error: "wrong token" });
|
||||
return;
|
||||
}
|
||||
// update config
|
||||
config.begin = req.body.begin ?? config.begin;
|
||||
config.limit = req.body.limit ?? config.limit;
|
||||
|
||||
Reference in New Issue
Block a user