- Moves `bootstrapTrustedSeeds` logic from `js/bootstrap.js` to a new service `js/services/trustBootstrap.js`.
- Updates `js/app.js` to explicitly await `nostrClient.init()` before calling `bootstrapTrustedSeeds()`, resolving race conditions where admin lists were fetched before the relay pool was ready.
- Ensures `waitForRelaysReady` checks for `nostrClient.pool` existence.
- Removes the logic in `restoreCacheSnapshot` that deleted cached view counts if they were older than `VIEW_COUNT_CACHE_TTL_MS`.
- Updates `tests/view-counter.test.mjs` to assert that stale cache data is preserved and used as a baseline during hydration, preventing view counts from dropping to zero or lower fallback values during network issues.
This introduces a new stage in the watch history feed pipeline that fetches missing video metadata from relays. Since watch history storage was optimized to store only event IDs, this hydration step ensures that the UI can display titles and thumbnails without requiring them to be persisted in the history payload itself.
- Implemented `createWatchHistoryHydrationStage` in `js/feedEngine/watchHistoryFeed.js`.
- Integrated `convertEventToVideo` to transform fetched events into usable video objects.
- Added a comprehensive integration test in `tests/watch-history.test.mjs` verifying the full flow from ID-only storage to hydrated feed items.
- Updated `js/historyView.js` to load history month-by-month and implement infinite scroll.
- Updated `js/watchHistoryService.js` and `js/nostr/watchHistory.js` to support fetching specific monthly buckets (`YYYY-MM`).
- Updated `js/nostr/client.js` to expose `fetchWatchHistoryMonth`.
- Updated `views/history.html` copy to reflect monthly/server-side storage and remove references to local caching/encryption.
- Ensure item removal targets the correct monthly bucket.
- Rename "Clear local cache" button to "Clear local history"
- Update info text to remove references to hydrating from session/caches
- Simplify copy to remove "encrypted" references in favor of "syncing" or "history"
- Update success/error messages to match new terminology
Removed the metadata toggle UI and related logic from the watch history implementation.
- Updated `components/profile-modal.html` to remove the UI block.
- Cleaned up `js/ui/profileModalController.js` and `js/historyView.js` to drop metadata preference state and handlers.
- Updated `tests/watch-history.test.mjs` to remove obsolete test cases referencing `metadataPreference`.
Removes the metadata argument from `WatchHistoryService.publishView` and cleans up the associated caching and resolution logic in `watchHistory.js` and `watchHistoryFeed.js`. Deletes `js/watchHistoryMetadata.js` as it is no longer used.
This simplification ensures watch history strictly manages pointers and timestamps, leaving metadata resolution to higher-level consumers. It also reduces the payload size and complexity of persisted history records.
Tests have been updated to reflect the API changes.
Removes legacy snapshot/chunk retry scheduling in favor of a monthly upsert approach.
Updates state persistence to remove `pendingSnapshotId`.
Fixes race condition in `scheduleRepublishForQueue` by using selective queue pruning.
Ensures data is not lost on publish failure in `snapshot`.
Updates tests to align with new architecture.
- Update `js/nostrEventSchemas.js` to remove encryption tagging and update schema for `WATCH_HISTORY`.
- Update `js/nostr/watchHistory.js` to:
- Bump storage version to 4.
- Bucket items by `YYYY-MM`.
- Publish plaintext JSON payloads with only event IDs and timestamps.
- Remove encryption logic from publishing.
- Update fetching to handle plaintext and fallback to legacy parsing.
- Update `js/watchHistoryService.js` to strip metadata from queued items and handle new snapshot response.
- Update `tests/watch-history.test.mjs` to reflect new plaintext behavior and disabled obsolete tests.
Refactors the watch-history system to prioritize `YYYY-MM` month identifiers over legacy snapshot IDs in event tags, storage keys, and cross-module references. Updates event schemas, storage keying (v3), and client interfaces to align with the new month-based structure. Renames `snapshotId` parameters to `taskId` for republishing operations.
Refactors `js/nostr/watchHistory.js` to store and publish watch history items in monthly buckets (`YYYY-MM`) instead of using chunk splitting. Updates storage version to 3, migrates existing data, and simplifies fetch/merge logic to handle monthly records. Removes legacy chunk rebalancing code. Updates tests to verify monthly bucketing behavior.
- Updated `buildWatchHistoryPayload` to remove legacy `snapshotId` logic.
- Updated `publishSnapshot` to use `YYYY-MM` as the `d` tag identifier.
- Updated `fetch` logic to retrieve all history events (removing restrictive `#d` filter) to ensure complete history across months is loaded.
- Fixed a runtime error in `fetch` where `now` was undefined.
- Updated `js/nostrEventSchemas.js` to prioritize `monthIdentifier` for the `d` tag.
- Removed legacy `snapshot` field from payload serialization.
- Rename `WATCH_HISTORY_CHUNK` schema to "Watch history monthly payload" in `js/nostrEventSchemas.js`.
- Update `js/nostr/watchHistory.js` to replace `snapshotId` with `recordId` and `monthIdentifier` in logging and error tracking context.
- Ensure `fetch` logic uses `recordId` and `month` in chunk decryption context for clarity.
- Fix indentation for added fields in logging objects.
This change updates `normalizePointersFromPayload` to process both legacy `items` and new `events` arrays from the watch history payload. It also adds logic to merge `watchedAt` timestamps from a map, supporting the new monthly format. Additionally, `mergeWatchHistoryItemsWithFallback` is updated to rely on the unified `items` list and hydrate metadata from fallback items for all entries, ensuring robust handling of sparse event pointers.
* Redefine `parseWatchHistoryPayload` to support `month`, `events` (IDs), and `watchedAt` map.
* Update `mergeWatchHistoryItemsWithFallback` to merge new monthly fields with fallback items.
* Update `buildWatchHistoryPayload` to produce payloads with `events` instead of `items`.
* Update `WatchHistoryManager` to remove legacy chunk index handling.
* Ensure backward compatibility for legacy chunk payloads.
Replaces the legacy chunked storage architecture with a single encrypted event per month.
- Renames `buildWatchHistoryChunkEvent` to `buildWatchHistoryEvent`.
- Updates `WatchHistoryManager` to publish and fetch single events, maintaining read compatibility for legacy chunks.
- Simplifies payload construction and removes chunk indexing logic.
- Updates tests to verify single-event publishing and legacy fallback.
Replaces the chunked watch history implementation with a single monthly payload.
This simplifies the event structure and removes chunking logic while maintaining backward compatibility for reading legacy chunked events.
Updates `parseWatchHistoryPayload`, `buildWatchHistoryPayload`, `publishSnapshot` and `fetch` in `js/nostr/watchHistory.js`.
Updates tests to reflect the new single-event behavior.