Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcccd14c82 | ||
|
|
eefca43a7b | ||
|
|
7816ab57cf |
3 changed files with 24 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "activitypub_federation"
|
name = "activitypub_federation"
|
||||||
version = "0.4.5"
|
version = "0.4.7"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "High-level Activitypub framework"
|
description = "High-level Activitypub framework"
|
||||||
keywords = ["activitypub", "activitystreams", "federation", "fediverse"]
|
keywords = ["activitypub", "activitystreams", "federation", "fediverse"]
|
||||||
|
|
|
||||||
|
|
@ -165,13 +165,14 @@ pub fn build_webfinger_response_with_type(
|
||||||
rel: Some("http://webfinger.net/rel/profile-page".to_string()),
|
rel: Some("http://webfinger.net/rel/profile-page".to_string()),
|
||||||
kind: Some("text/html".to_string()),
|
kind: Some("text/html".to_string()),
|
||||||
href: Some(url.clone()),
|
href: Some(url.clone()),
|
||||||
properties: Default::default(),
|
..Default::default()
|
||||||
},
|
},
|
||||||
WebfingerLink {
|
WebfingerLink {
|
||||||
rel: Some("self".to_string()),
|
rel: Some("self".to_string()),
|
||||||
kind: Some(FEDERATION_CONTENT_TYPE.to_string()),
|
kind: Some(FEDERATION_CONTENT_TYPE.to_string()),
|
||||||
href: Some(url.clone()),
|
href: Some(url.clone()),
|
||||||
properties,
|
properties,
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
acc.append(&mut links);
|
acc.append(&mut links);
|
||||||
|
|
@ -207,6 +208,8 @@ pub struct WebfingerLink {
|
||||||
pub kind: Option<String>,
|
pub kind: Option<String>,
|
||||||
/// Url pointing to the target resource
|
/// Url pointing to the target resource
|
||||||
pub href: Option<Url>,
|
pub href: Option<Url>,
|
||||||
|
/// Used for remote follow external interaction url
|
||||||
|
pub template: Option<String>,
|
||||||
/// Additional data about the link
|
/// Additional data about the link
|
||||||
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
|
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
|
||||||
pub properties: HashMap<Url, String>,
|
pub properties: HashMap<Url, String>,
|
||||||
|
|
|
||||||
|
|
@ -115,3 +115,22 @@ where
|
||||||
let inner = T::deserialize(value).unwrap_or_default();
|
let inner = T::deserialize(value).unwrap_or_default();
|
||||||
Ok(inner)
|
Ok(inner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn deserialize_one_multiple_values() {
|
||||||
|
use crate::protocol::helpers::deserialize_one;
|
||||||
|
use url::Url;
|
||||||
|
#[derive(serde::Deserialize)]
|
||||||
|
struct Note {
|
||||||
|
#[serde(deserialize_with = "deserialize_one")]
|
||||||
|
_to: Url,
|
||||||
|
}
|
||||||
|
|
||||||
|
let note = serde_json::from_str::<Note>(
|
||||||
|
r#"{"_to": ["https://example.com/u/alice", "https://example.com/u/bob"] }"#,
|
||||||
|
);
|
||||||
|
assert!(note.is_err());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue