Skip to content

Commit

Permalink
feat: Moved v2/keys to v2/precise
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark authored and KotRikD committed Mar 10, 2024
1 parent bc9dadd commit 5daec8d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ gosu compatible api
v2 _**(tosu own api)**_
- `/json/v2` - Example of `/websocket/v2` response
- `/websocket/v2` - [response example](https://github.com/KotRikD/tosu/wiki/v2-websocket-api-response)
- `/websocket/v2/precise` - [response example](https://github.com/KotRikD/tosu/wiki/v2-precise-websocket-api-response)
- `/files/beatmap/{path}` - same as `/Songs/{path}`
- `/files/skin/{path}` - similar as `/files/beatmap/{path}`, but for a skin

Expand Down
4 changes: 2 additions & 2 deletions packages/server/router/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function buildV2Api({
);
}

if (request.url == '/websocket/v2/keys') {
if (request.url == '/websocket/v2/precise') {
preciseWebsocket.socket.handleUpgrade(
request,
socket,
Expand All @@ -49,7 +49,7 @@ export default function buildV2Api({
sendJson(res, json);
});

app.route('/json/v2/keys', 'GET', (req, res) => {
app.route('/json/v2/precise', 'GET', (req, res) => {
const osuInstances: any = Object.values(
req.instanceManager.osuInstances || {}
);
Expand Down
33 changes: 18 additions & 15 deletions packages/tosu/src/api/utils/buildResultV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,22 +459,25 @@ export const buildPreciseResult = (service: DataRepo): PreciseApiAnswer => {
const { gamePlayData } = service.getServices(['gamePlayData']);

return {
k1: {
isPressed: gamePlayData.KeyOverlay.K1Pressed,
count: gamePlayData.KeyOverlay.K1Count
},
k2: {
isPressed: gamePlayData.KeyOverlay.K2Pressed,
count: gamePlayData.KeyOverlay.K2Count
},
m1: {
isPressed: gamePlayData.KeyOverlay.M1Pressed,
count: gamePlayData.KeyOverlay.M1Count
keys: {
k1: {
isPressed: gamePlayData.KeyOverlay.K1Pressed,
count: gamePlayData.KeyOverlay.K1Count
},
k2: {
isPressed: gamePlayData.KeyOverlay.K2Pressed,
count: gamePlayData.KeyOverlay.K2Count
},
m1: {
isPressed: gamePlayData.KeyOverlay.M1Pressed,
count: gamePlayData.KeyOverlay.M1Count
},
m2: {
isPressed: gamePlayData.KeyOverlay.M2Pressed,
count: gamePlayData.KeyOverlay.M2Count
}
},
m2: {
isPressed: gamePlayData.KeyOverlay.M2Pressed,
count: gamePlayData.KeyOverlay.M2Count
}
hitErrors: gamePlayData.HitErrors
};
};

Expand Down

0 comments on commit 5daec8d

Please sign in to comment.