diff options
author | megumin <megumin.bakaretsurie@gmail.com> | 2022-10-23 19:09:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-23 19:09:02 +0100 |
commit | ffbb52512cd61764cfe04c1cf2707eb63d5e57bf (patch) | |
tree | 3d372a20e6d014c6a1db19370f7cdc508c80e9cc /src/plugins/index.ts | |
parent | ff9d904fcb4d625fea82b9954626dec6fc1a939d (diff) | |
download | Vencord-ffbb52512cd61764cfe04c1cf2707eb63d5e57bf.tar.gz Vencord-ffbb52512cd61764cfe04c1cf2707eb63d5e57bf.tar.bz2 Vencord-ffbb52512cd61764cfe04c1cf2707eb63d5e57bf.zip |
fix: plugin dependencies not enabling (#150)
Diffstat (limited to 'src/plugins/index.ts')
-rw-r--r-- | src/plugins/index.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/index.ts b/src/plugins/index.ts index f15a711..2ce9c0f 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -42,6 +42,26 @@ export function startAllPlugins() { } } +export function startDependenciesRecursive(p: Plugin) { + let restartNeeded = false; + const failures: string[] = []; + if (p.dependencies) for (const dep of p.dependencies) { + if (!Settings.plugins[dep].enabled) { + startDependenciesRecursive(Plugins[dep]); + // If the plugin has patches, don't start the plugin, just enable it. + if (Plugins[dep].patches) { + logger.warn(`Enabling dependency ${dep} requires restart.`); + Settings.plugins[dep].enabled = true; + restartNeeded = true; + continue; + } + const result = startPlugin(Plugins[dep]); + if (!result) failures.push(dep); + } + } + return { restartNeeded, failures }; +} + export function startPlugin(p: Plugin) { if (p.start) { logger.info("Starting plugin", p.name); |