diff options
| author | Xe Iaso <me@christine.website> | 2022-05-18 20:17:48 -0400 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-05-18 20:17:48 -0400 |
| commit | e2b9f384bf4033eddf321b5b5020ac4847609b37 (patch) | |
| tree | a7d0b57c91821d29fa1d34f80599d5eca7e517dd /lib | |
| parent | 0e22f4c224401d10bc1097aeaf9ec4722d1f3e5e (diff) | |
| download | xesite-e2b9f384bf4033eddf321b5b5020ac4847609b37.tar.xz xesite-e2b9f384bf4033eddf321b5b5020ac4847609b37.zip | |
look for patreon creds in ~ instead of .
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/patreon/Cargo.toml | 1 | ||||
| -rw-r--r-- | lib/patreon/src/lib.rs | 9 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/patreon/Cargo.toml b/lib/patreon/Cargo.toml index e5907b1..fe6d40c 100644 --- a/lib/patreon/Cargo.toml +++ b/lib/patreon/Cargo.toml @@ -8,6 +8,7 @@ edition = "2018" [dependencies] chrono = { version = "0.4", features = ["serde"] } +dirs = "4" reqwest = { version = "0.11", features = ["json"] } serde_json = "1.0" serde = { version = "1", features = ["derive"] } diff --git a/lib/patreon/src/lib.rs b/lib/patreon/src/lib.rs index a2fa63d..4072c94 100644 --- a/lib/patreon/src/lib.rs +++ b/lib/patreon/src/lib.rs @@ -125,16 +125,15 @@ pub struct Links { impl Client { pub fn new() -> Result<Self> { - let mut creds = Credentials::default(); - - let p = Path::new(".patreon.json"); + let mut p = dirs::home_dir().unwrap_or(".".into()); + p.push(".patreon.json"); let config = fs::read_to_string(p)?; - creds = serde_json::from_str(&config)?; + let creds = serde_json::from_str(&config)?; Ok(Self { cli: reqwest::Client::new(), base_url: "https://api.patreon.com".into(), - creds: creds, + creds, }) } |
