Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to lnbits 1.0.0 #7

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixes
dni committed Oct 24, 2024

Verified

This commit was signed with the committer’s verified signature.
dni dni ⚡
commit 18b64a6b01451cc7c6bc6a181ece58186b8fcc22
16 changes: 6 additions & 10 deletions migrations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
async def m001_initial(db):

await db.execute(
"""
f"""
CREATE TABLE subdomains.domain (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
@@ -13,15 +13,13 @@ async def m001_initial(db):
cost INTEGER NOT NULL,
amountmade INTEGER NOT NULL,
allowed_record_types TEXT NOT NULL,
time TIMESTAMP NOT NULL DEFAULT """
+ db.timestamp_now
+ """
time TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
);
"""
"""
)

await db.execute(
"""
f"""
CREATE TABLE subdomains.subdomain (
id TEXT PRIMARY KEY,
domain TEXT NOT NULL,
@@ -33,9 +31,7 @@ async def m001_initial(db):
duration INTEGER NOT NULL,
paid BOOLEAN NOT NULL,
record_type TEXT NOT NULL,
time TIMESTAMP NOT NULL DEFAULT """
+ db.timestamp_now
+ """
time TIMESTAMP NOT NULL DEFAULT {db.timestamp_now}
);
"""
"""
)
6 changes: 4 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from datetime import datetime, timezone

from fastapi import Query
from pydantic import BaseModel

@@ -32,9 +34,9 @@ class Domain(BaseModel):
webhook: str
description: str
cost: int
time: int
allowed_record_types: str
amountmade: int = 0
time: datetime = datetime.now(timezone.utc)


class Subdomain(BaseModel):
@@ -47,6 +49,6 @@ class Subdomain(BaseModel):
ip: str
sats: int
duration: int
time: int
record_type: str
paid: bool = False
time: datetime = datetime.now(timezone.utc)
67 changes: 34 additions & 33 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions templates/subdomains/index.html
Original file line number Diff line number Diff line change
@@ -422,7 +422,8 @@ <h6 class="text-subtitle1 q-my-none">
.request(
'DELETE',
'/subdomains/api/v1/subdomains/' + subdomainId,
_.findWhere(this.g.user.wallets, {id: subdomains.wallet}).inkey
_.findWhere(this.g.user.wallets, {id: subdomains.wallet})
.adminkey
)
.then(response => {
this.subdomains = _.reject(this.subdomains, function (obj) {
@@ -446,9 +447,7 @@ <h6 class="text-subtitle1 q-my-none">
this.g.user.wallets[0].inkey
)
.then(response => {
this.domains = response.data.map(function (obj) {
return mapLNDomain(obj)
})
this.domains = response.data.map(mapLNDomain)
})
},
sendFormData() {
@@ -469,7 +468,7 @@ <h6 class="text-subtitle1 q-my-none">

createDomain(wallet, data) {
LNbits.api
.request('POST', '/subdomains/api/v1/domains', wallet.inkey, data)
.request('POST', '/subdomains/api/v1/domains', wallet.adminkey, data)
.then(response => {
this.domains.push(mapLNDomain(response.data))
this.domainDialog.show = false
@@ -491,7 +490,7 @@ <h6 class="text-subtitle1 q-my-none">
.request(
'PUT',
'/subdomains/api/v1/domains/' + data.id,
wallet.inkey,
wallet.adminkey,
data
)
.then(response => {
@@ -516,7 +515,7 @@ <h6 class="text-subtitle1 q-my-none">
.request(
'DELETE',
'/subdomains/api/v1/domains/' + domainId,
_.findWhere(this.g.user.wallets, {id: domains.wallet}).inkey
_.findWhere(this.g.user.wallets, {id: domains.wallet}).adminkey
)
.then(response => {
this.domains = _.reject(this.domains, function (obj) {