fix: simplify plugin lifecycle - no install/uninstall = just toggle
- Plugins without on_install hook: always 'installed', toggle works directly - Plugins with on_install: must Install first, then toggle, then Uninstall available - No data cleanup on Disable (only on Uninstall via on_uninstall hook) - Old plugins without lifecycle hooks simply don't get install/uninstall UI
This commit is contained in:
parent
e99ff984b1
commit
5c769c92a0
|
|
@ -354,13 +354,12 @@ type NodeMeta struct {
|
|||
|
||||
// Enable activates a plugin by name.
|
||||
// If the plugin has on_install hook, it must be installed first.
|
||||
// Plugins without on_install hook are always considered "installed".
|
||||
func (m *Manager) Enable(name string) error {
|
||||
for i := range m.plugins {
|
||||
if m.plugins[i].Meta.Name == name {
|
||||
p := &m.plugins[i]
|
||||
if p.HasInstall && !p.Installed {
|
||||
return fmt.Errorf("plugin %q must be installed first (use Install)", name)
|
||||
return fmt.Errorf("plugin %q must be installed first", name)
|
||||
}
|
||||
p.Active = true
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue