diff --git a/lnbits/extensions/copilot/crud.py b/lnbits/extensions/copilot/crud.py
index 04d78f167..432feb5e6 100644
--- a/lnbits/extensions/copilot/crud.py
+++ b/lnbits/extensions/copilot/crud.py
@@ -29,6 +29,7 @@ async def create_copilot(
lnurl_title: Optional[str] = None,
show_message: Optional[int] = None,
show_ack: Optional[int] = None,
+ show_price: Optional[int] = None,
amount_made: Optional[int] = None,
) -> Copilots:
copilot_id = urlsafe_short_hash()
@@ -53,10 +54,11 @@ async def create_copilot(
lnurl_title,
show_message,
show_ack,
+ show_price,
lnurl_title,
amount_made
)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""",
(
copilot_id,
@@ -76,6 +78,7 @@ async def create_copilot(
lnurl_title,
show_message,
show_ack,
+ show_price,
lnurl_title,
0
),
diff --git a/lnbits/extensions/copilot/migrations.py b/lnbits/extensions/copilot/migrations.py
index e7f6d2e60..449381c97 100644
--- a/lnbits/extensions/copilot/migrations.py
+++ b/lnbits/extensions/copilot/migrations.py
@@ -23,6 +23,7 @@ async def m001_initial(db):
lnurl_title TEXT,
show_message INTEGER,
show_ack INTEGER,
+ 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 1283c7ad5..cf33f7a2c 100644
--- a/lnbits/extensions/copilot/models.py
+++ b/lnbits/extensions/copilot/models.py
@@ -24,6 +24,7 @@ class Copilots(NamedTuple):
lnurl_title: str
show_message: int
show_ack: int
+ show_price: int
amount_made: int
timestamp: int
fullscreen_cam: int
diff --git a/lnbits/extensions/copilot/templates/copilot/compose.html b/lnbits/extensions/copilot/templates/copilot/compose.html
index 8fff5322b..42faeb1a8 100644
--- a/lnbits/extensions/copilot/templates/copilot/compose.html
+++ b/lnbits/extensions/copilot/templates/copilot/compose.html
@@ -15,20 +15,56 @@
>
-
+ Powered by LNbits/StreamerCopilot +
{% endblock %} {% block scripts %} @@ -52,7 +88,10 @@ el: '#vue', mixins: [windowMixin], data() { - return {} + return { + price: '', + counter: 1 + } }, methods: { openURL: function (url) { @@ -78,6 +117,25 @@ setTimeout(function () { setInterval(function () { self.connection.send('') + self.counter++ + if (self.counter % 20 === 0) { + if ('{{ copilot.show_price }}' != 'None') { + LNbits.api + .request('GET', 'https://api.opennode.com/v1/rates', 'filla') + .then(function (response) { + self.price = String( + new Intl.NumberFormat('en-US', { + style: 'currency', + currency: 'USD' + }).format(response.data.data.BTCUSD.USD) + ) + console.log(self.price) + }) + .catch(function (error) { + LNbits.utils.notifyApiError(error) + }) + } + } }, 1000) }, 2000) } diff --git a/lnbits/extensions/copilot/templates/copilot/index.html b/lnbits/extensions/copilot/templates/copilot/index.html index f6fcd7c12..e63e5fcaf 100644 --- a/lnbits/extensions/copilot/templates/copilot/index.html +++ b/lnbits/extensions/copilot/templates/copilot/index.html @@ -318,6 +318,15 @@ +