summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorAAGaming <aagaming@riseup.net>2024-06-13 15:12:24 -0400
committerAAGaming <aagaming@riseup.net>2024-06-13 15:12:24 -0400
commite6b1950bcb7795114be6a2d0c2e85434d883284b (patch)
tree4b04daf55267b7ab0866d2cf0e5777291b224e45 /frontend
parent0c6c7b1b06c93b961b183e91ab479d8a3d8c28a5 (diff)
downloaddecky-loader-e6b1950bcb7795114be6a2d0c2e85434d883284b.tar.gz
decky-loader-e6b1950bcb7795114be6a2d0c2e85434d883284b.zip
fix for latest beta (backport)
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/index.ts20
1 files changed, 16 insertions, 4 deletions
diff --git a/frontend/src/index.ts b/frontend/src/index.ts
index a108df66..7bb935c7 100644
--- a/frontend/src/index.ts
+++ b/frontend/src/index.ts
@@ -1,12 +1,24 @@
// Sets up DFL, then loads start.ts which starts up the loader
+interface Window {
+ // Shut up TS
+ SP_REACTDOM: any;
+}
+
(async () => {
- console.debug('Setting up @decky/ui...');
+ if (!window.SP_REACT) {
+ console.debug('[Decky:Boot] Setting up React globals...');
+ // deliberate partial import
+ const DFLWebpack = await import('decky-frontend-lib/dist/webpack');
+ window.SP_REACT = DFLWebpack.findModule((m) => m.Component && m.PureComponent && m.useLayoutEffect);
+ window.SP_REACTDOM = DFLWebpack.findModule((m) => m.createPortal && m.createRoot);
+ }
+ console.debug('[Decky:Boot] Setting up @decky/ui...');
window.DFL = await import('@decky/ui');
- console.debug('Authenticating with Decky backend...');
+ console.debug('[Decky:Boot] Authenticating with Decky backend...');
window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text());
- console.debug('Connecting to Decky backend...');
+ console.debug('[Decky:Boot] Connecting to Decky backend...');
window.DeckyBackend = new (await import('./wsrouter')).WSRouter();
await DeckyBackend.connect();
- console.debug('Starting Decky!');
+ console.debug('[Decky:Boot] Starting Decky!');
await import('./start');
})();