Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: compile errors

appflowy9f8e3b09c31d
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 4f2993f6dc..5f6b74990d 100755
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -51,6 +51,12 @@ version = "1.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3"
+[[package]]
+name = "arrayvec"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
+
[[package]]
name = "async-stream"
version = "0.3.2"
@@ -284,6 +290,18 @@ dependencies = [
"owo-colors",
]
+[[package]]
+name = "config"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3"
+dependencies = [
+ "lazy_static",
+ "nom",
+ "serde",
+ "yaml-rust",
+]
+
[[package]]
name = "convert_case"
version = "0.4.0"
@@ -889,6 +907,7 @@ dependencies = [
"anyhow",
"async-stream",
"bytes",
+ "config",
"dashmap",
"flowy-collaboration",
"flowy-derive",
@@ -900,12 +919,18 @@ dependencies = [
"flowy-user-data-model",
"futures-util",
"http-response",
+ "hyper",
"lazy_static",
"lib-dispatch",
"lib-infra",
"lib-ws",
+ "log",
"parking_lot",
"protobuf",
+ "reqwest",
+ "serde",
+ "serde-aux",
+ "serde_json",
"strum",
"strum_macros",
"tokio",
@@ -1448,6 +1473,19 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+[[package]]
+name = "lexical-core"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe"
+dependencies = [
+ "arrayvec",
+ "bitflags",
+ "cfg-if",
+ "ryu",
+ "static_assertions",
+]
+
[[package]]
name = "lib-dispatch"
version = "0.1.0"
@@ -1586,6 +1624,12 @@ dependencies = [
"vcpkg",
]
+[[package]]
+name = "linked-hash-map"
+version = "0.5.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
+
[[package]]
name = "lock_api"
version = "0.4.5"
@@ -1717,6 +1761,17 @@ dependencies = [
"tempfile",
]
+[[package]]
+name = "nom"
+version = "5.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
+dependencies = [
+ "lexical-core",
+ "memchr",
+ "version_check",
+]
+
[[package]]
name = "ntapi"
version = "0.3.6"
@@ -2279,6 +2334,17 @@ dependencies = [
"serde_derive",
]
+[[package]]
+name = "serde-aux"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "905f2fc9f3d1574e8b5923a58118240021f01d4e239673937ffb9f42707a4f22"
+dependencies = [
+ "chrono",
+ "serde",
+ "serde_json",
+]
+
[[package]]
name = "serde_cbor"
version = "0.11.2"
@@ -2432,6 +2498,12 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "static_assertions"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+
[[package]]
name = "strsim"
version = "0.10.0"
@@ -3036,3 +3108,12 @@ checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
dependencies = [
"winapi",
]
+
+[[package]]
+name = "yaml-rust"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
+dependencies = [
+ "linked-hash-map",
+]
diff --git a/frontend/rust-lib/flowy-net/Cargo.toml b/frontend/rust-lib/flowy-net/Cargo.toml
index 04bb1886d9..a71db47beb 100644
--- a/frontend/rust-lib/flowy-net/Cargo.toml
+++ b/frontend/rust-lib/flowy-net/Cargo.toml
@@ -30,6 +30,13 @@ dashmap = {version = "4.0"}
async-stream = "0.3.2"
futures-util = "0.3.15"
http-response = { git = "https://github.com/AppFlowy-IO/AppFlowy-Server", features = ["with_reqwest"]}
+serde-aux = "1.0.1"
+reqwest = "0.11"
+hyper = "0.14"
+config = { version = "0.10.1", default-features = false, features = ["yaml"] }
+log = "0.4.14"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
[features]
http_server = []
\ No newline at end of file
diff --git a/frontend/rust-lib/flowy-net/src/configuration.rs b/frontend/rust-lib/flowy-net/src/configuration.rs
index 6912188826..883151dc48 100644
--- a/frontend/rust-lib/flowy-net/src/configuration.rs
+++ b/frontend/rust-lib/flowy-net/src/configuration.rs
@@ -1,7 +1,6 @@
use config::FileFormat;
use serde_aux::field_attributes::deserialize_number_from_string;
use std::convert::{TryFrom, TryInto};
-pub const HOST: &str = "localhost:8000";
pub const HEADER_TOKEN: &str = "token";
#[derive(serde::Deserialize, Clone, Debug)]
@@ -89,6 +88,7 @@ pub enum Environment {
}
impl Environment {
+ #[allow(dead_code)]
pub fn as_str(&self) -> &'static str {
match self {
Environment::Local => "local",
diff --git a/frontend/rust-lib/flowy-net/src/lib.rs b/frontend/rust-lib/flowy-net/src/lib.rs
index 111f9e36e8..78f8a28f02 100644
--- a/frontend/rust-lib/flowy-net/src/lib.rs
+++ b/frontend/rust-lib/flowy-net/src/lib.rs
@@ -4,7 +4,6 @@ mod event;
mod handlers;
pub mod http_server;
pub mod local_server;
-mod middleware;
pub mod module;
pub mod protobuf;
mod request;
diff --git a/frontend/rust-lib/flowy-net/src/middleware.rs b/frontend/rust-lib/flowy-net/src/middleware.rs
deleted file mode 100644
index c1e8b695c0..0000000000
--- a/frontend/rust-lib/flowy-net/src/middleware.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use crate::{request::ResponseMiddleware, response::FlowyResponse};
-use lazy_static::lazy_static;
-use std::sync::Arc;
-use tokio::sync::broadcast;
-lazy_static! {
- pub static ref BACKEND_API_MIDDLEWARE: Arc<WorkspaceMiddleware> = Arc::new(WorkspaceMiddleware::new());
-}
-
-pub struct WorkspaceMiddleware {
- invalid_token_sender: broadcast::Sender<String>,
-}
-
-impl WorkspaceMiddleware {
- fn new() -> Self {
- let (sender, _) = broadcast::channel(10);
- WorkspaceMiddleware {
- invalid_token_sender: sender,
- }
- }
-
- pub fn invalid_token_subscribe(&self) -> broadcast::Receiver<String> {
- self.invalid_token_sender.subscribe()
- }
-}
-
-impl ResponseMiddleware for WorkspaceMiddleware {
- fn receive_response(&self, token: &Option<String>, response: &FlowyResponse) {
- if let Some(error) = &response.error {
- if error.is_unauthorized() {
- log::error!("user is unauthorized");
- match token {
- None => {}
- Some(token) => match self.invalid_token_sender.send(token.clone()) {
- Ok(_) => {}
- Err(e) => log::error!("{:?}", e),
- },
- }
- }
- }
- }
-}
diff --git a/frontend/rust-lib/flowy-sdk/src/lib.rs b/frontend/rust-lib/flowy-sdk/src/lib.rs
index 7e3c0da37b..d19d19adf6 100644
--- a/frontend/rust-lib/flowy-sdk/src/lib.rs
+++ b/frontend/rust-lib/flowy-sdk/src/lib.rs
@@ -76,7 +76,7 @@ fn crate_log_filter(level: String) -> String {
filters.push(format!("lib_ot={}", level));
filters.push(format!("lib_ws={}", level));
filters.push(format!("lib_infra={}", level));
- filters.push(format!("flowy_sync={}", level));
+ filters.push(format!("flowy_sync={}", "info"));
filters.join(",")
}