From 3ed30be93e366643ce1bb055c60f72fdee5768fb Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Tue, 1 Jul 2025 13:33:23 +0300 Subject: [PATCH] fix: condition for available, but not installed extension (#3232) --- lnbits/exceptions.py | 2 +- lnbits/settings.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lnbits/exceptions.py b/lnbits/exceptions.py index 4e3eef296..3eab27593 100644 --- a/lnbits/exceptions.py +++ b/lnbits/exceptions.py @@ -151,7 +151,7 @@ def register_exception_handlers(app: FastAPI): status_code = HTTPStatus.NOT_FOUND message: str = "Page not found." - if path in settings.lnbits_all_extensions_ids: + if settings.is_ready_to_install_extension_id(path): status_code = HTTPStatus.FORBIDDEN message = f"Extension '{path}' not installed. Ask the admin to install it." diff --git a/lnbits/settings.py b/lnbits/settings.py index f9b9a3330..7294555fd 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -1026,6 +1026,12 @@ class Settings(EditableSettings, ReadOnlySettings, TransientSettings, BaseSettin def is_installed_extension_id(self, ext_id: str) -> bool: return ext_id in self.lnbits_installed_extensions_ids + def is_ready_to_install_extension_id(self, ext_id: str) -> bool: + return ( + ext_id not in self.lnbits_installed_extensions_ids + and ext_id in self.lnbits_all_extensions_ids + ) + class SuperSettings(EditableSettings): super_user: str