From d47874bda918bee60b948e5eaf34459d82b4c89b Mon Sep 17 00:00:00 2001 From: arcbtc Date: Fri, 23 Feb 2024 11:36:51 +0000 Subject: [PATCH] removed local event and used the global function --- __pycache__/__init__.cpython-39.pyc | Bin 1055 -> 1055 bytes __pycache__/crud.cpython-39.pyc | Bin 3237 -> 3237 bytes __pycache__/lnurl.cpython-39.pyc | Bin 3382 -> 3382 bytes __pycache__/migrations.cpython-39.pyc | Bin 934 -> 934 bytes __pycache__/models.cpython-39.pyc | Bin 1311 -> 1311 bytes __pycache__/tasks.cpython-39.pyc | Bin 1405 -> 1405 bytes __pycache__/views.cpython-39.pyc | Bin 2231 -> 2231 bytes __pycache__/views_api.cpython-39.pyc | Bin 3763 -> 3763 bytes config.json | 2 +- static/{ => image}/myextension.png | Bin templates/myextension/myextension.html | 71 ++----------------------- 11 files changed, 6 insertions(+), 67 deletions(-) rename static/{ => image}/myextension.png (100%) diff --git a/__pycache__/__init__.cpython-39.pyc b/__pycache__/__init__.cpython-39.pyc index 68e4005453e3974c9c84419fca059c2a05dc2475..65868ffe07dfcbaa0504fa39746543948590dcf1 100644 GIT binary patch delta 26 icmbQwF`t7wk(ZZ?fq{YHT=|WS+}+HKQIn@LcK`rau?JQF delta 26 icmbQwF`t7wk(ZZ?fq{X+?b7az+}+HKw -
-
- lnurlpay - -
-
-
@@ -36,7 +29,7 @@ Moat extensions have a public page that can be shared (this page will still be accessible even if you have restricted access to your LNbits install). -
+

In this example when a user pays the LNURLpay it triggers an event via a websocket waiting for the payment.

.

@@ -56,70 +49,16 @@ mixins: [windowMixin], data: function () { return { - qrValue: '', + qrValue: '{{myextension_id}}', myExtensionID: '' } }, created: function () { - this.qrValue = '{{lnurlpay}}' - this.myExtensionID = '{{myextension_id}}' - this.connectWebocket(this.myExtensionID) + // Will trigger payment reaction when payment received, sent from tasks.py + eventReactionWebocket(this.myExtensionID) }, methods: { - makeItRain() { - document.getElementById("vue").disabled = true - var end = Date.now() + (2 * 1000) - var colors = ['#FFD700', '#ffffff'] - function frame() { - confetti({ - particleCount: 2, - angle: 60, - spread: 55, - origin: { x: 0 }, - colors: colors, - zIndex: 999999 - }) - confetti({ - particleCount: 2, - angle: 120, - spread: 55, - origin: { x: 1 }, - colors: colors, - zIndex: 999999 - }) - if (Date.now() < end) { - requestAnimationFrame(frame) - } - else { - document.getElementById("vue").disabled = false - } - } - frame() - }, - connectWebocket(id) { - ////////////////////////////////////////////////// - ///wait for pay action to happen and do a thing//// - /////////////////////////////////////////////////// - self = this - if (location.protocol !== 'http:') { - localUrl = - 'wss://' + - location.host + - '/api/v1/ws/' + - id - } else { - localUrl = - 'ws://' + - location.host + - '/api/v1/ws/' + - id - } - this.connection = new WebSocket(localUrl) - this.connection.onmessage = function (e) { - self.makeItRain() - } - } - }, + } }) {% endblock %} \ No newline at end of file