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:
1826
Cargo.lock
generated
1826
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
28
Cargo.toml
28
Cargo.toml
@@ -1,23 +1,23 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"gdriver-common",
|
"gdriver-common",
|
||||||
"gdriver-backend",
|
"gdriver-backend",
|
||||||
"gdriver-client",
|
"gdriver-client",
|
||||||
]
|
]
|
||||||
resolver="2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
tracing="0.1"
|
tracing = "0.1"
|
||||||
tokio={ version = "1.35", features = ["rt-multi-thread", "tracing", "fs", "macros"] }
|
tokio = { version = "1.35", features = ["rt-multi-thread", "tracing", "fs", "macros"] }
|
||||||
serde={ version = "1.0", features = ["serde_derive"] }
|
serde = { version = "1.0", features = ["serde_derive"] }
|
||||||
tarpc = { version = "0.34", features = ["full"] }
|
tarpc = { version = "0.37.0", features = ["full"] }
|
||||||
tracing-subscriber = { version = "0.3" , features = ["env-filter"]}
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
google-drive3="5.0"
|
google-drive3 = "7.0"
|
||||||
futures="0.3"
|
futures = "0.3"
|
||||||
lazy_static="1.4"
|
lazy_static = "1.4"
|
||||||
chrono="0.4"
|
chrono = "0.4"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
#tarpc = {path = "../../Documents/git/OMGeeky/tarpc/tarpc/"}
|
#tarpc = {path = "../../Documents/git/OMGeeky/tarpc/tarpc/"}
|
||||||
tarpc = {git = "https://github.com/google/tarpc.git"}
|
tarpc = { git = "https://github.com/google/tarpc.git" }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fuser={ version = "0.14", default_features = true, features = ["serializable"] }
|
fuser = { version = "0.16.0", default-features = true, features = ["serializable"] }
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
@@ -15,7 +15,7 @@ futures.workspace = true
|
|||||||
chrono.workspace = true
|
chrono.workspace = true
|
||||||
google-drive3.workspace = true
|
google-drive3.workspace = true
|
||||||
|
|
||||||
yup-oauth2 = "8.3"
|
yup-oauth2 = "12.1.2"
|
||||||
|
|
||||||
[dependencies.gdriver-common]
|
[dependencies.gdriver-common]
|
||||||
path = "../gdriver-common"
|
path = "../gdriver-common"
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ use std::collections::HashMap;
|
|||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use google_drive3::{oauth2, DriveHub};
|
use google_drive3::hyper_util::client::legacy::connect::HttpConnector;
|
||||||
use yup_oauth2::hyper::client::HttpConnector;
|
use google_drive3::{hyper_util, DriveHub};
|
||||||
use yup_oauth2::hyper::Client;
|
|
||||||
use yup_oauth2::hyper_rustls;
|
use yup_oauth2::hyper_rustls;
|
||||||
use yup_oauth2::hyper_rustls::HttpsConnector;
|
use yup_oauth2::hyper_rustls::HttpsConnector;
|
||||||
|
|
||||||
@@ -23,23 +22,26 @@ impl Debug for GoogleDrive {
|
|||||||
impl GoogleDrive {
|
impl GoogleDrive {
|
||||||
pub async fn new() -> Result<Self> {
|
pub async fn new() -> Result<Self> {
|
||||||
//TODO3: maybe change the path where the auth tokens get stored
|
//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,
|
auth,
|
||||||
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
||||||
)
|
)
|
||||||
.persist_tokens_to_disk("auth/tokens.json")
|
.persist_tokens_to_disk("auth/tokens.json")
|
||||||
.build()
|
.build()
|
||||||
.await?;
|
.await?;
|
||||||
let client = Client::builder().build(
|
|
||||||
hyper_rustls::HttpsConnectorBuilder::new()
|
let client =
|
||||||
.with_native_roots()
|
hyper_util::client::legacy::Client::builder(hyper_util::rt::TokioExecutor::new())
|
||||||
.https_or_http()
|
.build(
|
||||||
.enable_http1()
|
hyper_rustls::HttpsConnectorBuilder::new()
|
||||||
.enable_http2()
|
.with_native_roots()?
|
||||||
.build(),
|
.https_or_http()
|
||||||
);
|
.enable_http1()
|
||||||
|
.enable_http2()
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
hub: DriveHub::new(client, auth),
|
hub: DriveHub::new(client, auth),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ serde.workspace = true
|
|||||||
libc.workspace = true
|
libc.workspace = true
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
futures-sink = "0.3.30"
|
futures-sink = "0.3.30"
|
||||||
fuser = "0.14.0"
|
fuser = "0.16.0"
|
||||||
bimap = "0.6"
|
bimap = "0.6"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
thiserror = "1.0.56"
|
thiserror = "2.0.18"
|
||||||
tracing-subscriber = "0.3.18"
|
tracing-subscriber = "0.3.18"
|
||||||
|
|
||||||
[dependencies.gdriver-common]
|
[dependencies.gdriver-common]
|
||||||
|
|||||||
@@ -1,38 +1,3 @@
|
|||||||
mod reply {
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! reply_error_o {
|
|
||||||
($option_in:expr, $reply:ident, $error_code:expr, $error_msg:expr) => {
|
|
||||||
reply_error_o!($option_in, $reply, $error_code, $error_msg,)
|
|
||||||
};
|
|
||||||
($option_in:expr, $reply:ident, $error_code:expr, $error_msg:expr, $($arg:tt)*) => {{
|
|
||||||
match $option_in {
|
|
||||||
None=>{
|
|
||||||
::tracing::error!($error_msg, $($arg)*);
|
|
||||||
$reply.error($error_code);
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
Some(x) => x,
|
|
||||||
}
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! reply_error_e {
|
|
||||||
($result_in:expr, $reply:ident, $error_code:expr, $error_msg:expr) => {
|
|
||||||
reply_error_e!($result_in, $reply, $error_code, $error_msg,)
|
|
||||||
};
|
|
||||||
($result:expr, $reply:ident, $error_code:expr, $error_msg:expr, $($arg:tt)*) => {{
|
|
||||||
match $result {
|
|
||||||
Ok(x) => x,
|
|
||||||
Err(e) => {
|
|
||||||
error!("{}; e:{}",format!($error_msg, $($arg)*), e);
|
|
||||||
$reply.error($error_code);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod send_requests {
|
mod send_requests {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! send_request {
|
macro_rules! send_request {
|
||||||
@@ -42,36 +7,4 @@ mod send_requests {
|
|||||||
futures::executor::block_on($func)
|
futures::executor::block_on($func)
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
#[macro_export]
|
|
||||||
macro_rules! send_request_handled_internal {
|
|
||||||
($func:expr ,$reply:ident, $error_code:expr, $error_msg:expr, $($arg:tt)*) => {{
|
|
||||||
let x = send_request!($func);
|
|
||||||
reply_error_e!(x, $reply, $error_code, $error_msg, $($arg)*)
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! send_request_handled {
|
|
||||||
($func:expr ,$reply:ident) => {
|
|
||||||
send_request_handled!($func, $reply, "")
|
|
||||||
};
|
|
||||||
($func:expr ,$reply:ident, $error_msg:expr) => {
|
|
||||||
send_request_handled_internal!(
|
|
||||||
$func,
|
|
||||||
$reply,
|
|
||||||
::libc::EREMOTEIO,
|
|
||||||
"Failed send request: {}",
|
|
||||||
$error_msg
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! send_request_handled_consuming {
|
|
||||||
($func:expr ,$reply:ident) => {
|
|
||||||
send_request_handled_consuming!($func, $reply, "");
|
|
||||||
};
|
|
||||||
($func:expr ,$reply:ident, $error_msg:expr) => {
|
|
||||||
let _ = send_request_handled!($func, $reply, $error_msg);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
pub(crate) use gdriver_common::prelude::result::*;
|
pub(crate) use gdriver_common::prelude::result::*;
|
||||||
pub(crate) use gdriver_common::prelude::*;
|
pub(crate) use gdriver_common::prelude::*;
|
||||||
pub(crate) mod macros {
|
pub(crate) mod macros {
|
||||||
pub(crate) use crate::{
|
pub(crate) use crate::send_request;
|
||||||
reply_error_e, reply_error_o, send_request, send_request_handled_internal, send_request_handled,
|
|
||||||
send_request_handled_consuming,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "gdriver-common"
|
name = "gdriver-common"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@@ -15,10 +15,10 @@ futures.workspace = true
|
|||||||
lazy_static.workspace = true
|
lazy_static.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
google-drive3.workspace = true
|
google-drive3.workspace = true
|
||||||
confique={ version = "0.2" }
|
confique = { version = "0.4.0", features = ["toml"] }
|
||||||
thiserror = "1.0"
|
thiserror = "2.0.18"
|
||||||
anyhow = "1.0.79"
|
anyhow = "1.0.79"
|
||||||
directories = "5.0"
|
directories = "6.0.0"
|
||||||
serde_json = "1.0.111"
|
serde_json = "1.0.111"
|
||||||
#[patch.crates-io]
|
#[patch.crates-io]
|
||||||
#confique = {path="~/Documents/git/OMGeeky/confique "}
|
#confique = {path="~/Documents/git/OMGeeky/confique "}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use confique::{Config, Partial};
|
use confique::{Config, Layer};
|
||||||
use std::net::{IpAddr, Ipv6Addr};
|
use std::net::{IpAddr, Ipv6Addr};
|
||||||
const IP_DEFAULT: IpAddr = IpAddr::V6(Ipv6Addr::LOCALHOST);
|
const IP_DEFAULT: IpAddr = IpAddr::V6(Ipv6Addr::LOCALHOST);
|
||||||
#[derive(Debug, Serialize, Deserialize, Config, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Config, Clone)]
|
||||||
@@ -19,7 +19,7 @@ pub fn load_config_with_path(path: &Path) -> Result<Configuration> {
|
|||||||
fn add_default_locations(
|
fn add_default_locations(
|
||||||
builder: confique::Builder<Configuration>,
|
builder: confique::Builder<Configuration>,
|
||||||
) -> confique::Builder<Configuration> {
|
) -> confique::Builder<Configuration> {
|
||||||
type P = <Configuration as Config>::Partial;
|
type P = <Configuration as Config>::Layer;
|
||||||
let prebuilt = P {
|
let prebuilt = P {
|
||||||
ip: Some(IP_DEFAULT),
|
ip: Some(IP_DEFAULT),
|
||||||
..P::empty()
|
..P::empty()
|
||||||
|
|||||||
Reference in New Issue
Block a user