diff --git a/lnbits/extensions/example/README.md b/lnbits/extensions/example/README.md deleted file mode 100644 index 27729459..00000000 --- a/lnbits/extensions/example/README.md +++ /dev/null @@ -1,11 +0,0 @@ -

Example Extension

-

*tagline*

-This is an example extension to help you organise and build you own. - -Try to include an image - - - -

If your extension has API endpoints, include useful ones here

- -curl -H "Content-type: application/json" -X POST https://YOUR-LNBITS/YOUR-EXTENSION/api/v1/EXAMPLE -d '{"amount":"100","memo":"example"}' -H "X-Api-Key: YOUR_WALLET-ADMIN/INVOICE-KEY" diff --git a/lnbits/extensions/example/__init__.py b/lnbits/extensions/example/__init__.py deleted file mode 100644 index a78330e9..00000000 --- a/lnbits/extensions/example/__init__.py +++ /dev/null @@ -1,34 +0,0 @@ -import asyncio - -from fastapi import APIRouter -from fastapi.staticfiles import StaticFiles - -from lnbits.db import Database -from lnbits.helpers import template_renderer -from lnbits.tasks import catch_everything_and_restart - -db = Database("ext_example") - -example_ext: APIRouter = APIRouter(prefix="/example", tags=["example"]) - -example_static_files = [ - { - "path": "/example/static", - "app": StaticFiles(packages=[("lnbits", "extensions/example/static")]), - "name": "example_static", - } -] - - -def example_renderer(): - return template_renderer(["lnbits/extensions/example/templates"]) - - -from .tasks import wait_for_paid_invoices -from .views import * # noqa: F401,F403 -from .views_api import * # noqa: F401,F403 - - -def tpos_start(): - loop = asyncio.get_event_loop() - loop.create_task(catch_everything_and_restart(wait_for_paid_invoices)) diff --git a/lnbits/extensions/example/config.json b/lnbits/extensions/example/config.json deleted file mode 100644 index 46e84ce4..00000000 --- a/lnbits/extensions/example/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Build your own!", - "short_description": "Extension building guide", - "tile": "/example/static/bitcoin-extension.png", - "contributors": ["github_username"] -} diff --git a/lnbits/extensions/example/crud.py b/lnbits/extensions/example/crud.py deleted file mode 100644 index 8e5508fb..00000000 --- a/lnbits/extensions/example/crud.py +++ /dev/null @@ -1,5 +0,0 @@ -# crud.py is for communication with your extensions database - -# add your dependencies here - -# add your fnctions here diff --git a/lnbits/extensions/example/migrations.py b/lnbits/extensions/example/migrations.py deleted file mode 100644 index 9d37d977..00000000 --- a/lnbits/extensions/example/migrations.py +++ /dev/null @@ -1,12 +0,0 @@ -# migrations.py is for building your database - -# async def m001_initial(db): -# await db.execute( -# f""" -# CREATE TABLE example.example ( -# id TEXT PRIMARY KEY, -# wallet TEXT NOT NULL, -# time TIMESTAMP NOT NULL DEFAULT {db.timestamp_now} -# ); -# """ -# ) diff --git a/lnbits/extensions/example/models.py b/lnbits/extensions/example/models.py deleted file mode 100644 index bfeb7517..00000000 --- a/lnbits/extensions/example/models.py +++ /dev/null @@ -1,5 +0,0 @@ -# from pydantic import BaseModel - -# class Example(BaseModel): -# id: str -# wallet: str diff --git a/lnbits/extensions/example/static/bitcoin-extension.png b/lnbits/extensions/example/static/bitcoin-extension.png deleted file mode 100644 index 8366c0c2..00000000 Binary files a/lnbits/extensions/example/static/bitcoin-extension.png and /dev/null differ diff --git a/lnbits/extensions/example/static/conversion-example.png b/lnbits/extensions/example/static/conversion-example.png deleted file mode 100644 index 544e6335..00000000 Binary files a/lnbits/extensions/example/static/conversion-example.png and /dev/null differ diff --git a/lnbits/extensions/example/static/conversion-example2.png b/lnbits/extensions/example/static/conversion-example2.png deleted file mode 100644 index 7543fdc9..00000000 Binary files a/lnbits/extensions/example/static/conversion-example2.png and /dev/null differ diff --git a/lnbits/extensions/example/static/fastapi-example.png b/lnbits/extensions/example/static/fastapi-example.png deleted file mode 100644 index ed309bbe..00000000 Binary files a/lnbits/extensions/example/static/fastapi-example.png and /dev/null differ diff --git a/lnbits/extensions/example/static/fastapi-example2.png b/lnbits/extensions/example/static/fastapi-example2.png deleted file mode 100644 index ceacf494..00000000 Binary files a/lnbits/extensions/example/static/fastapi-example2.png and /dev/null differ diff --git a/lnbits/extensions/example/static/fastapi-framework.png b/lnbits/extensions/example/static/fastapi-framework.png deleted file mode 100644 index b446ce25..00000000 Binary files a/lnbits/extensions/example/static/fastapi-framework.png and /dev/null differ diff --git a/lnbits/extensions/example/static/fastapilogo.png b/lnbits/extensions/example/static/fastapilogo.png deleted file mode 100644 index 57eb6a80..00000000 Binary files a/lnbits/extensions/example/static/fastapilogo.png and /dev/null differ diff --git a/lnbits/extensions/example/static/qrcode-example.png b/lnbits/extensions/example/static/qrcode-example.png deleted file mode 100644 index 29781f53..00000000 Binary files a/lnbits/extensions/example/static/qrcode-example.png and /dev/null differ diff --git a/lnbits/extensions/example/static/qrcode-example1.png b/lnbits/extensions/example/static/qrcode-example1.png deleted file mode 100644 index a6c748f1..00000000 Binary files a/lnbits/extensions/example/static/qrcode-example1.png and /dev/null differ diff --git a/lnbits/extensions/example/static/quasar-example.png b/lnbits/extensions/example/static/quasar-example.png deleted file mode 100644 index 64da65ab..00000000 Binary files a/lnbits/extensions/example/static/quasar-example.png and /dev/null differ diff --git a/lnbits/extensions/example/static/quasar-framework.png b/lnbits/extensions/example/static/quasar-framework.png deleted file mode 100644 index c06e8cfa..00000000 Binary files a/lnbits/extensions/example/static/quasar-framework.png and /dev/null differ diff --git a/lnbits/extensions/example/static/quasarlogo.png b/lnbits/extensions/example/static/quasarlogo.png deleted file mode 100644 index 69228f86..00000000 Binary files a/lnbits/extensions/example/static/quasarlogo.png and /dev/null differ diff --git a/lnbits/extensions/example/static/script-example.png b/lnbits/extensions/example/static/script-example.png deleted file mode 100644 index 813a4254..00000000 Binary files a/lnbits/extensions/example/static/script-example.png and /dev/null differ diff --git a/lnbits/extensions/example/static/vif-example.png b/lnbits/extensions/example/static/vif-example.png deleted file mode 100644 index 3e6cfa11..00000000 Binary files a/lnbits/extensions/example/static/vif-example.png and /dev/null differ diff --git a/lnbits/extensions/example/static/vuejs-framework.png b/lnbits/extensions/example/static/vuejs-framework.png deleted file mode 100644 index eb634533..00000000 Binary files a/lnbits/extensions/example/static/vuejs-framework.png and /dev/null differ diff --git a/lnbits/extensions/example/static/vuejslogo.png b/lnbits/extensions/example/static/vuejslogo.png deleted file mode 100644 index 065c4a89..00000000 Binary files a/lnbits/extensions/example/static/vuejslogo.png and /dev/null differ diff --git a/lnbits/extensions/example/static/websocket-example.png b/lnbits/extensions/example/static/websocket-example.png deleted file mode 100644 index 52171d30..00000000 Binary files a/lnbits/extensions/example/static/websocket-example.png and /dev/null differ diff --git a/lnbits/extensions/example/tasks.py b/lnbits/extensions/example/tasks.py deleted file mode 100644 index 92319421..00000000 --- a/lnbits/extensions/example/tasks.py +++ /dev/null @@ -1,29 +0,0 @@ -# tasks.py is for asynchronous when invoices get paid - -# add your dependencies here - -import asyncio - -from loguru import logger - -from lnbits.core.models import Payment -from lnbits.helpers import get_current_extension_name -from lnbits.tasks import register_invoice_listener - - -async def wait_for_paid_invoices(): - invoice_queue = asyncio.Queue() - register_invoice_listener(invoice_queue, get_current_extension_name()) - - while True: - payment = await invoice_queue.get() - await on_invoice_paid(payment) - - -async def on_invoice_paid(payment: Payment) -> None: - if ( - payment.extra.get("tag") != "example" - ): # Will grab any payment with the tag "example" - logger.debug(payment) - # Do something - return diff --git a/lnbits/extensions/example/templates/example/index.html b/lnbits/extensions/example/templates/example/index.html deleted file mode 100644 index 36d325bb..00000000 --- a/lnbits/extensions/example/templates/example/index.html +++ /dev/null @@ -1,451 +0,0 @@ -{% extends "base.html" %} {% from "macros.jinja" import window_vars with context -%} {% block page %} - - - - - - - -
- Update thing - Create thing - Cancel -
-
-
-
- - - -
- Extension Development Guide - (also check the - docs) -
- - - - - - - - - - - - - - -
Frameworks
- -
- - - -
-
- - -
Useful Tools
-
- - - -
-
- - -
Good Practice
- Coming soon... -
- - -
Dev Enviroment
- Coming soon... -
- - -
Submission
- Coming soon... -
-
-
-
-
-{% endblock %} {% block scripts %} {{ window_vars(user) }} - - -{% endblock %} diff --git a/lnbits/extensions/example/views.py b/lnbits/extensions/example/views.py deleted file mode 100644 index b69b5194..00000000 --- a/lnbits/extensions/example/views.py +++ /dev/null @@ -1,20 +0,0 @@ -from fastapi import Depends, Request -from fastapi.templating import Jinja2Templates -from starlette.responses import HTMLResponse - -from lnbits.core.models import User -from lnbits.decorators import check_user_exists - -from . import example_ext, example_renderer - -templates = Jinja2Templates(directory="templates") - - -@example_ext.get("/", response_class=HTMLResponse) -async def index( - request: Request, - user: User = Depends(check_user_exists), -): - return example_renderer().TemplateResponse( - "example/index.html", {"request": request, "user": user.dict()} - ) diff --git a/lnbits/extensions/example/views_api.py b/lnbits/extensions/example/views_api.py deleted file mode 100644 index 556096ce..00000000 --- a/lnbits/extensions/example/views_api.py +++ /dev/null @@ -1,13 +0,0 @@ -# views_api.py is for you API endpoints that could be hit by another service - -# add your dependencies here - -from . import example_ext - -# add your endpoints here - - -@example_ext.get("/api/v1/test/{test_data}") -async def api_example(test_data): - # Do some python things and return the data - return test_data