1
0

plugins: structure plugin storage in wallet

store all plugin data by plugin name in a root dictionary `plugin_data`
inside the wallet db so that plugin data can get deleted again.
Prunes the data of plugins from the wallet db on wallet stop if the
plugin is not installed anymore.
This commit is contained in:
f321x
2025-05-05 18:16:29 +02:00
parent f25ddbc8f9
commit e80551192b
9 changed files with 47 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ import time
import os
import stat
from decimal import Decimal
from typing import Union, Optional, Dict, Sequence, Tuple, Any, Set, Callable
from typing import Union, Optional, Dict, Sequence, Tuple, Any, Set, Callable, AbstractSet
from numbers import Real
from functools import cached_property
@@ -349,6 +349,10 @@ class SimpleConfig(Logger):
def is_plugin_enabled(self, name: str) -> bool:
return bool(self.get(f'plugins.{name}.enabled'))
def get_installed_plugins(self) -> AbstractSet[str]:
"""Returns all plugin names registered in the config."""
return self.get('plugins', {}).keys()
def enable_plugin(self, name: str):
self.set_key(f'plugins.{name}.enabled', True, save=True)