aboutsummaryrefslogtreecommitdiff
path: root/src/components/Settings.tsx
diff options
context:
space:
mode:
authorArjixWasTaken <53124886+ArjixWasTaken@users.noreply.github.com>2022-10-06 01:11:32 +0300
committerGitHub <noreply@github.com>2022-10-06 00:11:32 +0200
commite563521416052808bcec57057b921f0c0b6ca594 (patch)
tree6e0e116c7377bf5417b0be119f10316bc4cab998 /src/components/Settings.tsx
parenta9e67aa3400075ec4fb2fe6d59d006bae8981f0c (diff)
downloadVencord-e563521416052808bcec57057b921f0c0b6ca594.tar.gz
Vencord-e563521416052808bcec57057b921f0c0b6ca594.tar.bz2
Vencord-e563521416052808bcec57057b921f0c0b6ca594.zip
Add commands API (#38)
Diffstat (limited to 'src/components/Settings.tsx')
-rw-r--r--src/components/Settings.tsx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index 4e0196f..0678745 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -129,23 +129,25 @@ export default ErrorBoundary.wrap(function Settings() {
value={settings.plugins[p.name].enabled || p.required || dependency}
onChange={v => {
settings.plugins[p.name].enabled = v;
+ let needsRestart = Boolean(p.patches?.length);
if (v) {
p.dependencies?.forEach(d => {
+ const dep = Plugins[d];
+ needsRestart ||= Boolean(dep.patches?.length && !settings.plugins[d].enabled);
settings.plugins[d].enabled = true;
- if (!Plugins[d].started && !stopPlugin) {
- settings.plugins[p.name].enabled = false;
+ if (!needsRestart && !dep.started && !startPlugin(dep)) {
showErrorToast(`Failed to start dependency ${d}. Check the console for more info.`);
}
});
- if (!p.started && !startPlugin(p)) {
+ if (!needsRestart && !p.started && !startPlugin(p)) {
showErrorToast(`Failed to start plugin ${p.name}. Check the console for more info.`);
}
} else {
- if (p.started && !stopPlugin(p)) {
+ if ((p.started || !p.start && p.commands?.length) && !stopPlugin(p)) {
showErrorToast(`Failed to stop plugin ${p.name}. Check the console for more info.`);
}
}
- if (p.patches) changes.handleChange(p.name);
+ if (needsRestart) changes.handleChange(p.name);
}}
note={p.description}
tooltipNote={