Browse Source

bug-fixes

master
Silberengel 4 weeks ago
parent
commit
432ca405d3
  1. 11
      src/lib/components/write/CreateEventForm.svelte
  2. 3
      src/lib/types/kind-metadata.ts

11
src/lib/components/write/CreateEventForm.svelte

@ -182,8 +182,6 @@
); );
const kindMetadata = $derived(getKindMetadata(effectiveKind)); const kindMetadata = $derived(getKindMetadata(effectiveKind));
const helpText = $derived(kindMetadata.helpText); const helpText = $derived(kindMetadata.helpText);
const isKind30040 = $derived(selectedKind === 30040);
const isKind10895 = $derived(selectedKind === 10895);
// Clear content for metadata-only kinds (but preserve content when cloning/editing) // Clear content for metadata-only kinds (but preserve content when cloning/editing)
$effect(() => { $effect(() => {
@ -361,12 +359,17 @@
const { processNostrLinks } = await import('../../utils/nostr-link-processor.js'); const { processNostrLinks } = await import('../../utils/nostr-link-processor.js');
const processedContent = processNostrLinks(contentWithUrls.trim()); const processedContent = processNostrLinks(contentWithUrls.trim());
// Repo announcements (kind 30617) must have empty content per NIP-34
const finalContent = (effectiveKind === 30617 || effectiveKind === KIND.REPO_ANNOUNCEMENT)
? ''
: processedContent;
const eventTemplate: Omit<NostrEvent, 'sig' | 'id'> = { const eventTemplate: Omit<NostrEvent, 'sig' | 'id'> = {
kind: effectiveKind, kind: effectiveKind,
pubkey: session.pubkey, pubkey: session.pubkey,
created_at: Math.floor(Date.now() / 1000), created_at: Math.floor(Date.now() / 1000),
tags: allTags, tags: allTags,
content: processedContent content: finalContent
}; };
const signedEvent = await session.signer(eventTemplate); const signedEvent = await session.signer(eventTemplate);
@ -625,7 +628,7 @@
{/if} {/if}
</div> </div>
{#if !isKind30040 && !isKind10895} {#if kindMetadata.requiresContent !== false}
<div class="form-group"> <div class="form-group">
<div class="content-header"> <div class="content-header">
<label for="content-textarea" class="form-label">Content</label> <label for="content-textarea" class="form-label">Content</label>

3
src/lib/types/kind-metadata.ts

@ -923,8 +923,9 @@ export const KIND_METADATA: Record<number, KindMetadata> = {
[KIND.REPO_ANNOUNCEMENT]: { [KIND.REPO_ANNOUNCEMENT]: {
...KIND_LOOKUP[KIND.REPO_ANNOUNCEMENT], ...KIND_LOOKUP[KIND.REPO_ANNOUNCEMENT],
writable: true, writable: true,
requiresContent: false,
helpText: { helpText: {
description: 'Repository Announcement (NIP-34/GRASP). Announces a Git repository. Content contains repository description.', description: 'Repository Announcement (NIP-34). Announces a Git repository. Content must be empty. Use the description tag for repository description.',
suggestedTags: ['d (repository identifier)', 'name (repository name)', 'description', 'clone (git clone URL)', 'web (repository URL)', 'relays (relay URLs)', 'maintainers (pubkey list)', 'image (profile image URL)', 'banner (banner image URL)', 'primary (mark as primary repo)', 'documentation (naddr or kind:pubkey:d-tag format, optional relay)'] suggestedTags: ['d (repository identifier)', 'name (repository name)', 'description', 'clone (git clone URL)', 'web (repository URL)', 'relays (relay URLs)', 'maintainers (pubkey list)', 'image (profile image URL)', 'banner (banner image URL)', 'primary (mark as primary repo)', 'documentation (naddr or kind:pubkey:d-tag format, optional relay)']
}, },
exampleJSON: (pubkey, eventId, relay, timestamp) => ({ exampleJSON: (pubkey, eventId, relay, timestamp) => ({

Loading…
Cancel
Save