Skip to content

Commit

Permalink
fix get_tabs oopsie
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Jul 14, 2022
1 parent b1739a6 commit a644363
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions backend/injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ async def _send_devtools_cmd(self, dc, receive=True):
return (await self.websocket.receive_json()) if receive else None
raise RuntimeError("Websocket not opened")

async def evaluate_js(self, js, run_async=False):
await self.open_websocket()
async def evaluate_js(self, js, run_async=False, manage_socket=True):
if manage_socket:
await self.open_websocket()

res = await self._send_devtools_cmd({
"id": 1,
"method": "Runtime.evaluate",
Expand All @@ -45,7 +47,8 @@ async def evaluate_js(self, js, run_async=False):
}
})

await self.client.close()
if manage_socket:
await self.client.close()
return res

async def get_steam_resource(self, url):
Expand All @@ -72,7 +75,7 @@ async def get_tabs():
r = await res.json()
return [Tab(i) for i in r]
else:
raise Exception(f"/json did not return 200. {await r.text()}")
raise Exception(f"/json did not return 200. {await res.text()}")

async def get_tab(tab_name):
tabs = await get_tabs()
Expand Down

0 comments on commit a644363

Please sign in to comment.