mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
when toggling a plugin, changed to save config after running load/unload handlers, in case those change the config
This commit is contained in:
@ -47,13 +47,13 @@ def toggle_plugin(name, enable=True):
|
|||||||
if not name in pwnagotchi.config['main']['plugins']:
|
if not name in pwnagotchi.config['main']['plugins']:
|
||||||
pwnagotchi.config['main']['plugins'][name] = dict()
|
pwnagotchi.config['main']['plugins'][name] = dict()
|
||||||
pwnagotchi.config['main']['plugins'][name]['enabled'] = enable
|
pwnagotchi.config['main']['plugins'][name]['enabled'] = enable
|
||||||
save_config(pwnagotchi.config, '/etc/pwnagotchi/config.toml')
|
|
||||||
|
|
||||||
if not enable and name in loaded:
|
if not enable and name in loaded:
|
||||||
if getattr(loaded[name], 'on_unload', None):
|
if getattr(loaded[name], 'on_unload', None):
|
||||||
loaded[name].on_unload(view.ROOT)
|
loaded[name].on_unload(view.ROOT)
|
||||||
del loaded[name]
|
del loaded[name]
|
||||||
|
if pwnagotchi.config:
|
||||||
|
save_config(pwnagotchi.config, '/etc/pwnagotchi/config.toml')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if enable and name in database and name not in loaded:
|
if enable and name in database and name not in loaded:
|
||||||
@ -65,6 +65,8 @@ def toggle_plugin(name, enable=True):
|
|||||||
one(name, 'config_changed', pwnagotchi.config)
|
one(name, 'config_changed', pwnagotchi.config)
|
||||||
one(name, 'ui_setup', view.ROOT)
|
one(name, 'ui_setup', view.ROOT)
|
||||||
one(name, 'ready', view.ROOT._agent)
|
one(name, 'ready', view.ROOT._agent)
|
||||||
|
if pwnagotchi.config:
|
||||||
|
save_config(pwnagotchi.config, '/etc/pwnagotchi/config.toml')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
Reference in New Issue
Block a user