From 899c3e11e612a6031b2d2b025849a7b688cb027b Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 19 Oct 2024 17:51:24 +0100 Subject: [PATCH] remove replay stuff --- .../src/controller/replay.controller.ts | 21 --------------- projects/backend/src/index.ts | 10 +------ .../backend/src/service/replay.service.ts | 27 ------------------- 3 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 projects/backend/src/controller/replay.controller.ts delete mode 100644 projects/backend/src/service/replay.service.ts diff --git a/projects/backend/src/controller/replay.controller.ts b/projects/backend/src/controller/replay.controller.ts deleted file mode 100644 index fb57984..0000000 --- a/projects/backend/src/controller/replay.controller.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Controller, Get } from "elysia-decorators"; -import { t } from "elysia"; -import { ReplayService } from "../service/replay.service"; - -@Controller("/replay") -export default class ReplayController { - @Get("/:playerId/:leaderboardId", { - config: {}, - params: t.Object({ - playerId: t.String({ required: true }), - leaderboardId: t.String({ required: true }), - }), - }) - public async getOpenGraphImage({ - params: { playerId, leaderboardId }, - }: { - params: { playerId: string; leaderboardId: string }; - }) { - return ReplayService.getReplay(playerId, leaderboardId); - } -} diff --git a/projects/backend/src/index.ts b/projects/backend/src/index.ts index a81e23b..d1c0832 100644 --- a/projects/backend/src/index.ts +++ b/projects/backend/src/index.ts @@ -16,7 +16,6 @@ import { scoresaberService } from "@ssr/common/service/impl/scoresaber"; import { delay, isProduction } from "@ssr/common/utils/utils"; import { connectScoreSaberWebSocket } from "@ssr/common/websocket/scoresaber-websocket"; import ImageController from "./controller/image.controller"; -import ReplayController from "./controller/replay.controller"; import { ScoreService } from "./service/score.service"; import { Config } from "@ssr/common/config"; import { PlayerDocument, PlayerModel } from "@ssr/common/model/player"; @@ -148,14 +147,7 @@ app.use( */ app.use( decorators({ - controllers: [ - AppController, - PlayerController, - ImageController, - ReplayController, - ScoresController, - LeaderboardController, - ], + controllers: [AppController, PlayerController, ImageController, ScoresController, LeaderboardController], }) ); diff --git a/projects/backend/src/service/replay.service.ts b/projects/backend/src/service/replay.service.ts deleted file mode 100644 index 89f29d1..0000000 --- a/projects/backend/src/service/replay.service.ts +++ /dev/null @@ -1,27 +0,0 @@ -import ky from "ky"; -import { NotFoundError } from "../error/not-found-error"; - -const SCORESABER_REPLAY_ENDPOINT = "https://scoresaber.com/api/game/telemetry/downloadReplay"; - -export class ReplayService { - /** - * Gets the app statistics. - */ - public static async getReplay(playerId: string, leaderboardId: string) { - const response = await ky.get(SCORESABER_REPLAY_ENDPOINT, { - searchParams: { - playerId, - leaderboardId, - }, - headers: { - "User-Agent": "ScoreSaber-PC/3.3.13", - }, - }); - const replayData = await response.arrayBuffer(); - if (replayData === undefined) { - throw new NotFoundError(`Replay for player "${playerId}" and leaderboard "${leaderboardId}" not found`); - } - - return replayData; - } -}