Browse Source

final hotfix: update for nostr-relay-inspector 0.0.19

develop
dskvr 2 years ago
parent
commit
19d42a1718
  1. 2
      src/components/relays/pages/RelaysStatistics.vue
  2. 2
      src/components/relays/tasks/HistoryTask.vue
  3. 24
      src/components/relays/tasks/RefreshTask.vue
  4. 4
      src/shared/relays-lib.js
  5. 2
      src/store/relays.js
  6. 2
      src/store/tasks.js

2
src/components/relays/pages/RelaysStatistics.vue

@ -146,7 +146,7 @@ export default defineComponent({
result?.info?.supported_nips.forEach( nip => {
if( !(nips[nip] instanceof Set ))
nips[nip] = new Set()
nips[nip].add(result.uri)
nips[nip].add(result.url)
})
})
//console.log('supported nips', nips)

2
src/components/relays/tasks/HistoryTask.vue

@ -61,7 +61,7 @@ export default defineComponent({
result?.info?.supported_nips.forEach( nip => {
if( !(nips[nip] instanceof Set ))
nips[nip] = new Set()
nips[nip].add(result.uri)
nips[nip].add(result.url)
})
})
//console.log('supported nips', nips)

24
src/components/relays/tasks/RefreshTask.vue

@ -79,7 +79,7 @@ const localMethods = {
this.untilNext = this.timeUntilRefresh()
this.sinceLast = this.timeSinceRefresh()
if(!this.store.tasks.isProcessing)
if( !this.store.tasks.isProcessing('relays') )
this.invalidate()
}, 1000)
},
@ -102,7 +102,6 @@ const localMethods = {
// this.addToQueue('relays/single', () => this.invalidate(false, relayUrl))
// },
invalidate: async function(force, single){
//console.log('invalidate()', this.relays.length, force || this.isExpired )
if( (!this.isExpired && !force) )
return
@ -111,12 +110,8 @@ const localMethods = {
this.store.tasks.startProcessing('relays')
let relays
if(this.store.relays.isProcessing('relays'))
relays = this.relays.filter( relay => !this.store.tasks.isProcessed('relays', relay) )
else
relays = [...this.relays]
const relays = this.relays.filter( relay => !this.store.tasks.isProcessed('relays', relay) )
//console.log('filtered relays', relays)
// if(this.pageOpen > 4*60*1000)
@ -139,14 +134,15 @@ const localMethods = {
if(this.store.tasks.isProcessed('relays', relay))
return
console.log('unique check', relay)
console.log('unique check', relay, result.url)
this.store.tasks.addProcessed('relays', result.uri)
this.store.tasks.addProcessed('relays', result.url)
this.results[result.uri] = result
this.results[result.url] = result
this.setCache(result)
console.log('cache set', result.uri, result)
console.log('cache set', result.url, result)
if(this.store.tasks.getProcessed('relays').length >= this.relays.length)
this.completeAll()
@ -164,7 +160,7 @@ const localMethods = {
completeAll: function(){
//console.log('completed')
this.store.tasks.finishProcessing('relays')
this.store.relays.updateNow()
// this.store.relays.updateNow()
this.store.relays.setAggregateCache('public', Object.keys(this.results).filter( result => this.results[result].aggregate === 'public' ))
this.store.relays.setAggregateCache('restricted', Object.keys(this.results).filter( result => this.results[result].aggregate === 'restricted' ))
this.store.relays.setAggregateCache('offline', Object.keys(this.results).filter( result => this.results[result].aggregate === 'offline' ))
@ -246,7 +242,7 @@ export default defineComponent({
created(){
clearInterval(this.interval)
document.body.onfocus = () => {
}
document.addEventListener('visibilitychange', this.handleVisibility, false)
},

4
src/shared/relays-lib.js

@ -28,7 +28,7 @@ export default {
return relays
},
setCache: function(result){
this.$storage.setStorageSync(result.uri, result);
this.$storage.setStorageSync(result.url, result);
},
getCache: function(key){
@ -65,7 +65,7 @@ export default {
aggregateTally += result?.check.read ? 1 : 0
aggregateTally += result?.check.write ? 1 : 0
// //console.log(result.uri, result?.check.connect, result?.check.read, result?.check.write, aggregateTally)
// //console.log(result.url, result?.check.connect, result?.check.read, result?.check.write, aggregateTally)
if (aggregateTally == 3) {
return 'public'

2
src/store/relays.js

@ -55,7 +55,7 @@ export const useRelaysStore = defineStore('relays', {
// setResult(result){
// // this.setStat('relays', this.)
// this.results[result.uri] = result
// this.results[result.url] = result
// },
// setResults(results){ this.results = results },
// clearResults(){ this.results = {} },

2
src/store/tasks.js

@ -20,8 +20,8 @@ export const useTaskStore = defineStore('tasks', {
return state.processed[key]
},
isProcessing: (state) => (key) => state.processing[key],
isAnyProcessing: (state) => Object.keys(state.processing).filter( key => state.processing[key] ),
isProcessed: (state) => (key, relay) => state.getProcessed(key).includes(relay),
isAnyProcessing: (state) => Object.keys(state.processing).filter( key => state.processing[key] ),
//queue/lists
getPending: (state) => state.pending,

Loading…
Cancel
Save