aboutsummaryrefslogtreecommitdiff
path: root/src/Vencord.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/Vencord.ts')
-rw-r--r--src/Vencord.ts35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/Vencord.ts b/src/Vencord.ts
index 3a405b2..cb06182 100644
--- a/src/Vencord.ts
+++ b/src/Vencord.ts
@@ -1,12 +1,41 @@
export * as Plugins from "./plugins";
export * as Webpack from "./webpack";
export * as Api from "./api";
-export { Settings } from "./api/settings";
+import { popNotice, showNotice } from "./api/Notices";
+import { Settings } from "./api/settings";
+import { startAllPlugins } from "./plugins";
+
+export { Settings };
import "./utils/patchWebpack";
import "./utils/quickCss";
-import { waitFor } from "./webpack";
+import { checkForUpdates, UpdateLogger } from './utils/updater';
+import { onceReady } from "./webpack";
+import { Router } from "./webpack/common";
export let Components;
-waitFor("useState", () => setTimeout(() => import("./components").then(mod => Components = mod), 0));
+async function init() {
+ await onceReady;
+ startAllPlugins();
+ Components = await import("./components");
+
+ try {
+ const isOutdated = await checkForUpdates();
+ if (isOutdated && Settings.notifyAboutUpdates)
+ setTimeout(() => {
+ showNotice(
+ "A Vencord update is available!",
+ "View Update",
+ () => {
+ popNotice();
+ Router.open("Vencord");
+ }
+ );
+ }, 10000);
+ } catch (err) {
+ UpdateLogger.error("Failed to check for updates", err);
+ }
+}
+
+init();