From 137f8a7519a7496972671efb05d56346f07f19c5 Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Thu, 24 Jun 2021 00:33:49 +0100 Subject: [PATCH] few bugs --- lnbits/extensions/copilot/crud.py | 2 +- lnbits/extensions/copilot/migrations.py | 2 +- lnbits/extensions/copilot/models.py | 4 ++-- .../copilot/templates/copilot/index.html | 19 ++++++++++++++++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/lnbits/extensions/copilot/crud.py b/lnbits/extensions/copilot/crud.py index 510c33531..2f52b7fcd 100644 --- a/lnbits/extensions/copilot/crud.py +++ b/lnbits/extensions/copilot/crud.py @@ -15,7 +15,7 @@ from quart import jsonify async def create_copilot( title: str, user: str, - lnurl_toggle: str, + lnurl_toggle: Optional[int] = 0, wallet: Optional[str] = None, animation1: Optional[str] = None, animation2: Optional[str] = None, diff --git a/lnbits/extensions/copilot/migrations.py b/lnbits/extensions/copilot/migrations.py index c0ec153f4..8e4e72d2f 100644 --- a/lnbits/extensions/copilot/migrations.py +++ b/lnbits/extensions/copilot/migrations.py @@ -23,7 +23,7 @@ async def m001_initial(db): lnurl_title TEXT, show_message INTEGER, show_ack INTEGER, - show_price TEXT, + show_price INTEGER, amount_made INTEGER, fullscreen_cam INTEGER, iframe_url TEXT, diff --git a/lnbits/extensions/copilot/models.py b/lnbits/extensions/copilot/models.py index 8aa2ae068..70d70cf5f 100644 --- a/lnbits/extensions/copilot/models.py +++ b/lnbits/extensions/copilot/models.py @@ -11,7 +11,7 @@ class Copilots(NamedTuple): id: str user: str title: str - lnurl_toggle: str + lnurl_toggle: int wallet: str animation1: str animation2: str @@ -25,7 +25,7 @@ class Copilots(NamedTuple): lnurl_title: str show_message: int show_ack: int - show_price: str + show_price: int amount_made: int timestamp: int fullscreen_cam: int diff --git a/lnbits/extensions/copilot/templates/copilot/index.html b/lnbits/extensions/copilot/templates/copilot/index.html index a760e1e8c..4dbf79a4b 100644 --- a/lnbits/extensions/copilot/templates/copilot/index.html +++ b/lnbits/extensions/copilot/templates/copilot/index.html @@ -494,8 +494,25 @@ createCopilot: function (wallet, data) { 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 - .request('POST', '/copilot/api/v1/copilot', wallet, data) + .request('POST', '/copilot/api/v1/copilot', wallet, updatedData) .then(function (response) { self.CopilotLinks.push(mapCopilot(response.data)) self.formDialogCopilot.show = false