Skip to content

Commit

Permalink
feat: add json route for `websocket/v2/keys
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Feb 19, 2024
1 parent 79f8b36 commit 804c0a7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/tosu/src/api/router/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const ApiV2 = ({
}
});

// todo
app.route('/json/v2', 'GET', (req, res) => {
const osuInstances: any = Object.values(
req.instanceManager.osuInstances || {}
Expand All @@ -43,6 +42,19 @@ export const ApiV2 = ({
sendJson(res, json);
});

app.route('/json/v2/keys', 'GET', (req, res) => {
const osuInstances: any = Object.values(
req.instanceManager.osuInstances || {}
);
if (osuInstances.length < 1) {
res.statusCode = 500;
return sendJson(res, { error: 'not_ready' });
}

const json = osuInstances[0].getKeyOverlay();
sendJson(res, json);
});

app.route(/\/files\/beatmap\/(?<filePath>.*)/, 'GET', readSongsFolder);

app.route(/\/files\/skin\/(?<filePath>.*)/, 'GET', (req, res) => {
Expand Down

0 comments on commit 804c0a7

Please sign in to comment.