From 64426d187c31c1ae50f2b020b0d53a5a0e403c09 Mon Sep 17 00:00:00 2001
From: Vlad Stan
Date: Thu, 22 Jun 2023 17:26:47 +0300
Subject: [PATCH] feat: add predefined relay list
plus code format
---
templates/nostrclient/index.html | 191 +++++++++----------------------
1 file changed, 53 insertions(+), 138 deletions(-)
diff --git a/templates/nostrclient/index.html b/templates/nostrclient/index.html
index 10fd4a5..7e83b6d 100644
--- a/templates/nostrclient/index.html
+++ b/templates/nostrclient/index.html
@@ -6,18 +6,18 @@
-
+
- Add relay
-
+
+
+
+
+
+
+
+
@@ -29,36 +29,18 @@
Nostrclient
-
+
-
+
-
+
{{ col.label }}
@@ -67,12 +49,7 @@
-
+
@@ -82,14 +59,7 @@
-
+
@@ -101,32 +71,15 @@
- Copy address
+ Copy address
Your endpoint:
-
+
-
+
@@ -134,13 +87,8 @@
Sender Private Key:
-
+
@@ -149,8 +97,7 @@
No not use your real private key! Leave empty for a randomly
- generated key.
+ generated key.
@@ -159,13 +106,7 @@
Sender Public Key:
-
+
@@ -173,15 +114,8 @@
Test Message:
-
+
@@ -189,35 +123,22 @@
Receiver Public Key:
-
+
- This is the recipient of the message. Field required.
+ This is the recipient of the message. Field required.
- Send Message
+ Send Message
@@ -229,14 +150,7 @@
Sent Data:
-
+
@@ -244,14 +158,7 @@
Received Data:
-
+
@@ -270,12 +177,8 @@
-
+
Only Admin users can manage this extension.
@@ -356,7 +259,15 @@
pagination: {
rowsPerPage: 10
}
- }
+ },
+ predefinedRelays: [
+ "wss://relay.damus.io",
+ "wss://nostr-pub.wellorder.net",
+ "wss://nostr.zebedee.cloud",
+ "wss://nodestr.fmt.wiz.biz",
+ "wss://nostr.oxtr.dev",
+ "wss://nostr.wine"
+ ],
}
},
methods: {
@@ -399,7 +310,7 @@
'POST',
'/nostrclient/api/v1/relay?usr=' + this.g.user.id,
this.g.user.wallets[0].adminkey,
- {url: this.relayToAdd}
+ { url: this.relayToAdd }
)
.then(function (response) {
console.log('response:', response)
@@ -414,6 +325,10 @@
})
return false
},
+ async addCustomRelay(relayUrl) {
+ this.relayToAdd = relayUrl
+ await this.addRelay()
+ },
deleteRelay(url) {
console.log('DELETE RELAY ' + url)
LNbits.api
@@ -421,7 +336,7 @@
'DELETE',
'/nostrclient/api/v1/relay?usr=' + this.g.user.id,
this.g.user.wallets[0].adminkey,
- {url: url}
+ { url: url }
)
.then(function (response) {
if (response.data) {
@@ -469,7 +384,7 @@
},
sendTestMessage: async function () {
try {
- const {data} = await LNbits.api.request(
+ const { data } = await LNbits.api.request(
'PUT',
'/nostrclient/api/v1/relay/test?usr=' + this.g.user.id,
this.g.user.wallets[0].adminkey,
@@ -490,7 +405,7 @@
const subscription = JSON.stringify([
'REQ',
'test-dms',
- {kinds: [4], '#p': [event.pubkey]}
+ { kinds: [4], '#p': [event.pubkey] }
])
this.testData.wsConnection.send(subscription)
} catch (error) {
@@ -555,4 +470,4 @@
}
})
-{% endblock %}
+{% endblock %}
\ No newline at end of file