Fix watch history reliability by migrating to Kind 30003

Migrates watch history persistence from Kind 30078 (Application Data) to Kind 30003 (Bookmark List) to resolve blocking issues on some relays. Updates fetch logic to query both kinds for backward compatibility.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-06 19:03:03 +00:00
1 parent 2537296f67
commit b3aeb95a0b
4 files changed
+17 -4

No files matched your search

+2 -1
View File
@@ -301,7 +301,8 @@ export const THEME_ACCENT_OVERRIDES = Object.freeze({
* example, a NIP-51 collection) can flip this number so long as their relays
* accept the chosen kind.
*/
export const WATCH_HISTORY_KIND = 30078;
export const WATCH_HISTORY_KIND = 30003;
export const WATCH_HISTORY_LEGACY_KIND = 30078;
/**
* Identifier applied to the watch-history list when storing it on relays.
+2
View File
@@ -28,6 +28,7 @@ import {
DEFAULT_TRUSTED_MUTE_HIDE_THRESHOLD,
DEFAULT_TRUSTED_SPAM_HIDE_THRESHOLD,
WATCH_HISTORY_KIND,
WATCH_HISTORY_LEGACY_KIND,
WATCH_HISTORY_LIST_IDENTIFIER,
WATCH_HISTORY_LEGACY_LIST_IDENTIFIERS,
WATCH_HISTORY_MAX_ITEMS,
@@ -118,6 +119,7 @@ export { ADMIN_WHITELIST_MODE_STORAGE_KEY };
// -----------------------------------------------------------------------------
export { WATCH_HISTORY_KIND };
export { WATCH_HISTORY_LEGACY_KIND };
export { WATCH_HISTORY_LIST_IDENTIFIER };
export { WATCH_HISTORY_LEGACY_LIST_IDENTIFIERS };
export { WATCH_HISTORY_MAX_ITEMS };
+10 -1
View File
@@ -1,5 +1,6 @@
import {
WATCH_HISTORY_KIND,
WATCH_HISTORY_LEGACY_KIND,
WATCH_HISTORY_LIST_IDENTIFIER,
WATCH_HISTORY_LEGACY_LIST_IDENTIFIERS,
WATCH_HISTORY_MAX_ITEMS,
@@ -1883,9 +1884,17 @@ class WatchHistoryManager {
}
let pointerEvents = [];
try {
const kinds = [WATCH_HISTORY_KIND];
if (
Number.isFinite(WATCH_HISTORY_LEGACY_KIND) &&
WATCH_HISTORY_LEGACY_KIND > 0 &&
WATCH_HISTORY_LEGACY_KIND !== WATCH_HISTORY_KIND
) {
kinds.push(WATCH_HISTORY_LEGACY_KIND);
}
const filters = [
{
kinds: [WATCH_HISTORY_KIND],
kinds,
authors: [actorKey],
// Fetch all parameterized replaceables of this kind to get history across all months
limit,
+3 -2
View File
@@ -11,6 +11,7 @@ const {
WATCH_HISTORY_BATCH_PAGE_SIZE,
WATCH_HISTORY_LIST_IDENTIFIER,
WATCH_HISTORY_KIND,
WATCH_HISTORY_LEGACY_KIND,
} =
await import("../js/config.js");
const {
@@ -2524,7 +2525,7 @@ async function testWatchHistoryFeedHydration() {
poolHarness.reset();
watchHistoryService.resetProgress();
const actor = "feed-hydration-actor";
const actor = "f".repeat(64);
const videoId = "hydration-video-id";
const videoTitle = "Hydrated Video Title";
const videoEvent = {
@@ -2563,7 +2564,7 @@ async function testWatchHistoryFeedHydration() {
results.push(videoEvent);
}
if (filter.kinds && filter.kinds.includes(WATCH_HISTORY_KIND)) {
if (filter.kinds && (filter.kinds.includes(WATCH_HISTORY_KIND) || filter.kinds.includes(WATCH_HISTORY_LEGACY_KIND))) {
results.push({
id: "history-event-id",
kind: WATCH_HISTORY_KIND,