feat: add support for addressable videos

This commit is contained in:
codytseng
2025-11-17 21:28:37 +08:00
parent cde0b49e2e
commit 65d44394a6
4 changed files with 30 additions and 8 deletions

View File

@@ -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)

View File

@@ -97,7 +97,12 @@ export default function Note({
content = <AudioPlayer className="mt-2" src={event.content} />
} else if (event.kind === ExtendedKind.PICTURE) {
content = <PictureNote className="mt-2" event={event} />
} 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 = <VideoNote className="mt-2" event={event} />
} else if (event.kind === ExtendedKind.RELAY_REVIEW) {
content = <RelayReview className="mt-2" event={event} />

View File

@@ -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 =

View File

@@ -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'