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

2
check-publication-structure.js

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

10
create-test-comments.js

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

10
create-test-highlights.js

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

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

@ -298,6 +298,8 @@
isLoadingExtension = false; isLoadingExtension = false;
try { try {
const ndk = new NDK(); 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 relay = "wss://relay.nsec.app";
const localNsec = const localNsec =
localStorage.getItem("amber/nsec") ?? localStorage.getItem("amber/nsec") ??

4
src/lib/consts.ts

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

15
src/lib/utils/mockCommentData.ts

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

8
src/lib/utils/mockHighlightData.ts

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

5
src/lib/utils/websocket_utils.ts

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

Loading…
Cancel
Save