Skip to content

Commit

Permalink
allow normal users to view mods
Browse files Browse the repository at this point in the history
  • Loading branch information
mrosack committed Dec 29, 2024
1 parent ab46e4d commit e9f0903
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/controllers/gameController/civ6Mods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class GameController_Civ6Mods {
@Request() request: HttpRequest,
gameId: string
): Promise<RawCiv6Mods[]> {
const { buffer } = await this.core(request, gameId);
const { buffer } = await this.core(request, gameId, true);

const wrapper = civ6.parse(buffer);

Expand Down Expand Up @@ -76,7 +76,7 @@ export class GameController_Civ6Mods {
return this.getModsFromWrapper(civ6.parse(updatedBuffer));
}

private async core(request: HttpRequest, gameId: string) {
private async core(request: HttpRequest, gameId: string, ignoreAdminCheck = false) {
const game = await this.gameRepository.getOrThrow404(gameId);

if (!game.inProgress) {
Expand All @@ -87,7 +87,7 @@ export class GameController_Civ6Mods {
throw new HttpResponseError(400, 'Game is not Civ 6');
}

if (game.createdBySteamId !== request.user) {
if (!ignoreAdminCheck && game.createdBySteamId !== request.user) {
throw new HttpResponseError(400, `Only admin can manage mods!`);
}

Expand Down

0 comments on commit e9f0903

Please sign in to comment.