Browse Source

remove addressable short videos

imwald
Silberengel 1 month ago
parent
commit
9ef1e1a278
  1. 4
      package-lock.json
  2. 2
      package.json
  3. 1
      src/components/Note/Highlight/index.tsx
  4. 1
      src/components/WebPreview/index.tsx
  5. 12
      src/constants.ts
  6. 4
      src/lib/draft-event.ts
  7. 4
      src/lib/event-ingest-filter.ts
  8. 2
      src/lib/kind-description.ts
  9. 3
      src/lib/wisp-trending-relay.ts
  10. 2
      src/pages/secondary/NotePage/index.tsx
  11. 14
      src/services/local-storage.service.ts
  12. 2
      src/services/mention-event-search.service.ts
  13. 1
      src/services/nip89.service.ts

4
package-lock.json generated

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
{
"name": "imwald",
"version": "23.9.2",
"version": "23.10.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "imwald",
"version": "23.9.2",
"version": "23.10.0",
"license": "MIT",
"dependencies": {
"@asciidoctor/core": "^3.0.4",

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "imwald",
"version": "23.9.2",
"version": "23.10.0",
"description": "Imwald — a user-friendly Nostr client focused on relay feed browsing, publications, and relay discovery",
"private": true,
"type": "module",

1
src/components/Note/Highlight/index.tsx

@ -282,7 +282,6 @@ export default function Highlight({ @@ -282,7 +282,6 @@ export default function Highlight({
ExtendedKind.VIDEO,
ExtendedKind.SHORT_VIDEO,
ExtendedKind.VIDEO_ADDRESSABLE,
ExtendedKind.SHORT_VIDEO_ADDRESSABLE, // NIP-71 addressable; same VideoNotePreview path as 21/22
ExtendedKind.PICTURE, // Has PictureNotePreview
ExtendedKind.PUBLICATION, // Has PublicationCard
ExtendedKind.WIKI_ARTICLE, // Has special card

1
src/components/WebPreview/index.tsx

@ -37,7 +37,6 @@ function getEventTypeName(kind: number): string { @@ -37,7 +37,6 @@ function getEventTypeName(kind: number): string {
case ExtendedKind.VIDEO_ADDRESSABLE:
return 'Video'
case ExtendedKind.SHORT_VIDEO:
case ExtendedKind.SHORT_VIDEO_ADDRESSABLE:
return 'Short Video'
case ExtendedKind.POLL:
return 'Poll'

12
src/constants.ts

@ -515,8 +515,6 @@ export const ExtendedKind = { @@ -515,8 +515,6 @@ export const ExtendedKind = {
SHORT_VIDEO: 22,
/** NIP-71: addressable normal video (same rendering as {@link ExtendedKind.VIDEO}). */
VIDEO_ADDRESSABLE: 34235,
/** NIP-71: addressable short video (same rendering as {@link ExtendedKind.SHORT_VIDEO}). */
SHORT_VIDEO_ADDRESSABLE: 34236,
POLL: 1068,
/** NIP-B9 zap poll (paid votes via zaps). */
ZAP_POLL: 6969,
@ -602,12 +600,11 @@ export function isUnsignedExperimentalKind(kind: number): boolean { @@ -602,12 +600,11 @@ export function isUnsignedExperimentalKind(kind: number): boolean {
return kind >= UNSIGNED_EXPERIMENTAL_KIND_MIN && kind <= UNSIGNED_EXPERIMENTAL_KIND_MAX
}
/** NIP-71 regular + addressable video kinds (21, 22, 34235, 34236). */
/** NIP-71 regular + addressable video kinds (21, 22, 34235). Kind 34236 is not supported. */
export const NIP71_VIDEO_KINDS: readonly number[] = [
ExtendedKind.VIDEO,
ExtendedKind.SHORT_VIDEO,
ExtendedKind.VIDEO_ADDRESSABLE,
ExtendedKind.SHORT_VIDEO_ADDRESSABLE
ExtendedKind.VIDEO_ADDRESSABLE
]
const NIP71_VIDEO_KIND_SET = new Set<number>(NIP71_VIDEO_KINDS)
@ -628,9 +625,9 @@ export function isNip71StyleVideoKind(kind: number): boolean { @@ -628,9 +625,9 @@ export function isNip71StyleVideoKind(kind: number): boolean {
*/
export const AUTHOR_CORE_PREFETCH_ON_INGEST_KINDS: ReadonlySet<number> = new Set<number>()
/** Short-form portrait-style bucket (kind 22 or 34236). */
/** Short-form portrait-style bucket (kind 22 only; addressable 34236 is not supported). */
export function isNip71ShortVideoKind(kind: number): boolean {
return kind === ExtendedKind.SHORT_VIDEO || kind === ExtendedKind.SHORT_VIDEO_ADDRESSABLE
return kind === ExtendedKind.SHORT_VIDEO
}
/** Max kind for signed “custom event” notes in the generic composer (below the unsigned experimental range). */
@ -837,7 +834,6 @@ export const SUPPORTED_KINDS = [ @@ -837,7 +834,6 @@ export const SUPPORTED_KINDS = [
ExtendedKind.VIDEO,
ExtendedKind.SHORT_VIDEO,
ExtendedKind.VIDEO_ADDRESSABLE,
ExtendedKind.SHORT_VIDEO_ADDRESSABLE,
ExtendedKind.POLL,
ExtendedKind.ZAP_POLL,
ExtendedKind.COMMENT,

4
src/lib/draft-event.ts

@ -1964,7 +1964,7 @@ export async function createVideoDraftEvent( @@ -1964,7 +1964,7 @@ export async function createVideoDraftEvent(
content: string,
imetaTags: string[][],
mentions: string[],
videoKind: number, // 21, 22, 34235, or 34236 (NIP-71)
videoKind: number, // 21, 22, or 34235 (NIP-71)
options: {
title?: string
addClientTag?: boolean
@ -2002,7 +2002,7 @@ export async function createVideoDraftEvent( @@ -2002,7 +2002,7 @@ export async function createVideoDraftEvent(
}
return setDraftEventCache({
kind: videoKind, // ExtendedKind.VIDEO or ExtendedKind.SHORT_VIDEO
kind: videoKind, // NIP-71: 21, 22, or 34235
content: transformedEmojisContent,
tags
})

4
src/lib/event-ingest-filter.ts

@ -56,6 +56,9 @@ function explicitLookupMatchesEvent(eventId: string, lookup?: string): boolean { @@ -56,6 +56,9 @@ function explicitLookupMatchesEvent(eventId: string, lookup?: string): boolean {
return eventId.toLowerCase() === l
}
/** NIP-71 addressable short video — dropped site-wide (relay spam). */
const DEPRECATED_NIP71_SHORT_VIDEO_ADDRESSABLE_KIND = 34236
/**
* Single gate for subscribe/cache/IDB read paths: drop kind-1 JSON-object spam, Kacti broadcast spam,
* and malformed relay reviews. Optional {@link ShouldDropEventOnIngestOptions} relaxes Kacti drops for explicit id fetch.
@ -64,6 +67,7 @@ export function shouldDropEventOnIngest( @@ -64,6 +67,7 @@ export function shouldDropEventOnIngest(
event: NEvent,
options?: ShouldDropEventOnIngestOptions
): boolean {
if (event.kind === DEPRECATED_NIP71_SHORT_VIDEO_ADDRESSABLE_KIND) return true
if (isIncompleteRelayReviewIngest(event)) return true
if (isStringifiedJsonObjectContentNostrEvent(event)) return true
if (isKactiBroadcastSpamKind1(event)) {

2
src/lib/kind-description.ts

@ -38,8 +38,6 @@ export function getKindDescription( @@ -38,8 +38,6 @@ export function getKindDescription(
return { number: 22, description: 'Short Video Note' }
case ExtendedKind.VIDEO_ADDRESSABLE:
return { number: 34235, description: 'Video Note (addressable)' }
case ExtendedKind.SHORT_VIDEO_ADDRESSABLE:
return { number: 34236, description: 'Short Video Note (addressable)' }
case kinds.LongFormArticle:
return { number: 30023, description: 'Long-form Article' }
case ExtendedKind.WIKI_ARTICLE:

3
src/lib/wisp-trending-relay.ts

@ -27,8 +27,7 @@ export const WISP_TRENDING_FEED_KINDS: readonly number[] = [ @@ -27,8 +27,7 @@ export const WISP_TRENDING_FEED_KINDS: readonly number[] = [
ExtendedKind.PICTURE,
ExtendedKind.VIDEO,
ExtendedKind.SHORT_VIDEO,
ExtendedKind.VIDEO_ADDRESSABLE,
ExtendedKind.SHORT_VIDEO_ADDRESSABLE
ExtendedKind.VIDEO_ADDRESSABLE
]
/** True when `url` is any nostrarchives notes trending WebSocket feed (path `/notes/trending/...`). */

2
src/pages/secondary/NotePage/index.tsx

@ -60,7 +60,6 @@ function getEventTypeName(kind: number): string { @@ -60,7 +60,6 @@ function getEventTypeName(kind: number): string {
case ExtendedKind.VIDEO_ADDRESSABLE:
return 'Video'
case ExtendedKind.SHORT_VIDEO:
case ExtendedKind.SHORT_VIDEO_ADDRESSABLE:
return 'Short Video'
case ExtendedKind.POLL:
return 'Poll'
@ -237,7 +236,6 @@ const NotePage = forwardRef(({ id, index, hideTitlebar = false, initialEvent }: @@ -237,7 +236,6 @@ const NotePage = forwardRef(({ id, index, hideTitlebar = false, initialEvent }:
case 34235: // ExtendedKind.VIDEO_ADDRESSABLE (NIP-71)
return 'Note: Video'
case 22: // ExtendedKind.SHORT_VIDEO
case 34236: // ExtendedKind.SHORT_VIDEO_ADDRESSABLE (NIP-71)
return 'Note: Short Video'
case 11: // ExtendedKind.DISCUSSION
return 'Discussions'

14
src/services/local-storage.service.ts

@ -335,7 +335,7 @@ class LocalStorageService { @@ -335,7 +335,7 @@ class LocalStorageService {
}
}
if (showKindsVersion < 13) {
// NIP-71 addressable video (34235 / 34236): add when user already had regular video kinds enabled.
// NIP-71 addressable normal video (34235): add when user already had regular video kinds enabled.
if (
showKinds.includes(ExtendedKind.VIDEO) ||
showKinds.includes(ExtendedKind.SHORT_VIDEO)
@ -343,8 +343,14 @@ class LocalStorageService { @@ -343,8 +343,14 @@ class LocalStorageService {
if (!showKinds.includes(ExtendedKind.VIDEO_ADDRESSABLE)) {
showKinds.push(ExtendedKind.VIDEO_ADDRESSABLE)
}
if (!showKinds.includes(ExtendedKind.SHORT_VIDEO_ADDRESSABLE)) {
showKinds.push(ExtendedKind.SHORT_VIDEO_ADDRESSABLE)
}
}
if (showKindsVersion < 14) {
// Kind 34236 (NIP-71 addressable short video) removed from the app — strip from saved filters.
const deprecatedShortVideoAddressable = 34236
for (let i = showKinds.length - 1; i >= 0; i--) {
if (showKinds[i] === deprecatedShortVideoAddressable) {
showKinds.splice(i, 1)
}
}
}
@ -354,7 +360,7 @@ class LocalStorageService { @@ -354,7 +360,7 @@ class LocalStorageService {
// keys cleared), persisting would write DEFAULT_FEED_SHOW_KINDS to IndexedDB and wipe the user's
// saved filter before initAsync/applySettings runs.
this.persistSetting(StorageKey.SHOW_KINDS, JSON.stringify(this.showKinds))
this.persistSetting(StorageKey.SHOW_KINDS_VERSION, '13')
this.persistSetting(StorageKey.SHOW_KINDS_VERSION, '14')
}
// Feed filter: kind 1 OPs, kind 1 replies, kind 1111 (migrate from legacy showRepliesAndComments if set)

2
src/services/mention-event-search.service.ts

@ -147,7 +147,7 @@ const PICKER_FULLTEXT_DB_CAP = 260 @@ -147,7 +147,7 @@ const PICKER_FULLTEXT_DB_CAP = 260
/**
* Search for events: session cache IndexedDB (publication + archive + cross-store full text) relays.
* Merges and dedupes by event id, up to limit.
* @param mode - 'nevent' uses NEVENT_KINDS (incl. NIP-71 video 21/22/34235/34236), 'naddr' uses NADDR_KINDS (30023,30817,30818,30040).
* @param mode - 'nevent' uses NEVENT_KINDS (incl. NIP-71 video 21/22/34235), 'naddr' uses NADDR_KINDS (30023,30817,30818,30040).
* @param kindFilter - When set, only these kinds are searched (overrides `mode` for the kinds list).
*/
export async function searchEventsForPicker(

1
src/services/nip89.service.ts

@ -220,7 +220,6 @@ class Nip89Service { @@ -220,7 +220,6 @@ class Nip89Service {
ExtendedKind.VIDEO,
ExtendedKind.SHORT_VIDEO,
ExtendedKind.VIDEO_ADDRESSABLE,
ExtendedKind.SHORT_VIDEO_ADDRESSABLE,
ExtendedKind.POLL,
ExtendedKind.COMMENT,
ExtendedKind.VOICE,

Loading…
Cancel
Save