From 647e4aa5ef90b762f785db67b89754f2381f3716 Mon Sep 17 00:00:00 2001 From: silberengel Date: Wed, 20 Aug 2025 17:55:32 +0200 Subject: [PATCH 01/12] fix formatting --- src/app.css | 7 ++++--- src/routes/+layout.svelte | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app.css b/src/app.css index c036bb1..c15dc2d 100644 --- a/src/app.css +++ b/src/app.css @@ -332,9 +332,10 @@ border-primary-200 has-[:hover]:border-primary-700; @apply dark:bg-primary-1000 dark:border-primary-800 dark:has-[:hover]:bg-primary-950 dark:has-[:hover]:border-primary-500; - max-width: 300px; - min-width: 200px; - overflow: hidden; + max-width: 450px; + min-width: 300px; + overflow-x: auto; + overflow-y: hidden; } /* Tooltip */ diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index d4ff137..0612dc6 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -181,7 +181,7 @@ -
+
{@render children()}
From a7ec489d44cf5024d73ced0f58ec52029620c8a0 Mon Sep 17 00:00:00 2001 From: vnugent Date: Wed, 20 Aug 2025 14:46:03 -0400 Subject: [PATCH 02/12] fix: fixes subtitle text max width causing profile and hamburger menu to wrap --- src/lib/components/Navigation.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/Navigation.svelte b/src/lib/components/Navigation.svelte index 675ab46..60c220f 100644 --- a/src/lib/components/Navigation.svelte +++ b/src/lib/components/Navigation.svelte @@ -20,7 +20,7 @@

Alexandria

-

READ THE ORIGINAL. MAKE CONNECTIONS. CULTIVATE KNOWLEDGE.

+

READ THE ORIGINAL. MAKE CONNECTIONS. CULTIVATE KNOWLEDGE.

From 1cea21e2fb9038747dd92d1bcb606e13690637b1 Mon Sep 17 00:00:00 2001 From: silberengel Date: Wed, 20 Aug 2025 22:22:10 +0200 Subject: [PATCH 03/12] Event search reinstated. --- src/lib/components/EventSearch.svelte | 59 +++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/src/lib/components/EventSearch.svelte b/src/lib/components/EventSearch.svelte index fc35baf..e06e132 100644 --- a/src/lib/components/EventSearch.svelte +++ b/src/lib/components/EventSearch.svelte @@ -2,7 +2,7 @@ import { goto } from "$app/navigation"; import { Input, Button } from "flowbite-svelte"; import { Spinner } from "flowbite-svelte"; - import type { NDKEvent } from "$lib/utils/nostrUtils"; + import { NDKEvent } from "@nostr-dev-kit/ndk"; import { searchEvent, searchBySubscription, @@ -113,6 +113,35 @@ } } + async function handleProfileSearch(query: string) { + try { + console.log("EventSearch: Starting profile search for:", query); + + // Use the profile search service to find the profile + const { searchProfiles } = await import("$lib/utils/profile_search"); + const result = await searchProfiles(query, ndk); + + if (result.profiles && result.profiles.length > 0) { + console.log("EventSearch: Profile found:", result.profiles[0]); + + // Create an NDKEvent from the profile data + const profileEvent = new NDKEvent(ndk); + profileEvent.kind = 0; // Profile event kind + profileEvent.content = JSON.stringify(result.profiles[0]); + profileEvent.pubkey = result.profiles[0].pubkey || ""; + + handleFoundEvent(profileEvent); + updateSearchState(false, true, 1, "profile"); + } else { + console.log("EventSearch: No profile found for:", query); + cleanupSearch(); + updateSearchState(false, true, 0, "profile"); + } + } catch (error) { + handleSearchError(error, "Profile lookup failed"); + } + } + async function handleEventSearch(query: string) { try { const foundEvent = await searchEvent(query, ndk); @@ -252,9 +281,22 @@ return { type: "nip05", term: query }; } + // AI-NOTE: Detect Nostr identifiers (npub, nevent, naddr, nprofile) + const trimmedQuery = query.trim(); + if (trimmedQuery.startsWith("npub") || trimmedQuery.startsWith("nprofile")) { + return { type: "profile", term: trimmedQuery }; + } + + if (trimmedQuery.startsWith("nevent") || trimmedQuery.startsWith("note")) { + return { type: "event", term: trimmedQuery }; + } + + if (trimmedQuery.startsWith("naddr")) { + return { type: "event", term: trimmedQuery }; + } + // AI-NOTE: Detect hex IDs (64-character hex strings with no spaces) // These are likely event IDs and should be searched as events - const trimmedQuery = query.trim(); if (trimmedQuery && isEventId(trimmedQuery)) { return { type: "event", term: trimmedQuery }; } @@ -262,12 +304,7 @@ // AI-NOTE: Treat plain text searches as generic searches by default // This allows for flexible searching without assuming it's always a profile search // Users can still use n: prefix for explicit name/profile searches - if ( - trimmedQuery && - !trimmedQuery.startsWith("nevent") && - !trimmedQuery.startsWith("npub") && - !trimmedQuery.startsWith("naddr") - ) { + if (trimmedQuery) { return null; // Let handleSearchEvent treat this as a generic search } @@ -293,6 +330,12 @@ return; } + if (type === "profile") { + console.log("EventSearch: Processing profile search:", term); + await handleProfileSearch(term); + return; + } + if (type === "event") { console.log("EventSearch: Processing event ID search:", term); // URL navigation is now handled in handleSearchEvent From 17fcc15ade5bb438debd16110343e4fd49cf90e7 Mon Sep 17 00:00:00 2001 From: silberengel Date: Wed, 20 Aug 2025 22:42:33 +0200 Subject: [PATCH 04/12] Reinstated Notifications --- src/lib/components/EventSearch.svelte | 41 +++++++++++++++++++++------ 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/lib/components/EventSearch.svelte b/src/lib/components/EventSearch.svelte index e06e132..d084b9c 100644 --- a/src/lib/components/EventSearch.svelte +++ b/src/lib/components/EventSearch.svelte @@ -9,6 +9,7 @@ searchNip05, } from "$lib/utils/search_utility"; import { neventEncode, naddrEncode, nprofileEncode } from "$lib/utils"; + import { nip19 } from "nostr-tools"; import { activeInboxRelays, activeOutboxRelays, @@ -122,16 +123,40 @@ const result = await searchProfiles(query, ndk); if (result.profiles && result.profiles.length > 0) { - console.log("EventSearch: Profile found:", result.profiles[0]); + // Get the npub from the profile, or use the original query if profile doesn't have pubkey + let npub = result.profiles[0].pubkey || query; - // Create an NDKEvent from the profile data - const profileEvent = new NDKEvent(ndk); - profileEvent.kind = 0; // Profile event kind - profileEvent.content = JSON.stringify(result.profiles[0]); - profileEvent.pubkey = result.profiles[0].pubkey || ""; + // Convert npub to hex pubkey + let hexPubkey = ""; + try { + if (npub.startsWith('npub')) { + const decoded = nip19.decode(npub); + if (decoded.type === 'npub') { + hexPubkey = decoded.data; + } + } else { + hexPubkey = npub; + } + } catch (error) { + console.warn("Failed to decode npub to hex:", error); + cleanupSearch(); + updateSearchState(false, true, 0, "profile"); + return; + } - handleFoundEvent(profileEvent); - updateSearchState(false, true, 1, "profile"); + // Fetch the actual profile event from relays + const profileEvent = await ndk.fetchEvent({ + kinds: [0], + authors: [hexPubkey], + }); + + if (profileEvent) { + handleFoundEvent(profileEvent); + updateSearchState(false, true, 1, "profile"); + } else { + cleanupSearch(); + updateSearchState(false, true, 0, "profile"); + } } else { console.log("EventSearch: No profile found for:", query); cleanupSearch(); From 1c2fc5f781467c002c0ddf37f11fe9fade464300 Mon Sep 17 00:00:00 2001 From: silberengel Date: Wed, 20 Aug 2025 22:54:42 +0200 Subject: [PATCH 05/12] Fixed heading on publication view --- src/lib/components/util/ArticleNav.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/util/ArticleNav.svelte b/src/lib/components/util/ArticleNav.svelte index 615c1dd..ba07a45 100644 --- a/src/lib/components/util/ArticleNav.svelte +++ b/src/lib/components/util/ArticleNav.svelte @@ -138,7 +138,7 @@