aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2020-12-02 16:16:58 -0500
committerGitHub <noreply@github.com>2020-12-02 16:16:58 -0500
commit233ea76204ea5bc9a7d8f12816a9525b7a732bc5 (patch)
treede0ef2b37a6b8ee04f51eee3169ab29a472fa031 /src/app
parentd35f62351f800115e7f6aef7fd0791b9ac608229 (diff)
downloadxesite-233ea76204ea5bc9a7d8f12816a9525b7a732bc5.tar.xz
xesite-233ea76204ea5bc9a7d8f12816a9525b7a732bc5.zip
add webmention support (#274)
* add webmention support Signed-off-by: Christine Dodrill <me@christine.website> * add webmention integration post Signed-off-by: Christine Dodrill <me@christine.website>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/mod.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs
index c18e121..7cb0044 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -16,6 +16,8 @@ pub struct Config {
pub(crate) resume_fname: PathBuf,
#[serde(rename = "webMentionEndpoint")]
pub(crate) webmention_url: String,
+ #[serde(rename = "miToken")]
+ pub(crate) mi_token: String,
}
#[instrument]
@@ -58,6 +60,7 @@ pub struct State {
pub jf: jsonfeed::Feed,
pub sitemap: Vec<u8>,
pub patrons: Option<patreon::Users>,
+ pub mi: mi::Client,
}
pub async fn init(cfg: PathBuf) -> Result<State> {
@@ -65,9 +68,10 @@ pub async fn init(cfg: PathBuf) -> Result<State> {
let sb = cfg.signalboost.clone();
let resume = fs::read_to_string(cfg.resume_fname.clone())?;
let resume: String = markdown::render(&resume)?;
- let blog = crate::post::load("blog")?;
- let gallery = crate::post::load("gallery")?;
- let talks = crate::post::load("talks")?;
+ let mi = mi::Client::new(cfg.mi_token.clone(), crate::APPLICATION_NAME.to_string())?;
+ let blog = crate::post::load("blog", Some(&mi)).await?;
+ let gallery = crate::post::load("gallery", None).await?;
+ let talks = crate::post::load("talks", None).await?;
let mut everything: Vec<Post> = vec![];
{
@@ -122,6 +126,7 @@ pub async fn init(cfg: PathBuf) -> Result<State> {
urlwriter.end()?;
Ok(State {
+ mi: mi,
cfg: cfg,
signalboost: sb,
resume: resume,