From 395e45167d742f7354688b84cd50b1fc2e644266 Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Thu, 9 Mar 2023 18:58:19 +0100 Subject: Shared Ctx tab rename to SharedJSContext (#395) --- backend/injector.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'backend/injector.py') diff --git a/backend/injector.py b/backend/injector.py index d77de13a..aeebc2b7 100644 --- a/backend/injector.py +++ b/backend/injector.py @@ -394,8 +394,10 @@ async def get_tab_lambda(test) -> Tab: raise ValueError(f"Tab not found by lambda") return tab +SHARED_CTX_NAMES = ["SharedJSContext", "Steam Shared Context presented by Valve™", "Steam", "SP"] + def tab_is_gamepadui(t: Tab) -> bool: - return "https://steamloopback.host/routes/" in t.url and (t.title == "Steam Shared Context presented by Valve™" or t.title == "Steam" or t.title == "SP") + return "https://steamloopback.host/routes/" in t.url and t.title in SHARED_CTX_NAMES async def get_gamepadui_tab() -> Tab: tabs = await get_tabs() @@ -412,7 +414,7 @@ async def inject_to_tab(tab_name, js, run_async=False): async def close_old_tabs(): tabs = await get_tabs() for t in tabs: - if not t.title or (t.title != "Steam Shared Context presented by Valve™" and t.title != "Steam" and t.title != "SP"): + if not t.title or t.title not in SHARED_CTX_NAMES: logger.debug("Closing tab: " + getattr(t, "title", "Untitled")) await t.close() - await sleep(0.5) \ No newline at end of file + await sleep(0.5) -- cgit v1.2.3