mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-06 10:41:21 +02:00
fix: build proper q-tag with relay hint and author pubkey for replies (#224)
* fix: build proper q-tag with relay hint and author pubkey for replies When sending replies in NIP-29 and NIP-C7 adapters, now build the full q-tag format per NIP-C7 spec: ["q", eventId, relayUrl, pubkey] Previously only the event ID was included, making it harder for clients to fetch the referenced event. Now: - NIP-29: includes group relay URL and author pubkey - NIP-C7: includes seen relay hint and author pubkey https://claude.ai/code/session_01Jy51Ayk57fzaFuuFFm1j1K * chore: remove unused NIP-C7 adapter The NIP-C7 adapter was already disabled/commented out everywhere. Removing the file to reduce dead code. https://claude.ai/code/session_01Jy51Ayk57fzaFuuFFm1j1K * chore: remove NIP-C7 references from docs and code - Remove nip-c7 from ChatProtocol type - Remove commented NIP-C7 adapter imports and switch cases - Update comments to reference NIP-29 instead of NIP-C7 - Update kind 9 renderer docs to reference NIP-29 - Clean up chat-parser docs and error messages https://claude.ai/code/session_01Jy51Ayk57fzaFuuFFm1j1K --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,6 @@ import type {
|
||||
LiveActivityMetadata,
|
||||
} from "@/types/chat";
|
||||
import { CHAT_KINDS } from "@/types/chat";
|
||||
// import { NipC7Adapter } from "@/lib/chat/adapters/nip-c7-adapter"; // Coming soon
|
||||
import { Nip10Adapter } from "@/lib/chat/adapters/nip-10-adapter";
|
||||
import { Nip29Adapter } from "@/lib/chat/adapters/nip-29-adapter";
|
||||
import { Nip53Adapter } from "@/lib/chat/adapters/nip-53-adapter";
|
||||
@@ -1243,8 +1242,6 @@ function getAdapter(protocol: ChatProtocol): ChatProtocolAdapter {
|
||||
switch (protocol) {
|
||||
case "nip-10":
|
||||
return new Nip10Adapter();
|
||||
// case "nip-c7": // Phase 1 - Simple chat (coming soon)
|
||||
// return new NipC7Adapter();
|
||||
case "nip-29":
|
||||
return new Nip29Adapter();
|
||||
// case "nip-17": // Phase 2 - Encrypted DMs (coming soon)
|
||||
|
||||
@@ -24,7 +24,6 @@ import { getEventDisplayTitle } from "@/lib/event-title";
|
||||
import { UserName } from "./nostr/UserName";
|
||||
import { getTagValues } from "@/lib/nostr-utils";
|
||||
import { getSemanticAuthor } from "@/lib/semantic-author";
|
||||
// import { NipC7Adapter } from "@/lib/chat/adapters/nip-c7-adapter"; // Coming soon
|
||||
import { Nip29Adapter } from "@/lib/chat/adapters/nip-29-adapter";
|
||||
import type { ChatProtocol, ProtocolIdentifier } from "@/types/chat";
|
||||
import { useState, useEffect } from "react";
|
||||
@@ -742,8 +741,6 @@ function useDynamicTitle(window: WindowInstance): WindowTitleData {
|
||||
// Currently only NIP-29 is supported
|
||||
const getAdapter = () => {
|
||||
switch (protocol) {
|
||||
// case "nip-c7": // Coming soon
|
||||
// return new NipC7Adapter();
|
||||
case "nip-29":
|
||||
return new Nip29Adapter();
|
||||
default:
|
||||
|
||||
@@ -9,13 +9,13 @@ import { isValidHexEventId } from "@/lib/nostr-validation";
|
||||
import { InlineReplySkeleton } from "@/components/ui/skeleton";
|
||||
|
||||
/**
|
||||
* Renderer for Kind 9 - Chat Message (NIP-C7)
|
||||
* Renderer for Kind 9 - Chat Message (NIP-29)
|
||||
* Displays chat messages with optional quoted parent message
|
||||
*/
|
||||
export function Kind9Renderer({ event, depth = 0 }: BaseEventProps) {
|
||||
const { addWindow } = useGrimoire();
|
||||
|
||||
// Parse 'q' tag for quoted parent message (NIP-C7 reply format)
|
||||
// Parse 'q' tag for quoted parent message
|
||||
const quotedEventIds = getTagValues(event, "q");
|
||||
const quotedEventId = quotedEventIds[0]; // First q tag
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ const kindRenderers: Record<number, React.ComponentType<BaseEventProps>> = {
|
||||
6: RepostRenderer, // Repost
|
||||
7: Kind7Renderer, // Reaction
|
||||
8: BadgeAwardRenderer, // Badge Award (NIP-58)
|
||||
9: Kind9Renderer, // Chat Message (NIP-C7)
|
||||
9: Kind9Renderer, // Chat Message (NIP-29)
|
||||
11: Kind1Renderer, // Public Thread Reply (NIP-10)
|
||||
16: RepostRenderer, // Generic Repost
|
||||
17: Kind7Renderer, // Reaction (NIP-25)
|
||||
|
||||
Reference in New Issue
Block a user