mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-11 23:53:03 -04:00
fix PronounDB crash with new profile in dms, force start dependencies
This commit is contained in:
parent
b48c8d8a4a
commit
81edc14070
8 changed files with 80 additions and 24 deletions
|
@ -30,11 +30,36 @@ export const PMLogger = logger;
|
|||
export const plugins = Plugins;
|
||||
export const patches = [] as Patch[];
|
||||
|
||||
const settings = Settings.plugins;
|
||||
|
||||
export function isPluginEnabled(p: string) {
|
||||
return (Settings.plugins[p]?.enabled || Plugins[p]?.required) ?? false;
|
||||
return (
|
||||
Plugins[p]?.required ||
|
||||
Plugins[p]?.isDependency ||
|
||||
settings[p]?.enabled
|
||||
) ?? false;
|
||||
}
|
||||
|
||||
for (const p of Object.values(Plugins))
|
||||
const pluginsValues = Object.values(Plugins);
|
||||
|
||||
// First roundtrip to mark and force enable dependencies
|
||||
for (const p of pluginsValues) {
|
||||
p.dependencies?.forEach(d => {
|
||||
const dep = Plugins[d];
|
||||
if (dep) {
|
||||
settings[d].enabled = true;
|
||||
dep.isDependency = true;
|
||||
}
|
||||
else {
|
||||
const error = new Error(`Plugin ${p.name} has unresolved dependency ${d}`);
|
||||
if (IS_DEV)
|
||||
throw error;
|
||||
logger.warn(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (const p of pluginsValues)
|
||||
if (p.patches && isPluginEnabled(p.name)) {
|
||||
for (const patch of p.patches) {
|
||||
patch.plugin = p.name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue