From 40c7c1b515abf4abcecd6480afb28f27fb71d0f0 Mon Sep 17 00:00:00 2001
From: AAGaming <aagaming@riseup.net>
Date: Sat, 30 Dec 2023 21:32:23 -0500
Subject: port updater to ws, also small refactoring

---
 frontend/src/start.tsx | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

(limited to 'frontend/src/start.tsx')

diff --git a/frontend/src/start.tsx b/frontend/src/start.tsx
index cc2c02c2..e8c489f2 100644
--- a/frontend/src/start.tsx
+++ b/frontend/src/start.tsx
@@ -6,15 +6,13 @@ import PluginLoader from './plugin-loader';
 import { DeckyUpdater } from './updater';
 
 declare global {
-  interface Window {
-    DeckyPluginLoader: PluginLoader;
-    DeckyUpdater?: DeckyUpdater;
-    importDeckyPlugin: Function;
-    deckyHasLoaded: boolean;
-    deckyHasConnectedRDT?: boolean;
-    deckyAuthToken: string;
-    DFL?: any;
-  }
+  export var DeckyPluginLoader: PluginLoader;
+  export var DeckyUpdater: DeckyUpdater | undefined; // TODO get rid of this
+  export var importDeckyPlugin: Function;
+  export var deckyHasLoaded: boolean;
+  export var deckyHasConnectedRDT: boolean | undefined;
+  export var deckyAuthToken: string;
+  export var DFL: any | undefined;
 }
 
 (async () => {
@@ -37,7 +35,7 @@ declare global {
       backend: {
         loadPath: 'http://127.0.0.1:1337/locales/{{lng}}.json',
         customHeaders: {
-          Authentication: window.deckyAuthToken,
+          Authentication: deckyAuthToken,
         },
         requestOptions: {
           credentials: 'include',
@@ -45,12 +43,12 @@ declare global {
       },
     });
 
-  window.DeckyPluginLoader?.dismountAll();
-  window.DeckyPluginLoader?.deinit();
+  window?.DeckyPluginLoader?.dismountAll();
+  window?.DeckyPluginLoader?.deinit();
   window.DeckyPluginLoader = new PluginLoader();
-  window.DeckyPluginLoader.init();
+  DeckyPluginLoader.init();
   window.importDeckyPlugin = function (name: string, version: string) {
-    window.DeckyPluginLoader?.importPlugin(name, version);
+    DeckyPluginLoader?.importPlugin(name, version);
   };
 })();
 
-- 
cgit v1.2.3

