mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-26 03:46:17 +02:00
Added ack and price
This commit is contained in:
@@ -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
|
||||
),
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
|
@@ -15,20 +15,56 @@
|
||||
></video>
|
||||
<img src="" style="width: 100%" id="animations" class="fixed-bottom-left" />
|
||||
|
||||
<qrcode
|
||||
<div
|
||||
v-if="'{{ lnurl_toggle }}' == 1"
|
||||
class="rounded-borders fixed-top-right column"
|
||||
style="width: 20%; z-index: 9999"
|
||||
:value="'{{ lnurl }}'"
|
||||
:options="{width:222}"
|
||||
class="rounded-borders fixed-top-right"
|
||||
></qrcode>
|
||||
>
|
||||
<div class="col">
|
||||
<qrcode
|
||||
style="width: 100%"
|
||||
:value="'{{ lnurl }}'"
|
||||
:options="{width:222}"
|
||||
class="rounded-borders"
|
||||
></qrcode>
|
||||
</div>
|
||||
<div
|
||||
class="col"
|
||||
style="
|
||||
font-size: 25px;
|
||||
background-color: white;
|
||||
color: black;
|
||||
width: 100%;
|
||||
"
|
||||
>
|
||||
<center>{{ copilot.title }}</center>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<q-btn
|
||||
color="primary"
|
||||
@click="reconnect"
|
||||
label="Reconnect"
|
||||
class="fixed-bottom-left"
|
||||
/>
|
||||
<h2
|
||||
v-if="'{{ copilot.show_price }}' != 'None'"
|
||||
class="text-bold fixed-bottom-left"
|
||||
style="
|
||||
margin: 60px 60px;
|
||||
font-size: 150px;
|
||||
text-shadow: 4px 8px 4px black;
|
||||
color: white;
|
||||
"
|
||||
>
|
||||
{% raw %}{{ price }}{% endraw %}
|
||||
</h2>
|
||||
<p
|
||||
v-if="'{{ copilot.show_ack }}' != 'None'"
|
||||
class="fixed-top"
|
||||
style="
|
||||
font-size: 22px;
|
||||
text-shadow: 2px 4px 1px black;
|
||||
color: white;
|
||||
padding-left: 40%;
|
||||
"
|
||||
>
|
||||
Powered by LNbits/StreamerCopilot
|
||||
</p>
|
||||
</q-page>
|
||||
{% endblock %} {% block scripts %}
|
||||
<script src="{{ url_for('static', filename='vendor/vue-qrcode@1.0.2/vue-qrcode.min.js') }}"></script>
|
||||
@@ -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)
|
||||
}
|
||||
|
@@ -318,6 +318,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="q-gutter-sm">
|
||||
<div class="row">
|
||||
<q-checkbox
|
||||
v-model="formDialogCopilot.data.show_price"
|
||||
left-label
|
||||
label="Show bitcoin price"
|
||||
></q-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-gutter-sm">
|
||||
<div class="row">
|
||||
<q-checkbox
|
||||
@@ -327,7 +336,6 @@
|
||||
></q-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn
|
||||
unelevated
|
||||
@@ -431,7 +439,8 @@
|
||||
data: {
|
||||
lnurl_toggle: false,
|
||||
show_message: false,
|
||||
show_ack: true,
|
||||
show_ack: false,
|
||||
show_price: false,
|
||||
title: ''
|
||||
}
|
||||
},
|
||||
|
@@ -40,6 +40,7 @@ from .crud import (
|
||||
"lnurl_title": {"type": "string", "empty": False, "required": False},
|
||||
"show_message": {"type": "integer", "empty": False, "required": False},
|
||||
"show_ack": {"type": "integer", "empty": False, "required": True},
|
||||
"show_price": {"type": "integer", "empty": False, "required": True},
|
||||
}
|
||||
)
|
||||
async def api_copilot_create_or_update(copilot_id=None):
|
||||
|
Reference in New Issue
Block a user