diff --git a/package.json b/package.json index c85b8d9..fed80b0 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "node-emoji": "1.11.0", "node-polyfill-webpack-plugin": "2.0.1", "nostr": "0.2.5", + "nostr-relay-inspector": "0.0.1", "nostr-tools": "0.24.1", "onion-regex": "2.0.8", "requests": "0.3.0", diff --git a/src/components/BaseRelays.vue b/src/components/BaseRelays.vue index 959603e..0e63443 100644 --- a/src/components/BaseRelays.vue +++ b/src/components/BaseRelays.vue @@ -135,7 +135,7 @@ - + 🔌 @@ -155,7 +155,7 @@ {{ relay }} - + @@ -265,8 +265,6 @@ export default defineComponent({ methods: { check(relay){ - - //console.log(relay, 'checking', this.count++) let inspect = new Inspector(relay, { checkLatency: true, run: true, @@ -277,17 +275,11 @@ export default defineComponent({ this.result[relay] = result }) .on('complete', (instance) => { - this.result[relay] = instance.result this.messages[relay] = instance.inbox - // console.log('notices', this.messages[relay]) this.setFlag(relay) this.setAggregateResult(relay) - //console.log('result state', instance.result) - //console.log('messages', this.messages[relay].notices.length ? this.messages[relay].notices : null) - // this.adjustResult(relay) - // //console.log(this.connections[relay]) - + this.adjustResult(relay) }) .on('notice', (notice) => { const hash = this.sha1(notice) @@ -299,13 +291,6 @@ export default defineComponent({ this.result[relay].observations.push( new Observation('notice', response_obj.code, response_obj.description, response_obj.relates_to) ) console.log(this.result[relay].observations) - - // if (Array.isArray(this.alerts[relay])) - // this.alerts[relay] = new Array() - // - // console.log('alerts', this.alerts, Array.isArray(this.alerts[relay]), this.alerts[relay], response_obj) - // - // this.alerts[relay].push = response_obj }) .on('close', () => { // delete this.connections[relay] @@ -344,19 +329,11 @@ export default defineComponent({ return [] }, - adjustResult (url) { - Object.entries(this.messages[url].notices).forEach( ([key, value]) => { - if(!value.hasOwnProperty("hash")) return - let code = RELAY_MESSAGES[value.hash].code, - type = RELAY_CODES[code].type - - this.result[url][type] = code - if (type == "maybe_public") { - this.result[url].check.write = false - this.result[url].aggregate = 'public' - } - if (type == "write_restricted") { - this.result[url].check.write = false + adjustResult (relay) { + this.result[relay].observations.forEach( observation => { + if (observation.code == "BLOCKS_WRITE_STATUS_CHECK") { + this.result[relay].check.write = false + this.result[relay].aggregate = 'public' } }) },