diff --git a/lnbits/extensions/copilot/crud.py b/lnbits/extensions/copilot/crud.py index 510c3353..2f52b7fc 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 c0ec153f..8e4e72d2 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 8aa2ae06..70d70cf5 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 a760e1e8..4dbf79a4 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