fix: hide Admin UI if LNBITS_ADMIN_UI is false (#1537)

* fix: hide Admin config if `LNBITS_ADMIN_UI` is `false`

* chore: code format

* chore: code format
This commit is contained in:
Vlad Stan 2023-02-22 14:30:57 +02:00 committed by GitHub
parent f7e43cdd95
commit 12014ee3e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -389,6 +389,9 @@ async def manifest(usr: str):
@core_html_routes.get("/admin", response_class=HTMLResponse) @core_html_routes.get("/admin", response_class=HTMLResponse)
async def index(request: Request, user: User = Depends(check_admin)): async def index(request: Request, user: User = Depends(check_admin)):
if not settings.lnbits_admin_ui:
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
WALLET = get_wallet_class() WALLET = get_wallet_class()
_, balance = await WALLET.status() _, balance = await WALLET.status()

View File

@ -107,6 +107,7 @@ def template_renderer(additional_folders: List = None) -> Jinja2Templates:
t.env.globals["SITE_DESCRIPTION"] = settings.lnbits_site_description t.env.globals["SITE_DESCRIPTION"] = settings.lnbits_site_description
t.env.globals["LNBITS_THEME_OPTIONS"] = settings.lnbits_theme_options t.env.globals["LNBITS_THEME_OPTIONS"] = settings.lnbits_theme_options
t.env.globals["LNBITS_VERSION"] = settings.lnbits_commit t.env.globals["LNBITS_VERSION"] = settings.lnbits_commit
t.env.globals["LNBITS_ADMIN_UI"] = settings.lnbits_admin_ui
t.env.globals["EXTENSIONS"] = [ t.env.globals["EXTENSIONS"] = [
e e
for e in get_valid_extensions() for e in get_valid_extensions()

View File

@ -185,7 +185,10 @@
:elevated="$q.screen.lt.md" :elevated="$q.screen.lt.md"
> >
<lnbits-wallet-list></lnbits-wallet-list> <lnbits-wallet-list></lnbits-wallet-list>
<lnbits-admin-ui></lnbits-admin-ui>
<lnbits-admin-ui
v-if="'{{LNBITS_ADMIN_UI}}' == 'True'"
></lnbits-admin-ui>
<lnbits-extension-list class="q-pb-xl"></lnbits-extension-list> <lnbits-extension-list class="q-pb-xl"></lnbits-extension-list>
</q-drawer> </q-drawer>
{% endblock %} {% block page_container %} {% endblock %} {% block page_container %}