diff options
| author | Xe Iaso <me@christine.website> | 2022-04-02 16:15:10 +0000 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-04-02 16:15:10 +0000 |
| commit | 1c8c3396a735bd373be417df2138607f0206b736 (patch) | |
| tree | 040c7807317b5286a01960a638fef9bb4e5ff9d1 /src | |
| parent | 0c0c5875e680ba5b76d79daddda0eed8d13e0726 (diff) | |
| download | xesite-1c8c3396a735bd373be417df2138607f0206b736.tar.xz xesite-1c8c3396a735bd373be417df2138607f0206b736.zip | |
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 <me@christine.website>
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/mod.rs | 9 | ||||
| -rw-r--r-- | src/post/mod.rs | 5 |
2 files changed, 5 insertions, 9 deletions
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<String>, pub(crate) signalboost: Vec<Person>, - 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<Option<patreon::Users>> { 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<jsonfeed::Item> 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<mi::Client>) -> Result<Post> { debug!( - "loading {}/{}", - dir, + "loading {}", fname.clone().into_os_string().into_string().unwrap() ); |
