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.

chore: bump client api (#4819)

Nathan.fooo3d8ff062b5f5
diff --git a/.github/workflows/rust_ci.yaml b/.github/workflows/rust_ci.yaml
index b4062980b5..9cca48942d 100644
--- a/.github/workflows/rust_ci.yaml
+++ b/.github/workflows/rust_ci.yaml
@@ -25,6 +25,22 @@ jobs:
test-on-ubuntu:
runs-on: ubuntu-latest
steps:
+# - name: Maximize build space
+# uses: easimon/maximize-build-space@master
+# with:
+# root-reserve-mb: 2048
+# swap-size-mb: 1024
+# remove-dotnet: 'true'
+#
+# # the following step is required to avoid running out of space
+# - name: Maximize build space
+# run: |
+# sudo rm -rf /usr/share/dotnet
+# sudo rm -rf /opt/ghc
+# sudo rm -rf "/usr/local/share/boost"
+# sudo rm -rf "$AGENT_TOOLSDIRECTORY"
+# sudo docker image prune --all --force
+
- name: Checkout source code
uses: actions/checkout@v4
@@ -86,3 +102,8 @@ jobs:
- name: clippy rust-lib
run: cargo clippy --all-targets -- -D warnings
working-directory: frontend/rust-lib
+
+ - name: Clean up Docker images
+ run: |
+ docker image prune -af
+ docker volume prune -f
diff --git a/frontend/appflowy_flutter/lib/env/cloud_env.dart b/frontend/appflowy_flutter/lib/env/cloud_env.dart
index 45dd135e98..27c4469f45 100644
--- a/frontend/appflowy_flutter/lib/env/cloud_env.dart
+++ b/frontend/appflowy_flutter/lib/env/cloud_env.dart
@@ -281,7 +281,7 @@ Future<AppFlowyCloudConfiguration> configurationFromUri(
if (authenticatorType == AuthenticatorType.appflowyCloudDevelop) {
return AppFlowyCloudConfiguration(
base_url: "$baseUrl:8000",
- ws_base_url: "ws://${baseUri.host}:8000/ws",
+ ws_base_url: "ws://${baseUri.host}:8000/ws/v1",
gotrue_url: "$baseUrl:9999",
);
} else {
@@ -319,7 +319,7 @@ Future<String> _getAppFlowyCloudWSUrl(String baseURL) async {
// Construct the WebSocket URL directly from the parsed URI.
final wsScheme = uri.isScheme('HTTPS') ? 'wss' : 'ws';
- final wsUrl = Uri(scheme: wsScheme, host: uri.host, path: '/ws');
+ final wsUrl = Uri(scheme: wsScheme, host: uri.host, path: '/ws/v1');
return wsUrl.toString();
} catch (e) {
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock
index 0e2f08cfbe..20a2e20290 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.lock
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.lock
@@ -162,7 +162,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "app-error"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -714,7 +714,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"again",
"anyhow",
@@ -741,6 +741,7 @@ dependencies = [
"realtime-protocol",
"reqwest",
"scraper 0.17.1",
+ "semver",
"serde",
"serde_json",
"serde_repr",
@@ -1312,7 +1313,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -2586,7 +2587,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"futures-util",
@@ -2603,7 +2604,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -3058,7 +3059,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"reqwest",
@@ -4800,7 +4801,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -4824,7 +4825,7 @@ dependencies = [
[[package]]
name = "realtime-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -5317,9 +5318,9 @@ dependencies = [
[[package]]
name = "semver"
-version = "1.0.17"
+version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
+checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
dependencies = [
"serde",
]
@@ -5496,7 +5497,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -6240,9 +6241,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.35.1"
+version = "1.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
+checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
dependencies = [
"backtrace",
"bytes",
@@ -6992,13 +6993,14 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
[[package]]
name = "websocket"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"futures-channel",
"futures-util",
"http",
"httparse",
"js-sys",
+ "percent-encoding",
"thiserror",
"tokio",
"tokio-tungstenite",
@@ -7454,7 +7456,7 @@ dependencies = [
[[package]]
name = "workspace-template"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"async-trait",
diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml
index 9307f3528a..cf031f86d8 100644
--- a/frontend/appflowy_tauri/src-tauri/Cargo.toml
+++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml
@@ -82,7 +82,7 @@ custom-protocol = ["tauri/custom-protocol"]
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "15c03e4f85fffd35089a82c2a84aca8042a38946" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "eb79b9f5e80846bd06b30b4f9c04039ce1452582" }
# Please use the following script to update collab.
# Working directory: frontend
#
diff --git a/frontend/appflowy_web/wasm-libs/Cargo.lock b/frontend/appflowy_web/wasm-libs/Cargo.lock
index 2274c4fb42..2dac333820 100644
--- a/frontend/appflowy_web/wasm-libs/Cargo.lock
+++ b/frontend/appflowy_web/wasm-libs/Cargo.lock
@@ -221,7 +221,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "app-error"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -545,7 +545,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"again",
"anyhow",
@@ -572,6 +572,7 @@ dependencies = [
"realtime-protocol",
"reqwest",
"scraper 0.17.1",
+ "semver",
"serde",
"serde_json",
"serde_repr",
@@ -945,7 +946,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -1699,7 +1700,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"futures-util",
@@ -1716,7 +1717,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -2050,7 +2051,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"reqwest",
@@ -3308,7 +3309,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -3332,7 +3333,7 @@ dependencies = [
[[package]]
name = "realtime-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -3665,6 +3666,12 @@ dependencies = [
"smallvec",
]
+[[package]]
+name = "semver"
+version = "1.0.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
+
[[package]]
name = "serde"
version = "1.0.195"
@@ -3779,7 +3786,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -4145,9 +4152,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.35.1"
+version = "1.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
+checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
dependencies = [
"backtrace",
"bytes",
@@ -4721,13 +4728,14 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10"
[[package]]
name = "websocket"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"futures-channel",
"futures-util",
"http",
"httparse",
"js-sys",
+ "percent-encoding",
"thiserror",
"tokio",
"tokio-tungstenite",
diff --git a/frontend/appflowy_web/wasm-libs/Cargo.toml b/frontend/appflowy_web/wasm-libs/Cargo.toml
index 5e56d2551a..e423a30207 100644
--- a/frontend/appflowy_web/wasm-libs/Cargo.toml
+++ b/frontend/appflowy_web/wasm-libs/Cargo.toml
@@ -55,7 +55,7 @@ codegen-units = 1
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "15c03e4f85fffd35089a82c2a84aca8042a38946" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "eb79b9f5e80846bd06b30b4f9c04039ce1452582" }
# Please use the following script to update collab.
# Working directory: frontend
#
diff --git a/frontend/appflowy_web/wasm-libs/af-wasm/src/lib.rs b/frontend/appflowy_web/wasm-libs/af-wasm/src/lib.rs
index ab017366bd..efe3855f28 100644
--- a/frontend/appflowy_web/wasm-libs/af-wasm/src/lib.rs
+++ b/frontend/appflowy_web/wasm-libs/af-wasm/src/lib.rs
@@ -49,14 +49,14 @@ pub fn init_wasm_core() -> js_sys::Promise {
#[cfg(feature = "localhost_dev")]
let config = AFCloudConfiguration {
base_url: "http://localhost".to_string(),
- ws_base_url: "ws://localhost/ws".to_string(),
+ ws_base_url: "ws://localhost/ws/v1".to_string(),
gotrue_url: "http://localhost/gotrue".to_string(),
};
#[cfg(not(feature = "localhost_dev"))]
let config = AFCloudConfiguration {
base_url: "https://beta.appflowy.cloud".to_string(),
- ws_base_url: "wss://beta.appflowy.cloud/ws".to_string(),
+ ws_base_url: "wss://beta.appflowy.cloud/ws/v1".to_string(),
gotrue_url: "https://beta.appflowy.cloud/gotrue".to_string(),
};
diff --git a/frontend/appflowy_web/wasm-libs/af-wasm/tests/util/tester.rs b/frontend/appflowy_web/wasm-libs/af-wasm/tests/util/tester.rs
index b8744bdeba..5142d8012f 100644
--- a/frontend/appflowy_web/wasm-libs/af-wasm/tests/util/tester.rs
+++ b/frontend/appflowy_web/wasm-libs/af-wasm/tests/util/tester.rs
@@ -24,7 +24,7 @@ impl WASMEventTester {
setup_log();
let config = AFCloudConfiguration {
base_url: "http://localhost".to_string(),
- ws_base_url: "ws://localhost/ws".to_string(),
+ ws_base_url: "ws://localhost/ws/v1".to_string(),
gotrue_url: "http://localhost/gotrue".to_string(),
};
let core = Arc::new(AppFlowyWASMCore::new("device_id", config).await.unwrap());
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index 595a605df0..9f686f4824 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -163,7 +163,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "app-error"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -673,7 +673,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"again",
"anyhow",
@@ -700,6 +700,7 @@ dependencies = [
"realtime-protocol",
"reqwest",
"scraper 0.17.1",
+ "semver",
"serde",
"serde_json",
"serde_repr",
@@ -1236,7 +1237,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -2410,7 +2411,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"futures-util",
@@ -2427,7 +2428,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -2821,7 +2822,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"reqwest",
@@ -4318,7 +4319,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -4342,7 +4343,7 @@ dependencies = [
[[package]]
name = "realtime-protocol"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"bincode",
@@ -4805,6 +4806,12 @@ dependencies = [
"smallvec",
]
+[[package]]
+name = "semver"
+version = "1.0.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
+
[[package]]
name = "serde"
version = "1.0.195"
@@ -4930,7 +4937,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"app-error",
@@ -5364,9 +5371,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.35.1"
+version = "1.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
+checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931"
dependencies = [
"backtrace",
"bytes",
@@ -6120,13 +6127,14 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
[[package]]
name = "websocket"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"futures-channel",
"futures-util",
"http",
"httparse",
"js-sys",
+ "percent-encoding",
"thiserror",
"tokio",
"tokio-tungstenite",
@@ -6360,7 +6368,7 @@ dependencies = [
[[package]]
name = "workspace-template"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=15c03e4f85fffd35089a82c2a84aca8042a38946#15c03e4f85fffd35089a82c2a84aca8042a38946"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=eb79b9f5e80846bd06b30b4f9c04039ce1452582#eb79b9f5e80846bd06b30b4f9c04039ce1452582"
dependencies = [
"anyhow",
"async-trait",
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index bd3aded33c..8be0d557df 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -105,7 +105,7 @@ incremental = false
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
-client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "15c03e4f85fffd35089a82c2a84aca8042a38946" }
+client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "eb79b9f5e80846bd06b30b4f9c04039ce1452582" }
# Please use the following script to update collab.
# Working directory: frontend
#
diff --git a/frontend/rust-lib/event-integration/src/user_event.rs b/frontend/rust-lib/event-integration/src/user_event.rs
index b348b89d64..4f8b858d6e 100644
--- a/frontend/rust-lib/event-integration/src/user_event.rs
+++ b/frontend/rust-lib/event-integration/src/user_event.rs
@@ -410,7 +410,7 @@ pub async fn user_localhost_af_cloud() {
let base_url =
std::env::var("af_cloud_test_base_url").unwrap_or("http://localhost:8000".to_string());
let ws_base_url =
- std::env::var("af_cloud_test_ws_url").unwrap_or("ws://localhost:8000/ws".to_string());
+ std::env::var("af_cloud_test_ws_url").unwrap_or("ws://localhost:8000/ws/v1".to_string());
let gotrue_url =
std::env::var("af_cloud_test_gotrue_url").unwrap_or("http://localhost:9999".to_string());
AFCloudConfiguration {
@@ -426,7 +426,7 @@ pub async fn user_localhost_af_cloud() {
#[allow(dead_code)]
pub async fn user_localhost_af_cloud_with_nginx() {
std::env::set_var("af_cloud_test_base_url", "http://localhost");
- std::env::set_var("af_cloud_test_ws_url", "ws://localhost/ws");
+ std::env::set_var("af_cloud_test_ws_url", "ws://localhost/ws/v1");
std::env::set_var("af_cloud_test_gotrue_url", "http://localhost/gotrue");
user_localhost_af_cloud().await
}
diff --git a/frontend/rust-lib/flowy-database2/build.rs b/frontend/rust-lib/flowy-database2/build.rs
index 7d0351bcf6..90f29201b0 100644
--- a/frontend/rust-lib/flowy-database2/build.rs
+++ b/frontend/rust-lib/flowy-database2/build.rs
@@ -1,14 +1,17 @@
fn main() {
- let crate_name = env!("CARGO_PKG_NAME");
#[cfg(feature = "dart")]
{
- flowy_codegen::protobuf_file::dart_gen(crate_name);
- flowy_codegen::dart_event::gen(crate_name);
+ flowy_codegen::protobuf_file::dart_gen(env!("CARGO_PKG_NAME"));
+ flowy_codegen::dart_event::gen(env!("CARGO_PKG_NAME"));
}
#[cfg(feature = "ts")]
{
- flowy_codegen::ts_event::gen(crate_name, flowy_codegen::Project::Tauri);
- flowy_codegen::protobuf_file::ts_gen(crate_name, crate_name, flowy_codegen::Project::Tauri);
+ flowy_codegen::ts_event::gen(env!("CARGO_PKG_NAME"), flowy_codegen::Project::Tauri);
+ flowy_codegen::protobuf_file::ts_gen(
+ env!("CARGO_PKG_NAME"),
+ env!("CARGO_PKG_NAME"),
+ flowy_codegen::Project::Tauri,
+ );
}
}
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs
index 625790d578..bc3b6f4863 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/impls/user/cloud_service_impl.rs
@@ -360,7 +360,7 @@ async fn get_admin_client(client: &Arc<AFCloudClient>) -> FlowyResult<Client> {
client.gotrue_url(),
&client.device_id,
ClientConfiguration::default(),
- &client.client_id,
+ &client.client_version.to_string(),
);
admin_client
.sign_in_password(&admin_email, &admin_password)
diff --git a/frontend/rust-lib/flowy-server/src/af_cloud/server.rs b/frontend/rust-lib/flowy-server/src/af_cloud/server.rs
index f165a86a51..ef5522f9aa 100644
--- a/frontend/rust-lib/flowy-server/src/af_cloud/server.rs
+++ b/frontend/rust-lib/flowy-server/src/af_cloud/server.rs
@@ -49,7 +49,7 @@ impl AppFlowyCloudServer {
config: AFCloudConfiguration,
enable_sync: bool,
mut device_id: String,
- app_version: &str,
+ client_version: &str,
) -> Self {
// The device id can't be empty, so we generate a new one if it is.
if device_id.is_empty() {
@@ -65,7 +65,7 @@ impl AppFlowyCloudServer {
ClientConfiguration::default()
.with_compression_buffer_size(10240)
.with_compression_quality(8),
- app_version,
+ client_version,
);
let token_state_rx = api_client.subscribe_token_state();
let enable_sync = Arc::new(AtomicBool::new(enable_sync));
@@ -75,13 +75,7 @@ impl AppFlowyCloudServer {
let ws_client = Arc::new(ws_client);
let api_client = Arc::new(api_client);
- spawn_ws_conn(
- &device_id,
- token_state_rx,
- &ws_client,
- &api_client,
- &enable_sync,
- );
+ spawn_ws_conn(token_state_rx, &ws_client, &api_client, &enable_sync);
Self {
config,
client: api_client,
@@ -240,13 +234,11 @@ impl AppFlowyServer for AppFlowyCloudServer {
/// This function listens to the `token_state_rx` channel for token state updates. Depending on the
/// received state, it either refreshes the WebSocket connection or disconnects from it.
fn spawn_ws_conn(
- device_id: &String,
mut token_state_rx: TokenStateReceiver,
ws_client: &Arc<WSClient>,
api_client: &Arc<Client>,
enable_sync: &Arc<AtomicBool>,
) {
- let cloned_device_id = device_id.to_owned();
let weak_ws_client = Arc::downgrade(ws_client);
let weak_api_client = Arc::downgrade(api_client);
let enable_sync = enable_sync.clone();
@@ -257,17 +249,17 @@ fn spawn_ws_conn(
while let Ok(state) = state_recv.recv().await {
info!("[websocket] state: {:?}", state);
match state {
- ConnectState::PingTimeout | ConnectState::Closed => {
+ ConnectState::PingTimeout | ConnectState::Lost => {
// Try to reconnect if the connection is timed out.
if let Some(api_client) = weak_api_client.upgrade() {
if enable_sync.load(Ordering::SeqCst) {
- match api_client.ws_url(&cloned_device_id).await {
- Ok(ws_addr) => {
+ match api_client.ws_connect_info().await {
+ Ok(conn_info) => {
// sleep two seconds and then try to reconnect
tokio::time::sleep(Duration::from_secs(2)).await;
event!(tracing::Level::INFO, "🟢reconnecting websocket");
- let _ = ws_client.connect(ws_addr, &cloned_device_id).await;
+ let _ = ws_client.connect(&api_client.ws_addr(), conn_info).await;
},
Err(err) => error!("Failed to get ws url: {}, connect state:{:?}", err, state),
}
@@ -287,7 +279,6 @@ fn spawn_ws_conn(
}
});
- let device_id = device_id.to_owned();
let weak_ws_client = Arc::downgrade(ws_client);
let weak_api_client = Arc::downgrade(api_client);
af_spawn(async move {
@@ -298,9 +289,9 @@ fn spawn_ws_conn(
if let (Some(api_client), Some(ws_client)) =
(weak_api_client.upgrade(), weak_ws_client.upgrade())
{
- match api_client.ws_url(&device_id).await {
- Ok(ws_addr) => {
- let _ = ws_client.connect(ws_addr, &device_id).await;
+ match api_client.ws_connect_info().await {
+ Ok(conn_info) => {
+ let _ = ws_client.connect(&api_client.ws_addr(), conn_info).await;
},
Err(err) => error!("Failed to get ws url: {}", err),
}
diff --git a/frontend/rust-lib/flowy-server/src/server.rs b/frontend/rust-lib/flowy-server/src/server.rs
index f26676eb6c..a20fe8465a 100644
--- a/frontend/rust-lib/flowy-server/src/server.rs
+++ b/frontend/rust-lib/flowy-server/src/server.rs
@@ -116,7 +116,7 @@ pub trait AppFlowyServer: Send + Sync + 'static {
}
fn get_ws_state(&self) -> ConnectState {
- ConnectState::Closed
+ ConnectState::Lost
}
#[allow(clippy::type_complexity)]
diff --git a/frontend/rust-lib/flowy-server/tests/af_cloud_test/util.rs b/frontend/rust-lib/flowy-server/tests/af_cloud_test/util.rs
index 8377eb3dd9..1a39d704a3 100644
--- a/frontend/rust-lib/flowy-server/tests/af_cloud_test/util.rs
+++ b/frontend/rust-lib/flowy-server/tests/af_cloud_test/util.rs
@@ -30,7 +30,7 @@ pub fn af_cloud_server(config: AFCloudConfiguration) -> Arc<AppFlowyCloudServer>
config,
true,
fake_device_id,
- "flowy-server-test",
+ "0.5.1",
))
}
@@ -51,7 +51,7 @@ pub async fn generate_sign_in_url(user_email: &str, config: &AFCloudConfiguratio
client.gotrue_url(),
"fake_device_id",
ClientConfiguration::default(),
- &client.client_id,
+ &client.client_version.to_string(),
);
admin_client
.sign_in_password(&admin_email, &admin_password)
diff --git a/frontend/rust-lib/flowy-user/src/services/db.rs b/frontend/rust-lib/flowy-user/src/services/db.rs
index 853365c04a..3305fca41a 100644
--- a/frontend/rust-lib/flowy-user/src/services/db.rs
+++ b/frontend/rust-lib/flowy-user/src/services/db.rs
@@ -1,7 +1,7 @@
use std::path::{Path, PathBuf};
use std::{collections::HashMap, fs, io, sync::Arc, time::Duration};
-use chrono::Local;
+use chrono::{Days, Local};
use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use collab_plugins::local_storage::kv::KVTransactionDB;
use flowy_error::FlowyError;
@@ -323,40 +323,46 @@ impl CollabDBZipBackup {
fn clean_old_backups(&self) -> io::Result<()> {
let mut backups = Vec::new();
- let threshold_date = Local::now() - chrono::Duration::days(10);
-
- // Collect all backup files
- for entry in fs::read_dir(&self.history_folder)? {
- let entry = entry?;
- let path = entry.path();
- if path.is_file() && path.extension().and_then(|s| s.to_str()) == Some("zip") {
- let filename = path
- .file_stem()
- .and_then(|s| s.to_str())
- .unwrap_or_default();
- let date_str = filename.split('_').last().unwrap_or("");
- backups.push((date_str.to_string(), path));
- }
- }
+ let now = Local::now();
+ match now.checked_sub_days(Days::new(10)) {
+ None => {
+ error!("Failed to calculate threshold date");
+ },
+ Some(threshold_date) => {
+ // Collect all backup files
+ for entry in fs::read_dir(&self.history_folder)? {
+ let entry = entry?;
+ let path = entry.path();
+ if path.is_file() && path.extension().and_then(|s| s.to_str()) == Some("zip") {
+ let filename = path
+ .file_stem()
+ .and_then(|s| s.to_str())
+ .unwrap_or_default();
+ let date_str = filename.split('_').last().unwrap_or("");
+ backups.push((date_str.to_string(), path));
+ }
+ }
- // Sort backups by date (oldest first)
- backups.sort_by(|a, b| a.0.cmp(&b.0));
-
- // Remove backups older than 10 days
- let threshold_str = threshold_date.format(zip_time_format()).to_string();
-
- info!("Current backup: {:?}", backups.len());
- // If there are more than 10 backups, remove the oldest ones
- while backups.len() > 10 {
- if let Some((date_str, path)) = backups.first() {
- if date_str < &threshold_str {
- info!("Remove old backup file: {:?}", path);
- fs::remove_file(path)?;
- backups.remove(0);
- } else {
- break;
+ // Sort backups by date (oldest first)
+ backups.sort_by(|a, b| a.0.cmp(&b.0));
+
+ // Remove backups older than 10 days
+ let threshold_str = threshold_date.format(zip_time_format()).to_string();
+
+ info!("Current backup: {:?}", backups.len());
+ // If there are more than 10 backups, remove the oldest ones
+ while backups.len() > 10 {
+ if let Some((date_str, path)) = backups.first() {
+ if date_str < &threshold_str {
+ info!("Remove old backup file: {:?}", path);
+ fs::remove_file(path)?;
+ backups.remove(0);
+ } else {
+ break;
+ }
+ }
}
- }
+ },
}
Ok(())