From 1c8c3396a735bd373be417df2138607f0206b736 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sat, 2 Apr 2022 16:15:10 +0000 Subject: lib/patreon: refresh token support This should hopefully make the patrons page work consistently and no longer require me to manually update the patreon token once per month. Why didn't I do this age ago?????? Hacked up live on twitch: https://twitch.tv/princessxen Closes #442 Signed-off-by: Xe --- src/app/mod.rs | 9 +++------ src/post/mod.rs | 5 ++--- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/app/mod.rs b/src/app/mod.rs index 2c4abcd..429018c 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -9,14 +9,9 @@ pub mod poke; #[derive(Clone, Deserialize)] pub struct Config { - #[serde(rename = "clackSet")] - pub(crate) clack_set: Vec, pub(crate) signalboost: Vec, - pub(crate) port: u16, #[serde(rename = "resumeFname")] pub(crate) resume_fname: PathBuf, - #[serde(rename = "webMentionEndpoint")] - pub(crate) webmention_url: String, #[serde(rename = "miToken")] pub(crate) mi_token: String, } @@ -27,7 +22,9 @@ async fn patrons() -> Result> { let creds: Credentials = envy::prefixed("PATREON_") .from_env() .unwrap_or(Credentials::default()); - let cli = Client::new(creds); + let mut cli = Client::new(creds)?; + + cli.refresh_token().await?; match cli.campaign().await { Ok(camp) => { diff --git a/src/post/mod.rs b/src/post/mod.rs index 1cd7f92..a152bc9 100644 --- a/src/post/mod.rs +++ b/src/post/mod.rs @@ -36,7 +36,7 @@ impl Into for Post { .date_published(self.date.to_rfc3339()) .author( jsonfeed::Author::new() - .name("Christine Dodrill") + .name("Xe Iaso") .url("https://christine.website") .avatar("https://christine.website/static/img/avatar.png"), ); @@ -83,8 +83,7 @@ impl Post { async fn read_post(dir: &str, fname: PathBuf, cli: &Option) -> Result { debug!( - "loading {}/{}", - dir, + "loading {}", fname.clone().into_os_string().into_string().unwrap() ); -- cgit v1.2.3