* add deleted flag on wallets
set deleted on delete wallet
2 twelves
format
fail on create invoice
make deleted check on SQL query
nazi flake8
add_test
boom... it works and passes!!
* add app fixture
vlad's recommendations
add deleted
* Add deleted flag to Wallet
* restore crud
* do not check for wallet in services.py
* add deleted flag on wallets
set deleted on delete wallet
2 twelves
format
fail on create invoice
make deleted check on SQL query
nazi flake8
add_test
boom... it works and passes!!
* add app fixture
vlad's recommendations
* add deleted
* error checks
---------
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
related to https://github.com/lnbits/lnbits/pull/1855
put the `.super_user` into our data_dir to not pollute our root dir
removed the weird mention to the url in the logs and mention
the `lnbits-cli superuser` instead
this is a breaking change for the bundlers, `cat .super_user` is not good anymore.
fix would be `cat data/.super_user` but for future compatibility i recommend
using `poetry run lnbits-cli superuser`
* save fiat_amounts on payment creation
* show fiat amount in frontend
* add lnbits_default_accounting_currency
* extract fiat calculation logic into service
* move all currency conversions to calc_fiat_amounts
move all conversion logic into create_invoice so extensions can benefit aswell
* show user-defined and wallet-defined currency in frontend
* remove sat from fiat units
* make bundle
* improve tests
* debug log
* replace async_wrap with run_sync
formatting
remove unused fn
properly raise exception, not for timeout though
* [TEST] proper startup and shutdown (#1860)
* add proper startup / shutdown in tests
* fix event loop issues
because uvloop was installed in server.py which is not the main entry point when tests are ran.
this caused the loops referenced by the locks and queues to be a different one than the one used to run the tests
(only an issue in python 3.9)
* give openapi more time, does not matter anyway, regtest takes way longer
---------
Co-authored-by: jacksn <jkranawetter05@gmail.com>
remove uvloop
* fix test
* dont touch pyproject
* fix: install uvloop in conftest
not using uvloop at all causes tests to take way longer
---------
Co-authored-by: jacksn <jkranawetter05@gmail.com>
* [CHORE] cleanup cache and exception on `make test`
moved the invalidate_forever task to proper location and use `create_permanent_task`.
and there was a Task never awaited Exception when running tests
* imrpove expiration test
* move cache into utils
* fix issue with pytest_asyncio
s
---------
Co-authored-by: jacksn <jkranawetter05@gmail.com>
* simplify and cache exchange rate
note that exir was removed as a provider
* add binance as provider
* log exception
* add test
* add blockchain.com provider
* [CHORE] update mypy and new issues
lnbits/cache.py:21: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/extension_manager.py:210: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/db.py:110: error: Only instance methods can be decorated with @property [misc]
lnbits/tasks.py:152: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/tasks.py:171: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/core/services.py:520: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/app.py:520: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/app.py:525: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
lnbits/app.py:532: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
* fix db.py
* fix mypy notes, type were not needed
* [REFACTOR] WalletType into enum
- move wallettype models from decorators.py into models.py
- use enum instead of int
- use HTTPStatus for consistency
* Update lnbits/core/models.py
Co-authored-by: jackstar12 <62219658+jackstar12@users.noreply.github.com>
* use dataclass
---------
Co-authored-by: jackstar12 <62219658+jackstar12@users.noreply.github.com>
* remove unused and update black + precommit
* makefile add ruff remove unused
* F541 fix
* complete ruff ignore
* remove unused workflow and combine linters into one
add lnbits/static to ruff ignore
save preview and linelength for later
define target version for black
* ignore upgrades for mypy
* remove flake8
* ignore F401 for __init__ files
* unused pylint comment
* unused noqa
* ignore upgrades for black
* run linting on py3.9 and py3.10
* dont assume python
* add centralized task management
in order to properly cleanup all long-running tasks we have to keep a list of them
* use new task management functions
* unify shutdown events
* vlads suggestions
rename variable for create_task
wrap cancel() with try/catch
fixup
* rename func to coro
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
* [refactor] pyln-client is not optional
some time ago we added pyln do main dependencies, its need for think like, saas or docker.
so this import was dead code
* stubs for pyln.client
* F821: undefine name
disabled and logged webhook_listener for opennode and lnpay because they are obviously not working
* E402: module level import not at top of file
* E721 fixes, only popped up for python3.9 not 3.10
* add simple caching utility
* test cache
* remove prefix, default on get
* check expiry in pop aswell
* remove unnecessary type
* improve invalidation task
increase default interval to 10 seconds - doesnt have to check that often.
instead of recreating the dict everytime mutate the existing one
* tests: hold invoice tests pending during payment
* sigh...
* ok
* hash preimage
* preimage_hash == payment_hash
* should error
* check that payment is gone
* cancel task while in-flight
* lnbits endpoing return error
* return error
* add both options
* fix list
* respond to error
* return false if payment status errors
* outgoing invoice should be deleted after one status check
* test api_payments_create error
* add send_payment_notification service
payment notifications are sent from multiple places with inconsistent and incomplete data
* adopt new send_payment_notification service
* add tests
* make sidebar above tabs on mobile
* Can we add padding instead
* fix: add padding for small screen
* make bundle... again
---------
Co-authored-by: Ben <ben@arc.wales>
Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
* better checking
* flake8 fix
* make format
* invoices scope are function for tests
* invoice back to sessionbut keep real_invoice for now
* make format
* comment
* get payment by checking id and test
* add github workflow for checking openapi
* verbose errors
* actual fix? remove env_names from BaseSettings class?
* dont kill process in workflow
* poetry version 1.5.1 for openapiu
* more reasonable default expiry
600 = 10 minutes which is a pretty short amount of time, for example when using lnbits fundingsource inside lnbits itself it would fail if you do a submarine swap or anything involved with hold invoices
i think 3600 = 1 hour should not make a difference in performance and is a way more reasonable expiry
* change default in .env.example
---------
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
* added ratelimiter
* Adds server logs to admin ui
* Added IP allow/ban list
* fixed remove ips
* Split rate limit number and unit
* security tab and background tasks for killswitch
* fix test for auditor api
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
* Create cn.js
Add chinese translation
* added additional files for chinese language
* Update lnbits/templates/base.html
---------
Co-authored-by: hodlbaby <52352588+hodlbaby@users.noreply.github.com>
Co-authored-by: dni ⚡ <office@dnilabs.com>
* feat: limit number of available fiat currencies
* feat: Add allowed currency selector to Admin UI
* motorinas suggestions
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
* Minor improvements to the German translation
This replaces some usages of "Sie" with "du", and also fixes a few minor mistakes.
* format
---------
Co-authored-by: ben <ben@arc.wales>
* Merged extensions into one page
* Bundle files updated
* Fixed install bug
* feat: client side version compatibility check
* fix: hide `Activated/Deactivated` toggle for non-admins
* feat: translate labels to `EN`
* feat: add other language translations
* chore: update bundle for i18n
* feat: check extension version server-side
* feat: show warning message
* refactor: nicer mapping
Co-authored-by: dni ⚡ <office@dnilabs.com>
* chore: code format
* chore: extra log
* feat: check_latest_version of ext
* feat: show tooltip for new version
* chore: `make bundle`
* chore: `mypy`
* chore: code clean-up
* feat: show version in badge (spacing is fine)
* chore: make bundle
* feat: check `min_lnbits_version` and `warning` in `config.json`
* chore: code formatting
* chore: downgrade log level
* fix: extract `ExtensionsInstallSettings` as readonly
* fix: do not show installed and deactivated extensions
* chore: format
* fix: `Enable` button tooltip
* fix: set installed release after installation
* fix: hide deactivated extensions from regular users
* bundle fundle
* bundle fundle
---------
Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
Co-authored-by: dni ⚡ <office@dnilabs.com>
* extend bar for mobile
* smaller padding
* center buttons
* Added rounded style
* Added icons, looks better
* service worker
* Changed icon
* Fixed show if
---------
Co-authored-by: ben <ben@arc.wales>
* fix: temp create account for `super_user_id` if missing
* chore: remove dumb import
* refactor: move logic outside `crud`
* feat: add uuid4 conversion
* fix: require valid string in .env file
* fix: update the `settings.super_user` value in case or normalisation for UUID4
* fix: allow long super_user
* chore: code format
* fix: add UI redirect with the normalized user
* fix: normalize `super_user` up one level
* fix: should normalize user in non-ui mode also
* initial backend support
* implement payments pagination on frontend
* implement search for payments api
* fix pyright issues
* sqlite support for searching
* backwards compatability
* formatting, small fixes
* small optimization
* fix sorting issue, add error handling
* GET payments test
* filter by dates, use List instead of list
* fix sqlite
* update bundle
* test old payments endpoint aswell
* refactor for easier review
* optimise test
* revert unnecessary change
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
* bugfix: 500 error if same wallet tries to pay an external invoice twice
* fstring
* log the error
---------
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
* feat filters, add them to GET payments
* add limit and offset to filters (#1563)
* add limit and offset to filters
* move filters example to parse_filters doc string
* black
* add openapi docs
* remove example commentC
* improve typing and make nested filter possible in openapi
* typo in fn name
* readd Type
---------
Co-authored-by: jackstar12 <62219658+jackstar12@users.noreply.github.com>
Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>
* BUG: proper exception for paid interal invoices
* test should now fail, because we pay invoice twice, and should also work in regtest
* sorting
* unpack check_internal
* introduce another crud fn for checking internal paid payment
* rename
---------
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
* remove static/vendor
* add node dependencies
* add bolt11-decoder
* run npm install inside dockerimage
* only use bundle.js and bundle.css
* use node_modules for bundling vendor assets
* remove dead code
* make argument optional
* reintroduce vendor dir
* reintroduce vendor and single javascript files, minification
* wrong moment, remove minification
* lock packages with non critical issues
* black
* feat: basic redirect to extension endpoint
* feat: filter by headers
* refactor: extract `middleware.py`
* fix: do not add twice the same extension to redirects
* chore: code clean-up
* remove invoices
* remove invoices tests
* remove unused tests/extensions dir
* fix issue
* formatting
* test passing locally. and i dont know why
* fix _extension_dir loading
* gitkeep extension dir
* formatting
* remove bundle from check
* do not prettier compliled css
* do not prettier compliled css
* create extension dir, if it does not exists, just to be sure
* Update lnbits/extension_manager.py
---------
Co-authored-by: calle <93376500+callebtc@users.noreply.github.com>