diff --git a/lnbits/extensions/example/README.md b/lnbits/extensions/example/README.md new file mode 100644 index 000000000..277294592 --- /dev/null +++ b/lnbits/extensions/example/README.md @@ -0,0 +1,11 @@ +
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
new file mode 100644
index 000000000..29a0f0b65
--- /dev/null
+++ b/lnbits/extensions/example/__init__.py
@@ -0,0 +1,19 @@
+from fastapi import APIRouter
+
+from lnbits.db import Database
+from lnbits.helpers import template_renderer
+
+db = Database("ext_example")
+
+example_ext: APIRouter = APIRouter(
+ prefix="/example",
+ tags=["example"]
+)
+
+
+def example_renderer():
+ return template_renderer(["lnbits/extensions/example/templates"])
+
+
+from .views import * # noqa
+from .views_api import * # noqa
diff --git a/lnbits/extensions/example/example.config.json b/lnbits/extensions/example/example.config.json
new file mode 100644
index 000000000..b8eec1939
--- /dev/null
+++ b/lnbits/extensions/example/example.config.json
@@ -0,0 +1,6 @@
+{
+ "name": "Build your own!!",
+ "short_description": "Join us, make an extension",
+ "icon": "info",
+ "contributors": ["github_username"]
+}
diff --git a/lnbits/extensions/example/migrations.py b/lnbits/extensions/example/migrations.py
new file mode 100644
index 000000000..99d7c362d
--- /dev/null
+++ b/lnbits/extensions/example/migrations.py
@@ -0,0 +1,10 @@
+# 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
new file mode 100644
index 000000000..0347a06f3
--- /dev/null
+++ b/lnbits/extensions/example/models.py
@@ -0,0 +1,6 @@
+# from pydantic import BaseModel
+
+# class Example(BaseModel):
+# id: str
+# wallet: str
+
diff --git a/lnbits/extensions/example/templates/example/index.html b/lnbits/extensions/example/templates/example/index.html
new file mode 100644
index 000000000..d732ef376
--- /dev/null
+++ b/lnbits/extensions/example/templates/example/index.html
@@ -0,0 +1,59 @@
+{% extends "base.html" %} {% from "macros.jinja" import window_vars with context
+%} {% block page %}
++ A magical "g" is always available, with info about the user, wallets and + extensions: +
+{% raw %}{{ g }}{% endraw %}
+