diff --git a/radicle-httpd/Cargo.toml b/radicle-httpd/Cargo.toml index 881784d33..762670e8c 100644 --- a/radicle-httpd/Cargo.toml +++ b/radicle-httpd/Cargo.toml @@ -19,6 +19,7 @@ anyhow = { version = "1" } axum = { version = "0.6.7", default-features = false, features = ["headers", "json", "query", "tokio"] } axum-auth = { version= "0.4.0", default-features = false, features = ["auth-bearer"] } axum-server = { version = "0.5.1", default-features = false } +base64 = "0.21.3" chrono = { version = "0.4.22", default-features = false, features = ["clock"] } fastrand = { version = "2.0.0" } flate2 = { version = "1" } diff --git a/radicle-httpd/src/api.rs b/radicle-httpd/src/api.rs index 0d7bb5de1..037b14ecb 100644 --- a/radicle-httpd/src/api.rs +++ b/radicle-httpd/src/api.rs @@ -127,6 +127,12 @@ pub struct PaginationQuery { pub per_page: Option, } +#[derive(Serialize, Deserialize, Clone)] +#[serde(rename_all = "camelCase")] +pub struct RawQuery { + pub mime: Option, +} + #[derive(Serialize, Deserialize, Clone)] #[serde(rename_all = "camelCase")] pub struct CobsQuery { diff --git a/radicle-httpd/src/api/json.rs b/radicle-httpd/src/api/json.rs index d97bc3e28..da1469d0d 100644 --- a/radicle-httpd/src/api/json.rs +++ b/radicle-httpd/src/api/json.rs @@ -12,7 +12,7 @@ use radicle::cob::patch::Review; use radicle::cob::patch::{Patch, PatchId}; use radicle::cob::thread; use radicle::cob::thread::CommentId; -use radicle::cob::{ActorId, Author, Reaction, Timestamp}; +use radicle::cob::{ActorId, Author, Embed, Reaction, Timestamp, Uri}; use radicle::git::RefString; use radicle::node::{Alias, AliasStore}; use radicle::prelude::NodeId; @@ -241,6 +241,7 @@ struct Comment<'a> { id: CommentId, author: Value, body: &'a str, + embeds: Vec>, reactions: Vec<(&'a ActorId, &'a Reaction)>, #[serde(with = "radicle::serde_ext::localtime::time")] timestamp: Timestamp, @@ -254,6 +255,7 @@ impl<'a> Comment<'a> { id: *id, author: author(&comment_author, aliases.alias(comment_author.id())), body: comment.body(), + embeds: comment.embeds().to_vec(), reactions: comment.reactions().collect::>(), timestamp: comment.timestamp(), reply_to: comment.reply_to(), diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index 2773db7ce..f9eb37d65 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -7,13 +7,14 @@ use axum::response::IntoResponse; use axum::routing::{get, patch, post}; use axum::{Json, Router}; use axum_auth::AuthBearer; +use base64::prelude::{Engine, BASE64_STANDARD}; use hyper::StatusCode; use radicle_surf::blob::{Blob, BlobRef}; use serde::{Deserialize, Serialize}; use serde_json::json; use tower_http::set_header::SetResponseHeaderLayer; -use radicle::cob::{issue, patch, Label}; +use radicle::cob::{issue, patch, Embed, Label, Uri}; use radicle::identity::{Did, Id}; use radicle::node::routing::Store; use radicle::node::AliasStore; @@ -511,6 +512,7 @@ pub struct IssueCreate { pub description: String, pub labels: Vec