mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-05 20:51:31 +02:00
format
This commit is contained in:
parent
c2bfc199e1
commit
1d980afb62
@ -52,7 +52,14 @@
|
|||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="text-h5 q-mb-md">
|
<div class="text-h5 q-mb-md">
|
||||||
Extension Development Guide
|
Extension Development Guide
|
||||||
<small>(also check the <a class="text-primary" href="http://docs.lnbits.org/devs/development.html">docs</a>)</small>
|
<small
|
||||||
|
>(also check the
|
||||||
|
<a
|
||||||
|
class="text-primary"
|
||||||
|
href="http://docs.lnbits.org/devs/development.html"
|
||||||
|
>docs</a
|
||||||
|
>)</small
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-card unelevated flat>
|
<q-card unelevated flat>
|
||||||
@ -188,7 +195,8 @@
|
|||||||
<p>
|
<p>
|
||||||
LNbits uses
|
LNbits uses
|
||||||
<a href="https://vuejs.org/" class="text-primary">Vue</a>
|
<a href="https://vuejs.org/" class="text-primary">Vue</a>
|
||||||
for best-in-class, responsive and high-performance components.
|
for best-in-class, responsive and high-performance
|
||||||
|
components.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>Typical example of Vue components in a frontend script:</p>
|
<p>Typical example of Vue components in a frontend script:</p>
|
||||||
@ -198,8 +206,7 @@
|
|||||||
/><br /><br />
|
/><br /><br />
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Content can be
|
Content can be conditionally rendered using Vue's
|
||||||
conditionally rendered using Vue's
|
|
||||||
<code class="bg-grey-3 text-black">v-if</code>:
|
<code class="bg-grey-3 text-black">v-if</code>:
|
||||||
</p>
|
</p>
|
||||||
<img
|
<img
|
||||||
@ -258,42 +265,82 @@
|
|||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
<q-tab-panel name="qrcodes" class="text-body1">
|
<q-tab-panel name="qrcodes" class="text-body1">
|
||||||
<div class="text-h5 q-mb-md">QR Codes</div>
|
<div class="text-h5 q-mb-md">QR Codes</div>
|
||||||
<p>For most purposes use Quasar's inbuilt VueQrcode library:</p>
|
<p>
|
||||||
|
For most purposes use Quasar's inbuilt VueQrcode library:
|
||||||
|
</p>
|
||||||
<img src="./static/qrcode-example1.png" />
|
<img src="./static/qrcode-example1.png" />
|
||||||
<p>
|
<p>
|
||||||
LNbits does also include a handy
|
LNbits does also include a handy
|
||||||
<a
|
<a
|
||||||
href="../docs#/default/img_api_v1_qrcode__data__get"
|
href="../docs#/default/img_api_v1_qrcode__data__get"
|
||||||
class="text-primary"
|
class="text-primary"
|
||||||
> QR code enpoint</a
|
>
|
||||||
|
QR code enpoint</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
{% raw
|
{% raw %} You can use via
|
||||||
%} You can use via <a href="/api/v1/qrcode/some-data-you-want-in-a-qrcode" class="text-primary">{{protocol + location}}{% endraw %}/api/v1/qrcode/some-data-you-want-in-a-qrcode:</a><br />
|
<a
|
||||||
|
href="/api/v1/qrcode/some-data-you-want-in-a-qrcode"
|
||||||
|
class="text-primary"
|
||||||
|
>{{protocol + location}}{% endraw
|
||||||
|
%}/api/v1/qrcode/some-data-you-want-in-a-qrcode:</a
|
||||||
|
><br />
|
||||||
<br />
|
<br />
|
||||||
<img src="./static/qrcode-example.png" />
|
<img src="./static/qrcode-example.png" />
|
||||||
<br />
|
<br />
|
||||||
<img class="bg-white" width="300px" src="/api/v1/qrcode/some-data-you-want-in-a-qrcode" />
|
<img
|
||||||
|
class="bg-white"
|
||||||
|
width="300px"
|
||||||
|
src="/api/v1/qrcode/some-data-you-want-in-a-qrcode"
|
||||||
|
/>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
|
|
||||||
<q-tab-panel name="websockets" class="text-body1">
|
<q-tab-panel name="websockets" class="text-body1">
|
||||||
<div class="text-h5 q-mb-md">Websockets</div>
|
<div class="text-h5 q-mb-md">Websockets</div>
|
||||||
<p>Fastapi includes a great <a class="text-primary" href="https://fastapi.tiangolo.com/advanced/websockets/#websockets-client">websocket tool</a></p>
|
|
||||||
{% raw
|
|
||||||
%}
|
|
||||||
<p>
|
<p>
|
||||||
A few LNbits extensions also make use of a weird and useful websocket/GET tool built into LNbits, such as extensions Copilot and LNURLDevices<br/>
|
Fastapi includes a great
|
||||||
You can subscribe to websocket with <code class="bg-grey-3 text-black">wss:{{location}}/api/v1/ws/{SOME-ID}</code><br/>
|
<a
|
||||||
You can post to any clients subscribed to the endpoint with <code class="bg-grey-3 text-black">{{protocol + location}}/api/v1/ws/{SOME-ID}/{THE-DATA-YOU-WANT-TO-POST}</code><br/>
|
class="text-primary"
|
||||||
|
href="https://fastapi.tiangolo.com/advanced/websockets/#websockets-client"
|
||||||
|
>websocket tool</a
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
{% raw %}
|
||||||
|
<p>
|
||||||
|
A few LNbits extensions also make use of a weird and useful
|
||||||
|
websocket/GET tool built into LNbits, such as extensions
|
||||||
|
Copilot and LNURLDevices<br />
|
||||||
|
You can subscribe to websocket with
|
||||||
|
<code class="bg-grey-3 text-black"
|
||||||
|
>wss:{{location}}/api/v1/ws/{SOME-ID}</code
|
||||||
|
><br />
|
||||||
|
You can post to any clients subscribed to the endpoint with
|
||||||
|
<code class="bg-grey-3 text-black"
|
||||||
|
>{{protocol +
|
||||||
|
location}}/api/v1/ws/{SOME-ID}/{THE-DATA-YOU-WANT-TO-POST}</code
|
||||||
|
><br />
|
||||||
<br />
|
<br />
|
||||||
<strong></div><div id="text-to-change">DEMO: Hit <a target="_blank" href="/api/v1/ws/32872r23g29/blah%20blah%20blah" class="text-primary">{{protocol + location}}/api/v1/ws/32872r23g29/blah%20blah%20blah</a> in a different browser window to change this text to `blah blah blah`.</div></strong>
|
<strong
|
||||||
|
><div id="text-to-change">
|
||||||
|
DEMO: Hit
|
||||||
|
<a
|
||||||
|
target="_blank"
|
||||||
|
href="/api/v1/ws/32872r23g29/blah%20blah%20blah"
|
||||||
|
class="text-primary"
|
||||||
|
>{{protocol +
|
||||||
|
location}}/api/v1/ws/32872r23g29/blah%20blah%20blah</a
|
||||||
|
>
|
||||||
|
in a different browser window to change this text to
|
||||||
|
`blah blah blah`.
|
||||||
|
</div></strong
|
||||||
|
>
|
||||||
<br />
|
<br />
|
||||||
Function used in this demo:<br />
|
Function used in this demo:<br />
|
||||||
<img src="./static/websocket-example.png" />
|
<img src="./static/websocket-example.png" /></p
|
||||||
</q-tab-panel>
|
></q-tab-panel>
|
||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
</q-tab-panels>
|
</q-tab-panels>
|
||||||
</template>
|
</template>
|
||||||
@ -337,7 +384,7 @@
|
|||||||
return {
|
return {
|
||||||
///// Declare models/variables /////
|
///// Declare models/variables /////
|
||||||
protocol: window.location.protocol,
|
protocol: window.location.protocol,
|
||||||
location: "//" + window.location.hostname,
|
location: '//' + window.location.hostname,
|
||||||
thingDialog: {
|
thingDialog: {
|
||||||
show: false,
|
show: false,
|
||||||
data: {}
|
data: {}
|
||||||
@ -386,7 +433,7 @@
|
|||||||
this.ws = new WebSocket(localUrl)
|
this.ws = new WebSocket(localUrl)
|
||||||
this.ws.addEventListener('message', async ({data}) => {
|
this.ws.addEventListener('message', async ({data}) => {
|
||||||
const res = data.toString()
|
const res = data.toString()
|
||||||
document.getElementById("text-to-change").innerHTML = res
|
document.getElementById('text-to-change').innerHTML = res
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
sendThingDialog() {
|
sendThingDialog() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user