fix(pterodactyl): fix failing to connect to the websocket due to a 403 error
This commit is contained in:
parent
53adeb4b80
commit
ea84044e73
1 changed files with 6 additions and 1 deletions
|
@ -29,6 +29,11 @@ class Pterodactyl(commands.Cog):
|
|||
base_url = await self.config.base_url()
|
||||
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).client
|
||||
websocket_credentials = client.servers.get_websocket(server_id)
|
||||
|
@ -40,7 +45,7 @@ class Pterodactyl(commands.Cog):
|
|||
self.logger.error(f'Failed to retrieve Pterodactyl websocket: {e}')
|
||||
return
|
||||
|
||||
async with websockets.connect(websocket_credentials['data']['socket']) as websocket:
|
||||
async with websockets.connect(websocket_credentials['data']['socket'], extra_headers=extra_headers) as websocket:
|
||||
self.logger.debug("WebSocket connection established")
|
||||
|
||||
# Send authentication token
|
||||
|
|
Loading…
Reference in a new issue