Compare commits

..

No commits in common. "2017cbb226ae3c898e6742b911dc7a86b4e72b7f" and "b7635f06f53619209aa4a16b3b52e8d2d732a2d3" have entirely different histories.

View file

@ -34,17 +34,14 @@ class Pterodactyl(commands.Cog):
api_key = await self.config.api_key()
server_id = await self.config.server_id()
extra_headers = {
"origin": base_url
}
try:
client = PterodactylClient(base_url, api_key, debug=True).client
self.client = client
websocket_credentials = client.servers.get_websocket(server_id)
self.logger.debug("""Websocket connection details retrieved:
Socket: %s
Token: %s...""",
websocket_credentials['data']['socket'],
websocket_credentials['data']['token'][:20]
)
#NOTE - The token is truncated to prevent it from being logged in its entirety, for security reasons
self.logger.debug("Websocket connection details retrieved:\nSocket: %s\nToken: %s", websocket_credentials['data']['socket'], websocket_credentials['data']['token'])
except exceptions.ClientConfigError as e:
self.logger.error('Failed to initialize Pterodactyl client: %s', e)
return
@ -52,7 +49,7 @@ class Pterodactyl(commands.Cog):
self.logger.error('Failed to retrieve Pterodactyl websocket: %s', e)
return
async for websocket in websockets.connect(websocket_credentials['data']['socket'], origin=base_url):
async for websocket in websockets.connect(websocket_credentials['data']['socket'], extra_headers=extra_headers):
try:
self.logger.debug("WebSocket connection established")
@ -60,6 +57,7 @@ class Pterodactyl(commands.Cog):
await websocket.send(auth_message)
self.logger.debug("Authentication message sent")
self.client = client
self.websocket = websocket
while True: