Files
bitvid/js/nostr/index.js
T
thePR0M3TH3ANandClaude Opus 4.8 efdf497c59 fix(feed): filter cached audio-only notes at render + hydration, not just ingest
The convert-time guard (17b48cbf) only blocks FRESH events. Audio notes cached
before it existed are rehydrated straight from IndexedDB/localStorage as
already-converted video objects (`sig: "unavailable (cached)"`), bypassing
convertEventToVideo — so they kept showing in the main feed and channel grids.

Extract the audio check into a reusable object-level predicate
`isAudioOnlyVideoObject(video)` (url + magnet + imeta tags) and apply it at every
boundary a cached object can slip through:
  - convertEventToVideo now delegates to it (fresh ingest, unchanged behavior)
  - PersistenceManager.applyCachedPayload drops audio-only on hydration (purges
    the cache going forward)
  - NostrClient.getActiveVideos filters it (main feed, immediate effect)
  - nostrService.shouldIncludeVideo filters it above the viewer-is-author
    short-circuit (channel/author grids, incl. the creator's own channel)

Audio-only = no magnet AND no imeta `m video/*` AND (imeta `m audio/*` OR an
unambiguous audio url); `.ogg` alone stays video. Bumped client.js size baseline
(+6 lines). Tests: video-schema-and-conversion (+3 predicate scenarios, 11/11);
nostr-service + ingest-adapter suites green. Lint + build clean. TODO #60.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-09 09:36:56 -04:00

67 lines
1.4 KiB
JavaScript

export {
__testExports,
NostrClient,
getActiveSigner,
setActiveSigner,
clearActiveSigner,
resolveActiveSigner,
shouldRequestExtensionPermissions,
} from "./client.js";
export {
DEFAULT_NIP07_ENCRYPTION_METHODS,
DEFAULT_NIP07_PERMISSION_METHODS,
} from "./nip07Permissions.js";
export {
buildNip71MetadataTags,
buildNip71VideoEvent,
collectNip71PointerRequests,
convertEventToVideo,
isAudioOnlyVideoObject,
extractNip71MetadataFromTags,
getDTagValueFromTags,
mergeNip71MetadataIntoVideo,
populateNip71MetadataForVideos,
processNip71Events,
buildVideoPointerValue,
stringFromInput,
} from "./nip71.js";
export {
normalizePointerInput,
pointerKey,
buildWatchHistoryPayload,
normalizeActorKey,
parseWatchHistoryContentWithFallback,
isNip04EncryptedWatchHistoryEvent,
watchHistoryHelpers,
} from "./watchHistory.js";
export {
updateWatchHistoryList,
removeWatchHistoryItem,
} from "./watchHistoryBindings.js";
export {
deriveViewEventBucketIndex,
deriveViewEventPointerScope,
hasRecentViewPublish,
rememberViewPublish,
createVideoViewEventFilters,
getViewEventGuardWindowMs,
listVideoViewEvents,
subscribeVideoViewEvents,
countVideoViewEvents,
publishViewEvent,
recordVideoView,
} from "./viewEvents.js";
export { publishVideoReaction } from "./reactionEvents.js";
export {
COMMENT_EVENT_KIND,
publishComment,
listVideoComments,
subscribeVideoComments,
} from "./commentEvents.js";