summaryrefslogtreecommitdiff
path: root/backend/injector.py
diff options
context:
space:
mode:
authormarios <marios8543@gmail.com>2022-05-26 04:00:18 +0300
committermarios <marios8543@gmail.com>2022-05-26 04:00:18 +0300
commit4b923c1dc70eaa4a3ca58d9e9f3218785b2fe919 (patch)
tree3394a7e752b61bdfa16b1a7f50842c4e1dbc0972 /backend/injector.py
parent74438a31458af8bddd08d90eacc6d63677bab844 (diff)
downloaddecky-loader-4b923c1dc70eaa4a3ca58d9e9f3218785b2fe919.tar.gz
decky-loader-4b923c1dc70eaa4a3ca58d9e9f3218785b2fe919.zip
display overhaul, compatibility with legacy plugins, fixes
Diffstat (limited to 'backend/injector.py')
-rw-r--r--backend/injector.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/injector.py b/backend/injector.py
index 16ced852..9b4fe353 100644
--- a/backend/injector.py
+++ b/backend/injector.py
@@ -48,6 +48,10 @@ class Tab:
await self.client.close()
return res
+ async def get_steam_resource(self, url):
+ res = await self.evaluate_js(f'(async function test() {{ return await (await fetch("{url}")).text() }})()', True)
+ return res["result"]["result"]["value"]
+
def __repr__(self):
return self.title
@@ -93,3 +97,15 @@ async def tab_has_global_var(tab_name, var_name):
return False
return res["result"]["result"]["value"]
+
+async def tab_has_element(tab_name, element_name):
+ try:
+ tab = await get_tab(tab_name)
+ except ValueError:
+ return False
+ res = await tab.evaluate_js(f"document.getElementById('{element_name}') != null", False)
+
+ if not "result" in res or not "result" in res["result"] or not "value" in res["result"]["result"]:
+ return False
+
+ return res["result"]["result"]["value"] \ No newline at end of file