This commit is contained in:
Ben Arc
2021-06-24 00:33:49 +01:00
parent 2bc3fb1b91
commit 137f8a7519
4 changed files with 22 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ from quart import jsonify
async def create_copilot( async def create_copilot(
title: str, title: str,
user: str, user: str,
lnurl_toggle: str, lnurl_toggle: Optional[int] = 0,
wallet: Optional[str] = None, wallet: Optional[str] = None,
animation1: Optional[str] = None, animation1: Optional[str] = None,
animation2: Optional[str] = None, animation2: Optional[str] = None,

View File

@@ -23,7 +23,7 @@ async def m001_initial(db):
lnurl_title TEXT, lnurl_title TEXT,
show_message INTEGER, show_message INTEGER,
show_ack INTEGER, show_ack INTEGER,
show_price TEXT, show_price INTEGER,
amount_made INTEGER, amount_made INTEGER,
fullscreen_cam INTEGER, fullscreen_cam INTEGER,
iframe_url TEXT, iframe_url TEXT,

View File

@@ -11,7 +11,7 @@ class Copilots(NamedTuple):
id: str id: str
user: str user: str
title: str title: str
lnurl_toggle: str lnurl_toggle: int
wallet: str wallet: str
animation1: str animation1: str
animation2: str animation2: str
@@ -25,7 +25,7 @@ class Copilots(NamedTuple):
lnurl_title: str lnurl_title: str
show_message: int show_message: int
show_ack: int show_ack: int
show_price: str show_price: int
amount_made: int amount_made: int
timestamp: int timestamp: int
fullscreen_cam: int fullscreen_cam: int

View File

@@ -494,8 +494,25 @@
createCopilot: function (wallet, data) { createCopilot: function (wallet, data) {
var self = this var self = this
var updatedData = {}
for (const property in data) {
if (data[property]) {
updatedData[property] = data[property]
}
if (property == 'animation1threshold' && data[property]) {
console.log(data[property])
updatedData[property] = parseInt(data[property])
}
if (property == 'animation2threshold' && data[property]) {
updatedData[property] = parseInt(data[property])
}
if (property == 'animation3threshold' && data[property]) {
updatedData[property] = parseInt(data[property])
}
}
console.log(updatedData)
LNbits.api LNbits.api
.request('POST', '/copilot/api/v1/copilot', wallet, data) .request('POST', '/copilot/api/v1/copilot', wallet, updatedData)
.then(function (response) { .then(function (response) {
self.CopilotLinks.push(mapCopilot(response.data)) self.CopilotLinks.push(mapCopilot(response.data))
self.formDialogCopilot.show = false self.formDialogCopilot.show = false