From eb938c11a86e5fa2db55ca025ab881c2504eefe5 Mon Sep 17 00:00:00 2001 From: Eneko Illarramendi Date: Tue, 21 Apr 2020 23:47:04 +0200 Subject: [PATCH] chore(paywall): minor updates --- lnbits/extensions/paywall/migrations.py | 6 +++-- .../paywall/templates/paywall/display.html | 24 +++++++++++++++---- lnbits/extensions/paywall/views_api.py | 2 +- .../withdraw/templates/withdraw/display.html | 2 +- lnbits/static/js/components.js | 15 ++++++++++++ 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/lnbits/extensions/paywall/migrations.py b/lnbits/extensions/paywall/migrations.py index 74ae6f8..23fca00 100644 --- a/lnbits/extensions/paywall/migrations.py +++ b/lnbits/extensions/paywall/migrations.py @@ -5,7 +5,8 @@ def m001_initial(db): """ Initial paywalls table. """ - db.execute(""" + db.execute( + """ CREATE TABLE IF NOT EXISTS paywalls ( id TEXT PRIMARY KEY, wallet TEXT NOT NULL, @@ -15,7 +16,8 @@ def m001_initial(db): amount INTEGER NOT NULL, time TIMESTAMP NOT NULL DEFAULT (strftime('%s', 'now')) ); - """) + """ + ) def migrate(): diff --git a/lnbits/extensions/paywall/templates/paywall/display.html b/lnbits/extensions/paywall/templates/paywall/display.html index 5b12ffe..e902aff 100644 --- a/lnbits/extensions/paywall/templates/paywall/display.html +++ b/lnbits/extensions/paywall/templates/paywall/display.html @@ -6,9 +6,19 @@
- - - +
{{ paywall.memo }}
+ Price: sat + +
+ + + + + +
+ Copy invoice +
+

You can access the URL behind this paywall:
{% raw %}{{ redirectUrl }}{% endraw %}

@@ -40,7 +50,7 @@ mixins: [windowMixin], data: function () { return { - pr: null, + paymentReq: null, fingerprint: { hash: null, isValid: false @@ -55,7 +65,7 @@ axios.get( '/paywall/api/v1/paywalls/{{ paywall.id }}/invoice' ).then(function (response) { - self.pr = response.data.payment_request; + self.paymentReq = response.data.payment_request; dismissMsg = self.$q.notify({ timeout: 0, @@ -79,8 +89,12 @@ icon: null }); } + }).catch(function (error) { + LNbits.utils.notifyApiError(error); }); }, 2000); + }).catch(function (error) { + LNbits.utils.notifyApiError(error); }); } }, diff --git a/lnbits/extensions/paywall/views_api.py b/lnbits/extensions/paywall/views_api.py index b931b5c..dc39dac 100644 --- a/lnbits/extensions/paywall/views_api.py +++ b/lnbits/extensions/paywall/views_api.py @@ -58,7 +58,7 @@ def api_paywall_get_invoice(paywall_id): try: checking_id, payment_request = create_invoice( - wallet_id=paywall.wallet, amount=paywall.amount, memo=paywall.memo + wallet_id=paywall.wallet, amount=paywall.amount, memo=f"#paywall {paywall.memo}" ) except Exception as e: return jsonify({"message": str(e)}), Status.INTERNAL_SERVER_ERROR diff --git a/lnbits/extensions/withdraw/templates/withdraw/display.html b/lnbits/extensions/withdraw/templates/withdraw/display.html index ae0ae63..38b330f 100644 --- a/lnbits/extensions/withdraw/templates/withdraw/display.html +++ b/lnbits/extensions/withdraw/templates/withdraw/display.html @@ -6,7 +6,7 @@
-
+
{% if link.is_spent %} Withdraw is spent. {% endif %} diff --git a/lnbits/static/js/components.js b/lnbits/static/js/components.js index f8a5c8c..76be279 100644 --- a/lnbits/static/js/components.js +++ b/lnbits/static/js/components.js @@ -1,3 +1,18 @@ +Vue.component('lnbits-fsat', { + props: { + amount: { + type: Number, + default: 0 + } + }, + template: '{{ fsat }}', + computed: { + fsat: function () { + return LNbits.utils.formatSat(this.amount); + } + } +}); + Vue.component('lnbits-wallet-list', { data: function () { return {