Skip to content

Commit

Permalink
because blowater
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Jul 25, 2024
1 parent 9422485 commit 8d7f03b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/relays/blocks/RelaysResultTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
<!-- {{ this.store.results.get(relay)?.pubkeyValid }}
{{ this.store.results.get(relay)?.info?.pubkey }} -->
<span
v-if="this.store.results.get(relay)?.pubkeyValid && this.store.results.get(relay)?.info?.pubkey"
v-if="typeof this.store.results.get(relay)?.info?.pubkey === 'string' && this.store.results.get(relay)?.pubkeyValid && this.store.results.get(relay)?.info?.pubkey"
v-tooltip:right.tooltip="`Valid pubkey was registered by relay: ${this.store.results.get(relay).info.pubkey}`"
class="cursor-pointer">
<svg class="svg-icon fill-green-600 dark:fill-green-600/70" style="width: 1em; height: 1em;vertical-align: middle;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M969.530368 512l-123.871232 89.4464 62.595072 139.424768-152.020992 15.362048-15.254528 152.062976-139.446272-62.596096L512 969.530368l-89.43616-123.830272-139.435008 62.596096-15.254528-152.062976-152.052736-15.362048 62.595072-139.424768L54.470656 512l123.860992-89.435136-62.595072-139.436032 152.052736-15.361024 15.255552-152.052736 139.435008 62.595072L512 54.469632l89.4464 123.840512 139.424768-62.595072 15.254528 152.052736 152.042496 15.361024L845.574144 422.56384 969.530368 512z" /></svg>
Expand Down
30 changes: 19 additions & 11 deletions src/components/relays/jobs/CheckNip11.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,26 @@ const localMethods = {
result.pubkeyValid = false
if(result.info.pubkey.startsWith('npub')) {
result.pubkeyError = "pubkey is in npub format, should be hex"
return result
}
if(!result.info.pubkey.match(/[0-9A-Fa-f]{6}/g)) {
result.pubkeyError = "pubkey is not hex"
return result
const pubkeyIsString = result?.info?.pubkey && typeof result.info.pubkey === 'string'
if(pubkeyIsString) {
if(result.info.pubkey.startsWith('npub')) {
result.pubkeyError = "pubkey is in npub format, should be hex"
return result
}
if(!result.info.pubkey?.match(/[0-9A-Fa-f]{6}/g)) {
result.pubkeyError = "pubkey is not hex"
return result
}
const pubkey = Uint8Array.from(Buffer.from(result.info.pubkey, 'hex'));
if(pubkey.length !== 32){
result.pubkeyError = 'pubkey is expected to be 32'
return result
}
}
const pubkey = Uint8Array.from(Buffer.from(result.info.pubkey, 'hex'));
if(pubkey.length !== 32){
result.pubkeyError = 'pubkey is expected to be 32'
else {
result.pubkeyError = 'pubkey is not a string'
return result
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/relays/jobs/RelayOperatorJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const localMethods = {
if( !this.isExpired(this.slug, 1000) && !force )
return
if( !this.result?.info?.pubkey || typeof this.result.info.pubkey !== 'string' )
return
this.queueJob(
this.slug,
() => {
Expand All @@ -36,7 +39,6 @@ const localMethods = {
.on('open', relay => {
relay.subscribe(`${subid}-0`, { limit:1, kinds:[0], authors:[this.result.info.pubkey] })
relay.subscribe(`${subid}-1`, { limit:10, kinds:[1], authors:[this.result.info.pubkey] })
// relay.subscribe(`${subid}-7`, { limit:10, kinds:[7], authors:[this.result.info.pubkey] })
})
.on('event', (relay, sub_id, event) => {
if(subid === `${subid}-0`){
Expand Down

0 comments on commit 8d7f03b

Please sign in to comment.