mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 19:24:23 +00:00
Introduce full asyncio version (still some module to migrate). Defender JSONRPC Server ready and using with uvcorn
This commit is contained in:
@@ -8,14 +8,22 @@ class RPCCommand:
|
||||
self._Loader = loader
|
||||
self._Command = loader.Commands
|
||||
|
||||
def command_list(self) -> list[dict]:
|
||||
def command_list(self, **kwargs) -> list[dict]:
|
||||
return [command.to_dict() for command in self._Command.DB_COMMANDS]
|
||||
|
||||
def command_get_by_module(self, module_name: str) -> list[dict]:
|
||||
def command_get_by_module(self, **kwargs) -> list[dict]:
|
||||
module_name = kwargs.get('module_name', None)
|
||||
if module_name is None:
|
||||
return []
|
||||
|
||||
return [command.to_dict() for command in self._Command.DB_COMMANDS if command.module_name.lower() == module_name.lower()]
|
||||
|
||||
def command_get_by_name(self, command_name: str) -> dict:
|
||||
def command_get_by_name(self, **kwargs) -> dict:
|
||||
command_name: str = kwargs.get('command_name', '')
|
||||
if not command_name:
|
||||
return dict()
|
||||
|
||||
for command in self._Command.DB_COMMANDS:
|
||||
if command.command_name.lower() == command_name.lower():
|
||||
return command.to_dict()
|
||||
return {}
|
||||
return dict()
|
||||
Reference in New Issue
Block a user