Browse Source

add orly and newsroom localhost port

remove nostr.band
get rid of individual relay settings
master^2
Silberengel 2 months ago
parent
commit
cd2489b865
  1. 3
      TECHNIQUE-create-test-highlights.md
  2. 2
      check-publication-structure.js
  3. 10
      create-test-comments.js
  4. 10
      create-test-highlights.js
  5. 2
      src/lib/components/util/Profile.svelte
  6. 4
      src/lib/consts.ts
  7. 15
      src/lib/utils/mockCommentData.ts
  8. 8
      src/lib/utils/mockHighlightData.ts
  9. 5
      src/lib/utils/websocket_utils.ts

3
TECHNIQUE-create-test-highlights.md

@ -47,7 +47,7 @@ const rootAddress = `${data.kind}:${data.pubkey}:${data.identifier}`; @@ -47,7 +47,7 @@ const rootAddress = `${data.kind}:${data.pubkey}:${data.identifier}`;
console.log("\nRoot Address:", rootAddress);
// Fetch the index event to see what sections it references
const relay = "wss://relay.nostr.band";
const relay = "wss://thecitadel.nostr1.com";
async function fetchPublication() {
return new Promise((resolve, reject) => {
@ -172,7 +172,6 @@ const sections = [ @@ -172,7 +172,6 @@ const sections = [
// Relays to publish to (matching HighlightLayer's relay list)
const relays = [
"wss://relay.damus.io",
"wss://relay.nostr.band",
"wss://nostr.wine",
];

2
check-publication-structure.js

@ -13,7 +13,7 @@ const rootAddress = `${data.kind}:${data.pubkey}:${data.identifier}`; @@ -13,7 +13,7 @@ const rootAddress = `${data.kind}:${data.pubkey}:${data.identifier}`;
console.log("\nRoot Address:", rootAddress);
// Fetch the index event to see what sections it references
const relay = "wss://relay.nostr.band";
const relay = "wss://thecitadel.nostr1.com";
async function fetchPublication() {
return new Promise((resolve, reject) => {

10
create-test-comments.js

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
import { finalizeEvent, generateSecretKey, getPublicKey } from "nostr-tools";
import WebSocket from "ws";
import { activeInboxRelays } from "./src/lib/ndk.ts";
import { secondaryRelays } from "./src/lib/consts.ts";
// Test user keys (generate fresh ones)
const testUserKey = generateSecretKey();
@ -25,12 +27,8 @@ const sections = [ @@ -25,12 +27,8 @@ const sections = [
`30041:${publicationPubkey}:the-persistent-escape-of-knowledge`,
];
// Relays to publish to (matching CommentLayer's relay list)
const relays = [
"wss://relay.damus.io",
"wss://relay.nostr.band",
"wss://nostr.wine",
];
// Relays to publish to - should match src/lib/consts.ts relay constants
const relays = [...secondaryRelays, ...activeInboxRelays];
// Test comments to create
const testComments = [

10
create-test-highlights.js

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
import { finalizeEvent, generateSecretKey, getPublicKey } from "nostr-tools";
import WebSocket from "ws";
import { activeInboxRelays } from "./src/lib/ndk.ts";
import { secondaryRelays } from "./src/lib/consts.ts";
// Test user keys (generate fresh ones)
const testUserKey = generateSecretKey();
@ -25,12 +27,8 @@ const sections = [ @@ -25,12 +27,8 @@ const sections = [
`30041:${publicationPubkey}:the-persistent-escape-of-knowledge`,
];
// Relays to publish to (matching HighlightLayer's relay list)
const relays = [
"wss://relay.damus.io",
"wss://relay.nostr.band",
"wss://nostr.wine",
];
// Relays to publish to - should match src/lib/consts.ts relay constants
const relays = [...secondaryRelays, ...activeInboxRelays];
// Test highlights to create
// AI-NOTE: Kind 9802 highlight events contain the actual highlighted text in .content

2
src/lib/components/util/Profile.svelte

@ -298,6 +298,8 @@ @@ -298,6 +298,8 @@
isLoadingExtension = false;
try {
const ndk = new NDK();
// AI-NOTE: relay.nsec.app is the specific relay for Amber/NIP-46 signer service
// This is service-specific and not a general-purpose relay, so it remains hard-coded
const relay = "wss://relay.nsec.app";
const localNsec =
localStorage.getItem("amber/nsec") ??

4
src/lib/consts.ts

@ -11,12 +11,11 @@ export const communityRelays = [ @@ -11,12 +11,11 @@ export const communityRelays = [
];
export const searchRelays = [
"wss://profiles.nostr1.com",
"wss://thecitadel.nostr1.com",
"wss://aggr.nostr.land",
"wss://relay.noswhere.com",
"wss://nostr.wine",
"wss://relay.damus.io",
"wss://relay.nostr.band",
"wss://freelay.sovbit.host",
];
@ -46,6 +45,7 @@ export const localRelays: string[] = [ @@ -46,6 +45,7 @@ export const localRelays: string[] = [
"ws://localhost:8080",
"ws://localhost:4869",
"ws://localhost:3334",
"ws://localhost:7777"
];
export enum FeedType {

15
src/lib/utils/mockCommentData.ts

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
import { NDKEvent } from "@nostr-dev-kit/ndk";
import type NDK from "@nostr-dev-kit/ndk";
import { secondaryRelays } from "../consts.ts";
/**
* Generate mock comment data for testing comment UI and threading
@ -49,18 +50,20 @@ function createMockComment( @@ -49,18 +50,20 @@ function createMockComment(
replyToId?: string,
replyToAuthor?: string,
): any {
// Use first search relay from constants instead of hard-coded relay
const relayUrl = secondaryRelays[0] || "wss://thecitadel.nostr1.com";
const tags: string[][] = [
["A", targetAddress, "wss://relay.damus.io", pubkey],
["A", targetAddress, relayUrl, pubkey],
["K", "30041"],
["P", pubkey, "wss://relay.damus.io"],
["a", targetAddress, "wss://relay.damus.io"],
["P", pubkey, relayUrl],
["a", targetAddress, relayUrl],
["k", "30041"],
["p", pubkey, "wss://relay.damus.io"],
["p", pubkey, relayUrl],
];
if (replyToId && replyToAuthor) {
tags.push(["e", replyToId, "wss://relay.damus.io", "reply"]);
tags.push(["p", replyToAuthor, "wss://relay.damus.io"]);
tags.push(["e", replyToId, relayUrl, "reply"]);
tags.push(["p", replyToAuthor, relayUrl]);
}
// Return a plain object that matches NDKEvent structure

8
src/lib/utils/mockHighlightData.ts

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
import { secondaryRelays } from "../consts.ts";
/**
* Generate mock highlight data (kind 9802) for testing highlight UI
* Creates realistic highlight events with context and optional annotations
@ -76,10 +78,12 @@ function createMockHighlight( @@ -76,10 +78,12 @@ function createMockHighlight(
offsetStart?: number,
offsetEnd?: number,
): any {
// Use first search relay from constants instead of hard-coded relay
const relayUrl = secondaryRelays[0] || "wss://thecitadel.nostr1.com";
const tags: string[][] = [
["a", targetAddress, "wss://relay.damus.io"],
["a", targetAddress, relayUrl],
["context", context],
["p", authorPubkey, "wss://relay.damus.io", "author"],
["p", authorPubkey, relayUrl, "author"],
];
// Add optional annotation

5
src/lib/utils/websocket_utils.ts

@ -92,8 +92,9 @@ export async function fetchNostrEvent( @@ -92,8 +92,9 @@ export async function fetchNostrEvent(
const { searchRelays, secondaryRelays } = await import("../consts.ts");
availableRelays = [...searchRelays, ...secondaryRelays];
if (availableRelays.length === 0) {
availableRelays = ["wss://thecitadel.nostr1.com"];
// Final fallback: use first secondary relay if all else fails
if (availableRelays.length === 0 && secondaryRelays.length > 0) {
availableRelays = [secondaryRelays[1]];
}
}

Loading…
Cancel
Save