mirror of
https://github.com/aljazceru/nostr-watch.git
synced 2025-12-18 13:54:23 +01:00
all working
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"prebuild": "node ./scripts/geo.js",
|
||||
"serve": "yarn prebuild && vue-cli-service serve --host localhost",
|
||||
"serve": "vue-cli-service serve --host localhost",
|
||||
"build": "yarn prebuild && vue-cli-service build",
|
||||
"watch": "yarn prebuild && vue-cli-service build --watch",
|
||||
"lint": "vue-cli-service lint",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
relays:
|
||||
- 'wss://rsslay.fiatjaf.com'
|
||||
# - 'wss://rsslay.fiatjaf.com'
|
||||
- 'wss://freedom-relay.herokuapp.com/ws'
|
||||
- 'wss://nostr-relay.freeberty.net'
|
||||
- 'wss://nostr-relay.wlvs.space'
|
||||
@@ -23,7 +23,7 @@ relays:
|
||||
- 'wss://relay.grunch.dev'
|
||||
- 'wss://relay.cynsar.foundation'
|
||||
- 'wss://nostr-pub.wellorder.net'
|
||||
- 'wss://relayer.fiatjaf.com'
|
||||
# - 'wss://relayer.fiatjaf.com'
|
||||
- 'wss://relay.oldcity-bitcoiners.info'
|
||||
- 'wss://relay.bitid.nz'
|
||||
- 'wss://relay.nostr.xyz'
|
||||
|
||||
@@ -8,31 +8,48 @@ let object,
|
||||
result,
|
||||
file = fs.readFileSync('./relays.yaml', 'utf8')
|
||||
|
||||
const getIp = async function(relay){
|
||||
let ip
|
||||
const getDns = async function(relay){
|
||||
let dns
|
||||
await fetch(`https://1.1.1.1/dns-query?name=${relay.replace('wss://', '')}`, { headers: { 'accept': 'application/dns-json' } })
|
||||
.then(response => response.json())
|
||||
.then((data) => { ip = data.Answer ? data.Answer[data.Answer.length-1].data : false })
|
||||
.then((data) => { dns = data.Answer ? data.Answer : false })
|
||||
.catch(err => console.log('./scripts/geo.js', err))
|
||||
return dns
|
||||
}
|
||||
|
||||
const getIp = async function(dns){
|
||||
let ip;
|
||||
if(dns)
|
||||
ip = dns[dns.length-1].data
|
||||
return ip
|
||||
}
|
||||
|
||||
const getGeo = async function(ip) {
|
||||
let geo
|
||||
await fetch(`http://ip-api.com/json/${ip}`, { headers: { 'accept': 'application/dns-json' } })
|
||||
.then(response => response.json())
|
||||
.then((data) => { geo = data })
|
||||
.catch(err => console.log('./scripts/geo.js', err))
|
||||
return geo
|
||||
.then(response => response.json())
|
||||
.then((data) => { geo = data })
|
||||
.catch(err => console.log('./scripts/geo.js', err))
|
||||
return geo;
|
||||
}
|
||||
|
||||
const query = async function(){
|
||||
|
||||
const relays = YAML.parse(file).relays,
|
||||
result = {}
|
||||
|
||||
for (const relay of relays) {
|
||||
ip = await getIp(relay)
|
||||
let dns, ip, geo
|
||||
dns = await getDns(relay)
|
||||
ip = await getIp(dns)
|
||||
// console.log(dns, ip)
|
||||
geo = await getGeo(ip)
|
||||
|
||||
console.log(geo, ip, dns)
|
||||
|
||||
if(dns)
|
||||
geo.dns = dns[dns.length-1]
|
||||
|
||||
if(geo.status == 'success')
|
||||
result[relay] = geo
|
||||
}
|
||||
|
||||
@@ -17,6 +17,5 @@ export default {
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
margin-top: 60px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</l-marker> -->
|
||||
|
||||
<l-circle-marker
|
||||
:lat-lng="getLatLng(entry)"
|
||||
:lat-lng="getLatLng()"
|
||||
:radius="3"
|
||||
:weight="6"
|
||||
:color="getCircleColor(relay)"
|
||||
@@ -32,7 +32,6 @@
|
||||
>
|
||||
<l-popup>
|
||||
{{ relay }}
|
||||
meopw
|
||||
</l-popup>
|
||||
</l-circle-marker>
|
||||
</l-map>
|
||||
@@ -40,16 +39,19 @@
|
||||
</template>
|
||||
<script>
|
||||
import "leaflet/dist/leaflet.css"
|
||||
import { LMap, LTileLayer, LCircleMarker } from "@vue-leaflet/vue-leaflet";
|
||||
import { LMap, LTileLayer, LCircleMarker, LPopup } from "@vue-leaflet/vue-leaflet";
|
||||
export default {
|
||||
components: {
|
||||
LMap,
|
||||
LTileLayer,
|
||||
LCircleMarker,
|
||||
LPopup
|
||||
},
|
||||
methods: {
|
||||
getLatLng(geo){
|
||||
return [geo.lat, geo.lon]
|
||||
getLatLng(){
|
||||
console.log("geo", this.relay, this.geo[this.relay].lat, this.geo[this.relay].lon)
|
||||
// if (!geo[this.relay]) console.log("no geo?", geo, this.relay, geo[this.relay])
|
||||
return [this.geo[this.relay].lat, this.geo[this.relay].lon]
|
||||
},
|
||||
getCircleColor(relay){
|
||||
|
||||
@@ -62,11 +64,11 @@ export default {
|
||||
else if(this.result[relay]?.aggregate == 'offline') {
|
||||
return '#FF0000'
|
||||
}
|
||||
return 'transparent'
|
||||
return 'black'
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
console.log('GEO', Object.entries(this.geo))
|
||||
console.log('GEO', this.geo[this.relay])
|
||||
},
|
||||
props: {
|
||||
geo: {
|
||||
@@ -81,6 +83,12 @@ export default {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
relay: {
|
||||
type: String,
|
||||
default(){
|
||||
return ""
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -92,8 +100,10 @@ export default {
|
||||
|
||||
<style>
|
||||
.leaflet-container {
|
||||
margin-top:37px;
|
||||
margin:0;
|
||||
height:250px !important;
|
||||
width:1000%;
|
||||
|
||||
}
|
||||
.leaflet-control-zoom {
|
||||
display: none !important;
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
<th class="table-column info" v-tooltip:top.tooltip="'Additional information detected regarding the relay during processing'">
|
||||
ℹ️
|
||||
</th>
|
||||
<th class="table-column nip nip-20" v-tooltip:top.tooltip="'Does the relay support NIP-20'">
|
||||
<!-- <th class="table-column nip nip-20" v-tooltip:top.tooltip="'Does the relay support NIP-20'">
|
||||
<span>NIP-11</span>
|
||||
</th>
|
||||
</th> -->
|
||||
</tr>
|
||||
<tr v-for="relay in query(section)" :key="{relay}" :class="getResultClass(relay)" class="relay">
|
||||
<RelaySingleComponent
|
||||
@@ -180,7 +180,7 @@ export default defineComponent({
|
||||
return JSON.stringify(result,null,'\t')
|
||||
},
|
||||
relaysTotal () {
|
||||
return this.relays.length-1
|
||||
return this.relays.length
|
||||
},
|
||||
relaysConnected () {
|
||||
return Object.keys(this.result).length
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
</td>
|
||||
|
||||
<td class="relay left-align relay-url">
|
||||
<span @click="copy(relay)" v-tooltip:top.tooltip="'Click to copy'">{{ relay }}</span>
|
||||
<router-link :to="`/${relayClean(relay)}`" active-class="active">{{ relay }}</router-link>
|
||||
<!-- <span @click="copy(relay)" v-tooltip:top.tooltip="'Click to copy'">{{ relay }}</span> -->
|
||||
</td>
|
||||
|
||||
<td class="verified">
|
||||
@@ -41,9 +42,9 @@
|
||||
</ul>
|
||||
</td>
|
||||
|
||||
<td class="nip nip-11">
|
||||
<!-- <td class="nip nip-11">
|
||||
<a v-if="result.info" @click="showModal=true">✅ </a>
|
||||
</td>
|
||||
</td> -->
|
||||
|
||||
<vue-final-modal v-model="showModal" classes="modal-container" content-class="modal-content">
|
||||
<div class="modal__title">
|
||||
@@ -192,6 +193,9 @@ export default defineComponent({
|
||||
}
|
||||
return string
|
||||
},
|
||||
relayClean(relay) {
|
||||
return relay.replace('wss://', '')
|
||||
},
|
||||
nipSignature(key){
|
||||
return key.toString().length == 1 ? `0${key}` : key
|
||||
},
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
:connections="connections"
|
||||
/>
|
||||
|
||||
<!-- <RelayListComponent
|
||||
<RelayListComponent
|
||||
section="processing"
|
||||
:relays="relays"
|
||||
:result="result"
|
||||
@@ -60,7 +60,7 @@
|
||||
:alerts="alerts"
|
||||
:connections="connections"
|
||||
:showJson="false"
|
||||
/> -->
|
||||
/>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
@@ -203,7 +203,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
relaysTotal () {
|
||||
return this.relays.length-1 //TODO: Figure out WHY?
|
||||
return this.relays.length //TODO: Figure out WHY?
|
||||
},
|
||||
|
||||
relaysConnected () {
|
||||
|
||||
@@ -1,61 +1,126 @@
|
||||
<template>
|
||||
<LeafletSingleComponent
|
||||
:geo="geo"
|
||||
:relay="relay"
|
||||
:result="result"
|
||||
/>
|
||||
<!-- <NavComponent /> -->
|
||||
<div id="wrapper" :class="loadingComplete()">
|
||||
<div id="wrapper">
|
||||
|
||||
|
||||
<row container :gutter="12">
|
||||
<column :xs="12" :md="12" :lg="12" class="title-card">
|
||||
<h1>nostr.watch<sup>{{version}}</sup></h1>
|
||||
<h2>{{relayUrl()}}</h2>
|
||||
<div style="display: none">{{result}}</div> <!-- ? -->
|
||||
|
||||
<h1>{{ relayUrl() }}</h1>
|
||||
<!-- <h2>nostr.watch<sup>{{version}}</sup></h2> -->
|
||||
<br >
|
||||
|
||||
<span class="badges">
|
||||
<span><img :src="badgeCheck('connect')" /></span>
|
||||
<span><img :src="badgeCheck('read')" /></span>
|
||||
<span><img :src="badgeCheck('write')" /></span>
|
||||
</span>
|
||||
|
||||
<br />
|
||||
|
||||
<span v-if="result.info?.supported_nips" class="badges">
|
||||
<span v-for="(nip) in result.info.supported_nips" :key="`${relay}_${nip}`">
|
||||
<a :href="nipLink(nip)" target="_blank"><img :src="badgeLink(nip)" /></a>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<!--table>
|
||||
<tr>
|
||||
<th colspan="3"><h4>Status</h4></th>
|
||||
</tr>
|
||||
<tr v-if="result.checkClass">
|
||||
<td :class="result.checkClass.connect" class="connect indicator">Connected</td>
|
||||
<td :class="result.checkClass.read" class="read indicator">Read</td>
|
||||
<td :class="result.checkClass.write" class="write indicator">Write</td>
|
||||
</tr>
|
||||
</table-->
|
||||
|
||||
|
||||
<table v-if="result.info">
|
||||
<tr>
|
||||
<th colspan="2"><h4>Info</h4></th>
|
||||
</tr>
|
||||
<tr v-for="(value, key) in Object.entries(result.info).filter(value => value[0] != 'id' && value[0] != 'supported_nips')" :key="`${value}_${key}`">
|
||||
<td>{{ value[0] }}</td>
|
||||
<td v-if="value[0]!='contact' && value[0]!='pubkey' && value[0]!='software' && value[0]!='version'">{{ value[1] }} </td>
|
||||
<td v-if="value[0]=='contact'"><SafeMail :email="value[1]" /></td>
|
||||
<td v-if="value[0]=='pubkey' || value[0]=='version'"><code>{{ value[1] }}</code></td>
|
||||
<td v-if="value[0]=='software'"><a href="{{ value[1] }}">{{ value[1] }}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>Identities</h4>
|
||||
<table v-if="result.identities">
|
||||
|
||||
<tr v-for="(value, key) in Object.entries(result?.identities)" :key="`${value}_${key}`">
|
||||
|
||||
<td>{{ value[0] }}</td>
|
||||
<td><code>{{ value[1] }}</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="display: none">{{result}}</div> <!-- ? -->
|
||||
</column>
|
||||
</row>
|
||||
|
||||
<row container :gutter="12">
|
||||
<column :xs="12" :md="12" :lg="12">
|
||||
<LeafletSingleComponent
|
||||
:geo="geo"
|
||||
:relay="relay"
|
||||
:result="result"
|
||||
/>
|
||||
<column :xs="12" :md="6" :lg="6" class="title-card">
|
||||
|
||||
<h4>GEO {{geo?.countryCode ? getFlag() : ''}}</h4>
|
||||
<table v-if="geo[relay]">
|
||||
<tr v-for="(value, key) in Object.entries(geo[relay])" :key="`${value}_${key}`">
|
||||
<td>{{ value[0] }}</td>
|
||||
<td>{{ value[1] }} </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</column>
|
||||
<column :xs="12" :md="6" :lg="6" class="title-card">
|
||||
<h4>DNS</h4>
|
||||
<table v-if="geo[relay]">
|
||||
<tr v-for="(value, key) in Object.entries(geo[relay].dns)" :key="`${value}_${key}`">
|
||||
<td>{{ value[0] }}</td>
|
||||
<td>{{ value[1] }} </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="display: none">{{result}}</div> <!-- ? -->
|
||||
|
||||
|
||||
|
||||
|
||||
</column>
|
||||
|
||||
|
||||
</row>
|
||||
|
||||
|
||||
|
||||
<row container :gutter="12">
|
||||
<column :xs="12" :md="12" :lg="12">
|
||||
<div class="block">
|
||||
<div v-if="result.info?.description">
|
||||
{{ result.info?.description }} <br/>
|
||||
<strong v-if="result.info?.pubkey">Public Key:</strong> {{ result.info?.pubkey }} <br/>
|
||||
<strong v-if="result.info?.contact">Contact:</strong> <SafeMail :email="result.info?.contact" v-if="result.info?.contact" />
|
||||
</div>
|
||||
<div>
|
||||
<h4>Status</h4>
|
||||
<ul>
|
||||
<li><strong>Connected</strong> <span :class="getResultClass(relay, 'connect')" class="connect indicator"></span></li>
|
||||
<li><strong>Read</strong> <span :class="getResultClass(relay, 'read')" class="read indicator"></span></li>
|
||||
<li><strong>Write</strong> <span :class="getResultClass(relay, 'write')" class="write indicator"></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<h4>Relay Info</h4>
|
||||
<ul>
|
||||
<li><strong>Software:</strong> {{ result.info?.software }} </li>
|
||||
<li><strong>Version</strong>: {{ result.info?.version }} </li>
|
||||
</ul>
|
||||
<h4>NIP Support</h4>
|
||||
<ul>
|
||||
<li v-for="(nip) in result.info?.supported_nips" :key="`${relay}_${nip}`">
|
||||
<a :href="nipLink(nip)" target="_blank">{{ nipFormatted(nip) }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<column :xs="12" :md="6" :lg="6">
|
||||
<div style="display: none">{{result}}</div> <!-- ? -->
|
||||
|
||||
|
||||
|
||||
|
||||
</column>
|
||||
<column :xs="12" :md="6" :lg="6">
|
||||
|
||||
|
||||
|
||||
<!-- <h4 v-if="result.info?.supported_nips">NIP Support</h4> -->
|
||||
|
||||
|
||||
|
||||
</column>
|
||||
</row>
|
||||
|
||||
<!-- <row container :gutter="12">
|
||||
<column :xs="12" :md="12" :lg="12" class="processing-card loading">
|
||||
<span v-if="(relaysTotal()-relaysConnected()>0)">Processing {{ relaysConnected() }}/{{ relaysTotal() }}</span>
|
||||
</column>
|
||||
</row> -->
|
||||
|
||||
<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>
|
||||
@@ -66,6 +131,9 @@ import { defineComponent} from 'vue'
|
||||
import LeafletSingleComponent from '../components/LeafletSingleComponent.vue'
|
||||
// import NavComponent from './NavComponent.vue'\
|
||||
|
||||
import SafeMail from "@2alheure/vue-safe-mail";
|
||||
|
||||
|
||||
import { countryCodeEmoji } from 'country-code-emoji';
|
||||
import emoji from 'node-emoji';
|
||||
|
||||
@@ -77,8 +145,8 @@ import { relays } from '../../relays.yaml'
|
||||
import { geo } from '../../geo.yaml'
|
||||
import { messages as RELAY_MESSAGES, codes as RELAY_CODES } from '../../codes.yaml'
|
||||
|
||||
import { Inspector, InspectorObservation } from 'nostr-relay-inspector'
|
||||
// import { Inspector, InspectorObservation } from '../../lib/nostr-relay-inspector'
|
||||
/* import { Inspector, InspectorObservation } from 'nostr-relay-inspector' */
|
||||
import { Inspector, InspectorObservation } from '../../lib/nostr-relay-inspector'
|
||||
|
||||
import crypto from "crypto"
|
||||
|
||||
@@ -88,8 +156,9 @@ export default defineComponent({
|
||||
components: {
|
||||
Row,
|
||||
Column,
|
||||
LeafletSingleComponent
|
||||
LeafletSingleComponent,
|
||||
// NavComponent
|
||||
SafeMail
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -97,7 +166,6 @@ export default defineComponent({
|
||||
relays,
|
||||
result: {},
|
||||
messages: {},
|
||||
connections: {},
|
||||
nips: {},
|
||||
alerts: {},
|
||||
timeouts: {},
|
||||
@@ -113,7 +181,9 @@ export default defineComponent({
|
||||
async mounted() {
|
||||
console.log('mounted')
|
||||
this.relay = this.relayUrl()
|
||||
console.log('relay', this.relay)
|
||||
this.check(this.relay)
|
||||
console.log('relay is compete', this.relay, this.result.check)
|
||||
},
|
||||
|
||||
computed: {
|
||||
@@ -125,12 +195,18 @@ export default defineComponent({
|
||||
// We will see what `params` is shortly
|
||||
return `wss://${this.$route.params.relayUrl}`
|
||||
},
|
||||
check(relay){
|
||||
async check(relay){
|
||||
//const self = this
|
||||
/* return new Promise(function(resolve, reject) { */
|
||||
/* let nip = new Array(99).fill(false);
|
||||
nip[5] = true
|
||||
nip[11] = true */
|
||||
|
||||
const opts = {
|
||||
checkLatency: true,
|
||||
setIP: false,
|
||||
setGeo: false,
|
||||
checkNips: true,
|
||||
/* checkNip: nip, */
|
||||
/* debug: true */
|
||||
}
|
||||
|
||||
let inspect = new Inspector(relay, opts)
|
||||
@@ -139,14 +215,23 @@ export default defineComponent({
|
||||
})
|
||||
.on('open', (e, result) => {
|
||||
this.result = result
|
||||
this.result.checkClass = {read: null, write: null, connect: null}
|
||||
this.setResultClass('connect')
|
||||
/* console.log('result on open', this.result) */
|
||||
})
|
||||
.on('complete', (instance) => {
|
||||
console.log('on_complete', instance.result.aggregate)
|
||||
/* console.log('on_complete', instance.result.aggregate) */
|
||||
this.result = instance.result
|
||||
this.messages[relay] = instance.inbox
|
||||
// this.setFlag(relay)
|
||||
this.setAggregateResult(relay)
|
||||
// this.adjustResult(relay)
|
||||
this.messages[this.relay] = instance.inbox
|
||||
|
||||
/* this.setFlag(relay) */
|
||||
this.setAggregateResult()
|
||||
/* this.adjustResult(relay) */
|
||||
this.setResultClass('read')
|
||||
this.setResultClass('write')
|
||||
/* console.log(this.result)
|
||||
console.log(this.result.info.supported_nips) */
|
||||
/* resolve(this.result) */
|
||||
})
|
||||
.on('notice', (notice) => {
|
||||
const hash = this.sha1(notice)
|
||||
@@ -157,23 +242,31 @@ export default defineComponent({
|
||||
|
||||
this.result.observations.push( new InspectorObservation('notice', response_obj.code, response_obj.description, response_obj.relates_to) )
|
||||
|
||||
console.log(this.result.observations)
|
||||
/* console.log(this.result.observations) */
|
||||
})
|
||||
.on('close', () => {})
|
||||
.on('error', () => {
|
||||
|
||||
.on('close', (msg) => {
|
||||
console.warn("CAUTION", msg)
|
||||
/* console.log('supported_nips', inspect.result.info) */
|
||||
})
|
||||
.on('error', (err) => {
|
||||
console.error("ERROR", err)
|
||||
/* reject(err) */
|
||||
})
|
||||
.run()
|
||||
|
||||
this.connections[relay] = inspect
|
||||
return inspect;
|
||||
/* }) */
|
||||
|
||||
},
|
||||
getResultClass (url, key) {
|
||||
setResultClass (key) {
|
||||
let result = this.result?.check?.[key] === true
|
||||
? 'success'
|
||||
: this.result?.check?.[key] === false
|
||||
? 'failure'
|
||||
: 'pending'
|
||||
return `indicator ${result}`
|
||||
|
||||
/* console.log('result class', result) */
|
||||
this.result.checkClass[key] = result
|
||||
},
|
||||
getLoadingClass () {
|
||||
return this.result?.state == 'complete' ? "relay loaded" : "relay"
|
||||
@@ -190,6 +283,14 @@ export default defineComponent({
|
||||
return bool ? '✅ ' : ''
|
||||
},
|
||||
|
||||
badgeLink(nip){
|
||||
return `https://img.shields.io/static/v1?style=for-the-badge&label=NIP&message=${this.nipSignature(nip)}&color=black`
|
||||
},
|
||||
|
||||
badgeCheck(which){
|
||||
return `https://img.shields.io/static/v1?style=for-the-badge&label=&message=${which}&color=${this.result?.check?.[which] ? 'green' : 'red'}`
|
||||
},
|
||||
|
||||
setCross (bool) {
|
||||
return !bool ? '❌' : ''
|
||||
},
|
||||
@@ -202,7 +303,7 @@ export default defineComponent({
|
||||
users = Object.entries(this.result.identities),
|
||||
count = 0
|
||||
|
||||
console.log(this.result.uri, 'admin', this.result.identities.serverAdmin)
|
||||
// console.log(this.result.uri, 'admin', this.result.identities.serverAdmin)
|
||||
|
||||
if(this.result.identities) {
|
||||
if(this.result.identities.serverAdmin) {
|
||||
@@ -234,7 +335,7 @@ export default defineComponent({
|
||||
return `https://github.com/nostr-protocol/nips/blob/master/${this.nipSignature(key)}.md`
|
||||
},
|
||||
async copy(text) {
|
||||
console.log('copy', text)
|
||||
// console.log('copy', text)
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
} catch($e) {
|
||||
@@ -251,11 +352,13 @@ export default defineComponent({
|
||||
// })
|
||||
// },
|
||||
|
||||
setAggregateResult (relay) {
|
||||
setAggregateResult () {
|
||||
if(!this.result) return
|
||||
|
||||
let aggregateTally = 0
|
||||
aggregateTally += this.result?.[relay]?.check.connect ? 1 : 0
|
||||
aggregateTally += this.result?.[relay]?.check.read ? 1 : 0
|
||||
aggregateTally += this.result?.[relay]?.check.write ? 1 : 0
|
||||
aggregateTally += this.result?.check.connect ? 1 : 0
|
||||
aggregateTally += this.result?.check.read ? 1 : 0
|
||||
aggregateTally += this.result?.check.write ? 1 : 0
|
||||
if (aggregateTally == 3) {
|
||||
this.result.aggregate = 'public'
|
||||
}
|
||||
@@ -267,13 +370,7 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
|
||||
relaysTotal () {
|
||||
return this.relays.length-1 //TODO: Figure out WHY?
|
||||
},
|
||||
|
||||
relaysConnected () {
|
||||
return Object.entries(this.result).length
|
||||
},
|
||||
|
||||
sha1 (message) {
|
||||
const hash = crypto.createHash('sha1').update(JSON.stringify(message)).digest('hex')
|
||||
@@ -281,14 +378,21 @@ export default defineComponent({
|
||||
return hash
|
||||
},
|
||||
|
||||
isDone(){
|
||||
return this.relaysTotal()-this.relaysConnected() == 0
|
||||
},
|
||||
|
||||
loadingComplete(){
|
||||
return this.isDone() ? 'loaded' : ''
|
||||
},
|
||||
},
|
||||
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
ul, ul li { padding:0; margin:0; list-style:none; }
|
||||
td { padding:5px 10px; }
|
||||
th h4 { text-align:center; padding:5px 10px; margin:0 0 6px; background:#f0f0f0; }
|
||||
table {width:90%; max-width:90%; margin:0 auto 20px ; border: 2px solid #f5f5f5; padding:20px}
|
||||
tr td:first-child { text-align:right }
|
||||
tr td:last-child { text-align:left }
|
||||
.indicator { display: table-cell; width:33% ; font-weight:bold; text-align: center !important; color: white; text-transform: uppercase; font-size:0.8em}
|
||||
body, .grid-column { padding:0; margin:0; }
|
||||
.badges { display:block; margin: 10px 0 0}
|
||||
.badges > span {margin-right:5px}
|
||||
#wrapper {max-width:800px}
|
||||
h1 {margin: 25px 0 15px; padding:0 0 10px; border-bottom:3px solid #e9e9e9}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user