Allow for custom image logo (#642)
* first test * add custom URL logo * some styling * fixed typo, wrong import * Update .env.example Co-authored-by: calle <93376500+callebtc@users.noreply.github.com> Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
parent
906f0166bd
commit
77fbea25af
5 changed files with 23 additions and 12 deletions
|
|
@ -34,6 +34,7 @@ LNBITS_SITE_TAGLINE="free and open-source lightning wallet"
|
||||||
LNBITS_SITE_DESCRIPTION="Some description about your service, will display if title is not 'LNbits'"
|
LNBITS_SITE_DESCRIPTION="Some description about your service, will display if title is not 'LNbits'"
|
||||||
# Choose from mint, flamingo, freedom, salvador, autumn, monochrome, classic
|
# Choose from mint, flamingo, freedom, salvador, autumn, monochrome, classic
|
||||||
LNBITS_THEME_OPTIONS="classic, bitcoin, freedom, mint, autumn, monochrome, salvador"
|
LNBITS_THEME_OPTIONS="classic, bitcoin, freedom, mint, autumn, monochrome, salvador"
|
||||||
|
# LNBITS_CUSTOM_LOGO="https://lnbits.com/assets/images/logo/logo.svg"
|
||||||
|
|
||||||
# Choose from LNPayWallet, OpenNodeWallet, LntxbotWallet,
|
# Choose from LNPayWallet, OpenNodeWallet, LntxbotWallet,
|
||||||
# LndRestWallet, CLightningWallet, LNbitsWallet, SparkWallet, FakeWallet, EclairWallet
|
# LndRestWallet, CLightningWallet, LNbitsWallet, SparkWallet, FakeWallet, EclairWallet
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,10 @@ from typing import Any, List, NamedTuple, Optional
|
||||||
import jinja2
|
import jinja2
|
||||||
import shortuuid # type: ignore
|
import shortuuid # type: ignore
|
||||||
|
|
||||||
|
import lnbits.settings as settings
|
||||||
from lnbits.jinja2_templating import Jinja2Templates
|
from lnbits.jinja2_templating import Jinja2Templates
|
||||||
from lnbits.requestvars import g
|
from lnbits.requestvars import g
|
||||||
|
|
||||||
import lnbits.settings as settings
|
|
||||||
|
|
||||||
|
|
||||||
class Extension(NamedTuple):
|
class Extension(NamedTuple):
|
||||||
code: str
|
code: str
|
||||||
|
|
@ -160,6 +159,7 @@ def template_renderer(additional_folders: List = []) -> Jinja2Templates:
|
||||||
["lnbits/templates", "lnbits/core/templates", *additional_folders]
|
["lnbits/templates", "lnbits/core/templates", *additional_folders]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if settings.LNBITS_AD_SPACE:
|
if settings.LNBITS_AD_SPACE:
|
||||||
t.env.globals["AD_SPACE"] = 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["HIDE_API"] = settings.LNBITS_HIDE_API
|
||||||
|
|
@ -170,6 +170,8 @@ def template_renderer(additional_folders: List = []) -> Jinja2Templates:
|
||||||
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["EXTENSIONS"] = get_valid_extensions()
|
t.env.globals["EXTENSIONS"] = get_valid_extensions()
|
||||||
|
if settings.LNBITS_CUSTOM_LOGO:
|
||||||
|
t.env.globals["USE_CUSTOM_LOGO"] = settings.LNBITS_CUSTOM_LOGO
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
t.env.globals["VENDORED_JS"] = map(url_for_vendored, get_js_vendored())
|
t.env.globals["VENDORED_JS"] = map(url_for_vendored, get_js_vendored())
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
import subprocess
|
|
||||||
import importlib
|
import importlib
|
||||||
|
import subprocess
|
||||||
from environs import Env # type: ignore
|
|
||||||
from os import path
|
from os import path
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
from environs import Env # type: ignore
|
||||||
|
|
||||||
env = Env()
|
env = Env()
|
||||||
env.read_env()
|
env.read_env()
|
||||||
|
|
@ -47,6 +46,7 @@ LNBITS_THEME_OPTIONS: List[str] = env.list(
|
||||||
default="classic, flamingo, mint, salvador, monochrome, autumn",
|
default="classic, flamingo, mint, salvador, monochrome, autumn",
|
||||||
subcast=str,
|
subcast=str,
|
||||||
)
|
)
|
||||||
|
LNBITS_CUSTOM_LOGO = env.str("LNBITS_CUSTOM_LOGO", default="")
|
||||||
|
|
||||||
WALLET = wallet_class()
|
WALLET = wallet_class()
|
||||||
DEFAULT_WALLET_NAME = env.str("LNBITS_DEFAULT_WALLET_NAME", default="LNbits wallet")
|
DEFAULT_WALLET_NAME = env.str("LNBITS_DEFAULT_WALLET_NAME", default="LNbits wallet")
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,12 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<q-toolbar-title>
|
<q-toolbar-title>
|
||||||
<q-btn flat no-caps dense size="lg" type="a" href="/">
|
<q-btn flat no-caps dense size="lg" type="a" href="/">
|
||||||
{% block toolbar_title %} {% if SITE_TITLE != 'LNbits' %} {{
|
{% block toolbar_title %} {% if USE_CUSTOM_LOGO %}
|
||||||
SITE_TITLE }} {% else %} <strong>LN</strong>bits {% endif %} {%
|
<img height="30px" alt="Logo" src="{{ USE_CUSTOM_LOGO }}" />
|
||||||
endblock %}</q-btn
|
{%else%} {% if SITE_TITLE != 'LNbits' %} {{ SITE_TITLE }} {% else
|
||||||
>
|
%}
|
||||||
|
<strong>LN</strong>bits {% endif %} {%endif%} {% endblock %}
|
||||||
|
</q-btn>
|
||||||
</q-toolbar-title>
|
</q-toolbar-title>
|
||||||
{% block beta %}
|
{% block beta %}
|
||||||
<q-badge color="yellow" text-color="black" class="q-mr-md">
|
<q-badge color="yellow" text-color="black" class="q-mr-md">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
{% extends "base.html" %} {% block beta %}{% endblock %} {% block drawer_toggle
|
{% extends "base.html" %} {% block beta %}{% endblock %} {% block drawer_toggle
|
||||||
%}{% endblock %} {% block drawer %}{% endblock %} {% block toolbar_title %}
|
%}{% endblock %} {% block drawer %}{% endblock %} {% block toolbar_title %}
|
||||||
<a href="/" class="inherit">
|
<a
|
||||||
{% if SITE_TITLE != 'LNbits' %} {{ SITE_TITLE }} {% else %}
|
href="/"
|
||||||
<strong>LN</strong>bits {% endif %}
|
class="inherit q-btn q-btn-item non-selectable no-outline q-btn--flat q-btn--rectangle q-btn--actionable q-focusable q-hoverable q-btn--no-uppercase q-btn--wrap q-btn--dense q-btn--active"
|
||||||
|
style="font-size: 20px"
|
||||||
|
>
|
||||||
|
{% if USE_CUSTOM_LOGO %}
|
||||||
|
<img height="30px" alt="Logo" src="{{ USE_CUSTOM_LOGO }}" />
|
||||||
|
{%else%} {% if SITE_TITLE != 'LNbits' %} {{ SITE_TITLE }} {% else %}
|
||||||
|
<strong>LN</strong>bits {% endif %} {% endif %}
|
||||||
</a>
|
</a>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue