diff options
author | Vika <vika@fireburn.ru> | 2021-05-06 18:06:59 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2021-05-06 18:06:59 +0300 |
commit | 8e4c7f215f11a3735bcf6f8944e13c1aa86d8101 (patch) | |
tree | 22bd28732398c7f53e5bee2f95079cd8c7a7f750 /src/micropub | |
parent | 3b96490a0ac57590396f4ae72d61311052659071 (diff) | |
download | kittybox-8e4c7f215f11a3735bcf6f8944e13c1aa86d8101.tar.zst |
Add a note about a possible optimization once the MF2 parser is ready
Diffstat (limited to 'src/micropub')
-rw-r--r-- | src/micropub/post.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/micropub/post.rs b/src/micropub/post.rs index 4d208c2..9edde54 100644 --- a/src/micropub/post.rs +++ b/src/micropub/post.rs @@ -330,6 +330,9 @@ async fn post_process_new_post<S: Storage>(req: Request<ApplicationState<S>>, po let source = &uid; stream::iter(posts_with_bodies.into_iter()) .filter_map(|(url, body): (surf::Url, String)| async move { + // TODO: Replace this function once the MF2 parser is ready + // A compliant parser's output format includes rels, + // we could just find a Webmention one in there let pattern = easy_scraper::Pattern::new(r#"<link href="{url}" rel="webmention">"#).expect("Pattern for webmentions couldn't be parsed"); let endpoint = &pattern.matches(&body)[0]["url"]; if let Ok(endpoint) = url.join(endpoint) { Some((url, endpoint)) } else { None } |