This commit is contained in:
dskvr
2022-11-20 12:53:14 +01:00
parent bbd679868c
commit f43779363a
10 changed files with 134 additions and 91 deletions

View File

@@ -3,6 +3,7 @@
const esbuild = require('esbuild') const esbuild = require('esbuild')
const alias = require('esbuild-plugin-alias') const alias = require('esbuild-plugin-alias')
const nodeGlobals = require('@esbuild-plugins/node-globals-polyfill').default const nodeGlobals = require('@esbuild-plugins/node-globals-polyfill').default
const vuePlugin = require("esbuild-vue");
const prod = process.argv.indexOf('prod') !== -1 const prod = process.argv.indexOf('prod') !== -1
@@ -15,8 +16,10 @@ esbuild
alias({ alias({
stream: require.resolve('readable-stream') stream: require.resolve('readable-stream')
}), }),
nodeGlobals({buffer: true}) nodeGlobals({buffer: true}),
vuePlugin(),
], ],
minify: true,
sourcemap: prod ? false : 'inline', sourcemap: prod ? false : 'inline',
define: { define: {
window: 'self', window: 'self',

137
main.js
View File

@@ -1,37 +1,12 @@
import {createApp, h} from 'vue' import {createApp, h} from 'vue'
import {relayConnect} from 'nostr-tools/relay' import {relayConnect} from 'nostr-tools/relay'
import yaml from 'js-yaml'
import fs from 'fs'
const App = { const App = {
data() { data() {
return { return {
relays: [ relays: yaml.load(fs.readFileSync('relays.yml', 'utf8')).relays,
'wss://nostr-pub.wellorder.net',
'wss://relayer.fiatjaf.com',
'wss://nostr.rocks',
'wss://rsslay.fiatjaf.com',
'wss://freedom-relay.herokuapp.com/ws',
'wss://nostr-relay.freeberty.net',
'wss://nostr.bitcoiner.social',
'wss://nostr-relay.wlvs.space',
'wss://nostr.onsats.org',
'wss://nostr-relay.untethr.me',
'wss://nostr.semisol.dev',
'wss://nostr-pub.semisol.dev',
'ws://jgqaglhautb4k6e6i2g34jakxiemqp6z4wynlirltuukgkft2xuglmqd.onion',
'wss://nostr-verified.wellorder.net',
'wss://nostr.drss.io',
'wss://nostr.unknown.place',
'wss://relay.damus.io',
'wss://nostr.openchain.fr',
'wss://nostr.delo.software',
'wss://relay.nostr.info',
'wss://relay.minds.com/nostr/v1/ws',
'wss://nostr.zaprite.io',
'wss://nostr.oxtr.dev',
'wss://nostr.ono.re',
'wss://relay.grunch.dev',
'wss://relay.cynsar.foundation'
],
status: {} status: {}
} }
}, },
@@ -92,59 +67,59 @@ const App = {
}) })
}, },
render() { // render() {
return h('table', {style: {fontSize: '28px'}}, [ // return h('table', {style: {fontSize: '28px'}}, [
h('tr', [h('th'), h('th', 'connect'), h('th', 'read'), h('th', 'write')]), // h('tr', [h('th'), h('th', 'connect'), h('th', 'read'), h('th', 'write')]),
...this.relays.map(url => // ...this.relays.map(url =>
h('tr', [ // h('tr', [
h( // h(
'th', // 'th',
{ // {
style: { // style: {
textAlign: 'right', // textAlign: 'right',
whiteSpace: 'pre-wrap', // whiteSpace: 'pre-wrap',
wordWrap: 'break-word', // wordWrap: 'break-word',
wordBreak: 'break-all' // wordBreak: 'break-all'
} // }
}, // },
url // url
), // ),
...['didConnect', 'didQuery', 'didPublish'].map(attr => // ...['didConnect', 'didQuery', 'didPublish'].map(attr =>
h( // h(
'td', // 'td',
{ // {
style: { // style: {
fontSize: '50px', // fontSize: '50px',
textAlign: 'center', // textAlign: 'center',
padding: '5px 35px', // padding: '5px 35px',
color: // color:
this.status?.[url]?.[attr] === true // this.status?.[url]?.[attr] === true
? 'green' // ? 'green'
: this.status?.[url]?.[attr] === false // : this.status?.[url]?.[attr] === false
? 'red' // ? 'red'
: 'silver' // : 'silver'
} // }
}, // },
'•' // '•'
) // )
) // )
]) // ])
), // ),
h('tr', [ // h('tr', [
h('th', {style: {textAlign: 'right'}}, 'Your relay here:'), // h('th', {style: {textAlign: 'right'}}, 'Your relay here:'),
h('th', {colSpan: 3}, [ // h('th', {colSpan: 3}, [
h( // h(
'a', // 'a',
{ // {
href: 'https://github.com/fiatjaf/nostr-relay-registry', // href: 'https://github.com/fiatjaf/nostr-relay-registry',
style: {color: 'black'} // style: {color: 'black'}
}, // },
'________________' // '________________'
) // )
]) // ])
]) // ])
]) // ])
} // }
} }
createApp(App).mount('#app') createApp(App).mount('#app')

View File

@@ -9,7 +9,10 @@
"readable-stream": "^3.6.0", "readable-stream": "^3.6.0",
"vue": "3" "vue": "3"
}, },
"devDependencies": {}, "devDependencies": {
"esbuild-vue": "1.2.2",
"json-server": "0.17.1"
},
"scripts": { "scripts": {
"build": "./build.js prod", "build": "./build.js prod",
"watch": "ag -l --js | entr ./build.js" "watch": "ag -l --js | entr ./build.js"

View File

@@ -1,8 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Nostr Relay Registry</title>
<div id="app" style="font-family: monospace"></div>
<script src="main.js"></script>

27
relays.yml Normal file
View File

@@ -0,0 +1,27 @@
relays:
- 'wss://nostr-pub.wellorder.net'
- 'wss://relayer.fiatjaf.com'
- 'wss://nostr.rocks'
- 'wss://rsslay.fiatjaf.com'
- 'wss://freedom-relay.herokuapp.com/ws'
- 'wss://nostr-relay.freeberty.net'
- 'wss://nostr.bitcoiner.social'
- 'wss://nostr-relay.wlvs.space'
- 'wss://nostr.onsats.org'
- 'wss://nostr-relay.untethr.me'
- 'wss://nostr.semisol.dev'
- 'wss://nostr-pub.semisol.dev'
- 'ws://jgqaglhautb4k6e6i2g34jakxiemqp6z4wynlirltuukgkft2xuglmqd.onion'
- 'wss://nostr-verified.wellorder.net'
- 'wss://nostr.drss.io'
- 'wss://nostr.unknown.place'
- 'wss://relay.damus.io'
- 'wss://nostr.openchain.fr'
- 'wss://nostr.delo.software'
- 'wss://relay.nostr.info'
- 'wss://relay.minds.com/nostr/v1/ws'
- 'wss://nostr.zaprite.io'
- 'wss://nostr.oxtr.dev'
- 'wss://nostr.ono.re'
- 'wss://relay.grunch.dev'
- 'wss://relay.cynsar.foundation'

11
src/App.vue Normal file
View File

@@ -0,0 +1,11 @@
<template>
<router-view />
</template>
<script>
import { defineComponent } from 'vue'
export default defineComponent({
name: 'App'
})
</script>

View File

0
src/pages/IndexPage.vue Normal file
View File

23
src/router/index.js Normal file
View File

@@ -0,0 +1,23 @@
import { route } from 'quasar/wrappers'
import {
createRouter,
createWebHistory,
createWebHashHistory,
} from 'vue-router'
import routes from './routes'
export default route(() => {
const createHistory =
process.env.VUE_ROUTER_MODE === 'history'
? createWebHistory
: createWebHashHistory
const Router = createRouter({
routes,
history: createHistory(
process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE
),
})
return Router
})

9
src/router/routes.js Normal file
View File

@@ -0,0 +1,9 @@
const routes = [
{
path: '/',
component: () => import('layouts/MainLayout.vue'),
children: [
{ path: '', component: () => import('pages/IndexPage.vue') }
]
export default routes