From 65d44394a606362f12cc9d1d07c2b8013eae2b1f Mon Sep 17 00:00:00 2001 From: codytseng Date: Mon, 17 Nov 2025 21:28:37 +0800 Subject: [PATCH] feat: add support for addressable videos --- src/components/KindFilter/index.tsx | 10 +++++++++- src/components/Note/index.tsx | 7 ++++++- src/constants.ts | 8 ++++++-- src/services/local-storage.service.ts | 13 +++++++++---- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/components/KindFilter/index.tsx b/src/components/KindFilter/index.tsx index a227eb9..ebf4e59 100644 --- a/src/components/KindFilter/index.tsx +++ b/src/components/KindFilter/index.tsx @@ -20,7 +20,15 @@ const KIND_FILTER_OPTIONS = [ { kindGroup: [ExtendedKind.POLL], label: 'Polls' }, { kindGroup: [ExtendedKind.VOICE, ExtendedKind.VOICE_COMMENT], label: 'Voice Posts' }, { kindGroup: [ExtendedKind.PICTURE], label: 'Photo Posts' }, - { kindGroup: [ExtendedKind.VIDEO, ExtendedKind.SHORT_VIDEO], label: 'Video Posts' } + { + kindGroup: [ + ExtendedKind.VIDEO, + ExtendedKind.SHORT_VIDEO, + ExtendedKind.ADDRESSABLE_NORMAL_VIDEO, + ExtendedKind.ADDRESSABLE_SHORT_VIDEO + ], + label: 'Video Posts' + } ] const ALL_KINDS = KIND_FILTER_OPTIONS.flatMap(({ kindGroup }) => kindGroup) diff --git a/src/components/Note/index.tsx b/src/components/Note/index.tsx index f14da17..15fbb5b 100644 --- a/src/components/Note/index.tsx +++ b/src/components/Note/index.tsx @@ -97,7 +97,12 @@ export default function Note({ content = } else if (event.kind === ExtendedKind.PICTURE) { content = - } else if (event.kind === ExtendedKind.VIDEO || event.kind === ExtendedKind.SHORT_VIDEO) { + } else if ( + event.kind === ExtendedKind.VIDEO || + event.kind === ExtendedKind.SHORT_VIDEO || + event.kind === ExtendedKind.ADDRESSABLE_NORMAL_VIDEO || + event.kind === ExtendedKind.ADDRESSABLE_SHORT_VIDEO + ) { content = } else if (event.kind === ExtendedKind.RELAY_REVIEW) { content = diff --git a/src/constants.ts b/src/constants.ts index 57612ab..7aa74bc 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -80,7 +80,9 @@ export const ExtendedKind = { FAVORITE_RELAYS: 10012, BLOSSOM_SERVER_LIST: 10063, RELAY_REVIEW: 31987, - GROUP_METADATA: 39000 + GROUP_METADATA: 39000, + ADDRESSABLE_NORMAL_VIDEO: 34235, + ADDRESSABLE_SHORT_VIDEO: 24236 } export const SUPPORTED_KINDS = [ @@ -96,7 +98,9 @@ export const SUPPORTED_KINDS = [ kinds.Highlights, kinds.LongFormArticle, ExtendedKind.RELAY_REVIEW, - kinds.Emojisets + kinds.Emojisets, + ExtendedKind.ADDRESSABLE_NORMAL_VIDEO, + ExtendedKind.ADDRESSABLE_SHORT_VIDEO ] export const URL_REGEX = diff --git a/src/services/local-storage.service.ts b/src/services/local-storage.service.ts index 82ebe43..a051513 100644 --- a/src/services/local-storage.service.ts +++ b/src/services/local-storage.service.ts @@ -168,14 +168,19 @@ class LocalStorageService { } else { const showKindsVersionStr = window.localStorage.getItem(StorageKey.SHOW_KINDS_VERSION) const showKindsVersion = showKindsVersionStr ? parseInt(showKindsVersionStr) : 0 - const showKinds = JSON.parse(showKindsStr) as number[] + const showKindSet = new Set(JSON.parse(showKindsStr) as number[]) if (showKindsVersion < 1) { - showKinds.push(ExtendedKind.VIDEO, ExtendedKind.SHORT_VIDEO) + showKindSet.add(ExtendedKind.VIDEO) + showKindSet.add(ExtendedKind.SHORT_VIDEO) } - this.showKinds = showKinds + if (showKindsVersion < 2 && showKindSet.has(ExtendedKind.VIDEO)) { + showKindSet.add(ExtendedKind.ADDRESSABLE_NORMAL_VIDEO) + showKindSet.add(ExtendedKind.ADDRESSABLE_SHORT_VIDEO) + } + this.showKinds = Array.from(showKindSet) } window.localStorage.setItem(StorageKey.SHOW_KINDS, JSON.stringify(this.showKinds)) - window.localStorage.setItem(StorageKey.SHOW_KINDS_VERSION, '1') + window.localStorage.setItem(StorageKey.SHOW_KINDS_VERSION, '2') this.hideContentMentioningMutedUsers = window.localStorage.getItem(StorageKey.HIDE_CONTENT_MENTIONING_MUTED_USERS) === 'true'