From f643496416c75ea468ffd866ccfee6436a3912f0 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Wed, 18 Nov 2020 12:18:24 -0500 Subject: various updates (#263) * various updates * fix glory shot * fix mi url for updating my blog * fix CI --- src/app/mod.rs | 16 ++++++++++------ src/main.rs | 26 ++++++++++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/app/mod.rs b/src/app/mod.rs index 035db07..c18e121 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -2,24 +2,28 @@ use crate::{post::Post, signalboost::Person}; use color_eyre::eyre::Result; use serde::Deserialize; use std::{fs, path::PathBuf}; -use tracing::{instrument, error}; +use tracing::{error, instrument}; pub mod markdown; #[derive(Clone, Deserialize)] pub struct Config { #[serde(rename = "clackSet")] - clack_set: Vec, - signalboost: Vec, - port: u16, + pub(crate) clack_set: Vec, + pub(crate) signalboost: Vec, + pub(crate) port: u16, #[serde(rename = "resumeFname")] - resume_fname: PathBuf, + pub(crate) resume_fname: PathBuf, + #[serde(rename = "webMentionEndpoint")] + pub(crate) webmention_url: String, } #[instrument] async fn patrons() -> Result> { use patreon::*; - let creds: Credentials = envy::prefixed("PATREON_").from_env().unwrap_or(Credentials::default()); + let creds: Credentials = envy::prefixed("PATREON_") + .from_env() + .unwrap_or(Credentials::default()); let cli = Client::new(creds); match cli.campaign().await { diff --git a/src/main.rs b/src/main.rs index 01333c9..0baaeef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,12 +26,15 @@ async fn main() -> Result<()> { tracing_subscriber::fmt::init(); log::info!("starting up commit {}", env!("GITHUB_SHA")); - let state = Arc::new(app::init( - std::env::var("CONFIG_FNAME") - .unwrap_or("./config.dhall".into()) - .as_str() - .into(), - ).await?); + let state = Arc::new( + app::init( + std::env::var("CONFIG_FNAME") + .unwrap_or("./config.dhall".into()) + .as_str() + .into(), + ) + .await?, + ); let healthcheck = warp::get().and(warp::path(".within").and(warp::path("health")).map(|| "OK")); @@ -144,6 +147,17 @@ async fn main() -> Result<()> { ) }) .map(|reply| warp::reply::with_header(reply, "X-Clacks-Overhead", "GNU Ashlynn")) + .map(|reply| { + warp::reply::with_header( + reply, + "Link", + format!( + r#"<{}>; rel="webmention""#, + std::env::var("WEBMENTION_URL") + .unwrap_or("https://mi.within.website/api/webmention/accept".to_string()) + ), + ) + }) .with(warp::log(APPLICATION_NAME)) .recover(handlers::rejection); -- cgit v1.2.3