From 9f586a1b97cf9069fbfbeee17e3909baf9e95f66 Mon Sep 17 00:00:00 2001
From: jbofill <74568881+jessebofill@users.noreply.github.com>
Date: Tue, 30 Dec 2025 12:29:08 -0700
Subject: Feat: Disable plugins (#850)

* implement base frontend changes necessary for plugin disabling

* implement frontend diisable functions/ modal

* plugin disable boilerplate / untested

* 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>

* fix mistakes

* add frontend

* working plugin disable, not tested extensively

* fix uninstalled hidden plugins remaining in list

* hide plugin irrelevant plugin setting menu option when disabled

* fix hidden plugin issues

* reset disabled plugin on uninstall

* fix plugin load on reenable

* move disable settings uninstall cleanup

* add engilsh tranlsations for enable/ disable elements

* fix bug where wrong loadType can get passed to importPlugin

* show correct number of hidden plugins if plugin is both hidden and disabled

* fix: get fresh list of plugin updates when changed in settings plugin list

* fix: fix invalid semver plugin version from preventing latest updates

* retain x position when changing focus in list items  that have multiple horizontal focusables

* correction to pluging version checking validation

* make sure disabled plugins get checked for updates

* show number of disabled plugins at bottom of plugin view

* add notice to update modals that disabled plugins will be enabled upon installation

* run formatter

* Update backend/decky_loader/locales/en-US.json

Co-authored-by: EMERALD <hudson.samuels@gmail.com>

* chore: correct filename typo

* chore: change disabled icon

* chore: revert accidental defsettings changes

* format

* add timeout to frontend importPlugin

if a request hangs this prevent it from blocking other plugin loads.
backend diaptch_plugin which calls this for individual plugin load (as opposed to batch) is set to 15s.
other callers of importPlugin are not using timeout, same as before.

* fix plugin update checking loop

---------

Co-authored-by: marios <marios8543@gmail.com>
Co-authored-by: EMERALD <hudson.samuels@gmail.com>
---
 frontend/src/store.tsx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'frontend/src/store.tsx')

diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx
index dfd9b04b..33c384a5 100644
--- a/frontend/src/store.tsx
+++ b/frontend/src/store.tsx
@@ -1,6 +1,6 @@
-import { compare } from 'compare-versions';
+import { compare, validate } from 'compare-versions';
 
-import { InstallType, Plugin, installPlugin, installPlugins } from './plugin';
+import { DisabledPlugin, InstallType, Plugin, installPlugin, installPlugins } from './plugin';
 import { getSetting, setSetting } from './utils/settings';
 
 export enum Store {
@@ -113,18 +113,21 @@ export async function requestMultiplePluginInstalls(requests: PluginInstallReque
   );
 }
 
-export async function checkForPluginUpdates(plugins: Plugin[]): Promise<PluginUpdateMapping> {
+export async function checkForPluginUpdates(plugins: (Plugin | DisabledPlugin)[]): Promise<PluginUpdateMapping> {
   const serverData = await getPluginList();
   const updateMap = new Map<string, StorePluginVersion>();
   for (let plugin of plugins) {
     const remotePlugin = serverData?.find((x) => x.name == plugin.name);
     //FIXME: Ugly hack since plugin.version might be null during evaluation,
     //so this will set the older version possible
-    const curVer = plugin.version ? plugin.version : '0.0';
+    const curVer = plugin.version ? plugin.version : '0.0.0';
+
     if (
       remotePlugin &&
       remotePlugin.versions?.length > 0 &&
       plugin.version != remotePlugin?.versions?.[0]?.name &&
+      validate(remotePlugin.versions?.[0]?.name) &&
+      validate(curVer) &&
       compare(remotePlugin?.versions?.[0]?.name, curVer, '>')
     ) {
       updateMap.set(plugin.name, remotePlugin.versions[0]);
-- 
cgit v1.2.3

