mirror of
https://github.com/OMGeeky/gdriver2.git
synced 2026-02-14 23:24:50 +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]
|
||||
members = [
|
||||
"gdriver-common",
|
||||
"gdriver-backend",
|
||||
"gdriver-client",
|
||||
"gdriver-common",
|
||||
"gdriver-backend",
|
||||
"gdriver-client",
|
||||
]
|
||||
resolver="2"
|
||||
resolver = "2"
|
||||
|
||||
[workspace.dependencies]
|
||||
tracing="0.1"
|
||||
tokio={ version = "1.35", features = ["rt-multi-thread", "tracing", "fs", "macros"] }
|
||||
serde={ version = "1.0", features = ["serde_derive"] }
|
||||
tarpc = { version = "0.34", features = ["full"] }
|
||||
tracing-subscriber = { version = "0.3" , features = ["env-filter"]}
|
||||
google-drive3="5.0"
|
||||
futures="0.3"
|
||||
lazy_static="1.4"
|
||||
chrono="0.4"
|
||||
tracing = "0.1"
|
||||
tokio = { version = "1.35", features = ["rt-multi-thread", "tracing", "fs", "macros"] }
|
||||
serde = { version = "1.0", features = ["serde_derive"] }
|
||||
tarpc = { version = "0.37.0", features = ["full"] }
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
google-drive3 = "7.0"
|
||||
futures = "0.3"
|
||||
lazy_static = "1.4"
|
||||
chrono = "0.4"
|
||||
libc = "0.2"
|
||||
|
||||
[patch.crates-io]
|
||||
#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
|
||||
|
||||
[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),
|
||||
})
|
||||
|
||||
@@ -13,10 +13,10 @@ serde.workspace = true
|
||||
libc.workspace = true
|
||||
anyhow = "1.0"
|
||||
futures-sink = "0.3.30"
|
||||
fuser = "0.14.0"
|
||||
fuser = "0.16.0"
|
||||
bimap = "0.6"
|
||||
futures = "0.3"
|
||||
thiserror = "1.0.56"
|
||||
thiserror = "2.0.18"
|
||||
tracing-subscriber = "0.3.18"
|
||||
|
||||
[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 {
|
||||
#[macro_export]
|
||||
macro_rules! send_request {
|
||||
@@ -42,36 +7,4 @@ mod send_requests {
|
||||
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::*;
|
||||
pub(crate) mod macros {
|
||||
pub(crate) use crate::{
|
||||
reply_error_e, reply_error_o, send_request, send_request_handled_internal, send_request_handled,
|
||||
send_request_handled_consuming,
|
||||
};
|
||||
pub(crate) use crate::send_request;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "gdriver-common"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
# 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
|
||||
tracing-subscriber.workspace = true
|
||||
google-drive3.workspace = true
|
||||
confique={ version = "0.2" }
|
||||
thiserror = "1.0"
|
||||
confique = { version = "0.4.0", features = ["toml"] }
|
||||
thiserror = "2.0.18"
|
||||
anyhow = "1.0.79"
|
||||
directories = "5.0"
|
||||
directories = "6.0.0"
|
||||
serde_json = "1.0.111"
|
||||
#[patch.crates-io]
|
||||
#confique = {path="~/Documents/git/OMGeeky/confique "}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::*;
|
||||
use crate::prelude::*;
|
||||
use confique::{Config, Partial};
|
||||
use confique::{Config, Layer};
|
||||
use std::net::{IpAddr, Ipv6Addr};
|
||||
const IP_DEFAULT: IpAddr = IpAddr::V6(Ipv6Addr::LOCALHOST);
|
||||
#[derive(Debug, Serialize, Deserialize, Config, Clone)]
|
||||
@@ -19,7 +19,7 @@ pub fn load_config_with_path(path: &Path) -> Result<Configuration> {
|
||||
fn add_default_locations(
|
||||
builder: confique::Builder<Configuration>,
|
||||
) -> confique::Builder<Configuration> {
|
||||
type P = <Configuration as Config>::Partial;
|
||||
type P = <Configuration as Config>::Layer;
|
||||
let prebuilt = P {
|
||||
ip: Some(IP_DEFAULT),
|
||||
..P::empty()
|
||||
|
||||
Reference in New Issue
Block a user