feat: add UI for blocked/allowed public keys

This commit is contained in:
Vlad Stan 2023-02-07 16:41:57 +02:00
parent 1e2307a758
commit 709e201fec
2 changed files with 107 additions and 4 deletions

View file

@ -9,6 +9,8 @@ async function relayDetails(path) {
return {
tab: 'info',
relay: null,
blockedPubkey: '',
allowedPubkey: '',
formDialogItem: {
show: false,
data: {
@ -59,7 +61,9 @@ async function relayDetails(path) {
wallet: '',
costToJoin: 0,
freeStorage: 0,
storageCostPerKb: 0
storageCostPerKb: 0,
allowedPublicKeys: [],
blockedPublicKeys: []
}
this.relay = data
@ -90,6 +94,23 @@ async function relayDetails(path) {
togglePaidRelay: async function () {
this.relay.config.wallet =
this.relay.config.wallet || this.walletOptions[0].value
},
allowPublicKey: function () {
this.relay.config.allowedPublicKeys.push(this.allowedPubkey)
this.allowedPubkey = ''
},
blockPublicKey: function () {
this.relay.config.blockedPublicKeys.push(this.blockedPubkey)
this.blockedPubkey = ''
},
deleteAllowedPublicKey: function (pubKey) {
this.relay.config.allowedPublicKeys =
this.relay.config.allowedPublicKeys.filter(p => p !== pubKey)
},
deleteBlockedPublicKey: function (pubKey) {
this.relay.config.blockedPublicKeys =
this.relay.config.blockedPublicKeys.filter(p => p !== pubKey)
}
},