diff --git a/.env.example b/.env.example index e3e50aa4d..1dd640354 100644 --- a/.env.example +++ b/.env.example @@ -52,6 +52,9 @@ LNBITS_RESERVE_FEE_MIN=2000 # value in percent LNBITS_RESERVE_FEE_PERCENT=1.0 +# Limit fiat currencies allowed to see in UI +# LNBITS_ALLOWED_CURRENCIES="EUR, USD" + # Change theme LNBITS_SITE_TITLE="LNbits" LNBITS_SITE_TAGLINE="free and open-source lightning wallet" diff --git a/lnbits/core/templates/admin/_tab_server.html b/lnbits/core/templates/admin/_tab_server.html index f4d61bbf6..e8cec2208 100644 --- a/lnbits/core/templates/admin/_tab_server.html +++ b/lnbits/core/templates/admin/_tab_server.html @@ -54,6 +54,20 @@
+
+
+

Allowed currencies

+ +
+
+

Admin Extensions

diff --git a/lnbits/core/views/api.py b/lnbits/core/views/api.py index 4771efb38..5b1989b4d 100644 --- a/lnbits/core/views/api.py +++ b/lnbits/core/views/api.py @@ -672,6 +672,12 @@ async def api_perform_lnurlauth( @core_app.get("/api/v1/currencies") async def api_list_currencies_available(): + if len(settings.lnbits_allowed_currencies) > 0: + return [ + item + for item in currencies.keys() + if item.upper() in settings.lnbits_allowed_currencies + ] return list(currencies.keys()) diff --git a/lnbits/core/views/generic.py b/lnbits/core/views/generic.py index 97053e8e0..1e34930ee 100644 --- a/lnbits/core/views/generic.py +++ b/lnbits/core/views/generic.py @@ -18,6 +18,7 @@ from lnbits.helpers import template_renderer, url_for from lnbits.settings import get_wallet_class, settings from ...extension_manager import InstallableExtension, get_valid_extensions +from ...utils.exchange_rates import currencies from ..crud import ( create_account, create_wallet, @@ -400,6 +401,7 @@ async def index(request: Request, user: User = Depends(check_admin)): "user": user.dict(), "settings": settings.dict(), "balance": balance, + "currencies": list(currencies.keys()), }, ) diff --git a/lnbits/settings.py b/lnbits/settings.py index 416941d72..adec59510 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -89,6 +89,7 @@ class ThemesSettings(LNbitsSettings): default="https://shop.lnbits.com/;/static/images/lnbits-shop-light.png;/static/images/lnbits-shop-dark.png" ) # sneaky sneaky lnbits_ad_space_enabled: bool = Field(default=False) + lnbits_allowed_currencies: List[str] = Field(default=[]) class OpsSettings(LNbitsSettings):