mirror of
https://github.com/aljazceru/nostr-watch.git
synced 2025-12-18 22:04:23 +01:00
add more relays, add build scripts, update components
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ yarn.lock
|
||||
node_modules
|
||||
*.wasm
|
||||
public/main.js
|
||||
lib/nostr-relay-inspector
|
||||
|
||||
@@ -6,11 +6,16 @@
|
||||
"serve": "vue-cli-service serve --host localhost",
|
||||
"build": "vue-cli-service build",
|
||||
"watch": "vue-cli-service build --watch",
|
||||
"lint": "vue-cli-service lint"
|
||||
"lint": "vue-cli-service lint",
|
||||
"docker": "docker:build && docker:tag && docker:push",
|
||||
"docker:build": "docker build . -t nostr-relay-status",
|
||||
"docker:tag": "docker tag nostr-relay-status:latest registry.digitalocean.com/sandwich-farm/nostr-relay-status",
|
||||
"docker:push": "docker push registry.digitalocean.com/sandwich-farm/nostr-relay-status"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^3.8.3",
|
||||
"country-code-emoji": "2.3.0",
|
||||
"cross-fetch": "3.1.5",
|
||||
"doh-resolver": "1.2.8",
|
||||
"geoip-lite": "1.4.6",
|
||||
"global": "4.4.0",
|
||||
@@ -22,7 +27,7 @@
|
||||
"node-emoji": "1.11.0",
|
||||
"node-polyfill-webpack-plugin": "2.0.1",
|
||||
"nostr": "0.2.5",
|
||||
"nostr-relay-inspector": "0.0.1",
|
||||
"nostr-relay-inspector": "0.0.3",
|
||||
"nostr-tools": "0.24.1",
|
||||
"onion-regex": "2.0.8",
|
||||
"requests": "0.3.0",
|
||||
|
||||
10
relays.yaml
10
relays.yaml
@@ -25,4 +25,12 @@ relays:
|
||||
- 'wss://nostr-pub.wellorder.net'
|
||||
- 'wss://relayer.fiatjaf.com'
|
||||
- 'wss://nostr.sandwich.farm'
|
||||
- 'wss://none.sandwich.farm'
|
||||
- 'wss://relay.sovereign-stack.org'
|
||||
- 'wss://relay.oldcity-bitcoiners.info'
|
||||
- 'wss://relay.bitid.nz'
|
||||
- 'wss://relay.nostr.xyz'
|
||||
- 'wss://relay.futohq.com'
|
||||
- 'wss://nostr.rdfriedl.com'
|
||||
- 'wss://relay.farscapian.com'
|
||||
- 'wss://astral.ninja'
|
||||
- 'wss://relay.sovereign-stack.org'
|
||||
|
||||
@@ -51,7 +51,9 @@
|
||||
<tr v-for="relay in query('public')" :key="{relay}" :class="getLoadingClass(relay)" class="online public">
|
||||
<td :key="generateKey(relay, 'aggregate')"><span :class="getAggregateResultClass(relay)"></span></td>
|
||||
<td class="left-align relay-url" @click="copy(relay)">{{ relay }}</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<span v-tooltip:top.tooltip="nip05List(relay)"> <span class="verified-shape-wrapper" v-if="result[relay].nips[5]"><span class="shape verified"></span></span></span>
|
||||
</td>
|
||||
<!-- <td>{{result[relay].flag}}</td> -->
|
||||
<td><span>{{ result[relay].latency.final }}<span v-if="result[relay].check.latency">ms</span></span></td>
|
||||
<td :key="generateKey(relay, 'check.connect')"><span :class="getResultClass(relay, 'connect')"></span></td>
|
||||
@@ -195,7 +197,7 @@
|
||||
</table>
|
||||
<a href="./relays/">JSON API</a> -->
|
||||
|
||||
<span class="credit"><a href="http://sandwich.farm">Another 🥪 by sandwich.farm</a>, built with <a href="">nostr-js</a> and <a href="">nostr-relay-inspector</a>, inspired by <a href="">nostr-relay-registry</a></span>
|
||||
<span class="credit"><a href="http://sandwich.farm">Another 🥪 by sandwich.farm</a>, built with <a href="https://github.com/jb55/nostr-js">nostr-js</a> and <a href="https://github.com/dskvr/nostr-relay-inspector">nostr-relay-inspector</a>, inspired by <a href="https://github.com/fiatjaf/nostr-relay-registry">nostr-relay-registry</a></span>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
@@ -218,10 +220,12 @@ import onionRegex from 'onion-regex';
|
||||
import countryCodeEmoji from 'country-code-emoji'
|
||||
import emoji from 'node-emoji'
|
||||
|
||||
|
||||
import { relays } from '../../relays.yaml'
|
||||
import { messages as RELAY_MESSAGES, codes as RELAY_CODES } from '../../codes.yaml'
|
||||
|
||||
import { Inspector, Observation } from 'nostr-relay-inspector'
|
||||
// import { Inspector, Observation } from '../../lib/nostr-relay-inspector'
|
||||
|
||||
import crypto from "crypto"
|
||||
|
||||
@@ -253,7 +257,11 @@ export default defineComponent({
|
||||
|
||||
async mounted() {
|
||||
// //console.log(this.relays.filter((relay) => this.result?.[relay] && !this.result?.[relay].state=='complete').length)
|
||||
this.relays.forEach(relay => { this.check(relay) })
|
||||
this.relays.forEach(async relay => {
|
||||
// const nip05 = await searchDomain(relay)
|
||||
// console.log(relay, 'search domain', nip05)
|
||||
this.check(relay)
|
||||
})
|
||||
// setTimeout(() => {
|
||||
// this.relays.forEach(relay => { this.checkLatency(relay) })
|
||||
// }, 10000)
|
||||
@@ -265,11 +273,13 @@ export default defineComponent({
|
||||
methods: {
|
||||
|
||||
check(relay){
|
||||
|
||||
let inspect = new Inspector(relay, {
|
||||
checkLatency: true,
|
||||
run: true,
|
||||
setIP: false,
|
||||
setGeo: false
|
||||
setGeo: false,
|
||||
checkNip05: true
|
||||
})
|
||||
.on('open', (e, result) => {
|
||||
this.result[relay] = result
|
||||
@@ -457,6 +467,24 @@ export default defineComponent({
|
||||
return value
|
||||
},
|
||||
|
||||
nip05List (url) {
|
||||
let string = ''
|
||||
if(this.result[url].nips[5]) {
|
||||
string = `${string}Relay domain contains NIP-05 verification data for:`
|
||||
let users = Object.entries(this.result[url].nips[5]),
|
||||
count = 0
|
||||
users.forEach( ([key, value]) => {
|
||||
count++
|
||||
string = `${string} @${key} ${(count!=users.length) ? 'and' : ''}`
|
||||
})
|
||||
}
|
||||
return string
|
||||
},
|
||||
|
||||
// searchDomain(domain){
|
||||
// return searchDomain(domain)
|
||||
// },
|
||||
|
||||
|
||||
sha1 (message) {
|
||||
const hash = crypto.createHash('sha1').update(JSON.stringify(message)).digest('hex')
|
||||
@@ -523,7 +551,7 @@ tr.relay.loaded td {
|
||||
|
||||
.badge.write-only,
|
||||
.badge.read-only,
|
||||
tr.online.public .indicator.failure {
|
||||
tr.online .indicator.failure {
|
||||
background-color:orange !important;
|
||||
}
|
||||
|
||||
@@ -619,7 +647,7 @@ tr.online .relay-url {
|
||||
}
|
||||
|
||||
.shape.verified {
|
||||
background: blue;
|
||||
background: #777;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
position: relative;
|
||||
@@ -627,6 +655,11 @@ tr.online .relay-url {
|
||||
left:-5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
th .shape.verified:before,
|
||||
th .shape.verified:after {
|
||||
background:#c0c0c0 !important;
|
||||
}
|
||||
.shape.verified:before,
|
||||
.shape.verified:after {
|
||||
content: "";
|
||||
@@ -635,7 +668,7 @@ tr.online .relay-url {
|
||||
left: 0;
|
||||
height: 13px;
|
||||
width: 13px;
|
||||
background: blue;
|
||||
background: #777;
|
||||
}
|
||||
.shape.verified:before {
|
||||
transform: rotate(30deg);
|
||||
|
||||
@@ -1,27 +1,39 @@
|
||||
<template>
|
||||
<h2><span class="indicator badge readwrite">{{ query('public').length }}</span>Public</h2>
|
||||
<table class="online" v-if="query('public').length > 0">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>🔌</th>
|
||||
<th>👁️🗨️</th>
|
||||
<th>✏️</th>
|
||||
<th>🌎</th>
|
||||
<!-- <td>wl</td>
|
||||
<td>nip-05><td> -->
|
||||
<th>⌛️</th>
|
||||
<th>ℹ️</th>
|
||||
</tr>
|
||||
<tr v-for="relay in query('public')" :key="{relay}" :class="getLoadingClass(relay)">
|
||||
<RelaySingle
|
||||
:relay="{{relay}}"
|
||||
:didConnect="{{didConnect}}"
|
||||
:didRead="{{didRead}}"
|
||||
:didWrite="{{didWrite}}"
|
||||
/>
|
||||
</tr>
|
||||
</table>
|
||||
<tr><td colspan="11"><h2><span class="indicator badge readwrite">{{ query('public').length }}</span>Public</h2></td></tr>
|
||||
<tr class="online public" v-if="query('public').length > 0">
|
||||
<th class="table-column status-indicator"></th>
|
||||
<th class="table-column relay"></th>
|
||||
<th class="table-column verified"><span class="verified-shape-wrapper"><span class="shape verified"></span></span></th>
|
||||
<!-- <th class="table-column location" v-tooltip:top.tooltip="Ping">
|
||||
🌎
|
||||
</th> -->
|
||||
<th class="table-column latency" v-tooltip:top.tooltip="'Relay Latency on Read'">
|
||||
⌛️
|
||||
</th>
|
||||
<th class="table-column connect" v-tooltip:top.tooltip="'Relay connection status'">
|
||||
🔌
|
||||
</th>
|
||||
<th class="table-column read" v-tooltip:top.tooltip="'Relay read status'">
|
||||
👁️🗨️
|
||||
</th>
|
||||
<th class="table-column write" v-tooltip:top.tooltip="'Relay write status'">
|
||||
✏️
|
||||
</th>
|
||||
<th class="table-column info" v-tooltip:top.tooltip="'Additional information detected regarding the relay during processing'">
|
||||
ℹ️
|
||||
</th>
|
||||
<th class="table-column nip nip-15" v-tooltip:top.tooltip="'Does the relay support NIP-15'">
|
||||
NIP-15
|
||||
</th>
|
||||
<th class="table-column nip nip-20" v-tooltip:top.tooltip="'Does the relay support NIP-20'">
|
||||
NIP-20
|
||||
</th>
|
||||
<!-- <th>FILTER: LIMIT</th> -->
|
||||
</tr>
|
||||
<tr v-for="relay in query('public')" :key="{relay}" :class="getLoadingClass(relay)" class="online public">
|
||||
|
||||
<!-- <td>{{ setCaution(result[relay].didSubscribeFilterLimit) }}</td> -->
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
<template>
|
||||
<td :key="generateKey(relay, 'aggregate')"><span :class="getAggregateStatusClass(relay)"></span></td>
|
||||
|
||||
<td :key="generateKey(relay, 'aggregate')"><span :class="getAggregateResultClass(relay)"></span></td>
|
||||
<td class="left-align relay-url" @click="copy(relay)">{{ relay }}</td>
|
||||
<td :key="generateKey(relay, 'didConnect')"><span :class="getStatusClass(relay, 'didConnect')"></span></td>
|
||||
<td :key="generateKey(relay, 'didRead')"><span :class="getStatusClass(relay, 'didRead')"></span></td>
|
||||
<td :key="generateKey(relay, 'didWrite')"><span :class="getStatusClass(relay, 'didWrite')"></span></td>
|
||||
<td>{{status[relay].flag}}</td>
|
||||
<td><span v-if="status[relay].didConnect">{{ status[relay].latency }}<span v-if="status[relay].latency">ms</span></span></td>
|
||||
<td>
|
||||
<Popper v-if="Object.keys(status[relay].messages).length">
|
||||
{{ status[relay].type }}
|
||||
<button @mouseover="showPopper">log</button>
|
||||
<template #content>
|
||||
<ul>
|
||||
<li v-for="(message, key) in status[relay].messages" :key="generateKey(relay, key)">{{key}}</li>
|
||||
</ul>
|
||||
</template>
|
||||
</Popper>
|
||||
<span v-tooltip:top.tooltip="nip05List(relay)"> <span class="verified-shape-wrapper" v-if="result[relay].nips[5]"><span class="shape verified"></span></span></span>
|
||||
</td>
|
||||
<!-- <td>{{result[relay].flag}}</td> -->
|
||||
<td><span>{{ result[relay].latency.final }}<span v-if="result[relay].check.latency">ms</span></span></td>
|
||||
<td :key="generateKey(relay, 'check.connect')"><span :class="getResultClass(relay, 'connect')"></span></td>
|
||||
<td :key="generateKey(relay, 'check.read')"><span :class="getResultClass(relay, 'read')"></span></td>
|
||||
<td :key="generateKey(relay, 'check.write')"><span :class="getResultClass(relay, 'write')"></span></td>
|
||||
<td>
|
||||
<ul v-if="result[relay].observations && result[relay].observations.length">
|
||||
<li class="observation" v-for="(alert) in result[relay].observations" :key="generateKey(relay, alert.description)">
|
||||
<span v-tooltip:top.tooltip="alert.description" :class="alert.type" v-if="alert.type == 'notice'">✉️</span>
|
||||
<span v-tooltip:top.tooltip="alert.description" :class="alert.type" v-if="alert.type == 'caution'">⚠️</span>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>{{ setCheck(connections[relay].nip(15)) }}</td>
|
||||
<td>{{ setCheck(connections[relay].nip(20)) }}</td>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user