diff options
author | Vendicated <vendicated@riseup.net> | 2022-10-01 00:42:50 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-10-01 00:42:50 +0200 |
commit | 8161a07dba401f04dac93f861e6b2cffe53ab7e3 (patch) | |
tree | 1499e825bcd6a162bc43507f492b262e9b1901ed /src/Vencord.ts | |
parent | 9aaa47ea4e9ac068bf5fcbb997e31d722f43f1e5 (diff) | |
download | Vencord-8161a07dba401f04dac93f861e6b2cffe53ab7e3.tar.gz Vencord-8161a07dba401f04dac93f861e6b2cffe53ab7e3.tar.bz2 Vencord-8161a07dba401f04dac93f861e6b2cffe53ab7e3.zip |
Add in client updater, Notices API
Diffstat (limited to 'src/Vencord.ts')
-rw-r--r-- | src/Vencord.ts | 35 |
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(); |