Merge branch 'main' into universalwebsocket

This commit is contained in:
Arc 2022-11-29 11:12:28 +00:00 committed by GitHub
commit a7fd44f4ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 27 deletions

View File

@ -11,8 +11,10 @@ from urllib.parse import ParseResult, parse_qs, urlencode, urlparse, urlunparse
import httpx
import pyqrcode
from fastapi import (Depends, Header, Query, Request, WebSocket,
WebSocketDisconnect)
from fastapi.exceptions import HTTPException
from fastapi.params import Body
from loguru import logger
@ -565,8 +567,8 @@ class DecodePayment(BaseModel):
data: str
@core_app.post("/api/v1/payments/decode")
async def api_payments_decode(data: DecodePayment):
@core_app.post("/api/v1/payments/decode", status_code=HTTPStatus.OK)
async def api_payments_decode(data: DecodePayment, response: Response):
payment_str = data.data
try:
if payment_str[:5] == "LNURL":
@ -587,6 +589,7 @@ async def api_payments_decode(data: DecodePayment):
"min_final_cltv_expiry": invoice.min_final_cltv_expiry,
}
except:
response.status_code = HTTPStatus.BAD_REQUEST
return {"message": "Failed to decode"}

View File

@ -8,7 +8,7 @@ async def m001_initial(db):
id {db.serial_primary_key},
wallet TEXT NOT NULL,
description TEXT NOT NULL,
amount INTEGER NOT NULL,
amount {db.big_int} NOT NULL,
served_meta INTEGER NOT NULL,
served_pr INTEGER NOT NULL
);

View File

@ -22,7 +22,7 @@ async def m001_initial(db):
description TEXT NOT NULL,
image TEXT, -- image/png;base64,...
enabled BOOLEAN NOT NULL DEFAULT true,
price INTEGER NOT NULL,
price {db.big_int} NOT NULL,
unit TEXT NOT NULL DEFAULT 'sat'
);
"""

View File

@ -3,14 +3,14 @@ async def m001_initial(db):
Initial paywalls table.
"""
await db.execute(
"""
f"""
CREATE TABLE paywall.paywalls (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
secret TEXT NOT NULL,
url TEXT NOT NULL,
memo TEXT NOT NULL,
amount INTEGER NOT NULL,
amount {db.big_int} NOT NULL,
time TIMESTAMP NOT NULL DEFAULT """
+ db.timestamp_now
+ """
@ -25,14 +25,14 @@ async def m002_redux(db):
"""
await db.execute("ALTER TABLE paywall.paywalls RENAME TO paywalls_old")
await db.execute(
"""
f"""
CREATE TABLE paywall.paywalls (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
url TEXT NOT NULL,
memo TEXT NOT NULL,
description TEXT NULL,
amount INTEGER DEFAULT 0,
amount {db.big_int} DEFAULT 0,
time TIMESTAMP NOT NULL DEFAULT """
+ db.timestamp_now
+ """,

View File

@ -3,14 +3,14 @@ async def m001_initial(db):
Creates an improved satsdice table and migrates the existing data.
"""
await db.execute(
"""
f"""
CREATE TABLE satsdice.satsdice_pay (
id TEXT PRIMARY KEY,
wallet TEXT,
title TEXT,
min_bet INTEGER,
max_bet INTEGER,
amount INTEGER DEFAULT 0,
amount {db.big_int} DEFAULT 0,
served_meta INTEGER NOT NULL,
served_pr INTEGER NOT NULL,
multiplier FLOAT,
@ -28,11 +28,11 @@ async def m002_initial(db):
Creates an improved satsdice table and migrates the existing data.
"""
await db.execute(
"""
f"""
CREATE TABLE satsdice.satsdice_withdraw (
id TEXT PRIMARY KEY,
satsdice_pay TEXT,
value INTEGER DEFAULT 1,
value {db.big_int} DEFAULT 1,
unique_hash TEXT UNIQUE,
k1 TEXT,
open_time INTEGER,
@ -47,11 +47,11 @@ async def m003_initial(db):
Creates an improved satsdice table and migrates the existing data.
"""
await db.execute(
"""
f"""
CREATE TABLE satsdice.satsdice_payment (
payment_hash TEXT PRIMARY KEY,
satsdice_pay TEXT,
value INTEGER,
value {db.big_int},
paid BOOL DEFAULT FALSE,
lost BOOL DEFAULT FALSE
);

View File

@ -4,7 +4,7 @@ async def m001_initial(db):
"""
await db.execute(
"""
f"""
CREATE TABLE satspay.charges (
id TEXT NOT NULL PRIMARY KEY,
"user" TEXT,
@ -18,8 +18,8 @@ async def m001_initial(db):
completelink TEXT,
completelinktext TEXT,
time INTEGER,
amount INTEGER,
balance INTEGER DEFAULT 0,
amount {db.big_int},
balance {db.big_int} DEFAULT 0,
timestamp TIMESTAMP NOT NULL DEFAULT """
+ db.timestamp_now
+ """

View File

@ -3,25 +3,25 @@ async def m001_initial(db):
Initial wallet table.
"""
await db.execute(
"""
f"""
CREATE TABLE watchonly.wallets (
id TEXT NOT NULL PRIMARY KEY,
"user" TEXT,
masterpub TEXT NOT NULL,
title TEXT NOT NULL,
address_no INTEGER NOT NULL DEFAULT 0,
balance INTEGER NOT NULL
balance {db.big_int} NOT NULL
);
"""
)
await db.execute(
"""
f"""
CREATE TABLE watchonly.addresses (
id TEXT NOT NULL PRIMARY KEY,
address TEXT NOT NULL,
wallet TEXT NOT NULL,
amount INTEGER NOT NULL
amount {db.big_int} NOT NULL
);
"""
)

View File

@ -3,13 +3,13 @@ async def m001_initial(db):
Creates an improved withdraw table and migrates the existing data.
"""
await db.execute(
"""
f"""
CREATE TABLE withdraw.withdraw_links (
id TEXT PRIMARY KEY,
wallet TEXT,
title TEXT,
min_withdrawable INTEGER DEFAULT 1,
max_withdrawable INTEGER DEFAULT 1,
min_withdrawable {db.big_int} DEFAULT 1,
max_withdrawable {db.big_int} DEFAULT 1,
uses INTEGER DEFAULT 1,
wait_time INTEGER,
is_unique INTEGER DEFAULT 0,
@ -28,13 +28,13 @@ async def m002_change_withdraw_table(db):
Creates an improved withdraw table and migrates the existing data.
"""
await db.execute(
"""
f"""
CREATE TABLE withdraw.withdraw_link (
id TEXT PRIMARY KEY,
wallet TEXT,
title TEXT,
min_withdrawable INTEGER DEFAULT 1,
max_withdrawable INTEGER DEFAULT 1,
min_withdrawable {db.big_int} DEFAULT 1,
max_withdrawable {db.big_int} DEFAULT 1,
uses INTEGER DEFAULT 1,
wait_time INTEGER,
is_unique INTEGER DEFAULT 0,