update & remove some unused stuff

This commit is contained in:
2026-01-25 12:48:09 +01:00
parent ea7296c449
commit 2ed6cd3c06
9 changed files with 962 additions and 1014 deletions

View File

@@ -2,9 +2,8 @@ use std::collections::HashMap;
use std::fmt::{Debug, Formatter};
use chrono::{DateTime, Utc};
use google_drive3::{oauth2, DriveHub};
use yup_oauth2::hyper::client::HttpConnector;
use yup_oauth2::hyper::Client;
use google_drive3::hyper_util::client::legacy::connect::HttpConnector;
use google_drive3::{hyper_util, DriveHub};
use yup_oauth2::hyper_rustls;
use yup_oauth2::hyper_rustls::HttpsConnector;
@@ -23,23 +22,26 @@ impl Debug for GoogleDrive {
impl GoogleDrive {
pub async fn new() -> Result<Self> {
//TODO3: maybe change the path where the auth tokens get stored
let auth = oauth2::read_application_secret("auth/client_secret.json").await?;
let auth = yup_oauth2::read_application_secret("auth/client_secret.json").await?;
let auth = oauth2::InstalledFlowAuthenticator::builder(
let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
auth,
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
)
.persist_tokens_to_disk("auth/tokens.json")
.build()
.await?;
let client = Client::builder().build(
hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.https_or_http()
.enable_http1()
.enable_http2()
.build(),
);
let client =
hyper_util::client::legacy::Client::builder(hyper_util::rt::TokioExecutor::new())
.build(
hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()?
.https_or_http()
.enable_http1()
.enable_http2()
.build(),
);
Ok(Self {
hub: DriveHub::new(client, auth),
})