admin/plugins/search: don't list installed plugins
Massimo Melina committed
Jun 4, 2023 at 16:42 UTC
e16c2250360058f9af5d9e2461c44f05dd8ce191
1 file changed
+3
-3
src/api.plugins.ts
+3
-3
@@ -110,10 +110,10 @@ const apis: ApiHandlers = {
110
const folder2repo = getFolder2repo()
111
for await (const pl of searchPlugins(text)) {
112
const repo = pl.id
113
+ if (_.includes(folder2repo, repo)) continue
114
const folder = _.findKey(folder2repo, x => x === repo)
115
const installed = folder && getPluginInfo(folder)
116
Object.assign(pl, {
116
- installed: _.includes(folder2repo, repo),
117
update: installed && installed.version < pl.version!,
118
})
119
list.add(pl)
@@ -157,7 +157,7 @@ const apis: ApiHandlers = {
157
if (!found)
158
return new ApiError(404)
159
const enabled = isPluginEnabled(found.id)
160
- await enablePlugin(found.id, false)
160
+ await stopPlugin(found.id)
161
await downloadPlugin(pl.id, pl.branch, true)
162
if (enabled)
163
startPlugin(found.id).then() // don't wait, in case it fails to start
@@ -165,7 +165,7 @@ const apis: ApiHandlers = {
165
},
166
167
async uninstall_plugin({ id }) {
168
- await enablePlugin(id, false)
168
+ await stopPlugin(id)
169
await rm(PLUGINS_PATH + '/' + id, { recursive: true, force: true })
170
return {}
171
}