From 968c8b113c4ec52d121520aac7879a31c2856446 Mon Sep 17 00:00:00 2001 From: marios Date: Tue, 7 Oct 2025 02:40:41 +0300 Subject: working plugin disable, not tested extensively --- backend/decky_loader/utilities.py | 4 +++- .../settings/pages/plugin_list/PluginListLabel.tsx | 19 ++++++++++++++++-- .../settings/pages/plugin_list/index.tsx | 13 +++++++----- frontend/src/plugin-loader.tsx | 23 ++++++++++++++++++---- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/backend/decky_loader/utilities.py b/backend/decky_loader/utilities.py index 63ffff06..ea797dad 100644 --- a/backend/decky_loader/utilities.py +++ b/backend/decky_loader/utilities.py @@ -80,6 +80,8 @@ class Utilities: context.ws.add_route("utilities/restart_webhelper", self.restart_webhelper) context.ws.add_route("utilities/close_cef_socket", self.close_cef_socket) context.ws.add_route("utilities/_call_legacy_utility", self._call_legacy_utility) + context.ws.add_route("utilities/enable_plugin", self.enable_plugin) + context.ws.add_route("utilities/disable_plugin", self.disable_plugin) context.web_app.add_routes([ post("/methods/{method_name}", self._handle_legacy_server_method_call) @@ -481,7 +483,7 @@ class Utilities: await self.set_setting("disabled_plugins", disabled_plugins) await self.context.plugin_loader.plugins[name].stop() - await self.context.ws.emit("loader/unload_plugin", name) + await self.context.ws.emit("loader/disable_plugin", name) async def enable_plugin(self, name: str): disabled_plugins: List[str] = await self.get_setting("disabled_plugins", []) diff --git a/frontend/src/components/settings/pages/plugin_list/PluginListLabel.tsx b/frontend/src/components/settings/pages/plugin_list/PluginListLabel.tsx index fec03e56..416d693e 100644 --- a/frontend/src/components/settings/pages/plugin_list/PluginListLabel.tsx +++ b/frontend/src/components/settings/pages/plugin_list/PluginListLabel.tsx @@ -1,15 +1,16 @@ import { FC } from 'react'; import { useTranslation } from 'react-i18next'; -import { FaEyeSlash, FaLock } from 'react-icons/fa'; +import { FaEyeSlash, FaLock, FaMoon } from 'react-icons/fa'; interface PluginListLabelProps { frozen: boolean; hidden: boolean; + disabled: boolean; name: string; version?: string; } -const PluginListLabel: FC = ({ name, frozen, hidden, version }) => { +const PluginListLabel: FC = ({ name, frozen, hidden, version, disabled }) => { const { t } = useTranslation(); return (
@@ -43,6 +44,20 @@ const PluginListLabel: FC = ({ name, frozen, hidden, versi {t('PluginListLabel.hidden')}
)} + {disabled && ( +
+ + {t('PluginListLabel.disabled')} +
+ )} ); }; diff --git a/frontend/src/components/settings/pages/plugin_list/index.tsx b/frontend/src/components/settings/pages/plugin_list/index.tsx index da70f4ca..b21e4933 100644 --- a/frontend/src/components/settings/pages/plugin_list/index.tsx +++ b/frontend/src/components/settings/pages/plugin_list/index.tsx @@ -13,7 +13,7 @@ import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { FaDownload, FaEllipsisH, FaRecycle } from 'react-icons/fa'; -import { InstallType } from '../../../../plugin'; +import { enablePlugin, InstallType } from '../../../../plugin'; import { StorePluginVersion, getPluginList, @@ -84,9 +84,11 @@ function PluginInteractables(props: { entry: ReorderableEntry } {t('PluginListIndex.uninstall')} {disabled ? - // implement enabler - <> - : + enablePlugin(name)} + > + {t('PluginListIndex.plugin_enable')} + : DeckyPluginLoader.disablePlugin( @@ -188,7 +190,8 @@ export default function PluginList({ isDeveloper }: { isDeveloper: boolean }) { const hidden = hiddenPlugins.includes(name); return { - label: