diff --git a/config/instance-config.js b/config/instance-config.js index 10d582b0..2ef81c37 100644 --- a/config/instance-config.js +++ b/config/instance-config.js @@ -44,3 +44,42 @@ export const ADMIN_WHITELIST_MODE_STORAGE_KEY = "bitvid_admin_whitelist_mode"; * default state when no preference has been stored in localStorage yet. */ export const DEFAULT_WHITELIST_MODE_ENABLED = true; + +/** + * Nostr kind used when persisting watch history events. + * + * BitVid’s roadmap standardizes on kind 30078 so that watch events, view logs, + * and media metadata stay in the same family of documents. Operators that want + * to experiment with a separate list kind (for example, a NIP-51 collection) + * can flip this number so long as their relays accept the chosen kind. + */ +export const WATCH_HISTORY_KIND = 30078; + +/** + * Identifier applied to the watch-history list when storing it on relays. + * + * This becomes the value of the `d` tag so clients can find the correct list + * without guessing. Customize the slug if you need isolation between multiple + * BitVid deployments that share relays, but keep it stable once clients begin + * syncing history. + */ +export const WATCH_HISTORY_LIST_IDENTIFIER = "watch-history"; + +/** + * Maximum number of watch-history entries to retain per user. + * + * The roadmap targets a rolling window of 1,500 items so the UI can highlight + * recently played videos without ballooning relay storage. Adjust this cap up + * or down depending on your retention and privacy policies; smaller values + * reduce storage pressure while larger ones surface a deeper backlog. + */ +export const WATCH_HISTORY_MAX_ITEMS = 1500; + +/** + * Whether clients should resolve watch-history entries in batches. + * + * When enabled, BitVid fetches video metadata in grouped queries instead of + * issuing one request per entry. Operators with relays that struggle under + * bursty loads can disable batching at the cost of additional round trips. + */ +export const WATCH_HISTORY_BATCH_RESOLVE = true; diff --git a/js/config.js b/js/config.js index 5fc79f62..fe95d495 100644 --- a/js/config.js +++ b/js/config.js @@ -4,6 +4,10 @@ import { ADMIN_SUPER_NPUB, ADMIN_WHITELIST_MODE_STORAGE_KEY, DEFAULT_WHITELIST_MODE_ENABLED, + WATCH_HISTORY_KIND, + WATCH_HISTORY_LIST_IDENTIFIER, + WATCH_HISTORY_MAX_ITEMS, + WATCH_HISTORY_BATCH_RESOLVE, } from "../config/instance-config.js"; export const isDevMode = true; // Set to false for production @@ -42,3 +46,12 @@ export function setWhitelistMode(enabled) { } export { ADMIN_WHITELIST_MODE_STORAGE_KEY }; + +// ----------------------------------------------------------------------------- +// Watch history — roadmap defaults balance retention with relay load +// ----------------------------------------------------------------------------- + +export { WATCH_HISTORY_KIND }; +export { WATCH_HISTORY_LIST_IDENTIFIER }; +export { WATCH_HISTORY_MAX_ITEMS }; +export { WATCH_HISTORY_BATCH_RESOLVE };