mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
fix: mcp and desktop communication (#18)
This commit is contained in:
@@ -464,17 +464,24 @@ impl SproutMcpServer {
|
||||
|
||||
let channel_tag = match nostr::Tag::parse(&["channel", &p.channel_id]) {
|
||||
Ok(t) => t,
|
||||
Err(e) => return format!("Error building tag: {e}"),
|
||||
Err(e) => return format!("Error building channel tag: {e}"),
|
||||
};
|
||||
let event_ref_tag = match nostr::Tag::parse(&["e", &p.channel_id]) {
|
||||
Ok(t) => t,
|
||||
Err(e) => return format!("Error building event-ref tag: {e}"),
|
||||
};
|
||||
|
||||
let keys = self.client.keys().clone();
|
||||
let event =
|
||||
match nostr::EventBuilder::new(nostr::Kind::Custom(kind), &p.content, [channel_tag])
|
||||
.sign_with_keys(&keys)
|
||||
{
|
||||
Ok(e) => e,
|
||||
Err(e) => return format!("Error signing event: {e}"),
|
||||
};
|
||||
let event = match nostr::EventBuilder::new(
|
||||
nostr::Kind::Custom(kind),
|
||||
&p.content,
|
||||
[channel_tag, event_ref_tag],
|
||||
)
|
||||
.sign_with_keys(&keys)
|
||||
{
|
||||
Ok(e) => e,
|
||||
Err(e) => return format!("Error signing event: {e}"),
|
||||
};
|
||||
|
||||
match self.client.send_event(event).await {
|
||||
Ok(ok) if ok.accepted => format!("Message sent. Event ID: {}", ok.event_id),
|
||||
|
||||
@@ -167,7 +167,6 @@ export function AppShell() {
|
||||
: "No channel selected"
|
||||
}
|
||||
isLoading={messagesQuery.isLoading}
|
||||
key={activeChannel?.id ?? "no-channel"}
|
||||
messages={timelineMessages}
|
||||
/>
|
||||
<MessageComposer
|
||||
@@ -178,7 +177,6 @@ export function AppShell() {
|
||||
sendMessageMutation.isPending
|
||||
}
|
||||
isSending={sendMessageMutation.isPending}
|
||||
key={activeChannel?.id ?? "no-channel"}
|
||||
onSend={async (content) => {
|
||||
await sendMessageMutation.mutateAsync(content);
|
||||
}}
|
||||
|
||||
@@ -35,7 +35,10 @@ function createOptimisticMessage(
|
||||
pubkey: identity.pubkey,
|
||||
created_at: Math.floor(Date.now() / 1_000),
|
||||
kind: 4_0001,
|
||||
tags: [["e", channelId]],
|
||||
tags: [
|
||||
["channel", channelId],
|
||||
["e", channelId],
|
||||
],
|
||||
content,
|
||||
sig: "",
|
||||
pending: true,
|
||||
|
||||
@@ -122,7 +122,13 @@ class RelayClient {
|
||||
const event = await signRelayEvent({
|
||||
kind: 40001,
|
||||
content: content.trim(),
|
||||
tags: [["e", channelId]],
|
||||
// Include both tags for now:
|
||||
// - `channel` lets the relay persist and authorize the event as channel-scoped
|
||||
// - `e` keeps the existing desktop WebSocket history/subscription filters working
|
||||
tags: [
|
||||
["channel", channelId],
|
||||
["e", channelId],
|
||||
],
|
||||
});
|
||||
|
||||
return new Promise<RelayEvent>((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user