This commit is contained in:
Felix Ableitner 2021-08-09 17:04:21 +02:00
parent f86a99b336
commit 53079c113a
3 changed files with 123 additions and 1008 deletions

1121
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -44,4 +44,4 @@ anyhow = "1.0.43"
thiserror = "1.0.26" thiserror = "1.0.26"
background-jobs = "0.9.0" background-jobs = "0.9.0"
reqwest = { version = "0.11.4", features = ["json"] } reqwest = { version = "0.11.4", features = ["json"] }
webmention = {version = "0.1.3", features = ["hyper"], default-features = false } webmention = {version = "0.3.0", git = "https://github.com/marinintim/webmention.git", branch = "feature/response" }

View file

@ -28,6 +28,7 @@ use lemmy_utils::{
LemmyError, LemmyError,
}; };
use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud}; use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
use log::warn;
use url::Url; use url::Url;
use webmention::Webmention; use webmention::Webmention;
@ -141,8 +142,11 @@ impl PerformCrud for CreatePost {
if let Some(url) = updated_post_url { if let Some(url) = updated_post_url {
let hostname = Url::parse(&Settings::get().get_protocol_and_hostname())?; let hostname = Url::parse(&Settings::get().get_protocol_and_hostname())?;
let mut webmention: Webmention = (hostname, url.clone().into_inner()).into(); let mut webmention: Webmention = (hostname, url.into_inner()).into();
webmention.send().await?; webmention.set_checked(true);
if let Err(e) = webmention.send().await {
warn!("Failed to send webmention: {}", e);
}
} }
send_post_ws_message( send_post_ws_message(