Skip to content

Commit

Permalink
Fix Barricade SCAN_PLAYERS and NEW_REPORT commands (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
timraay authored Sep 4, 2024
1 parent 3d30303 commit d8a81c9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
17 changes: 16 additions & 1 deletion rcon/barricade.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,23 @@
from channels.layers import get_channel_layer
from datetime import datetime
from enum import Enum
import os
import pydantic

from django.conf import settings as django_settings
django_settings.configure(CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [
{
"address": os.getenv("HLL_REDIS_URL"),
}
],
},
},
})

GROUP_NAME = "barricade"


Expand Down Expand Up @@ -63,7 +78,7 @@ class UnbanPlayersRequestPayload(pydantic.BaseModel):


class NewReportRequestPayloadPlayer(pydantic.BaseModel):
player_id: int
player_id: str
player_name: str
bm_rcon_url: str | None

Expand Down
2 changes: 1 addition & 1 deletion rcon/blacklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,5 +1224,5 @@ def handle_barricade_warn_online(
if online_player_ids:
send_to_barricade(
request_type=ServerRequestType.SCAN_PLAYERS,
payload=ScanPlayersRequestPayload(player_ids=online_player_ids),
payload=ScanPlayersRequestPayload(player_ids=online_player_ids).model_dump(),
)
3 changes: 2 additions & 1 deletion rconweb/api/barricade.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,10 @@ async def new_report(self, payload: NewReportRequestPayload):
BlacklistCommandHandler.send(
BlacklistCommand(
command=BlacklistCommandType.BARRICADE_WARN_ONLINE,
server_mask=None,
payload=BlacklistBarricadeWarnOnlineCommand(
player_ids=[player.player_id for player in payload.players]
),
).model_dump(),
)
)

Expand Down

0 comments on commit d8a81c9

Please sign in to comment.