move webpack check into index

This commit is contained in:
AAGaming
2024-06-27 00:07:38 -04:00
parent 13a38d82fd
commit dcff7d146b
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ class PluginManager:
if ON_LINUX and await tab.has_global_var("deckyHasLoaded", False):
await restart_webhelper()
return # We'll catch the next tab in the main loop
await tab.evaluate_js("try{if (window.deckyHasLoaded){setTimeout(() => SteamClient.Browser.RestartJSContext(), 100)}else{window.deckyHasLoaded = true;(async()=>{try{while(!window.webpackChunksteamui){await new Promise(r => setTimeout(r, 10))};await import('http://localhost:1337/frontend/index.js?v=%s')}catch(e){console.error(e)};})();}}catch(e){console.error(e)}" % (get_loader_version(), ), False, False, False)
await tab.evaluate_js("try{if (window.deckyHasLoaded){setTimeout(() => SteamClient.Browser.RestartJSContext(), 100)}else{window.deckyHasLoaded = true;(async()=>{try{await import('http://localhost:1337/frontend/index.js?v=%s')}catch(e){console.error(e)};})();}}catch(e){console.error(e)}" % (get_loader_version(), ), False, False, False)
except:
logger.info("Failed to inject JavaScript into tab\n" + format_exc())
pass
+5
View File
@@ -5,6 +5,11 @@ interface Window {
}
(async () => {
// Wait for react to definitely be loaded
while (!window.webpackChunksteamui || window.webpackChunksteamui <= 3) {
await new Promise(r => setTimeout(r, 10)); // Can't use DFL sleep here.
}
if (!window.SP_REACT) {
console.debug('[Decky:Boot] Setting up React globals...');
// deliberate partial import