moonraker: return list of registered directors in server.info response

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-01-20 10:21:27 -05:00
parent e2c325a724
commit ff8e53b269
2 changed files with 9 additions and 1 deletions

View File

@ -468,11 +468,16 @@ class Server:
return "ok" return "ok"
async def _handle_info_request(self, web_request): async def _handle_info_request(self, web_request):
file_manager = self.lookup_plugin('file_manager', None)
reg_dirs = []
if file_manager is not None:
reg_dirs = file_manager.get_registered_dirs()
return { return {
'klippy_connected': self.klippy_connection.is_connected(), 'klippy_connected': self.klippy_connection.is_connected(),
'klippy_state': self.klippy_state, 'klippy_state': self.klippy_state,
'plugins': list(self.plugins.keys()), 'plugins': list(self.plugins.keys()),
'failed_plugins': self.failed_plugins} 'failed_plugins': self.failed_plugins,
'registered_directories': reg_dirs}
class KlippyConnection: class KlippyConnection:
def __init__(self, on_recd, on_close): def __init__(self, on_recd, on_close):

View File

@ -117,6 +117,9 @@ class FileManager:
def get_sd_directory(self): def get_sd_directory(self):
return self.file_paths.get('gcodes', "") return self.file_paths.get('gcodes', "")
def get_registered_dirs(self):
return list(self.file_paths.keys())
def get_fixed_path_args(self): def get_fixed_path_args(self):
return dict(self.fixed_path_args) return dict(self.fixed_path_args)