forked from cadey/xesite
fix better????
Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
parent
ea8e1e045a
commit
6b771b5503
|
@ -125,14 +125,16 @@ pub struct Links {
|
|||
|
||||
impl Client {
|
||||
pub fn new() -> Result<Self> {
|
||||
let mut creds = Credentials::default();
|
||||
|
||||
let p = Path::new(".patreon.json");
|
||||
let config = fs::read_to_string(p)?;
|
||||
let creds: Credentials = serde_json::from_str(&config)?;
|
||||
creds = serde_json::from_str(&config)?;
|
||||
|
||||
Ok(Self {
|
||||
cli: reqwest::Client::new(),
|
||||
base_url: "https://api.patreon.com".into(),
|
||||
creds,
|
||||
creds: creds,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
use crate::{post::Post, signalboost::Person};
|
||||
use color_eyre::eyre::Result;
|
||||
use serde::Deserialize;
|
||||
use std::{fs, path::PathBuf};
|
||||
use std::{
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use tracing::{error, instrument};
|
||||
|
||||
pub mod markdown;
|
||||
|
@ -18,6 +21,12 @@ pub struct Config {
|
|||
|
||||
#[instrument]
|
||||
async fn patrons() -> Result<Option<patreon::Users>> {
|
||||
let p = Path::new(".patreon.json");
|
||||
if !p.exists() {
|
||||
info!("{:?} does not exist", p);
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let mut cli = patreon::Client::new()?;
|
||||
|
||||
if let Err(why) = cli.refresh_token().await {
|
||||
|
|
Loading…
Reference in New Issue