mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-05 13:28:08 +03:00
feat: search checksums in editablequest
This commit is contained in:
@@ -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<SongChartsSearch>(
|
||||
`/games/${game}/${playtype}/charts?search=${input}`
|
||||
`/games/${game}/${playtype}/charts?search=${encodeURIComponent(input)}`
|
||||
);
|
||||
|
||||
if (!res.success) {
|
||||
const res2 = await APIFetchV1<SongChartsSearch>(
|
||||
`/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),
|
||||
}));
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user