frontpage: Load shortcuts from .d directories too

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-06-23 23:42:00 -07:00 committed by James Valleroy
parent aaa306aef5
commit 4ea2e755db
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -160,11 +160,15 @@ def _extract_web_app_url(custom_shortcut):
def get_custom_shortcuts():
"""Return a merged dictionary of all custom shortcuts."""
shortcuts_dirs = [cfg.config_dir, cfg.data_dir, cfg.file_root]
dirs = [cfg.config_dir, cfg.data_dir, cfg.file_root]
file_paths = [
pathlib.Path(dir_) / 'custom-shortcuts.json' for dir_ in dirs
]
file_paths = cfg.expand_to_dot_d_paths(file_paths)
shortcuts = {'shortcuts': []}
for shortcuts_dir in shortcuts_dirs:
file_path = pathlib.Path(shortcuts_dir) / 'custom-shortcuts.json'
for file_path in file_paths:
file_path = pathlib.Path(file_path)
if not file_path.is_file() or not file_path.stat().st_size:
continue