@samitouri / QOSami-HFS / commits / b4976fc0

fix: admin/plugins: installing a plugin that was previously installed+started+removed, resulted in the plugin being automatically started (despite the dialog asking the user)

Massimo Melina committed Jan 8, 2024 at 11:46 UTC b4976fc0ed0216f98a261460f1ca0cbb925a5dc7
2 files changed +4 -2
admin/src/OnlinePlugins.ts
+1 -1
@@ -94,7 +94,7 @@ export default function OnlinePlugins() {
94
95 async function installPlugin(id: string, branch?: string): Promise<any> {
96 try {
97 - const res = await apiCall('download_plugin', { id, branch }, { timeout: false })
97 + const res = await apiCall('download_plugin', { id, branch, stop: true }, { timeout: false })
98 if (await confirmDialog(`Plugin ${id} downloaded`, { confirmText: "Start" }))
99 await startPlugin(res.id)
100 }
src/api.plugins.ts
+3 -1
@@ -129,9 +129,11 @@ const apis: ApiHandlers = {
129 })
130 },
131
132 - async download_plugin({ id, branch }) {
132 + async download_plugin({ id, branch, stop }) {
133 await checkDependencies(await readOnlinePlugin(id, branch))
134 const folder = await downloadPlugin(id, { branch })
135 + if (stop) // be sure this is not automatically started
136 + await stopPlugin(folder)
137 return (await waitFor(() => getPluginInfo(folder), { timeout: 5000 }))
138 || new ApiError(HTTP_SERVER_ERROR)
139 },