From 6fba20239b305e92a79b360ee87850f8f2d9b62e Mon Sep 17 00:00:00 2001
From: marios <marios8543@gmail.com>
Date: Mon, 6 Oct 2025 23:54:49 +0300
Subject: Feat disable plugins (#810)

* implement base frontend changes necessary for plugin disabling

* implement frontend diisable functions/ modal

---------

Co-authored-by: Jesse Bofill <jesse_bofill@yahoo.com>
---
 frontend/src/plugin-loader.tsx | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

(limited to 'frontend/src/plugin-loader.tsx')

diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx
index df0a6956..755c4460 100644
--- a/frontend/src/plugin-loader.tsx
+++ b/frontend/src/plugin-loader.tsx
@@ -30,7 +30,7 @@ import { FrozenPluginService } from './frozen-plugins-service';
 import { HiddenPluginsService } from './hidden-plugins-service';
 import Logger from './logger';
 import { NotificationService } from './notification-service';
-import { InstallType, Plugin, PluginLoadType } from './plugin';
+import { DisabledPlugin, InstallType, Plugin, PluginLoadType } from './plugin';
 import RouterHook from './router-hook';
 import { deinitSteamFixes, initSteamFixes } from './steamfixes';
 import { checkForPluginUpdates } from './store';
@@ -197,7 +197,7 @@ class PluginLoader extends Logger {
 
   private getPluginsFromBackend = DeckyBackend.callable<
     [],
-    { name: string; version: string; load_type: PluginLoadType }[]
+    { name: string; version: string; load_type: PluginLoadType; disabled: boolean }[]
   >('loader/get_plugins');
 
   private restartWebhelper = DeckyBackend.callable<[], void>('utilities/restart_webhelper');
@@ -220,10 +220,16 @@ class PluginLoader extends Logger {
     this.runCrashChecker();
     const plugins = await this.getPluginsFromBackend();
     const pluginLoadPromises = [];
+    const disabledPlugins: DisabledPlugin[] = [];
     const loadStart = performance.now();
     for (const plugin of plugins) {
-      if (!this.hasPlugin(plugin.name))
-        pluginLoadPromises.push(this.importPlugin(plugin.name, plugin.version, plugin.load_type, false));
+      if (plugin.disabled) {
+        disabledPlugins.push({ name: plugin.name, version: plugin.version });
+        this.deckyState.setDisabledPlugins(disabledPlugins);
+      } else {
+        if (!this.hasPlugin(plugin.name))
+          pluginLoadPromises.push(this.importPlugin(plugin.name, plugin.version, plugin.load_type, false));
+      }
     }
     await Promise.all(pluginLoadPromises);
     const loadEnd = performance.now();
@@ -335,6 +341,10 @@ class PluginLoader extends Logger {
     showModal(<PluginUninstallModal name={name} title={title} buttonText={buttonText} description={description} />);
   }
 
+  public disablePlugin(name: string, title: string, buttonText: string, description: string) {
+    showModal(<PluginUninstallModal name={name} title={title} buttonText={buttonText} description={description} />);
+  }
+
   public hasPlugin(name: string) {
     return Boolean(this.plugins.find((plugin) => plugin.name == name));
   }
-- 
cgit v1.2.3

