Skip to content

Commit

Permalink
Use dev relays on localhost.
Browse files Browse the repository at this point in the history
  • Loading branch information
chmac committed May 26, 2024
1 parent 87493a6 commit e680889
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const DEFAULT_RELAYS = [
"wss://relay.damus.io",
"wss://nostr.manasiwibi.com",
];
export const DEV_RELAYS = ["wss://nos.lol"];
export const PANEL_CONTAINER_ID = "panelID";
export const BADGE_CONTAINER_ID = "badge";
export const CONTENT_MINIMUM_LENGTH = 3;
Expand Down
8 changes: 5 additions & 3 deletions src/nostr/relays.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Sub, relayInit, Relay, Event, Filter } from "nostr-tools";
import { DEFAULT_RELAYS, RELAYS_STORAGE_KEY } from "../constants";
import { Event, Filter, Relay, Sub, relayInit } from "nostr-tools";
import { DEFAULT_RELAYS, DEV_RELAYS, RELAYS_STORAGE_KEY } from "../constants";
import { MaybeLocalStorage, NostrEvent } from "../types";
import { isDev } from "./utils";

const relays: Relay[] = [];
globalThis.relays = relays;
Expand Down Expand Up @@ -136,6 +137,7 @@ export const _subscribe = async ({
export const createRelays = async () => {
const relaysInstalled = await hasRelays();
if (!relaysInstalled) {
await setRelays({ relays: DEFAULT_RELAYS });
const relays = isDev() ? DEV_RELAYS : DEFAULT_RELAYS;
await setRelays({ relays });
}
};

0 comments on commit e680889

Please sign in to comment.