mirror of
https://github.com/OMGeeky/gdriver2.git
synced 2026-02-15 22:14:31 +01:00
update & remove some unused stuff
This commit is contained in:
@@ -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),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user