Skip to content

Commit

Permalink
feat: New shortcut routes for beatmap files
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Oct 25, 2024
1 parent 04cc3c6 commit 4a2480e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/server/router/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { wLogger } from '@tosu/common';
import path from 'path';

import { HttpServer, sendJson } from '../index';
import { beatmapFileShortcut } from '../scripts/beatmapFile';
import { directoryWalker } from '../utils/directories';

export default function buildV2Api(app: HttpServer) {
Expand All @@ -27,6 +28,12 @@ export default function buildV2Api(app: HttpServer) {
sendJson(res, json);
});

app.route(
/\/files\/beatmap\/(?<type>background|audio|file)/,
'GET',
(req, res) => beatmapFileShortcut(req, res, req.params.type as any)
);

app.route(/^\/files\/beatmap\/(?<filePath>.*)/, 'GET', (req, res) => {
try {
const url = req.pathname || '/';
Expand Down

0 comments on commit 4a2480e

Please sign in to comment.