mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 07:04:19 +01:00
chore: remove console.log debug output from profile services and hooks
This commit is contained in:
@@ -61,14 +61,12 @@ export const useMarkdownToHTML = (
|
|||||||
setProcessedMarkdown('')
|
setProcessedMarkdown('')
|
||||||
|
|
||||||
if (!markdown) {
|
if (!markdown) {
|
||||||
console.log(`[markdown-to-html] No markdown provided`)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let isCancelled = false
|
let isCancelled = false
|
||||||
|
|
||||||
const processMarkdown = () => {
|
const processMarkdown = () => {
|
||||||
console.log(`[markdown-to-html] Processing markdown with ${profileLabels.size} profile labels`)
|
|
||||||
try {
|
try {
|
||||||
// Replace nostr URIs with profile labels (progressive) and article titles
|
// Replace nostr URIs with profile labels (progressive) and article titles
|
||||||
const processed = replaceNostrUrisInMarkdownWithProfileLabels(
|
const processed = replaceNostrUrisInMarkdownWithProfileLabels(
|
||||||
@@ -79,7 +77,6 @@ export const useMarkdownToHTML = (
|
|||||||
|
|
||||||
if (isCancelled) return
|
if (isCancelled) return
|
||||||
|
|
||||||
console.log(`[markdown-to-html] Markdown processed, length: ${processed.length}`)
|
|
||||||
setProcessedMarkdown(processed)
|
setProcessedMarkdown(processed)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`[markdown-to-html] Error processing markdown:`, error)
|
console.error(`[markdown-to-html] Error processing markdown:`, error)
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
// Ignore errors, continue processing other pointers
|
// Ignore errors, continue processing other pointers
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(`[profile-labels] Extracted ${result.length} profile identifiers from content:`, result.map(r => ({ encoded: r.encoded.slice(0, 20) + '...', pubkey: r.pubkey.slice(0, 16) + '...' })))
|
|
||||||
return result
|
return result
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(`[profile-labels] Error extracting profile pointers:`, error)
|
console.warn(`[profile-labels] Error extracting profile pointers:`, error)
|
||||||
@@ -44,13 +43,11 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
// Initialize labels synchronously from cache on first render to avoid delay
|
// Initialize labels synchronously from cache on first render to avoid delay
|
||||||
const initialLabels = useMemo(() => {
|
const initialLabels = useMemo(() => {
|
||||||
if (profileData.length === 0) {
|
if (profileData.length === 0) {
|
||||||
console.log(`[profile-labels] No profile data, returning empty labels`)
|
|
||||||
return new Map<string, string>()
|
return new Map<string, string>()
|
||||||
}
|
}
|
||||||
|
|
||||||
const allPubkeys = profileData.map(({ pubkey }) => pubkey)
|
const allPubkeys = profileData.map(({ pubkey }) => pubkey)
|
||||||
const cachedProfiles = loadCachedProfiles(allPubkeys)
|
const cachedProfiles = loadCachedProfiles(allPubkeys)
|
||||||
console.log(`[profile-labels] Loaded ${cachedProfiles.size} cached profiles out of ${allPubkeys.length} requested`)
|
|
||||||
const labels = new Map<string, string>()
|
const labels = new Map<string, string>()
|
||||||
|
|
||||||
profileData.forEach(({ encoded, pubkey }) => {
|
profileData.forEach(({ encoded, pubkey }) => {
|
||||||
@@ -61,12 +58,10 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
const displayName = profileData.display_name || profileData.name || profileData.nip05
|
const displayName = profileData.display_name || profileData.name || profileData.nip05
|
||||||
if (displayName) {
|
if (displayName) {
|
||||||
labels.set(encoded, `@${displayName}`)
|
labels.set(encoded, `@${displayName}`)
|
||||||
console.log(`[profile-labels] Found cached name for ${encoded.slice(0, 20)}...: ${displayName}`)
|
|
||||||
} else {
|
} else {
|
||||||
// Use fallback npub display if profile has no name
|
// Use fallback npub display if profile has no name
|
||||||
const fallback = getNpubFallbackDisplay(pubkey)
|
const fallback = getNpubFallbackDisplay(pubkey)
|
||||||
labels.set(encoded, fallback)
|
labels.set(encoded, fallback)
|
||||||
console.log(`[profile-labels] Cached profile for ${encoded.slice(0, 20)}... has no name, using fallback: ${fallback}`)
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Use fallback npub display if parsing fails
|
// Use fallback npub display if parsing fails
|
||||||
@@ -74,12 +69,9 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
labels.set(encoded, fallback)
|
labels.set(encoded, fallback)
|
||||||
console.warn(`[profile-labels] Error parsing cached profile for ${encoded.slice(0, 20)}..., using fallback:`, error)
|
console.warn(`[profile-labels] Error parsing cached profile for ${encoded.slice(0, 20)}..., using fallback:`, error)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log(`[profile-labels] No cached profile for ${encoded.slice(0, 20)}... (pubkey: ${pubkey.slice(0, 16)}...)`)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(`[profile-labels] Initial labels from cache:`, Array.from(labels.entries()).map(([enc, label]) => ({ encoded: enc.slice(0, 20) + '...', label })))
|
|
||||||
return labels
|
return labels
|
||||||
}, [profileData])
|
}, [profileData])
|
||||||
|
|
||||||
@@ -155,11 +147,9 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
|
|
||||||
const pubkeysToFetch: string[] = []
|
const pubkeysToFetch: string[] = []
|
||||||
|
|
||||||
console.log(`[profile-labels] Checking eventStore for ${profileData.length} profiles`)
|
|
||||||
profileData.forEach(({ encoded, pubkey }) => {
|
profileData.forEach(({ encoded, pubkey }) => {
|
||||||
// Skip if already resolved from initial cache
|
// Skip if already resolved from initial cache
|
||||||
if (labels.has(encoded)) {
|
if (labels.has(encoded)) {
|
||||||
console.log(`[profile-labels] Skipping ${encoded.slice(0, 20)}..., already has label from cache`)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,12 +159,7 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
const eventStoreProfile = eventStore.getEvent(pubkey + ':0')
|
const eventStoreProfile = eventStore.getEvent(pubkey + ':0')
|
||||||
if (eventStoreProfile) {
|
if (eventStoreProfile) {
|
||||||
profileEvent = eventStoreProfile
|
profileEvent = eventStoreProfile
|
||||||
console.log(`[profile-labels] Found profile in eventStore for ${encoded.slice(0, 20)}...`)
|
|
||||||
} else {
|
|
||||||
console.log(`[profile-labels] Profile not in eventStore for ${encoded.slice(0, 20)}... (pubkey: ${pubkey.slice(0, 16)}...)`)
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log(`[profile-labels] No eventStore available`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profileEvent) {
|
if (profileEvent) {
|
||||||
@@ -183,12 +168,10 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
const displayName = profileData.display_name || profileData.name || profileData.nip05
|
const displayName = profileData.display_name || profileData.name || profileData.nip05
|
||||||
if (displayName) {
|
if (displayName) {
|
||||||
labels.set(encoded, `@${displayName}`)
|
labels.set(encoded, `@${displayName}`)
|
||||||
console.log(`[profile-labels] Set label from eventStore for ${encoded.slice(0, 20)}...: @${displayName}`)
|
|
||||||
} else {
|
} else {
|
||||||
// Use fallback npub display if profile has no name
|
// Use fallback npub display if profile has no name
|
||||||
const fallback = getNpubFallbackDisplay(pubkey)
|
const fallback = getNpubFallbackDisplay(pubkey)
|
||||||
labels.set(encoded, fallback)
|
labels.set(encoded, fallback)
|
||||||
console.log(`[profile-labels] Profile in eventStore for ${encoded.slice(0, 20)}... has no name, using fallback: ${fallback}`)
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Use fallback npub display if parsing fails
|
// Use fallback npub display if parsing fails
|
||||||
@@ -199,7 +182,6 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
} else {
|
} else {
|
||||||
// No profile found yet, will use fallback after fetch or keep empty
|
// No profile found yet, will use fallback after fetch or keep empty
|
||||||
// We'll set fallback labels for missing profiles at the end
|
// We'll set fallback labels for missing profiles at the end
|
||||||
console.log(`[profile-labels] Adding ${encoded.slice(0, 20)}... to fetch queue`)
|
|
||||||
pubkeysToFetch.push(pubkey)
|
pubkeysToFetch.push(pubkey)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -209,12 +191,9 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
if (!labels.has(encoded)) {
|
if (!labels.has(encoded)) {
|
||||||
const fallback = getNpubFallbackDisplay(pubkey)
|
const fallback = getNpubFallbackDisplay(pubkey)
|
||||||
labels.set(encoded, fallback)
|
labels.set(encoded, fallback)
|
||||||
console.log(`[profile-labels] Setting fallback label for ${encoded.slice(0, 20)}...: ${fallback}`)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(`[profile-labels] Labels after checking cache and eventStore:`, Array.from(labels.entries()).map(([enc, label]) => ({ encoded: enc.slice(0, 20) + '...', label })))
|
|
||||||
console.log(`[profile-labels] Profiles to fetch: ${pubkeysToFetch.length}`, pubkeysToFetch.map(p => p.slice(0, 16) + '...'))
|
|
||||||
setProfileLabels(new Map(labels))
|
setProfileLabels(new Map(labels))
|
||||||
|
|
||||||
// Fetch missing profiles asynchronously with reactive updates
|
// Fetch missing profiles asynchronously with reactive updates
|
||||||
@@ -228,9 +207,6 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(`[profile-labels] Fetching ${pubkeysToFetch.length} profiles from relays`)
|
|
||||||
console.log(`[profile-labels] Calling fetchProfiles with relayPool and ${pubkeysToFetch.length} pubkeys`)
|
|
||||||
|
|
||||||
// Capture refs at effect level for cleanup function
|
// Capture refs at effect level for cleanup function
|
||||||
const currentPendingUpdatesRef = pendingUpdatesRef
|
const currentPendingUpdatesRef = pendingUpdatesRef
|
||||||
const currentRafScheduledRef = rafScheduledRef
|
const currentRafScheduledRef = rafScheduledRef
|
||||||
@@ -239,12 +215,9 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
const handleProfileEvent = (event: NostrEvent) => {
|
const handleProfileEvent = (event: NostrEvent) => {
|
||||||
const encoded = pubkeyToEncoded.get(event.pubkey)
|
const encoded = pubkeyToEncoded.get(event.pubkey)
|
||||||
if (!encoded) {
|
if (!encoded) {
|
||||||
console.log(`[profile-labels] Received profile for unknown pubkey ${event.pubkey.slice(0, 16)}..., skipping`)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[profile-labels] Received profile event for ${encoded.slice(0, 20)}...`)
|
|
||||||
|
|
||||||
// Determine the label for this profile
|
// Determine the label for this profile
|
||||||
let label: string
|
let label: string
|
||||||
try {
|
try {
|
||||||
@@ -252,11 +225,9 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
const displayName = profileData.display_name || profileData.name || profileData.nip05
|
const displayName = profileData.display_name || profileData.name || profileData.nip05
|
||||||
if (displayName) {
|
if (displayName) {
|
||||||
label = `@${displayName}`
|
label = `@${displayName}`
|
||||||
console.log(`[profile-labels] Updated label reactively for ${encoded.slice(0, 20)}... to @${displayName}`)
|
|
||||||
} else {
|
} else {
|
||||||
// Use fallback npub display if profile has no name
|
// Use fallback npub display if profile has no name
|
||||||
label = getNpubFallbackDisplay(event.pubkey)
|
label = getNpubFallbackDisplay(event.pubkey)
|
||||||
console.log(`[profile-labels] Profile for ${encoded.slice(0, 20)}... has no name, keeping fallback: ${label}`)
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Use fallback npub display if parsing fails
|
// Use fallback npub display if parsing fails
|
||||||
@@ -292,8 +263,6 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
|
|
||||||
fetchProfiles(relayPool, eventStore as unknown as IEventStore, pubkeysToFetch, undefined, handleProfileEvent)
|
fetchProfiles(relayPool, eventStore as unknown as IEventStore, pubkeysToFetch, undefined, handleProfileEvent)
|
||||||
.then((fetchedProfiles) => {
|
.then((fetchedProfiles) => {
|
||||||
console.log(`[profile-labels] Fetch completed (EOSE), received ${fetchedProfiles.length} profiles total`)
|
|
||||||
|
|
||||||
// Ensure any pending batched updates are applied immediately after EOSE
|
// Ensure any pending batched updates are applied immediately after EOSE
|
||||||
// This ensures all profile updates are applied even if RAF hasn't fired yet
|
// This ensures all profile updates are applied even if RAF hasn't fired yet
|
||||||
const pendingUpdates = currentPendingUpdatesRef.current
|
const pendingUpdates = currentPendingUpdatesRef.current
|
||||||
@@ -313,16 +282,8 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
updatedLabels.set(encoded, label)
|
updatedLabels.set(encoded, label)
|
||||||
}
|
}
|
||||||
pendingUpdates.clear()
|
pendingUpdates.clear()
|
||||||
console.log(`[profile-labels] Flushed ${pendingCount} pending updates after EOSE`)
|
|
||||||
console.log(`[profile-labels] Final labels after EOSE:`, Array.from(updatedLabels.entries()).map(([enc, label]) => ({ encoded: enc.slice(0, 20) + '...', label })))
|
|
||||||
return updatedLabels
|
return updatedLabels
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
// No pending updates, just log final state
|
|
||||||
setProfileLabels(prevLabels => {
|
|
||||||
console.log(`[profile-labels] Final labels after EOSE:`, Array.from(prevLabels.entries()).map(([enc, label]) => ({ encoded: enc.slice(0, 20) + '...', label })))
|
|
||||||
return prevLabels
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -359,14 +320,6 @@ export function useProfileLabels(content: string, relayPool?: RelayPool | null):
|
|||||||
// Clear using captured reference to avoid linter warning
|
// Clear using captured reference to avoid linter warning
|
||||||
pendingUpdates.clear()
|
pendingUpdates.clear()
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (pubkeysToFetch.length === 0) {
|
|
||||||
console.log(`[profile-labels] No profiles to fetch`)
|
|
||||||
} else if (!relayPool) {
|
|
||||||
console.log(`[profile-labels] No relayPool available, cannot fetch profiles`)
|
|
||||||
} else if (!eventStore) {
|
|
||||||
console.log(`[profile-labels] No eventStore available, cannot fetch profiles`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [profileData, eventStore, relayPool, initialLabels])
|
}, [profileData, eventStore, relayPool, initialLabels])
|
||||||
|
|
||||||
|
|||||||
@@ -195,12 +195,10 @@ export const fetchProfiles = async (
|
|||||||
): Promise<NostrEvent[]> => {
|
): Promise<NostrEvent[]> => {
|
||||||
try {
|
try {
|
||||||
if (pubkeys.length === 0) {
|
if (pubkeys.length === 0) {
|
||||||
console.log(`[fetch-profiles] No pubkeys provided`)
|
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
const uniquePubkeys = Array.from(new Set(pubkeys))
|
const uniquePubkeys = Array.from(new Set(pubkeys))
|
||||||
console.log(`[fetch-profiles] Requested ${pubkeys.length} profiles (${uniquePubkeys.length} unique)`)
|
|
||||||
|
|
||||||
// First, check localStorage cache for all requested profiles
|
// First, check localStorage cache for all requested profiles
|
||||||
const cachedProfiles = loadCachedProfiles(uniquePubkeys)
|
const cachedProfiles = loadCachedProfiles(uniquePubkeys)
|
||||||
@@ -213,16 +211,11 @@ export const fetchProfiles = async (
|
|||||||
eventStore.add(profile)
|
eventStore.add(profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[fetch-profiles] Found ${cachedProfiles.size} profiles in cache`)
|
|
||||||
|
|
||||||
// Determine which pubkeys need to be fetched from relays
|
// Determine which pubkeys need to be fetched from relays
|
||||||
const pubkeysToFetch = uniquePubkeys.filter(pubkey => !cachedProfiles.has(pubkey))
|
const pubkeysToFetch = uniquePubkeys.filter(pubkey => !cachedProfiles.has(pubkey))
|
||||||
|
|
||||||
console.log(`[fetch-profiles] Need to fetch ${pubkeysToFetch.length} profiles from relays`)
|
|
||||||
|
|
||||||
// If all profiles are cached, return early
|
// If all profiles are cached, return early
|
||||||
if (pubkeysToFetch.length === 0) {
|
if (pubkeysToFetch.length === 0) {
|
||||||
console.log(`[fetch-profiles] All profiles cached, returning ${profilesByPubkey.size} profiles`)
|
|
||||||
return Array.from(profilesByPubkey.values())
|
return Array.from(profilesByPubkey.values())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,9 +223,6 @@ export const fetchProfiles = async (
|
|||||||
const relayUrls = Array.from(relayPool.relays.values()).map(relay => relay.url)
|
const relayUrls = Array.from(relayPool.relays.values()).map(relay => relay.url)
|
||||||
const prioritized = prioritizeLocalRelays(relayUrls)
|
const prioritized = prioritizeLocalRelays(relayUrls)
|
||||||
const { local: localRelays, remote: remoteRelays } = partitionRelays(prioritized)
|
const { local: localRelays, remote: remoteRelays } = partitionRelays(prioritized)
|
||||||
|
|
||||||
console.log(`[fetch-profiles] Querying ${localRelays.length} local relays and ${remoteRelays.length} remote relays`)
|
|
||||||
console.log(`[fetch-profiles] Active relays:`, relayUrls)
|
|
||||||
const hasPurplePages = relayUrls.some(url => url.includes('purplepag.es'))
|
const hasPurplePages = relayUrls.some(url => url.includes('purplepag.es'))
|
||||||
if (!hasPurplePages) {
|
if (!hasPurplePages) {
|
||||||
console.warn(`[fetch-profiles] purplepag.es not in active relay pool, adding it temporarily`)
|
console.warn(`[fetch-profiles] purplepag.es not in active relay pool, adding it temporarily`)
|
||||||
@@ -259,9 +249,6 @@ export const fetchProfiles = async (
|
|||||||
eventStore.add(event)
|
eventStore.add(event)
|
||||||
// Cache to localStorage for future use
|
// Cache to localStorage for future use
|
||||||
cacheProfile(event)
|
cacheProfile(event)
|
||||||
console.log(`[fetch-profiles] Received profile for ${event.pubkey.slice(0, 16)}... (event #${eventCount})`)
|
|
||||||
} else {
|
|
||||||
console.log(`[fetch-profiles] Received older profile for ${event.pubkey.slice(0, 16)}..., keeping existing`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,12 +278,10 @@ export const fetchProfiles = async (
|
|||||||
|
|
||||||
const profiles = Array.from(profilesByPubkey.values())
|
const profiles = Array.from(profilesByPubkey.values())
|
||||||
|
|
||||||
console.log(`[fetch-profiles] Fetch completed: received ${eventCount} events, ${fetchedPubkeys.size} unique profiles`)
|
|
||||||
const missingPubkeys = pubkeysToFetch.filter(p => !fetchedPubkeys.has(p))
|
const missingPubkeys = pubkeysToFetch.filter(p => !fetchedPubkeys.has(p))
|
||||||
if (missingPubkeys.length > 0) {
|
if (missingPubkeys.length > 0) {
|
||||||
console.warn(`[fetch-profiles] ${missingPubkeys.length} profiles not found on relays:`, missingPubkeys.map(p => p.slice(0, 16) + '...'))
|
console.warn(`[fetch-profiles] ${missingPubkeys.length} profiles not found on relays:`, missingPubkeys.map(p => p.slice(0, 16) + '...'))
|
||||||
}
|
}
|
||||||
console.log(`[fetch-profiles] Returning ${profiles.length} total profiles (${cachedProfiles.size} cached + ${fetchedPubkeys.size} fetched)`)
|
|
||||||
|
|
||||||
// Note: We don't preload all profile images here to avoid ERR_INSUFFICIENT_RESOURCES
|
// Note: We don't preload all profile images here to avoid ERR_INSUFFICIENT_RESOURCES
|
||||||
// Profile images will be cached by Service Worker when they're actually displayed.
|
// Profile images will be cached by Service Worker when they're actually displayed.
|
||||||
|
|||||||
@@ -315,14 +315,12 @@ export function replaceNostrUrisInMarkdownWithProfileLabels(
|
|||||||
profileLabels: Map<string, string> = new Map(),
|
profileLabels: Map<string, string> = new Map(),
|
||||||
articleTitles: Map<string, string> = new Map()
|
articleTitles: Map<string, string> = new Map()
|
||||||
): string {
|
): string {
|
||||||
console.log(`[markdown-replace] Replacing URIs with ${profileLabels.size} profile labels and ${articleTitles.size} article titles`)
|
|
||||||
return replaceNostrUrisSafely(markdown, (encoded) => {
|
return replaceNostrUrisSafely(markdown, (encoded) => {
|
||||||
const link = createNostrLink(encoded)
|
const link = createNostrLink(encoded)
|
||||||
|
|
||||||
// Check if we have a resolved profile name
|
// Check if we have a resolved profile name
|
||||||
if (profileLabels.has(encoded)) {
|
if (profileLabels.has(encoded)) {
|
||||||
const displayName = profileLabels.get(encoded)!
|
const displayName = profileLabels.get(encoded)!
|
||||||
console.log(`[markdown-replace] Using profile label for ${encoded.slice(0, 20)}...: ${displayName}`)
|
|
||||||
return `[${displayName}](${link})`
|
return `[${displayName}](${link})`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +329,6 @@ export function replaceNostrUrisInMarkdownWithProfileLabels(
|
|||||||
const decoded = decode(encoded)
|
const decoded = decode(encoded)
|
||||||
if (decoded.type === 'naddr' && articleTitles.has(encoded)) {
|
if (decoded.type === 'naddr' && articleTitles.has(encoded)) {
|
||||||
const title = articleTitles.get(encoded)!
|
const title = articleTitles.get(encoded)!
|
||||||
console.log(`[markdown-replace] Using article title for ${encoded.slice(0, 20)}...: ${title}`)
|
|
||||||
return `[${title}](${link})`
|
return `[${title}](${link})`
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -340,7 +337,6 @@ export function replaceNostrUrisInMarkdownWithProfileLabels(
|
|||||||
|
|
||||||
// For other types or if not resolved, use default label (shortened npub format)
|
// For other types or if not resolved, use default label (shortened npub format)
|
||||||
const label = getNostrUriLabel(encoded)
|
const label = getNostrUriLabel(encoded)
|
||||||
console.log(`[markdown-replace] Using default label for ${encoded.slice(0, 20)}...: ${label}`)
|
|
||||||
return `[${label}](${link})`
|
return `[${label}](${link})`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user