Browse Source

remove redundant alt client tag

imwald
Silberengel 3 weeks ago
parent
commit
1abd3d51b6
  1. 3
      src/components/PostEditor/PostTextarea/Preview.tsx
  2. 12
      src/lib/draft-event.ts

3
src/components/PostEditor/PostTextarea/Preview.tsx

@ -2,7 +2,6 @@ import ClientTag from '@/components/ClientTag' @@ -2,7 +2,6 @@ import ClientTag from '@/components/ClientTag'
import { Card } from '@/components/ui/card'
import { ExtendedKind, POLL_TYPE } from '@/constants'
import {
buildAltTag,
buildClientTag,
stripImwaldAttributionTags,
transformCustomEmojisInContent
@ -164,7 +163,7 @@ export default function Preview({ @@ -164,7 +163,7 @@ export default function Preview({
}
const stripped = stripImwaldAttributionTags(tags)
if (addClientTag) {
stripped.push(buildClientTag(), buildAltTag())
stripped.push(buildClientTag())
}
return stripped
}, [emojiTags, highlightTags, pollTags, mediaImetaTags, articleMetadata, kind, extraPreviewTags, addClientTag])

12
src/lib/draft-event.ts

@ -1405,12 +1405,8 @@ export function buildClientTag(handlerPubkey?: string, handlerIdentifier?: strin @@ -1405,12 +1405,8 @@ export function buildClientTag(handlerPubkey?: string, handlerIdentifier?: strin
return ['client', 'imwald']
}
/** Canonical `alt` we attach for Imwald / jumble.imwald.eu publishing attribution (NIP-31). */
export const IMWALD_ATTRIBUTION_ALT_TEXT = 'This event was published by https://jumble.imwald.eu.'
export function buildAltTag(): string[] {
return ['alt', IMWALD_ATTRIBUTION_ALT_TEXT]
}
/** Canonical `alt` text used in legacy Jumble/Imwald attribution tags (kept for stripping old events). */
const IMWALD_ATTRIBUTION_ALT_TEXT = 'This event was published by https://jumble.imwald.eu.'
/**
* True for `alt` tags that are *our* app attribution (current or legacy Jumble/Imwald wording).
@ -1445,7 +1441,7 @@ export function stripImwaldAttributionTags(tags: string[][]): string[][] { @@ -1445,7 +1441,7 @@ export function stripImwaldAttributionTags(tags: string[][]): string[][] {
/**
* Before sign/publish: strip all `client` tags and Imwald/Jumble attribution `alt` tags, then
* append exactly one {@link buildClientTag} + {@link buildAltTag} when `addClientTag !== false`.
* append exactly one {@link buildClientTag} when `addClientTag !== false`.
*/
export function applyImwaldAttributionTags(
draftEvent: TDraftEvent,
@ -1456,7 +1452,7 @@ export function applyImwaldAttributionTags( @@ -1456,7 +1452,7 @@ export function applyImwaldAttributionTags(
const sanitizedTags = stripImwaldAttributionTags(existingTags)
const shouldAdd = options?.addClientTag !== false
if (shouldAdd) {
draft.tags = [...sanitizedTags, buildClientTag(), buildAltTag()]
draft.tags = [...sanitizedTags, buildClientTag()]
} else {
draft.tags = [...sanitizedTags]
}

Loading…
Cancel
Save