Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Barricade SCAN_PLAYERS and NEW_REPORT commands #674

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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