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