feat: nixos side of the config #45
1 changed files with 10 additions and 7 deletions
|
@ -122,12 +122,12 @@ struct WolvesResultUser {
|
|||
requested: String,
|
||||
approved: String,
|
||||
sitename: String,
|
||||
domain: String
|
||||
domain: String,
|
||||
}
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
struct WolvesResult {
|
||||
success: i8,
|
||||
result: Vec<WolvesResultUser>
|
||||
result: Vec<WolvesResultUser>,
|
||||
}
|
||||
|
||||
async fn get_wolves(config: &Config) -> Vec<AccountWolves> {
|
||||
|
@ -137,23 +137,26 @@ async fn get_wolves(config: &Config) -> Vec<AccountWolves> {
|
|||
if config.wolves_url.is_empty() {
|
||||
return vec![];
|
||||
}
|
||||
|
||||
|
||||
// get wolves data
|
||||
let uri = &config.wolves_url;
|
||||
let mut res = surf::post(uri).header("X-AM-Identity", &config.wolves_key).await.unwrap();
|
||||
|
||||
if let Ok(WolvesResult { success, result }) = res.body_json().await {
|
||||
|
||||
if let Ok(WolvesResult {
|
||||
success,
|
||||
result,
|
||||
}) = res.body_json().await
|
||||
{
|
||||
if success != 1 {
|
||||
return vec![];
|
||||
}
|
||||
|
||||
return result.iter().map(|wolves| AccountWolves::from(wolves) ).collect::<Vec<AccountWolves>>();
|
||||
return result.iter().map(AccountWolves::from).collect::<Vec<AccountWolves>>();
|
||||
}
|
||||
|
||||
vec![]
|
||||
}
|
||||
|
||||
|
||||
async fn update_account(db: &Pool<Sqlite>, account: &AccountWolves) {
|
||||
sqlx::query_as::<_, AccountWolves>(
|
||||
"
|
||||
|
|
Loading…
Reference in a new issue