@samitouri / QOSami-HFS / commits / d89f6415

fix: admin/plugins/get-more: inconsistent state for download button after an inactive plugin was deleted from disk

Massimo Melina committed Apr 4, 2026 at 20:27 UTC d89f64151b4c63b501a86027be790c85bbefc2dd
2 files changed +5 -5
src/api.plugins.ts
+1 -2
@@ -120,8 +120,7 @@ const apis: ApiHandlers = {
120 if (repos.includes(p.repo))
121 list.update({ id: p.repo }, { installed: true })
122 },
123 - pluginUninstalled: folder => {
124 - const repo = getFolder2repo()[folder]
123 + pluginUninstalled: (_folder, repo) => {
124 if (typeof repo !== 'string') return // custom repo
125 if (repos.includes(repo))
126 list.update({ id: repo }, { installed: false })
src/plugins.ts
+4 -3
@@ -473,9 +473,10 @@ function watchPlugin(id: string, path: string) {
473
474 async function onUninstalled() {
475 await stop()
476 - if (!getPluginInfo(id)) return // already missing
476 + const info = getPluginInfo(id)
477 + if (!info) return // already missing
478 delete inactivePlugins[id]
478 - events.emit('pluginUninstalled', id)
479 + events.emit('pluginUninstalled', id, info.repo)
480 }
481
482 async function markItInactive() {
@@ -493,7 +494,7 @@ function watchPlugin(id: string, path: string) {
494 if (!p) return
495 await p.unload()
496 await markItInactive().catch(() =>
496 - events.emit('pluginUninstalled', id)) // when a running plugin is deleted, avoid error and report
497 + events.emit('pluginUninstalled', id, p.repo)) // when a running plugin is deleted, avoid error and report
498 events.emit('pluginStopped', p)
499 }
500