mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-13 00:23:02 -04:00
Add in client updater, Notices API
This commit is contained in:
parent
9aaa47ea4e
commit
8161a07dba
20 changed files with 525 additions and 48 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue