mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-20 01:56:33 +00:00
only show popular relays that you are not already connected to
This commit is contained in:
parent
59a5b96ba0
commit
8370002762
@ -86,7 +86,7 @@ export default {
|
||||
const content = JSON.parse(event.content);
|
||||
for (const url in content) {
|
||||
try {
|
||||
const parsed = new URL(url).toString();
|
||||
const parsed = new URL(url).toString().replace(/\/$/, '');
|
||||
const count = relays.get(parsed) || 0;
|
||||
relays.set(parsed, count + 1);
|
||||
} catch (e) {
|
||||
@ -98,7 +98,9 @@ export default {
|
||||
}
|
||||
}
|
||||
});
|
||||
const sorted = Array.from(relays.entries()).sort((a, b) => b[1] - a[1]);
|
||||
const sorted = Array.from(relays.entries())
|
||||
.filter(([url]) => !this.relays.has(url))
|
||||
.sort((a, b) => b[1] - a[1]);
|
||||
return sorted.map((entry) => {
|
||||
return { url: entry[0], users: entry[1] };
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user