feat(pterodactyl): added a regex blacklist command
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 19s
Actions / Build Documentation (MkDocs) (push) Successful in 24s

This commit is contained in:
SeaswimmerTheFsh 2024-03-02 19:27:36 -05:00
parent 5c2bfea238
commit f6ebbae583
Signed by: cswimr
GPG key ID: B8953EC01E5C4063
4 changed files with 58 additions and 3 deletions

View file

@ -45,8 +45,10 @@ async def establish_websocket_connection(coginstance: Pterodactyl) -> None:
logger.info("WebSocket authentication successful")
if json.loads(message)['event'] == 'console output' and await config.console_channel() is not None:
if await config.current_status() in ('running', 'offline', ''):
content = remove_ansi_escape_codes(json.loads(message)['args'][0])
msg = json.loads(message)['args'][0]
regex_blacklist = await config.regex_blacklist()
if await config.current_status() in ('running', 'offline', '') and not any(re.match(regex, msg) for regex in regex_blacklist):
content = remove_ansi_escape_codes(msg)
if await config.mask_ip() is True:
content = mask_ip(content)