Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e39cb20525 | ||
|
|
3cea9a90d1 | ||
|
|
3224e2e774 | ||
|
|
cfc9874517 | ||
|
|
62cd151fd6 | ||
|
|
a4d0aa5db8 | ||
|
|
77630781d7 | ||
|
|
59da350cc9 |
@@ -10,15 +10,16 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.head_ref || github.event.pull_request.head.sha }}
|
||||||
- uses: lnbits/lnbits/.github/actions/prepare@dev
|
- uses: lnbits/lnbits/.github/actions/prepare@dev
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
node-version: "24.x"
|
node-version: "24.x"
|
||||||
npm: true
|
npm: true
|
||||||
- run: make bundle
|
- name: Build and commit bundle (same-repo PR)
|
||||||
- name: Commit and push bundle changes
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
run: |
|
run: |
|
||||||
|
make bundle
|
||||||
git config user.name "alan"
|
git config user.name "alan"
|
||||||
git config user.email "alan@lnbits.com"
|
git config user.email "alan@lnbits.com"
|
||||||
git add lnbits/static
|
git add lnbits/static
|
||||||
@@ -27,3 +28,6 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
git commit -m "chore: make bundle [skip ci]"
|
git commit -m "chore: make bundle [skip ci]"
|
||||||
git push
|
git push
|
||||||
|
- name: Check bundle is up-to-date (fork PR)
|
||||||
|
if: github.event.pull_request.head.repo.full_name != github.repository
|
||||||
|
run: make checkbundle
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ nav_order: 1
|
|||||||
sudo apt-get install jq libfuse2
|
sudo apt-get install jq libfuse2
|
||||||
wget $(curl -s https://api.github.com/repos/lnbits/lnbits/releases/latest | jq -r '.assets[] | select(.name | endswith(".AppImage")) | .browser_download_url') -O LNbits-latest.AppImage
|
wget $(curl -s https://api.github.com/repos/lnbits/lnbits/releases/latest | jq -r '.assets[] | select(.name | endswith(".AppImage")) | .browser_download_url') -O LNbits-latest.AppImage
|
||||||
chmod +x LNbits-latest.AppImage
|
chmod +x LNbits-latest.AppImage
|
||||||
LNBITS_ADMIN_UI=true HOST=0.0.0.0 PORT=5000 ./LNbits-latest.AppImage # most system settings are now in the admin UI, but pass additional .env variables here
|
LNBITS_ADMIN_UI=true HOST=0.0.0.0 PORT=5000 AUTH_HTTPS_ONLY=false ./LNbits-latest.AppImage # most system settings are now in the admin UI, but pass additional .env variables here
|
||||||
```
|
```
|
||||||
|
|
||||||
- LNbits will create a folder for DB and extension files **in the same directory** as the AppImage.
|
- LNbits will create a folder for DB and extension files **in the same directory** as the AppImage.
|
||||||
@@ -285,10 +285,7 @@ but you can also set the env variables or pass command line arguments:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# .env variables are currently passed when running, but LNbits can be managed with the admin UI.
|
# .env variables are currently passed when running, but LNbits can be managed with the admin UI.
|
||||||
LNBITS_ADMIN_UI=true ./result/bin/lnbits --port 9000 --host 0.0.0.0
|
LNBITS_ADMIN_UI=true AUTH_HTTPS_ONLY=false ./result/bin/lnbits --port 9000 --host 0.0.0.0
|
||||||
|
|
||||||
# Once you have created a user, you can set as the super_user
|
|
||||||
SUPER_USER=be54db7f245346c8833eaa430e1e0405 LNBITS_ADMIN_UI=true ./result/bin/lnbits --port 9000
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> 
|
> 
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import httpx
|
|||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from lnbits.core.crud import get_wallet
|
from lnbits.core.crud import get_wallet
|
||||||
from lnbits.core.crud.payments import create_payment
|
from lnbits.core.crud.payments import create_payment, update_payment
|
||||||
from lnbits.core.models import CreatePayment, Payment, PaymentState
|
from lnbits.core.models import CreatePayment, Payment, PaymentState
|
||||||
from lnbits.core.models.misc import SimpleStatus
|
from lnbits.core.models.misc import SimpleStatus
|
||||||
from lnbits.db import Connection
|
from lnbits.db import Connection
|
||||||
@@ -57,6 +57,8 @@ async def check_fiat_status(payment: Payment) -> FiatPaymentStatus:
|
|||||||
fiat_status = await fiat_provider.get_invoice_status(checking_id)
|
fiat_status = await fiat_provider.get_invoice_status(checking_id)
|
||||||
|
|
||||||
if fiat_status.success:
|
if fiat_status.success:
|
||||||
|
payment.status = PaymentState.SUCCESS.value
|
||||||
|
await update_payment(payment)
|
||||||
await handle_fiat_payment_confirmation(payment)
|
await handle_fiat_payment_confirmation(payment)
|
||||||
|
|
||||||
# notify receivers asynchronously
|
# notify receivers asynchronously
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+10
-10
File diff suppressed because one or more lines are too long
@@ -27,6 +27,14 @@ const DynamicComponent = {
|
|||||||
name: r.name,
|
name: r.name,
|
||||||
component: async () => {
|
component: async () => {
|
||||||
await LNbits.utils.loadTemplate(r.template)
|
await LNbits.utils.loadTemplate(r.template)
|
||||||
|
if (r.i18n) {
|
||||||
|
const locale =
|
||||||
|
window.i18n?.global?.locale?.value ??
|
||||||
|
window.i18n?.global?.locale ??
|
||||||
|
window.g.locale ??
|
||||||
|
'en'
|
||||||
|
await LNbits.utils.loadExtI18n(r.i18n, locale)
|
||||||
|
}
|
||||||
await LNbits.utils.loadScript(r.component)
|
await LNbits.utils.loadScript(r.component)
|
||||||
return window[r.name]
|
return window[r.name]
|
||||||
}
|
}
|
||||||
@@ -151,6 +159,30 @@ window.i18n = new VueI18n.createI18n({
|
|||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
messages: window.localisation
|
messages: window.localisation
|
||||||
})
|
})
|
||||||
|
;(function () {
|
||||||
|
let _applying = false
|
||||||
|
let _target = null
|
||||||
|
Vue.watch(
|
||||||
|
() => window.i18n.global.locale,
|
||||||
|
async (locale, prevLocale) => {
|
||||||
|
if (_applying || !LNbits.utils._extI18nDirs.size) return
|
||||||
|
_target = locale
|
||||||
|
_applying = true
|
||||||
|
window.i18n.global.locale = prevLocale
|
||||||
|
_applying = false
|
||||||
|
await Promise.all(
|
||||||
|
[...LNbits.utils._extI18nDirs].map(dir =>
|
||||||
|
LNbits.utils.loadExtI18n(dir, locale)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (_target !== locale) return
|
||||||
|
_applying = true
|
||||||
|
window.i18n.global.locale = locale
|
||||||
|
_applying = false
|
||||||
|
},
|
||||||
|
{flush: 'sync'}
|
||||||
|
)
|
||||||
|
})()
|
||||||
|
|
||||||
window.app.mixin({
|
window.app.mixin({
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -323,6 +323,20 @@ window._lnbitsUtils = {
|
|||||||
converter.setOption('simpleLineBreaks', true)
|
converter.setOption('simpleLineBreaks', true)
|
||||||
return converter.makeHtml(text)
|
return converter.makeHtml(text)
|
||||||
},
|
},
|
||||||
|
_extI18nDirs: new Set(),
|
||||||
|
_extI18nLoaded: {},
|
||||||
|
loadExtI18n(dir, locale) {
|
||||||
|
this._extI18nDirs.add(dir)
|
||||||
|
const loaded = (this._extI18nLoaded[dir] ??= {})
|
||||||
|
if (loaded[locale]) return loaded[locale]
|
||||||
|
loaded[locale] = this.loadScript(`${dir}/${locale}.js`).catch(() => {
|
||||||
|
if (locale !== 'en') {
|
||||||
|
loaded['en'] ??= this.loadScript(`${dir}/en.js`).catch(() => {})
|
||||||
|
return loaded['en']
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return loaded[locale]
|
||||||
|
},
|
||||||
async decryptLnurlPayAES(success_action, preimage) {
|
async decryptLnurlPayAES(success_action, preimage) {
|
||||||
let keyb = new Uint8Array(
|
let keyb = new Uint8Array(
|
||||||
preimage.match(/[\da-f]{2}/gi).map(h => parseInt(h, 16))
|
preimage.match(/[\da-f]{2}/gi).map(h => parseInt(h, 16))
|
||||||
|
|||||||
@@ -117,11 +117,12 @@ class PhoenixdWallet(Wallet):
|
|||||||
# PhoenixD description limited to 128 characters
|
# PhoenixD description limited to 128 characters
|
||||||
if description_hash:
|
if description_hash:
|
||||||
data["descriptionHash"] = description_hash.hex()
|
data["descriptionHash"] = description_hash.hex()
|
||||||
|
elif unhashed_description:
|
||||||
|
data["descriptionHash"] = hashlib.sha256(
|
||||||
|
unhashed_description
|
||||||
|
).hexdigest()
|
||||||
else:
|
else:
|
||||||
desc = memo
|
desc = memo or ""
|
||||||
if desc is None and unhashed_description:
|
|
||||||
desc = unhashed_description.decode()
|
|
||||||
desc = desc or ""
|
|
||||||
if len(desc) > 128:
|
if len(desc) > 128:
|
||||||
data["descriptionHash"] = hashlib.sha256(desc.encode()).hexdigest()
|
data["descriptionHash"] = hashlib.sha256(desc.encode()).hexdigest()
|
||||||
else:
|
else:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "lnbits"
|
name = "lnbits"
|
||||||
version = "1.5.5-rc2"
|
version = "1.5.5"
|
||||||
requires-python = ">=3.10,<3.13"
|
requires-python = ">=3.10,<3.13"
|
||||||
description = "LNbits, free and open-source Lightning wallet and accounts system."
|
description = "LNbits, free and open-source Lightning wallet and accounts system."
|
||||||
authors = [{ name = "Alan Bits", email = "alan@lnbits.com" }]
|
authors = [{ name = "Alan Bits", email = "alan@lnbits.com" }]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from unittest.mock import AsyncMock
|
|||||||
import pytest
|
import pytest
|
||||||
from pytest_mock.plugin import MockerFixture
|
from pytest_mock.plugin import MockerFixture
|
||||||
|
|
||||||
from lnbits.core.crud.payments import get_payments
|
from lnbits.core.crud.payments import get_payment, get_payments
|
||||||
from lnbits.core.crud.users import get_user
|
from lnbits.core.crud.users import get_user
|
||||||
from lnbits.core.crud.wallets import create_wallet
|
from lnbits.core.crud.wallets import create_wallet
|
||||||
from lnbits.core.models.payments import CreateInvoice, Payment, PaymentState
|
from lnbits.core.models.payments import CreateInvoice, Payment, PaymentState
|
||||||
@@ -1752,6 +1752,51 @@ async def test_check_fiat_status_handles_internal_states(mocker: MockerFixture):
|
|||||||
assert queue_put.await_count == 1
|
assert queue_put.await_count == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_check_fiat_status_persists_successful_payment(
|
||||||
|
to_wallet: Wallet, settings: Settings, mocker: MockerFixture
|
||||||
|
):
|
||||||
|
settings.stripe_enabled = True
|
||||||
|
settings.stripe_api_secret_key = "mock_sk_test_4eC39HqLyjWDarjtT1zdp7dc"
|
||||||
|
settings.stripe_limits.service_min_amount_sats = 0
|
||||||
|
settings.stripe_limits.service_max_amount_sats = 0
|
||||||
|
settings.stripe_limits.service_fee_wallet_id = None
|
||||||
|
settings.stripe_limits.service_faucet_wallet_id = None
|
||||||
|
|
||||||
|
invoice_data = CreateInvoice(
|
||||||
|
unit="USD", amount=1.0, memo="Test", fiat_provider="stripe"
|
||||||
|
)
|
||||||
|
fiat_mock_response = FiatInvoiceResponse(
|
||||||
|
ok=True,
|
||||||
|
checking_id=f"session_paid_{get_random_string(10)}",
|
||||||
|
payment_request="https://stripe.com/pay/session_paid",
|
||||||
|
)
|
||||||
|
mocker.patch(
|
||||||
|
"lnbits.fiat.StripeWallet.create_invoice",
|
||||||
|
AsyncMock(return_value=fiat_mock_response),
|
||||||
|
)
|
||||||
|
mocker.patch(
|
||||||
|
"lnbits.utils.exchange_rates.get_fiat_rate_satoshis",
|
||||||
|
AsyncMock(return_value=1000),
|
||||||
|
)
|
||||||
|
payment = await payments.create_fiat_invoice(to_wallet.id, invoice_data)
|
||||||
|
assert payment.status == PaymentState.PENDING
|
||||||
|
|
||||||
|
mocker.patch(
|
||||||
|
"lnbits.fiat.StripeWallet.get_invoice_status",
|
||||||
|
AsyncMock(return_value=FiatPaymentStatus(paid=True)),
|
||||||
|
)
|
||||||
|
queue_put = mocker.patch("lnbits.tasks.internal_invoice_queue.put", AsyncMock())
|
||||||
|
|
||||||
|
status = await check_fiat_status(payment)
|
||||||
|
|
||||||
|
assert status.success is True
|
||||||
|
assert payment.status == PaymentState.SUCCESS
|
||||||
|
updated_payment = await get_payment(payment.checking_id)
|
||||||
|
assert updated_payment.status == PaymentState.SUCCESS
|
||||||
|
queue_put.assert_awaited_once_with(payment.checking_id)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_verify_paypal_webhook_requires_configuration(settings: Settings):
|
async def test_verify_paypal_webhook_requires_configuration(settings: Settings):
|
||||||
settings.paypal_webhook_id = None
|
settings.paypal_webhook_id = None
|
||||||
|
|||||||
Reference in New Issue
Block a user