Skip to content

Commit

Permalink
Feat: exclude admin bypass to 7722
Browse files Browse the repository at this point in the history
  • Loading branch information
Bizzonium committed Sep 5, 2022
1 parent 1401646 commit 37344c7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
13 changes: 12 additions & 1 deletion queue-backend/src/queue/queue.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Interval } from '@nestjs/schedule'
import { queuedServerList } from '../config/server-config'
import { PassService } from '../pass/pass.service'
import { UserDto } from '../auth/dto/user.dto';
import { isStaff } from '../common/utils';



Expand All @@ -32,8 +33,18 @@ export class QueueService {

private readonly logger = new Logger(QueueService.name);

async addToQueue(serverPort: string, { ckey, donatorTier }: UserDto): Promise<boolean> {
async addToQueue(serverPort: string, { ckey, donatorTier, adminFlags, whitelistPasses }: UserDto): Promise<boolean> {
if (await this.passService.checkPass(ckey, serverPort)) return false

if (isStaff(adminFlags)) {
if (serverPort === '7722' && whitelistPasses?.includes(parseInt(serverPort))) {
await this.playerListService.addFromQueue(serverPort, ckey)
return true
} else if (serverPort !== '7722') {
await this.playerListService.addFromQueue(serverPort, ckey)
return true
}
}

if (donatorTier >= 2) {
await this.playerListService.addFromQueue(serverPort, ckey)
Expand Down
6 changes: 3 additions & 3 deletions queue-backend/src/status-events/status-events.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export class StatusEventsService {

async onClientConnect({ckey, adminFlags}: UserDto, ip: string) {
await this.ipLinkService.linkIp(ckey, ip)
if (isStaff(adminFlags)) {
this.passService.addPassesForCkey(ckey)
}
// if (isStaff(adminFlags)) {
// this.passService.addPassesForCkey(ckey)
// }

if (!this.clientConnections[ckey]) {
this.clientConnections[ckey] = new ClientConnectionCounter(
Expand Down
2 changes: 1 addition & 1 deletion queue-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"typescript": "4.5.4"
},
"packageManager": "[email protected]"
}
}

0 comments on commit 37344c7

Please sign in to comment.