-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
3,037 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
uses: lnbits/lnbits/.github/workflows/lint.yml@dev | ||
tests: | ||
runs-on: ubuntu-latest | ||
needs: [lint] | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: lnbits/lnbits/.github/actions/prepare@dev | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Run pytest | ||
uses: pavelzw/pytest-action@v2 | ||
env: | ||
LNBITS_BACKEND_WALLET_CLASS: FakeWallet | ||
PYTHONUNBUFFERED: 1 | ||
DEBUG: true | ||
with: | ||
verbose: true | ||
job-summary: true | ||
emoji: false | ||
click-to-expand: true | ||
custom-pytest: poetry run pytest | ||
report-title: 'test (${{ matrix.python-version }})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
__pycache__ | ||
node_modules | ||
.mypy_cache | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"semi": false, | ||
"arrowParens": "avoid", | ||
"insertPragma": false, | ||
"printWidth": 80, | ||
"proseWrap": "preserve", | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"useTabs": false, | ||
"bracketSameLine": false, | ||
"bracketSpacing": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
all: format check | ||
|
||
format: prettier black ruff | ||
|
||
check: mypy pyright checkblack checkruff checkprettier | ||
|
||
prettier: | ||
poetry run ./node_modules/.bin/prettier --write . | ||
pyright: | ||
poetry run ./node_modules/.bin/pyright | ||
|
||
mypy: | ||
poetry run mypy . | ||
|
||
black: | ||
poetry run black . | ||
|
||
ruff: | ||
poetry run ruff check . --fix | ||
|
||
checkruff: | ||
poetry run ruff check . | ||
|
||
checkprettier: | ||
poetry run ./node_modules/.bin/prettier --check . | ||
|
||
checkblack: | ||
poetry run black --check . | ||
|
||
checkeditorconfig: | ||
editorconfig-checker | ||
|
||
test: | ||
PYTHONUNBUFFERED=1 \ | ||
DEBUG=true \ | ||
poetry run pytest | ||
install-pre-commit-hook: | ||
@echo "Installing pre-commit hook to git" | ||
@echo "Uninstall the hook with poetry run pre-commit uninstall" | ||
poetry run pre-commit install | ||
|
||
pre-commit: | ||
poetry run pre-commit run --all-files | ||
|
||
|
||
checkbundle: | ||
@echo "skipping checkbundle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
import asyncio | ||
from typing import List | ||
|
||
from fastapi import APIRouter | ||
from loguru import logger | ||
|
||
from lnbits.db import Database | ||
from lnbits.helpers import template_renderer | ||
from lnbits.tasks import create_permanent_unique_task | ||
|
||
db = Database("ext_lnurldevice") | ||
from .crud import db | ||
from .tasks import wait_for_paid_invoices | ||
from .views import lnurldevice_generic_router | ||
from .views_api import lnurldevice_api_router | ||
from .views_lnurl import lnurldevice_lnurl_router | ||
|
||
lnurldevice_ext: APIRouter = APIRouter(prefix="/lnurldevice", tags=["lnurldevice"]) | ||
lnurldevice_ext.include_router(lnurldevice_generic_router) | ||
lnurldevice_ext.include_router(lnurldevice_api_router) | ||
lnurldevice_ext.include_router(lnurldevice_lnurl_router) | ||
|
||
lnurldevice_static_files = [ | ||
{ | ||
"path": "/lnurldevice/static", | ||
"name": "lnurldevice_static", | ||
} | ||
] | ||
|
||
|
||
def lnurldevice_renderer(): | ||
return template_renderer(["lnurldevice/templates"]) | ||
|
||
|
||
from .lnurl import * # noqa: F401,F403 | ||
from .tasks import wait_for_paid_invoices | ||
from .views import * # noqa: F401,F403 | ||
from .views_api import * # noqa: F401,F403 | ||
|
||
|
||
scheduled_tasks: list[asyncio.Task] = [] | ||
|
||
|
||
def lnurldevice_stop(): | ||
for task in scheduled_tasks: | ||
try: | ||
task.cancel() | ||
except Exception as ex: | ||
logger.warning(ex) | ||
|
||
|
||
def lnurldevice_start(): | ||
from lnbits.tasks import create_permanent_unique_task | ||
|
||
task = create_permanent_unique_task("ext_lnurldevice", wait_for_paid_invoices) | ||
scheduled_tasks.append(task) | ||
|
||
|
||
__all__ = [ | ||
"db", | ||
"lnurldevice_ext", | ||
"lnurldevice_static_files", | ||
"lnurldevice_start", | ||
"lnurldevice_stop", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
For LNURL based hardware (although you could use for software), people build things like bitcoin switches, Points of Sale, and ATMs. | ||
|
||
For LNURL based hardware (although you could use for software), people build things like bitcoin switches, Points of Sale, and ATMs. | ||
|
||
* LNPoS: https://lnbits.github.io/lnpos | ||
* bitcoinSwitch: https://github.com/lnbits/bitcoinSwitch | ||
* FOSSA: https://github.com/lnbits/fossa | ||
* BATM: https://github.com/lnbits/fossa | ||
* OfflineSwitch: https://github.com/lnbits/fossa | ||
- LNPoS: https://lnbits.github.io/lnpos | ||
- bitcoinSwitch: https://github.com/lnbits/bitcoinSwitch | ||
- FOSSA: https://github.com/lnbits/fossa | ||
- BATM: https://github.com/lnbits/fossa | ||
- OfflineSwitch: https://github.com/lnbits/fossa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "lnurldevice", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"prettier": "^3.2.5", | ||
"pyright": "^1.1.358" | ||
} | ||
} |
Oops, something went wrong.