From 4a588dda1bcfdc78e33f713caaec07d54139a380 Mon Sep 17 00:00:00 2001 From: benarc Date: Wed, 23 Feb 2022 13:51:30 +0000 Subject: [PATCH] Added ad space and option to turn off api docs --- .env.example | 3 +++ lnbits/core/templates/core/wallet.html | 8 +++++++- lnbits/helpers.py | 3 +++ lnbits/settings.py | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 51259007..e4952359 100644 --- a/.env.example +++ b/.env.example @@ -11,6 +11,9 @@ LNBITS_ADMIN_USERS="" LNBITS_ADMIN_EXTENSIONS="ngrok" LNBITS_DEFAULT_WALLET_NAME="LNbits wallet" +LNBITS_AD_SPACE="" # csv ad image filepaths or urls, extensions can choose to honor +LNBITS_HIDE_API=false # Hides wallet api, extensions can choose to honor + # Disable extensions for all users, use "all" to disable all extensions LNBITS_DISABLED_EXTENSIONS="amilk" diff --git a/lnbits/core/templates/core/wallet.html b/lnbits/core/templates/core/wallet.html index 95436f86..0fb6f7e4 100644 --- a/lnbits/core/templates/core/wallet.html +++ b/lnbits/core/templates/core/wallet.html @@ -273,7 +273,11 @@ -
+ + {% if HIDE_API %} +
+ {% else %} +
@@ -378,6 +382,8 @@ + {% endif %} {% if AD_SPACE %} {% for AD in AD_SPACE %} + {% endfor %} {% endif %}
diff --git a/lnbits/helpers.py b/lnbits/helpers.py index d2616375..cb6f8ee7 100644 --- a/lnbits/helpers.py +++ b/lnbits/helpers.py @@ -160,6 +160,9 @@ def template_renderer(additional_folders: List = []) -> Jinja2Templates: ["lnbits/templates", "lnbits/core/templates", *additional_folders] ) ) + if settings.LNBITS_AD_SPACE: + t.env.globals["AD_SPACE"] = settings.LNBITS_AD_SPACE + t.env.globals["HIDE_API"] = settings.LNBITS_HIDE_API t.env.globals["SITE_TITLE"] = settings.LNBITS_SITE_TITLE t.env.globals["LNBITS_DENOMINATION"] = settings.LNBITS_DENOMINATION t.env.globals["SITE_TAGLINE"] = settings.LNBITS_SITE_TAGLINE diff --git a/lnbits/settings.py b/lnbits/settings.py index 26699bc0..a24f1ed8 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -34,6 +34,8 @@ LNBITS_DISABLED_EXTENSIONS: List[str] = env.list( "LNBITS_DISABLED_EXTENSIONS", default=[], subcast=str ) +LNBITS_AD_SPACE = env.list("LNBITS_AD_SPACE", default=[]) +LNBITS_HIDE_API = env.bool("LNBITS_HIDE_API", default=True) LNBITS_SITE_TITLE = env.str("LNBITS_SITE_TITLE", default="LNbits") LNBITS_DENOMINATION = env.str("LNBITS_DENOMINATION", default="sats") LNBITS_SITE_TAGLINE = env.str(