diff --git a/lnbits/extensions/gerty/crud.py b/lnbits/extensions/gerty/crud.py
index ffe8c1bb..385282ed 100644
--- a/lnbits/extensions/gerty/crud.py
+++ b/lnbits/extensions/gerty/crud.py
@@ -10,8 +10,8 @@ async def create_gerty(wallet_id: str, data: Gerty) -> Gerty:
gerty_id = urlsafe_short_hash()
await db.execute(
"""
- INSERT INTO gerty.gertys (id, name, wallet, lnbits_wallets, sats_quote, exchange, onchain_sats, ln_stats)
- VALUES (?, ?, ?, ?, ?, ?)
+ INSERT INTO gerty.gertys (id, name, wallet, lnbits_wallets, sats_quote, exchange, onchain_stats, ln_stats)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
""",
(
gerty_id,
diff --git a/lnbits/extensions/gerty/migrations.py b/lnbits/extensions/gerty/migrations.py
index 06ca7513..09af3f0e 100644
--- a/lnbits/extensions/gerty/migrations.py
+++ b/lnbits/extensions/gerty/migrations.py
@@ -6,12 +6,13 @@ async def m001_initial(db):
"""
CREATE TABLE gerty.gertys (
id TEXT PRIMARY KEY,
+ name TEXT NOT NULL,
wallet TEXT NOT NULL,
- lnbits_wallets TEXT NOT NULL,
- sats_quote BOOL NOT NULL,
- exchange TEXT NOT NULL,
- onchain_sats BOOL NOT NULL,
- ln_stats BOOL NOT NULL
+ lnbits_wallets TEXT,
+ sats_quote BOOL,
+ exchange TEXT,
+ onchain_stats BOOL,
+ ln_stats BOOL
);
"""
)
\ No newline at end of file
diff --git a/lnbits/extensions/gerty/models.py b/lnbits/extensions/gerty/models.py
index 9338ee47..690614ee 100644
--- a/lnbits/extensions/gerty/models.py
+++ b/lnbits/extensions/gerty/models.py
@@ -7,10 +7,10 @@ from pydantic import BaseModel
class Gerty(BaseModel):
- id: str
+ id: str = Query(None)
name: str
wallet: str
- lnbits_wallets: str # Wallets to keep an eye on, {"wallet-id": "wallet-read-key, etc"}
+ lnbits_wallets: str = Query(None) # Wallets to keep an eye on, {"wallet-id": "wallet-read-key, etc"}
sats_quote: bool = Query(False) # Fetch Satoshi quotes
exchange: str = Query(None) # BTC <-> Fiat exchange rate to pull ie "USD", in 0.0001 and sats
onchain_sats: bool = Query(False) # Onchain stats
diff --git a/lnbits/extensions/gerty/templates/gerty/gerty.html b/lnbits/extensions/gerty/templates/gerty/gerty.html
new file mode 100644
index 00000000..ef4db38d
--- /dev/null
+++ b/lnbits/extensions/gerty/templates/gerty/gerty.html
@@ -0,0 +1,54 @@
+{% extends "public.html" %} {% block page %}
+
+
+
+
+
+
+ Copy LNURL
+
+
+
+
+
+
+
+
+ Gerty
+ Use an LNURL compatible bitcoin wallet to pay.
+
+
+
+ {% include "lnurlp/_lnurl.html" %}
+
+
+
+
+{% endblock %} {% block scripts %}
+
+{% endblock %}
diff --git a/lnbits/extensions/gerty/templates/gerty/index.html b/lnbits/extensions/gerty/templates/gerty/index.html
index f8e08c01..852e054d 100644
--- a/lnbits/extensions/gerty/templates/gerty/index.html
+++ b/lnbits/extensions/gerty/templates/gerty/index.html
@@ -9,7 +9,6 @@
>
-
@@ -137,7 +136,7 @@
Create Gerty
@@ -383,7 +382,7 @@
formDialog: {
show: false,
data: {sats_quote: false,
- onchain_sats: false,
+ onchain_stats: false,
ln_stats: false}
}
}
@@ -396,11 +395,10 @@
},
getGertys: function () {
var self = this
-
LNbits.api
.request(
'GET',
- '/gerty/api/v1/gertys?all_wallets=true',
+ '/gerty/api/v1/gerty?all_wallets=true',
this.g.user.wallets[0].inkey
)
.then(function (response) {
@@ -412,20 +410,19 @@
createGerty: function () {
var data = {
name: this.formDialog.data.name,
- currency: this.formDialog.data.currency,
- tip_options: this.formDialog.data.tip_options
- ? JSON.stringify(
- this.formDialog.data.tip_options.map(str => parseInt(str))
- )
- : JSON.stringify([]),
- tip_wallet: this.formDialog.data.tip_wallet || ''
+ wallet: this.formDialog.data.wallet,
+ lnbits_wallets: this.formDialog.data.lnbits_wallets,
+ sats_quote: this.formDialog.data.sats_quote,
+ exchange: this.formDialog.data.exchange,
+ onchain_sats: this.formDialog.data.onchain_sats,
+ ln_stats: this.formDialog.data.ln_stats
}
var self = this
LNbits.api
.request(
'POST',
- '/gerty/api/v1/gertys',
+ '/gerty/api/v1/gerty',
_.findWhere(this.g.user.wallets, {id: this.formDialog.data.wallet})
.inkey,
data
@@ -448,7 +445,7 @@
LNbits.api
.request(
'DELETE',
- '/gerty/api/v1/gertys/' + gertyId,
+ '/gerty/api/v1/gerty/' + gertyId,
_.findWhere(self.g.user.wallets, {id: gerty.wallet}).adminkey
)
.then(function (response) {
diff --git a/lnbits/extensions/gerty/views.py b/lnbits/extensions/gerty/views.py
index 54735d3a..c2a87085 100644
--- a/lnbits/extensions/gerty/views.py
+++ b/lnbits/extensions/gerty/views.py
@@ -21,3 +21,11 @@ async def index(request: Request, user: User = Depends(check_user_exists)):
"gerty/index.html", {"request": request, "user": user.dict()}
)
+@gerty_ext.get("/{gerty_id}", response_class=HTMLResponse)
+async def display(request: Request, gerty_id):
+ gerty = await get_gerty(gerty_id)
+ if not gerty:
+ raise HTTPException(
+ status_code=HTTPStatus.NOT_FOUND, detail="Gerty does not exist."
+ )
+ return lnurlp_renderer().TemplateResponse("gerty/gerty.html", ctx)
\ No newline at end of file
diff --git a/lnbits/extensions/gerty/views_api.py b/lnbits/extensions/gerty/views_api.py
index b3f6f6a6..d24843b5 100644
--- a/lnbits/extensions/gerty/views_api.py
+++ b/lnbits/extensions/gerty/views_api.py
@@ -91,18 +91,14 @@ async def api_gerty_satoshi():
@gerty_ext.get("/api/v1/gerty/{gerty_id}")
async def api_gerty_json(
- gerty_id: str, wallet: WalletTypeInfo = Depends(require_admin_key)
+ gerty_id: str
):
gerty = await get_gerty(gerty_id)
+ logger.debug(gerty.wallet)
if not gerty:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="Gerty does not exist."
)
- if gerty.wallet != wallet.wallet.id:
- raise HTTPException(
- status_code=HTTPStatus.FORBIDDEN,
- detail="Come on, seriously, this isn't your Gerty!",
- )
gertyReturn = []
if gerty.lnbits_wallets != "":
gertyReturn.append(gerty.lnbitsWallets)