mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 23:24:22 +01:00
fix: prevent tracking reading position for nostr-event sentinel URLs
- Add check to filter out nostr-event: URLs from reading position tracking - nostr-event: is an internal sentinel, not a valid Nostr URI per NIP-21 - Prevents these sentinel URLs from being saved to reading position data
This commit is contained in:
@@ -155,6 +155,8 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
const isTextContent = useMemo(() => {
|
||||
if (loading) return false
|
||||
if (!markdown && !html) return false
|
||||
// Don't track internal sentinel URLs (nostr-event: is not a real Nostr URI per NIP-21)
|
||||
if (selectedUrl?.startsWith('nostr-event:')) return false
|
||||
if (selectedUrl?.includes('youtube') || selectedUrl?.includes('vimeo')) return false
|
||||
if (!shouldTrackReadingProgress(html, markdown)) return false
|
||||
|
||||
|
||||
@@ -394,22 +394,8 @@ const Me: React.FC<MeProps> = ({
|
||||
}
|
||||
|
||||
const getReadItemUrl = (item: ReadItem) => {
|
||||
// Handle nostr-event: URLs specially - route to /e/ path
|
||||
const urlToCheck = item.url || item.id
|
||||
if (urlToCheck?.startsWith('nostr-event:')) {
|
||||
const eventId = urlToCheck.replace('nostr-event:', '')
|
||||
return `/e/${eventId}`
|
||||
}
|
||||
|
||||
if (item.type === 'article') {
|
||||
// Check if ID is actually an naddr
|
||||
if (item.id.startsWith('naddr1')) {
|
||||
if (item.type === 'article' && item.id.startsWith('naddr1')) {
|
||||
return `/a/${item.id}`
|
||||
}
|
||||
// Fallback: if it has a URL, use /r/ path
|
||||
if (item.url) {
|
||||
return `/r/${encodeURIComponent(item.url)}`
|
||||
}
|
||||
} else if (item.url) {
|
||||
return `/r/${encodeURIComponent(item.url)}`
|
||||
}
|
||||
@@ -450,27 +436,17 @@ const Me: React.FC<MeProps> = ({
|
||||
}
|
||||
|
||||
const handleSelectUrl = (url: string, bookmark?: { id: string; kind: number; tags: string[][]; pubkey: string }) => {
|
||||
// Handle nostr-event: URLs specially - route to /e/ path
|
||||
if (url?.startsWith('nostr-event:')) {
|
||||
const eventId = url.replace('nostr-event:', '')
|
||||
navigate(`/e/${eventId}`)
|
||||
return
|
||||
}
|
||||
|
||||
if (bookmark && bookmark.kind === 30023) {
|
||||
// For kind:30023 articles, navigate to the article route
|
||||
const dTag = bookmark.tags.find(t => t[0] === 'd')?.[1] || ''
|
||||
if (dTag && bookmark.pubkey) {
|
||||
const pointer = {
|
||||
identifier: dTag,
|
||||
const naddr = nip19.naddrEncode({
|
||||
kind: 30023,
|
||||
pubkey: bookmark.pubkey,
|
||||
}
|
||||
const naddr = nip19.naddrEncode(pointer)
|
||||
identifier: dTag
|
||||
})
|
||||
navigate(`/a/${naddr}`)
|
||||
}
|
||||
} else if (url) {
|
||||
// For regular URLs, navigate to the reader route
|
||||
navigate(`/r/${encodeURIComponent(url)}`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user