diff --git a/client/src/components/targets/AddNewGoalForQuestModal.tsx b/client/src/components/targets/AddNewGoalForQuestModal.tsx index 00df3acee..5ff7d03eb 100644 --- a/client/src/components/targets/AddNewGoalForQuestModal.tsx +++ b/client/src/components/targets/AddNewGoalForQuestModal.tsx @@ -312,16 +312,20 @@ function ChartSelect({ // debounce this query to only run after 300ms of no more user input. lastTimeout = window.setTimeout(async () => { const res = await APIFetchV1( - `/games/${game}/${playtype}/charts?search=${input}` + `/games/${game}/${playtype}/charts?search=${encodeURIComponent(input)}` ); - if (!res.success) { + const res2 = await APIFetchV1( + `/search/chart-hash?search=${encodeURIComponent(input)}` + ); + + if (!res.success || !res2.success) { throw new Error(res.description); } - const songMap = CreateSongMap(res.body.songs); + const songMap = CreateSongMap([...res.body.songs, ...res2.body.songs]); - const options = res.body.charts.map((e) => ({ + const options = [...res.body.charts, ...res2.body.charts].map((e) => ({ value: e.chartID, label: FormatChart(game, songMap.get(e.songID)!, e), })); diff --git a/server/src/server/router/api/v1/search/router.ts b/server/src/server/router/api/v1/search/router.ts index e0cf6289d..fdbc82e19 100644 --- a/server/src/server/router/api/v1/search/router.ts +++ b/server/src/server/router/api/v1/search/router.ts @@ -95,7 +95,7 @@ router.get("/", async (req, res) => { * * @note This matches MD5 and SHA256 for BMS/PMS, and SHA1 for USC. */ -router.get("/chart-hash", RequireBokutachi, async (req, res) => { +router.get("/chart-hash", async (req, res) => { if (!IsString(req.query.search)) { return res.status(400).json({ success: false, @@ -107,7 +107,7 @@ router.get("/chart-hash", RequireBokutachi, async (req, res) => { return res.status(200).json({ success: true, - description: `Searched BMS, PMS and USC for ${req.query.search}.`, + description: `Searched for chart hash ${req.query.search}.`, body: { songs, charts,