summaryrefslogtreecommitdiff
path: root/backend/injector.py
diff options
context:
space:
mode:
authorTrainDoctor <traindoctor@protonmail.com>2023-01-15 17:40:47 -0800
committerGitHub <noreply@github.com>2023-01-15 17:40:47 -0800
commit5fdcc56409a0bc75171df25ca50b6e09ffe7bf3a (patch)
tree2e35f9fe6246dca82ac415298af5c2bfe9c879b5 /backend/injector.py
parent915997d1495cc47f60e148252df3e4878a1179a5 (diff)
downloaddecky-loader-5fdcc56409a0bc75171df25ca50b6e09ffe7bf3a.tar.gz
decky-loader-5fdcc56409a0bc75171df25ca50b6e09ffe7bf3a.zip
Aa/bump dfl navigation fix jan2023 (#341)v2.4.10-pre1
* fix React DevTools * bump DFL to fix Navigation * Bump DFL and add shims * fix shims not applying due to timing issue Co-authored-by: AAGaming <aa@mail.catvibers.me>
Diffstat (limited to 'backend/injector.py')
-rw-r--r--backend/injector.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/backend/injector.py b/backend/injector.py
index f4dfd384..d77de13a 100644
--- a/backend/injector.py
+++ b/backend/injector.py
@@ -394,9 +394,12 @@ async def get_tab_lambda(test) -> Tab:
raise ValueError(f"Tab not found by lambda")
return tab
+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")
+
async def get_gamepadui_tab() -> Tab:
tabs = await get_tabs()
- tab = next((i for i in tabs if ("https://steamloopback.host/routes/" in i.url and (i.title == "Steam Shared Context presented by Valve™" or i.title == "Steam" or i.title == "SP"))), None)
+ tab = next((i for i in tabs if tab_is_gamepadui(i)), None)
if not tab:
raise ValueError(f"GamepadUI Tab not found")
return tab
@@ -405,3 +408,11 @@ async def inject_to_tab(tab_name, js, run_async=False):
tab = await get_tab(tab_name)
return await tab.evaluate_js(js, run_async)
+
+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"):
+ logger.debug("Closing tab: " + getattr(t, "title", "Untitled"))
+ await t.close()
+ await sleep(0.5) \ No newline at end of file