fix(pterodactyl): set origin header through websockets.connect and not through extra_headers

This commit is contained in:
Seaswimmer 2024-02-28 12:54:34 -05:00
parent b7635f06f5
commit caa03a63e6
Signed by: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -34,10 +34,6 @@ class Pterodactyl(commands.Cog):
api_key = await self.config.api_key() api_key = await self.config.api_key()
server_id = await self.config.server_id() server_id = await self.config.server_id()
extra_headers = {
"origin": base_url
}
try: try:
client = PterodactylClient(base_url, api_key, debug=True).client client = PterodactylClient(base_url, api_key, debug=True).client
websocket_credentials = client.servers.get_websocket(server_id) websocket_credentials = client.servers.get_websocket(server_id)
@ -49,7 +45,7 @@ class Pterodactyl(commands.Cog):
self.logger.error('Failed to retrieve Pterodactyl websocket: %s', e) self.logger.error('Failed to retrieve Pterodactyl websocket: %s', e)
return return
async for websocket in websockets.connect(websocket_credentials['data']['socket'], extra_headers=extra_headers): async for websocket in websockets.connect(websocket_credentials['data']['socket'], origin=base_url):
try: try:
self.logger.debug("WebSocket connection established") self.logger.debug("WebSocket connection established")