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:
@@ -6,7 +6,7 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
fuser={ version = "0.14", default_features = true, features = ["serializable"] }
|
||||
fuser = { version = "0.16.0", default-features = true, features = ["serializable"] }
|
||||
tracing.workspace = true
|
||||
tokio.workspace = true
|
||||
serde.workspace = true
|
||||
@@ -15,7 +15,7 @@ futures.workspace = true
|
||||
chrono.workspace = true
|
||||
google-drive3.workspace = true
|
||||
|
||||
yup-oauth2 = "8.3"
|
||||
yup-oauth2 = "12.1.2"
|
||||
|
||||
[dependencies.gdriver-common]
|
||||
path = "../gdriver-common"
|
||||
|
||||
@@ -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