Added extra default ads to support project (#2421)

This commit is contained in:
Arc 2024-04-16 15:26:04 +01:00 committed by GitHub
parent 839fe8b96d
commit d78f6a1f9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 38 additions and 25 deletions

View file

@ -69,7 +69,6 @@ from .tasks import (
async def startup(app: FastAPI):
# wait till migration is done
await migrate_databases()
@ -177,7 +176,6 @@ def create_app() -> FastAPI:
async def check_funding_source() -> None:
funding_source = get_funding_source()
max_retries = settings.funding_source_max_retries

View file

@ -146,14 +146,17 @@ async def create_invoice(
f"{settings.lnbits_wallet_limit_max_balance} sats."
)
ok, checking_id, payment_request, error_message = (
await funding_source.create_invoice(
amount=amount_sat,
memo=invoice_memo,
description_hash=description_hash,
unhashed_description=unhashed_description,
expiry=expiry or settings.lightning_invoice_expiry,
)
(
ok,
checking_id,
payment_request,
error_message,
) = await funding_source.create_invoice(
amount=amount_sat,
memo=invoice_memo,
description_hash=description_hash,
unhashed_description=unhashed_description,
expiry=expiry or settings.lightning_invoice_expiry,
)
if not ok or not payment_request or not checking_id:
raise InvoiceError(error_message or "unexpected backend error.")

View file

@ -502,18 +502,28 @@
</div>
</div>
</div>
{% if AD_SPACE %} {% for ADS in AD_SPACE %} {% set AD = ADS.split(';') %}
<div class="col-6 col-sm-4 col-md-8 q-gutter-y-sm">
{% if AD_SPACE %}
<div class="q-mx-auto">
<q-btn flat color="secondary" class="full-width q-mb-md"
>{{ AD_SPACE_TITLE }}</q-btn
>
<div class="row justify-center">
{% for ADS in AD_SPACE %} {% set AD = ADS.split(';') %}
<div class="flex flex-center column">
<a href="{{ AD[0] }}">
<img
v-if="($q.dark.isActive)"
src="{{ AD[1] }}"
style="max-width: 420px"
/>
<img v-else src="{{ AD[2] }}" style="max-width: 420px" />
</a>
</div>
<a href="{{ AD[0] }}" class="q-ma-md">
<img v-if="($q.dark.isActive)" src="{{ AD[1] }}" style="max-width: 90%" />
<img v-else src="{{ AD[2] }}" style="max-width: 90%" />
</a>
{% endfor %}
</div>
</div>
{% endfor %} {% endif %}
{% endif %}
</div>
<div v-if="'{{SITE_TITLE}}' == 'LNbits'" class="row gt-sm q-mt-xl">
<div class="col-1"></div>

View file

@ -459,19 +459,21 @@
</q-list>
</q-card-section>
</q-card>
{% endif %} {% if AD_SPACE %} {% for ADS in AD_SPACE %} {% set AD =
ADS.split(";") %}
{% endif %} {% if AD_SPACE %}
<q-card>
<q-card-section>
<h6 class="text-subtitle1 q-mt-none q-mb-sm">
{{ AD_SPACE_TITLE }}
</h6>
</q-card-section>
{% for ADS in AD_SPACE %} {% set AD = ADS.split(";") %}
<q-card-section class="q-pa-none">
<a
style="display: inline-block"
href="{{ AD[0] }}"
class="q-ma-md"
class="q-ml-md q-mb-xs q-mr-md"
style="max-width: 80%"
>
<img
style="max-width: 100%; height: auto"
@ -483,8 +485,10 @@
v-else
src="{{ AD[2] }}"
/>
</a> </q-card-section></q-card
>{% endfor %} {% endif %}
</a> </q-card-section
>{% endfor %}
</q-card>
{% endif %}
</div>
</div>

View file

@ -99,7 +99,7 @@ class ThemesSettings(LNbitsSettings):
lnbits_custom_logo: str = Field(default=None)
lnbits_ad_space_title: str = Field(default="Supported by")
lnbits_ad_space: str = Field(
default="https://shop.lnbits.com/;/static/images/lnbits-shop-light.png;/static/images/lnbits-shop-dark.png"
default="https://shop.lnbits.com/;/static/images/bitcoin-shop-banner.png;/static/images/bitcoin-shop-banner.png,https://affil.trezor.io/aff_c?offer_id=169&aff_id=33845;/static/images/bitcoin-hardware-wallet.png;/static/images/bitcoin-hardware-wallet.png,https://opensats.org/;/static/images/open-sats.png;/static/images/open-sats.png"
) # sneaky sneaky
lnbits_ad_space_enabled: bool = Field(default=False)
lnbits_allowed_currencies: list[str] = Field(default=[])

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -28,7 +28,6 @@ class TestMock(BaseModel):
class Mock(FunctionMock, TestMock):
@staticmethod
def combine_mocks(fs_mock, test_mock):
_mock = fs_mock | test_mock

View file

@ -45,7 +45,6 @@ async def test_rest_wallet(httpserver: HTTPServer, test_data: WalletTest):
def _apply_mock(httpserver: HTTPServer, mock: Mock):
request_data: Dict[str, Union[str, dict]] = {}
request_type = getattr(mock.dict(), "request_type", None)
# request_type = mock.request_type <--- this des not work for whatever reason!!!