Skip to content

Commit ded3155

Browse files
authored
Merge pull request #91 from orcestra-campaign/exclude-providers
2 parents 5de0638 + 9f8c63e commit ded3155

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/ui/src/components/DSContainer.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ function parseProvider(provider: Provider): string | undefined {
7575
const updateProviders = async() => {
7676
if (metadata.value?.item_cid) {
7777
for await (const provider of heliaProvider.helia.value.routing.findProviders(metadata.value?.item_cid)) {
78+
// Exclude peers by multiaddr pattern
79+
const excludeAddrPatterns = [
80+
/127\.0\.0\.1/,
81+
/localhost/,
82+
/ipfs\.io/,
83+
/dweb\.link/,
84+
/trustless-gateway\.link/,
85+
]
86+
87+
const addrs = provider.multiaddrs?.map(a => a.toString()) ?? []
88+
const matchesExcludedAddr = addrs.some(addr =>
89+
excludeAddrPatterns.some(pattern => pattern.test(addr))
90+
)
91+
92+
if (matchesExcludedAddr) continue
93+
7894
providers.value = [...providers.value, provider];
7995
}
8096
}

0 commit comments

Comments
 (0)