fix: condition for available, but not installed extension (#3232)
This commit is contained in:
parent
37f99e7f96
commit
3ed30be93e
2 changed files with 7 additions and 1 deletions
|
|
@ -151,7 +151,7 @@ def register_exception_handlers(app: FastAPI):
|
||||||
status_code = HTTPStatus.NOT_FOUND
|
status_code = HTTPStatus.NOT_FOUND
|
||||||
message: str = "Page 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
|
status_code = HTTPStatus.FORBIDDEN
|
||||||
message = f"Extension '{path}' not installed. Ask the admin to install it."
|
message = f"Extension '{path}' not installed. Ask the admin to install it."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1026,6 +1026,12 @@ class Settings(EditableSettings, ReadOnlySettings, TransientSettings, BaseSettin
|
||||||
def is_installed_extension_id(self, ext_id: str) -> bool:
|
def is_installed_extension_id(self, ext_id: str) -> bool:
|
||||||
return ext_id in self.lnbits_installed_extensions_ids
|
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):
|
class SuperSettings(EditableSettings):
|
||||||
super_user: str
|
super_user: str
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue