mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-11 16:07:15 +02:00
refactor: remove relay.nostr.band and update AGGREGATOR_RELAYS
relay.nostr.band is no longer operational, so remove it from the codebase: AGGREGATOR_RELAYS changes: - Removed: wss://relay.nostr.band/ - Removed: wss://purplepag.es/ - Added: wss://relay.snort.social/ - Added: wss://relay.damus.io/ - New list: nos.lol, relay.snort.social, relay.primal.net, relay.damus.io Updated code: - src/services/loaders.ts: Updated AGGREGATOR_RELAYS constant - src/lib/chat/adapters/nip-53-adapter.ts: Use AGGREGATOR_RELAYS instead of hardcoded relays Updated tests: - All test files updated to expect new relay URLs - Replaced relay.nostr.band references with relay.snort.social - Replaced purplepag.es references with relay.snort.social - Fixed URL formats to include trailing slashes for normalization All 980 tests passing ✓
This commit is contained in:
@@ -21,6 +21,7 @@ import eventStore from "@/services/event-store";
|
||||
import pool from "@/services/relay-pool";
|
||||
import { publishEventToRelays } from "@/services/hub";
|
||||
import accountManager from "@/services/accounts";
|
||||
import { AGGREGATOR_RELAYS } from "@/services/loaders";
|
||||
import {
|
||||
parseLiveActivity,
|
||||
getLiveStatus,
|
||||
@@ -720,7 +721,7 @@ export class Nip53Adapter extends ChatProtocolAdapter {
|
||||
}
|
||||
|
||||
// Default fallback relays for live activities
|
||||
return ["wss://relay.damus.io", "wss://nos.lol", "wss://purplepag.es"];
|
||||
return AGGREGATOR_RELAYS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -296,7 +296,7 @@ describe("relayReferences transformer", () => {
|
||||
"wss://relay.damus.io",
|
||||
"wss://nos.lol",
|
||||
"wss://relay.snort.social",
|
||||
"wss://purplepag.es",
|
||||
"wss://relay.primal.net",
|
||||
"wss://nostr.wine",
|
||||
];
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ vi.mock("@/services/relay-list-cache", () => ({
|
||||
// Mock the loaders for AGGREGATOR_RELAYS
|
||||
vi.mock("@/services/loaders", () => ({
|
||||
AGGREGATOR_RELAYS: [
|
||||
"wss://relay.damus.io",
|
||||
"wss://nos.lol",
|
||||
"wss://relay.nostr.band",
|
||||
"wss://nos.lol/",
|
||||
"wss://relay.snort.social/",
|
||||
"wss://relay.primal.net/",
|
||||
"wss://relay.damus.io/",
|
||||
],
|
||||
}));
|
||||
|
||||
@@ -152,7 +153,7 @@ describe("selectZapRelays", () => {
|
||||
|
||||
expect(result.relays.length).toBeGreaterThan(0);
|
||||
expect(result.sources.fallback.length).toBeGreaterThan(0);
|
||||
expect(result.relays).toContain("wss://relay.damus.io");
|
||||
expect(result.relays).toContain("wss://relay.damus.io/");
|
||||
});
|
||||
|
||||
it("should use fallback when recipient has empty relay list", async () => {
|
||||
|
||||
@@ -385,9 +385,9 @@ describe("eventLoader", () => {
|
||||
|
||||
// Should only have aggregator relays (normalized with trailing slash)
|
||||
expect(relays).toContain("wss://nos.lol/");
|
||||
expect(relays).toContain("wss://nos.lol/");
|
||||
expect(relays).toContain("wss://purplepag.es/");
|
||||
expect(relays).toContain("wss://relay.snort.social/");
|
||||
expect(relays).toContain("wss://relay.primal.net/");
|
||||
expect(relays).toContain("wss://relay.damus.io/");
|
||||
});
|
||||
|
||||
it("should limit cached relays to 3", () => {
|
||||
|
||||
@@ -53,8 +53,9 @@ function extractRelayContext(event: NostrEvent): {
|
||||
// IMPORTANT: URLs must be normalized (trailing slash, lowercase) to match RelayStateManager keys
|
||||
export const AGGREGATOR_RELAYS = [
|
||||
"wss://nos.lol/",
|
||||
"wss://purplepag.es/",
|
||||
"wss://relay.snort.social/",
|
||||
"wss://relay.primal.net/",
|
||||
"wss://relay.damus.io/",
|
||||
];
|
||||
|
||||
// Base event loader (used internally)
|
||||
|
||||
@@ -76,7 +76,7 @@ describe("selectRelaysForFilter", () => {
|
||||
const relayListEvent = createRelayListEvent(testSecretKeys[0], [
|
||||
["r", "wss://relay.damus.io"],
|
||||
["r", "wss://nos.lol"],
|
||||
["r", "wss://purplepag.es", "read"],
|
||||
["r", "wss://relay.snort.social", "read"],
|
||||
]);
|
||||
|
||||
// Add to event store
|
||||
@@ -99,7 +99,7 @@ describe("selectRelaysForFilter", () => {
|
||||
result.relays.includes("wss://nos.lol/");
|
||||
expect(hasWriteRelay).toBe(true);
|
||||
// Should NOT include read-only relay
|
||||
expect(result.relays).not.toContain("wss://purplepag.es/");
|
||||
expect(result.relays).not.toContain("wss://relay.snort.social/");
|
||||
});
|
||||
|
||||
it("should handle multiple authors", async () => {
|
||||
@@ -141,7 +141,7 @@ describe("selectRelaysForFilter", () => {
|
||||
const relayListEvent = createRelayListEvent(testSecretKeys[2], [
|
||||
["r", "wss://relay.damus.io", "write"],
|
||||
["r", "wss://nos.lol", "read"],
|
||||
["r", "wss://purplepag.es", "read"],
|
||||
["r", "wss://relay.snort.social", "read"],
|
||||
]);
|
||||
|
||||
eventStore.add(relayListEvent);
|
||||
@@ -160,7 +160,7 @@ describe("selectRelaysForFilter", () => {
|
||||
// Should include at least one read relay - selectOptimalRelays may pick subset
|
||||
const hasReadRelay =
|
||||
result.relays.includes("wss://nos.lol/") ||
|
||||
result.relays.includes("wss://purplepag.es/");
|
||||
result.relays.includes("wss://relay.snort.social/");
|
||||
expect(hasReadRelay).toBe(true);
|
||||
// Should NOT include write-only relay
|
||||
expect(result.relays).not.toContain("wss://relay.damus.io/");
|
||||
|
||||
Reference in New Issue
Block a user