-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 4d5e989
Showing
32 changed files
with
4,683 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Create github release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref_name }} | ||
run: | | ||
gh release create "$tag" --generate-notes | ||
pullrequest: | ||
needs: [release] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.EXT_GITHUB }} | ||
repository: lnbits/lnbits-extensions | ||
path: './lnbits-extensions' | ||
|
||
- name: setup git user | ||
run: | | ||
git config --global user.name "alan" | ||
git config --global user.email "[email protected]" | ||
- name: Create pull request in extensions repo | ||
env: | ||
GH_TOKEN: ${{ secrets.EXT_GITHUB }} | ||
repo_name: '${{ github.event.repository.name }}' | ||
tag: '${{ github.ref_name }}' | ||
branch: 'update-${{ github.event.repository.name }}-${{ github.ref_name }}' | ||
title: '[UPDATE] ${{ github.event.repository.name }} to ${{ github.ref_name }}' | ||
body: 'https://github.com/lnbits/${{ github.event.repository.name }}/releases/${{ github.ref_name }}' | ||
archive: 'https://github.com/lnbits/${{ github.event.repository.name }}/archive/refs/tags/${{ github.ref_name }}.zip' | ||
run: | | ||
cd lnbits-extensions | ||
git checkout -b $branch | ||
# if there is another open PR | ||
git pull origin $branch || echo "branch does not exist" | ||
sh util.sh update_extension $repo_name $tag | ||
git add -A | ||
git commit -am "$title" | ||
git push origin $branch | ||
# check if pr exists before creating it | ||
gh config set pager cat | ||
check=$(gh pr list -H $branch | wc -l) | ||
test $check -ne 0 || gh pr create --title "$title" --body "$body" --repo lnbits/lnbits-extensions |
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,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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 LNbits | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Bitcoin Switch - <small>[LNbits](https://github.com/lnbits/lnbits) extension</small> | ||
|
||
Turn things on with bitcoin! | ||
|
||
[bitcoinswitch.lnbits.com](https://bitcoinswitch.lnbits.com) | ||
|
||
`Author: Ben Arc` `Author: DNI` |
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,49 @@ | ||
import asyncio | ||
|
||
from fastapi import APIRouter | ||
from loguru import logger | ||
|
||
from .crud import db | ||
from .tasks import wait_for_paid_invoices | ||
from .views import bitcoinswitch_generic_router | ||
from .views_api import bitcoinswitch_api_router | ||
from .views_lnurl import bitcoinswitch_lnurl_router | ||
|
||
bitcoinswitch_ext: APIRouter = APIRouter( | ||
prefix="/bitcoinswitch", tags=["bitcoinswitch"] | ||
) | ||
bitcoinswitch_ext.include_router(bitcoinswitch_generic_router) | ||
bitcoinswitch_ext.include_router(bitcoinswitch_api_router) | ||
bitcoinswitch_ext.include_router(bitcoinswitch_lnurl_router) | ||
|
||
bitcoinswitch_static_files = [ | ||
{ | ||
"path": "/bitcoinswitch/static", | ||
"name": "bitcoinswitch_static", | ||
} | ||
] | ||
scheduled_tasks: list[asyncio.Task] = [] | ||
|
||
|
||
def bitcoinswitch_stop(): | ||
for task in scheduled_tasks: | ||
try: | ||
task.cancel() | ||
except Exception as ex: | ||
logger.warning(ex) | ||
|
||
|
||
def bitcoinswitch_start(): | ||
from lnbits.tasks import create_permanent_unique_task | ||
|
||
task = create_permanent_unique_task("ext_bitcoinswitch", wait_for_paid_invoices) | ||
scheduled_tasks.append(task) | ||
|
||
|
||
__all__ = [ | ||
"db", | ||
"bitcoinswitch_ext", | ||
"bitcoinswitch_static_files", | ||
"bitcoinswitch_start", | ||
"bitcoinswitch_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "Bitcoin Switch", | ||
"short_description": "Hardware focused LNURL helper", | ||
"tile": "/bitcoinswitch/static/image/lnurldevice.png", | ||
"min_lnbits_version": "1.0.0", | ||
"contributors": [ | ||
{ | ||
"name": "Ben Arc", | ||
"uri": "mailto:[email protected]", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name": "BlackCoffee", | ||
"uri": "https://github.com/blackcoffee", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name": "Vlad Stan", | ||
"uri": "https://github.com/motorina1", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name": "dni", | ||
"uri": "https://github.com/dni", | ||
"role": "Developer" | ||
} | ||
], | ||
"images": [ | ||
{ | ||
"uri": "https://raw.githubusercontent.com/lnbits/bitcoinswitch/main/static/image/oS5VEEf.png" | ||
}, | ||
{ | ||
"uri": "https://raw.githubusercontent.com/lnbits/bitcoinswitch/main/static/image/U8dgtSl.png" | ||
}, | ||
{ | ||
"uri": "https://raw.githubusercontent.com/lnbits/bitcoinswitch/main/static/image/7Nz9PyU.png" | ||
}, | ||
{ | ||
"uri": "https://raw.githubusercontent.com/lnbits/bitcoinswitch/main/static/image/uPxF8SO.png", | ||
"link": "https://www.youtube.com/watch?v=98VYC99s770", | ||
"tooltip": "demo video" | ||
} | ||
], | ||
"description_md": "https://raw.githubusercontent.com/lnbits/bitcoinswitch/main/description.md", | ||
"terms_and_conditions_md": "https://raw.githubusercontent.com/lnbits/bitcoinswitch/main/toc.md", | ||
"license": "MIT" | ||
} |
Oops, something went wrong.