Skip to content
23 changes: 15 additions & 8 deletions crates/buzz-acp/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4989,14 +4989,21 @@ pub(crate) async fn post_failure_notice(
parent_event_id: parent_id,
})
});
let builder =
match buzz_sdk::build_message(channel_id, content, thread_ref.as_ref(), &[], false, &[]) {
Ok(b) => b,
Err(e) => {
tracing::warn!(channel = %channel_id, "failure notice: build failed: {e}");
return;
}
};
let builder = match buzz_sdk::build_message(
channel_id,
content,
thread_ref.as_ref(),
&[],
false,
&[],
&[],
) {
Ok(b) => b,
Err(e) => {
tracing::warn!(channel = %channel_id, "failure notice: build failed: {e}");
return;
}
};
let event = match builder.sign_with_keys(&rest.keys) {
Ok(e) => e,
Err(e) => {
Expand Down
1 change: 1 addition & 0 deletions crates/buzz-acp/src/setup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ async fn publish_setup_nudge(
&[recipient_hex], // p-tag the verified effective asker
false,
&[],
&[],
)
.map_err(|e| anyhow::anyhow!("failed to build setup nudge: {e}"))?;

Expand Down
13 changes: 13 additions & 0 deletions crates/buzz-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ buzz channels topic --channel <uuid> --topic "New topic"
buzz reactions add --event <event-id> --emoji "👍"
buzz reactions get --event <event-id>

# GIFs (requires relay to advertise buzz-gif / KLIPY)
buzz gifs search # trending GIFs
buzz gifs search --query "celebration" # search GIFs
buzz gifs share --slug <slug> # report selection to provider Recents
# Paste the `cdn_url` from a search result directly into messages send --content

# Custom emoji in messages
# buzz messages send scans outgoing content for :shortcode: patterns and
# automatically attaches NIP-30 ["emoji", shortcode, url] tags from the
# workspace palette — identical to the desktop composer behavior.

# Users & Presence
buzz users get # your own profile
buzz users get --pubkey <hex> # single user
Expand Down Expand Up @@ -130,6 +141,8 @@ stored rules in `validation_error` so an owner can remove and repair them.
| `reactions` | `add` | React to a message |
| | `remove` | Remove a reaction |
| | `get` | List reactions |
| `gifs` | `search` | Search or browse trending GIFs (requires relay buzz-gif support) |
| | `share` | Report a selected GIF to the provider's Recents |
| `dms` | `list` | List DM conversations |
| | `open` | Open a DM (1–8 pubkeys) |
| | `add-member` | Add member to DM group |
Expand Down
41 changes: 41 additions & 0 deletions crates/buzz-cli/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,47 @@ impl BuzzClient {
.await
}

/// POST a JSON body to a relay-relative path with NIP-98 authentication.
///
/// Used by `buzz gifs search` and `buzz gifs share` to reach the relay's
/// KLIPY proxy endpoints. Returns the raw response body as a string (may
/// be empty for 204 No Content responses).
pub async fn post_json_authed(
&self,
path: &str,
body: &serde_json::Value,
) -> Result<String, CliError> {
let url = format!("{}{path}", self.relay_url);
let body_bytes = bytes::Bytes::from(
serde_json::to_vec(body)
.map_err(|e| CliError::Other(format!("request serialization failed: {e}")))?,
);
self.with_retry_body(|| {
let body_bytes = body_bytes.clone();
let url = url.clone();
async move {
let auth = sign_nip98(&self.keys, "POST", &url, Some(&body_bytes))?;
let resp = self
.with_auth_tag(
self.http
.post(&url)
.header("Authorization", auth)
.header("Content-Type", "application/json")
.body(body_bytes),
)
.send()
.await?;
// 204 No Content: return empty string rather than failing on
// an empty body that cannot be parsed as JSON.
if resp.status() == reqwest::StatusCode::NO_CONTENT {
return Ok(String::new());
}
self.handle_response(resp).await
}
})
.await
}

/// Submit a signed Nostr event via POST /events.
///
/// For non-idempotent moderation command kinds (9040–9044), an ambiguous
Expand Down
Loading
Loading