aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2020-11-18 12:18:24 -0500
committerGitHub <noreply@github.com>2020-11-18 12:18:24 -0500
commitf643496416c75ea468ffd866ccfee6436a3912f0 (patch)
tree902a3b987474906360544c55bd28b96f9e2bb44a /src
parent089b14788dbc0fe9a6b3a9263d5926a27c96f237 (diff)
downloadxesite-f643496416c75ea468ffd866ccfee6436a3912f0.tar.xz
xesite-f643496416c75ea468ffd866ccfee6436a3912f0.zip
various updates (#263)
* various updates * fix glory shot * fix mi url for updating my blog * fix CI
Diffstat (limited to 'src')
-rw-r--r--src/app/mod.rs16
-rw-r--r--src/main.rs26
2 files changed, 30 insertions, 12 deletions
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<String>,
- signalboost: Vec<Person>,
- port: u16,
+ pub(crate) clack_set: Vec<String>,
+ pub(crate) signalboost: Vec<Person>,
+ 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<Option<patreon::Users>> {
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);