-
-
Notifications
You must be signed in to change notification settings - Fork 83
Replace humanize with ISO timestamp for ban message #1102
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
base: develop
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,6 @@ | |
| import urllib.request | ||
| from functools import wraps | ||
| from typing import ClassVar, Optional | ||
|
|
||
| import aiohttp | ||
| from sqlalchemy import and_, func, select | ||
| from sqlalchemy.exc import DBAPIError, OperationalError | ||
|
|
||
|
|
@@ -1503,10 +1501,16 @@ | |
| return | ||
|
|
||
| ban_expiry = row.expires_at | ||
| ban_reason = row.reason | ||
| if now < ban_expiry: | ||
| self._logger.debug( | ||
| "Aborting connection of banned user: %s, %s, %s", | ||
| self.player.id, self.player.login, self.session | ||
| ) | ||
| raise BanError(ban_expiry, ban_reason) | ||
| ban_reason = row.reason | ||
| if now < ban_expiry: | ||
| self._logger.debug('Aborting connection of banned user: %s, %s, %s', | ||
| self.player.id, self.player.login, self.session) | ||
| self.send_ban_message_and_abort(ban_expiry, ban_reason) | ||
|
|
||
| def send_ban_message_and_abort(self, ban_expiry, reason): | ||
| error_payload = { | ||
| "command": "banned", | ||
| "expires_at": ban_expiry.astimezone(timezone.utc).isoformat() | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Send the banned payload as the top-level command. The 🤖 Prompt for AI Agents |
||
| raise ClientError(error_payload, recoverable=False) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win
Restore the
aiohttpimport.The
import aiohttpstatement was removed, butcheck_policy_conformitystill callsaiohttp.ClientSessionat Line 589. Whenconfig.USE_POLICY_SERVERis enabled, every login raisesNameError.🐛 Proposed fix
+import aiohttp from sqlalchemy import and_, func, select from sqlalchemy.exc import DBAPIError, OperationalError📝 Committable suggestion
🤖 Prompt for AI Agents