diff --git a/src/pages/api/beatleader/stars.js b/src/pages/api/beatleader/stars.js index cc2d9de..15943f5 100644 --- a/src/pages/api/beatleader/stars.js +++ b/src/pages/api/beatleader/stars.js @@ -15,6 +15,12 @@ const KEY = "BL_MAP_STAR_"; * @returns */ export default async function handler(req, res) { + if (!req.query.hash || !req.query.difficulty || !req.query.characteristic) { + return res.status(404).json({ + status: 404, + message: "Invalid request", + }); + } const mapHash = req.query.hash.replace("custom_level_", "").toLowerCase(); const difficulty = req.query.difficulty.replace(" ", ""); const characteristic = req.query.characteristic; diff --git a/src/pages/api/beatsaver/map.js b/src/pages/api/beatsaver/map.js index b11701f..6b5505c 100644 --- a/src/pages/api/beatsaver/map.js +++ b/src/pages/api/beatsaver/map.js @@ -1,6 +1,12 @@ import { getMapData } from "../../../../src/helpers/beatSaverHelpers"; export default async function handler(req, res) { + if (!req.query.hash) { + return res.status(404).json({ + status: 404, + message: "Invalid request", + }); + } const mapHash = req.query.hash; const mapData = await getMapData(mapHash); diff --git a/src/pages/api/scoresaber/stars.js b/src/pages/api/scoresaber/stars.js index cad143e..4a8e261 100644 --- a/src/pages/api/scoresaber/stars.js +++ b/src/pages/api/scoresaber/stars.js @@ -16,6 +16,12 @@ const KEY = "SS_MAP_STAR_"; * @returns */ export default async function handler(req, res) { + if (!req.query.hash) { + return res.status(404).json({ + status: 404, + message: "Invalid request", + }); + } const mapHash = req.query.hash.replace("custom_level_", "").toLowerCase(); const difficulty = req.query.difficulty.replace(" ", ""); const characteristic = req.query.characteristic;