mirror of
https://github.com/mii443/vrchatapi-rust.git
synced 2025-09-04 08:09:30 +00:00
Scope password stricter and less mut
This commit is contained in:
@ -30,11 +30,17 @@ const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|||||||
async fn main() -> Result<(), anyhow::Error> {
|
async fn main() -> Result<(), anyhow::Error> {
|
||||||
dotenv::dotenv().map_err(|e|Error::DotenvInitError(e))?;
|
dotenv::dotenv().map_err(|e|Error::DotenvInitError(e))?;
|
||||||
let username = dotenv::var("USERNAME").map_err(|e|Error::NoUsername(e))?;
|
let username = dotenv::var("USERNAME").map_err(|e|Error::NoUsername(e))?;
|
||||||
|
|
||||||
|
let client = {
|
||||||
let password = dotenv::var("PASSWORD").map_err(|e|Error::NoPassword(e))?;
|
let password = dotenv::var("PASSWORD").map_err(|e|Error::NoPassword(e))?;
|
||||||
|
|
||||||
let mut client = vrchatapi::apis::configuration::Configuration::default();
|
let mut client = vrchatapi::apis::configuration::Configuration::default();
|
||||||
client.user_agent = Some(format!("vrchatapi-rust@{VERSION} https://github.com/vrchatapi/vrchatapi-rust/issues/new"));
|
client.user_agent = Some(format!("vrchatapi-rust@{VERSION} https://github.com/vrchatapi/vrchatapi-rust/issues/new"));
|
||||||
client.basic_auth = Some((username.clone(), Some(password)));
|
client.basic_auth = Some((username.clone(), Some(password)));
|
||||||
|
|
||||||
|
client
|
||||||
|
};
|
||||||
|
|
||||||
let u = login(&client, &username).await?;
|
let u = login(&client, &username).await?;
|
||||||
|
|
||||||
logout(&client).await?;
|
logout(&client).await?;
|
||||||
|
Reference in New Issue
Block a user