From c0aef8f4fecdc2f4a0f872058d2bdc422c83c1f2 Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Tue, 30 Jan 2024 09:33:34 +0800 Subject: [PATCH] fix: login issue (#4546) * fix: reset server url when using appflowy cloud the first time * refactor: set authenticator in frontend * chore: log version * chore: show hint when changing the server type * chore: bump version * chore: fix test * chore: bump collab --- .../integration_test/util/base.dart | 21 +++-- .../appflowy_flutter/lib/env/backend_env.dart | 2 + .../appflowy_flutter/lib/env/cloud_env.dart | 45 ++++++++--- .../setting/cloud/appflowy_cloud_page.dart | 2 +- .../self_host/self_host_bottom_sheet.dart | 3 +- .../lib/startup/launch_configuration.dart | 2 + .../appflowy_flutter/lib/startup/startup.dart | 9 +-- .../lib/startup/tasks/rust_sdk.dart | 3 + .../settings/appflowy_cloud_setting_bloc.dart | 3 + .../settings/appflowy_cloud_urls_bloc.dart | 24 ++++-- .../settings/supabase_cloud_urls_bloc.dart | 80 +++++++++++-------- .../settings/settings_dialog.dart | 2 +- .../settings/widgets/_restart_app_button.dart | 19 +++++ .../widgets/setting_appflowy_cloud.dart | 40 +++++----- .../settings/widgets/setting_cloud.dart | 45 ++++++----- .../settings/widgets/setting_local_cloud.dart | 11 ++- .../widgets/setting_supabase_cloud.dart | 11 ++- .../presentation/widgets/dialogs.dart | 14 ++-- frontend/appflowy_tauri/src-tauri/Cargo.lock | 44 +++++----- frontend/appflowy_tauri/src-tauri/Cargo.toml | 16 ++-- frontend/appflowy_tauri/src-tauri/src/init.rs | 2 + frontend/appflowy_web/wasm-libs/Cargo.lock | 55 +++++-------- frontend/appflowy_web/wasm-libs/Cargo.toml | 16 ++-- .../appflowy_web/wasm-libs/af-user/Cargo.toml | 4 +- .../appflowy_web/wasm-libs/af-wasm/Cargo.toml | 6 +- frontend/resources/translations/en.json | 5 +- frontend/rust-lib/Cargo.lock | 58 ++++++-------- frontend/rust-lib/Cargo.toml | 16 ++-- frontend/rust-lib/collab-integrate/Cargo.toml | 3 +- frontend/rust-lib/dart-ffi/src/env_serde.rs | 1 + frontend/rust-lib/dart-ffi/src/lib.rs | 1 + .../rust-lib/event-integration/Cargo.toml | 2 +- .../rust-lib/event-integration/src/lib.rs | 17 ++-- frontend/rust-lib/flowy-core/Cargo.toml | 1 - frontend/rust-lib/flowy-core/src/config.rs | 4 + frontend/rust-lib/flowy-database2/Cargo.toml | 3 +- frontend/rust-lib/flowy-document/Cargo.toml | 3 - frontend/rust-lib/flowy-encrypt/Cargo.toml | 5 +- frontend/rust-lib/flowy-folder/Cargo.toml | 1 - frontend/rust-lib/flowy-server/Cargo.toml | 1 - frontend/rust-lib/flowy-storage/Cargo.toml | 6 +- frontend/rust-lib/flowy-user-pub/Cargo.toml | 4 - .../rust-lib/flowy-user/src/event_handler.rs | 2 +- frontend/scripts/makefile/web.toml | 2 +- 44 files changed, 337 insertions(+), 277 deletions(-) diff --git a/frontend/appflowy_flutter/integration_test/util/base.dart b/frontend/appflowy_flutter/integration_test/util/base.dart index f128c6f3dc..11b0dcf1ba 100644 --- a/frontend/appflowy_flutter/integration_test/util/base.dart +++ b/frontend/appflowy_flutter/integration_test/util/base.dart @@ -11,7 +11,6 @@ import 'package:appflowy/user/application/auth/supabase_mock_auth_service.dart'; import 'package:appflowy/user/presentation/presentation.dart'; import 'package:appflowy/user/presentation/screens/sign_in_screen/widgets/widgets.dart'; import 'package:appflowy/workspace/application/settings/prelude.dart'; -import 'package:dartz/dartz.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/gestures.dart'; @@ -78,14 +77,14 @@ extension AppFlowyTestBase on WidgetTester { await useLocal(); break; case AuthenticatorType.supabase: - await useSupabaseCloud(); + await useTestSupabaseCloud(); getIt.unregister(); getIt.registerFactory( () => SupabaseMockAuthService(), ); break; case AuthenticatorType.appflowyCloudSelfHost: - await useAppFlowyCloud(); + await useTestSelfHostedAppFlowyCloud(); getIt.unregister(); getIt.registerFactory( () => AppFlowyCloudMockAuthService(email: email), @@ -249,20 +248,18 @@ extension AppFlowyFinderTestBase on CommonFinders { } Future useLocal() async { - await setAuthenticatorType(AuthenticatorType.local); + await useLocalServer(); } -Future useSupabaseCloud() async { - await setAuthenticatorType(AuthenticatorType.supabase); - await setSupbaseServer( - Some(TestEnv.supabaseUrl), - Some(TestEnv.supabaseAnonKey), +Future useTestSupabaseCloud() async { + await useSupabaseCloud( + url: TestEnv.supabaseUrl, + anonKey: TestEnv.supabaseAnonKey, ); } -Future useAppFlowyCloud() async { - await setAuthenticatorType(AuthenticatorType.appflowyCloudSelfHost); - await setAppFlowyCloudUrl(Some(TestEnv.afCloudUrl)); +Future useTestSelfHostedAppFlowyCloud() async { + await useSelfHostedAppFlowyCloudWithURL(TestEnv.afCloudUrl); } Future mockApplicationDataStorage({ diff --git a/frontend/appflowy_flutter/lib/env/backend_env.dart b/frontend/appflowy_flutter/lib/env/backend_env.dart index a4df1816f0..8d8b95b70c 100644 --- a/frontend/appflowy_flutter/lib/env/backend_env.dart +++ b/frontend/appflowy_flutter/lib/env/backend_env.dart @@ -7,6 +7,7 @@ part 'backend_env.g.dart'; class AppFlowyConfiguration { AppFlowyConfiguration({ required this.root, + required this.app_version, required this.custom_app_path, required this.origin_app_path, required this.device_id, @@ -20,6 +21,7 @@ class AppFlowyConfiguration { _$AppFlowyConfigurationFromJson(json); final String root; + final String app_version; final String custom_app_path; final String origin_app_path; final String device_id; diff --git a/frontend/appflowy_flutter/lib/env/cloud_env.dart b/frontend/appflowy_flutter/lib/env/cloud_env.dart index 67aecbfd08..066695025f 100644 --- a/frontend/appflowy_flutter/lib/env/cloud_env.dart +++ b/frontend/appflowy_flutter/lib/env/cloud_env.dart @@ -17,7 +17,7 @@ import 'package:dartz/dartz.dart'; /// - `CloudType.local` is stored as "0". /// - `CloudType.supabase` is stored as "1". /// - `CloudType.appflowyCloud` is stored as "2". -Future setAuthenticatorType(AuthenticatorType ty) async { +Future _setAuthenticatorType(AuthenticatorType ty) async { switch (ty) { case AuthenticatorType.local: await getIt().set(KVKeys.kCloudType, 0.toString()); @@ -54,7 +54,7 @@ Future getAuthenticatorType() async { final value = await getIt().get(KVKeys.kCloudType); if (value.isNone() && !integrationMode().isUnitTest) { // if the cloud type is not set, then set it to AppFlowy Cloud as default. - await setAuthenticatorType(AuthenticatorType.appflowyCloud); + await useAppFlowyBetaCloudWithURL(kAppflowyCloudUrl); return AuthenticatorType.appflowyCloud; } @@ -70,7 +70,7 @@ Future getAuthenticatorType() async { case "4": return AuthenticatorType.appflowyCloudDevelop; default: - await setAuthenticatorType(AuthenticatorType.appflowyCloud); + await useAppFlowyBetaCloudWithURL(kAppflowyCloudUrl); return AuthenticatorType.appflowyCloud; } } @@ -171,13 +171,35 @@ AuthenticatorType currentCloudType() { return getIt().authenticatorType; } -Future setAppFlowyCloudUrl(Option url) async { +Future _setAppFlowyCloudUrl(Option url) async { await url.fold( () => getIt().set(KVKeys.kAppflowyCloudBaseURL, ""), (s) => getIt().set(KVKeys.kAppflowyCloudBaseURL, s), ); } +Future useSelfHostedAppFlowyCloudWithURL(String url) async { + await _setAuthenticatorType(AuthenticatorType.appflowyCloudSelfHost); + await _setAppFlowyCloudUrl(Some(url)); +} + +Future useAppFlowyBetaCloudWithURL(String url) async { + await _setAuthenticatorType(AuthenticatorType.appflowyCloud); + await _setAppFlowyCloudUrl(Some(url)); +} + +Future useLocalServer() async { + await _setAuthenticatorType(AuthenticatorType.local); +} + +Future useSupabaseCloud({ + required String url, + required String anonKey, +}) async { + await _setAuthenticatorType(AuthenticatorType.supabase); + await setSupbaseServer(Some(url), Some(anonKey)); +} + /// Use getIt() to get the shared environment. class AppFlowyCloudSharedEnv { AppFlowyCloudSharedEnv({ @@ -198,12 +220,13 @@ class AppFlowyCloudSharedEnv { // Use the custom cloud configuration. var authenticatorType = await getAuthenticatorType(); - final appflowyCloudConfig = authenticatorType.isLocal - ? AppFlowyCloudConfiguration.defaultConfig() - : await getAppFlowyCloudConfig(authenticatorType); - final supabaseCloudConfig = authenticatorType.isLocal - ? SupabaseConfiguration.defaultConfig() - : await getSupabaseCloudConfig(); + final appflowyCloudConfig = authenticatorType.isAppFlowyCloudEnabled + ? await getAppFlowyCloudConfig(authenticatorType) + : AppFlowyCloudConfiguration.defaultConfig(); + + final supabaseCloudConfig = authenticatorType.isSupabaseEnabled + ? await getSupabaseCloudConfig() + : SupabaseConfiguration.defaultConfig(); // In the backend, the value '2' represents the use of AppFlowy Cloud. However, in the frontend, // we distinguish between [AuthenticatorType.appflowyCloudSelfHost] and [AuthenticatorType.appflowyCloud]. @@ -283,7 +306,7 @@ Future getAppFlowyCloudUrl() async { final result = await getIt().get(KVKeys.kAppflowyCloudBaseURL); return result.fold( - () => "https://beta.appflowy.cloud", + () => kAppflowyCloudUrl, (url) => url, ); } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/cloud/appflowy_cloud_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/cloud/appflowy_cloud_page.dart index acaa515a8a..10a1b5097a 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/cloud/appflowy_cloud_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/cloud/appflowy_cloud_page.dart @@ -19,7 +19,7 @@ class AppFlowyCloudPage extends StatelessWidget { body: Padding( padding: const EdgeInsets.all(20.0), child: SettingCloud( - didResetServerUrl: () async { + restartAppFlowy: () async { await runAppFlowy(); }, ), diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/self_host/self_host_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/self_host/self_host_bottom_sheet.dart index 66fcb196f3..840306f34a 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/self_host/self_host_bottom_sheet.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/self_host/self_host_bottom_sheet.dart @@ -3,7 +3,6 @@ import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/application/settings/appflowy_cloud_urls_bloc.dart'; import 'package:appflowy_backend/log.dart'; -import 'package:dartz/dartz.dart' show Some; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; @@ -99,7 +98,7 @@ class _SelfHostUrlBottomSheetState extends State { if (value.isNotEmpty) { validateUrl(value).fold( (url) async { - await setAppFlowyCloudUrl(Some(url)); + await useSelfHostedAppFlowyCloudWithURL(url); await runAppFlowy(); }, (err) => Log.error(err), diff --git a/frontend/appflowy_flutter/lib/startup/launch_configuration.dart b/frontend/appflowy_flutter/lib/startup/launch_configuration.dart index c4c34a60b8..da1a64db3e 100644 --- a/frontend/appflowy_flutter/lib/startup/launch_configuration.dart +++ b/frontend/appflowy_flutter/lib/startup/launch_configuration.dart @@ -1,11 +1,13 @@ class LaunchConfiguration { const LaunchConfiguration({ this.isAnon = false, + required this.version, required this.rustEnvs, }); // APP will automatically register after launching. final bool isAnon; + final String version; // final Map rustEnvs; } diff --git a/frontend/appflowy_flutter/lib/startup/startup.dart b/frontend/appflowy_flutter/lib/startup/startup.dart index b9f28f606c..e7422ded8f 100644 --- a/frontend/appflowy_flutter/lib/startup/startup.dart +++ b/frontend/appflowy_flutter/lib/startup/startup.dart @@ -81,14 +81,13 @@ class FlowyRunner { final config = LaunchConfiguration( isAnon: isAnon, + // Unit test can't use the package_info_plus plugin + version: mode.isUnitTest + ? '1.0.0' + : await PackageInfo.fromPlatform().then((value) => value.version), rustEnvs: rustEnvsBuilder?.call() ?? {}, ); - if (!mode.isUnitTest) { - // Unit test can't use the package_info_plus plugin - config.rustEnvs["APP_VERSION"] = - await PackageInfo.fromPlatform().then((value) => value.version); - } // Specify the env await initGetIt(getIt, mode, f, config); await didInitGetItCallback?.call(); diff --git a/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart b/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart index 6899c4d373..bb39ac2703 100644 --- a/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart +++ b/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart @@ -31,6 +31,7 @@ class InitRustSDKTask extends LaunchTask { // Pass the environment variables to the Rust SDK final env = _makeAppFlowyConfiguration( root.path, + context.config.version, dir.path, applicationPath.path, deviceId, @@ -45,6 +46,7 @@ class InitRustSDKTask extends LaunchTask { AppFlowyConfiguration _makeAppFlowyConfiguration( String root, + String appVersion, String customAppPath, String originAppPath, String deviceId, { @@ -53,6 +55,7 @@ AppFlowyConfiguration _makeAppFlowyConfiguration( final env = getIt(); return AppFlowyConfiguration( root: root, + app_version: appVersion, custom_app_path: customAppPath, origin_app_path: originAppPath, device_id: deviceId, diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart index e115303cc8..b94b52fa48 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart @@ -52,6 +52,7 @@ class AppFlowyCloudSettingBloc emit( state.copyWith( setting: setting, + showRestartHint: setting.serverUrl.isNotEmpty, ), ); }, @@ -75,11 +76,13 @@ class AppFlowyCloudSettingEvent with _$AppFlowyCloudSettingEvent { class AppFlowyCloudSettingState with _$AppFlowyCloudSettingState { const factory AppFlowyCloudSettingState({ required CloudSettingPB setting, + required bool showRestartHint, }) = _AppFlowyCloudSettingState; factory AppFlowyCloudSettingState.initial(CloudSettingPB setting) => AppFlowyCloudSettingState( setting: setting, + showRestartHint: setting.serverUrl.isNotEmpty, ); } diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart index 7d425bcb47..72b91f011c 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart @@ -16,24 +16,29 @@ class AppFlowyCloudURLsBloc await event.when( initial: () async {}, updateServerUrl: (url) { - emit(state.copyWith(updatedServerUrl: url)); + emit( + state.copyWith( + updatedServerUrl: url, + urlError: none(), + showRestartHint: url.isNotEmpty, + ), + ); }, confirmUpdate: () async { if (state.updatedServerUrl.isEmpty) { emit( state.copyWith( updatedServerUrl: "", - urlError: none(), - restartApp: true, + urlError: Some( + LocaleKeys.settings_menu_appFlowyCloudUrlCanNotBeEmpty.tr(), + ), + restartApp: false, ), ); - await setAppFlowyCloudUrl(none()); } else { validateUrl(state.updatedServerUrl).fold( (url) async { - if (state.config.base_url != url) { - await setAppFlowyCloudUrl(Some(url)); - } + await useSelfHostedAppFlowyCloudWithURL(url); add(const AppFlowyCloudURLsEvent.didSaveConfig()); }, (err) => emit(state.copyWith(urlError: Some(err))), @@ -69,6 +74,7 @@ class AppFlowyCloudURLsState with _$AppFlowyCloudURLsState { required String updatedServerUrl, required Option urlError, required bool restartApp, + required bool showRestartHint, }) = _AppFlowyCloudURLsState; factory AppFlowyCloudURLsState.initial() => AppFlowyCloudURLsState( @@ -76,6 +82,10 @@ class AppFlowyCloudURLsState with _$AppFlowyCloudURLsState { urlError: none(), updatedServerUrl: getIt().appflowyCloudConfig.base_url, + showRestartHint: getIt() + .appflowyCloudConfig + .base_url + .isNotEmpty, restartApp: false, ); } diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart index 0145ea93d0..b87e0189ab 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart @@ -19,49 +19,63 @@ class SupabaseCloudURLsBloc on((event, emit) async { await event.when( updateUrl: (String url) { - emit(state.copyWith(updatedUrl: url)); + emit( + state.copyWith( + updatedUrl: url, + showRestartHint: url.isNotEmpty && state.upatedAnonKey.isNotEmpty, + urlError: none(), + ), + ); }, updateAnonKey: (String anonKey) { - emit(state.copyWith(upatedAnonKey: anonKey)); + emit( + state.copyWith( + upatedAnonKey: anonKey, + showRestartHint: + anonKey.isNotEmpty && state.updatedUrl.isNotEmpty, + anonKeyError: none(), + ), + ); }, confirmUpdate: () async { if (state.updatedUrl.isEmpty) { emit( state.copyWith( - urlError: none(), + urlError: Some( + LocaleKeys.settings_menu_cloudSupabaseUrlCanNotBeEmpty.tr(), + ), anonKeyError: none(), - restartApp: true, + restartApp: false, ), ); - await setSupbaseServer(none(), none()); - } else { - // The anon key can't be empty if the url is not empty. - if (state.upatedAnonKey.isEmpty) { - emit( - state.copyWith( - urlError: none(), - anonKeyError: some( - LocaleKeys.settings_menu_cloudSupabaseAnonKeyCanNotBeEmpty - .tr(), - ), - restartApp: false, - ), - ); - return; - } - - validateUrl(state.updatedUrl).fold( - (error) => emit(state.copyWith(urlError: Some(error))), - (_) async { - await setSupbaseServer( - Some(state.updatedUrl), - Some(state.upatedAnonKey), - ); - - add(const SupabaseCloudURLsEvent.didSaveConfig()); - }, - ); + return; } + + if (state.upatedAnonKey.isEmpty) { + emit( + state.copyWith( + urlError: none(), + anonKeyError: Some( + LocaleKeys.settings_menu_cloudSupabaseAnonKeyCanNotBeEmpty + .tr(), + ), + restartApp: false, + ), + ); + return; + } + + validateUrl(state.updatedUrl).fold( + (error) => emit(state.copyWith(urlError: Some(error))), + (_) async { + await useSupabaseCloud( + url: state.updatedUrl, + anonKey: state.upatedAnonKey, + ); + + add(const SupabaseCloudURLsEvent.didSaveConfig()); + }, + ); }, didSaveConfig: () { emit( @@ -99,6 +113,7 @@ class SupabaseCloudURLsState with _$SupabaseCloudURLsState { required Option urlError, required Option anonKeyError, required bool restartApp, + required bool showRestartHint, }) = _SupabaseCloudURLsState; factory SupabaseCloudURLsState.initial() { @@ -109,6 +124,7 @@ class SupabaseCloudURLsState with _$SupabaseCloudURLsState { urlError: none(), anonKeyError: none(), restartApp: false, + showRestartHint: config.url.isNotEmpty && config.anon_key.isNotEmpty, config: config, ); } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart index f7ad239e97..c57378ce71 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart @@ -106,7 +106,7 @@ class SettingsDialog extends StatelessWidget { return const SettingsNotificationsView(); case SettingsPage.cloud: return SettingCloud( - didResetServerUrl: () => restartApp(), + restartAppFlowy: () => restartApp(), ); case SettingsPage.shortcuts: return const SettingsCustomizeShortcutsWrapper(); diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/_restart_app_button.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/_restart_app_button.dart index 6119d233db..17f1582c90 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/_restart_app_button.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/_restart_app_button.dart @@ -8,13 +8,32 @@ import 'package:flutter/material.dart'; class RestartButton extends StatelessWidget { const RestartButton({ super.key, + required this.showRestartHint, required this.onClick, }); + final bool showRestartHint; final VoidCallback onClick; @override Widget build(BuildContext context) { + final List children = [_buildRestartButton()]; + if (showRestartHint) { + children.add( + Padding( + padding: const EdgeInsets.only(top: 10), + child: FlowyText( + LocaleKeys.settings_menu_restartAppTip.tr(), + maxLines: null, + ), + ), + ); + } + + return Column(children: children); + } + + Widget _buildRestartButton() { if (PlatformExtension.isDesktopOrWeb) { return Row( children: [ diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart index 2e89ef02d9..ca4083c663 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart @@ -9,7 +9,7 @@ import 'package:appflowy_backend/dispatch/dispatch.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/user_setting.pb.dart'; -import 'package:dartz/dartz.dart' show Either, Some; +import 'package:dartz/dartz.dart' show Either; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra/size.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; @@ -58,23 +58,27 @@ class AppFlowyCloudViewSetting extends StatelessWidget { return BlocProvider( create: (context) => AppFlowyCloudSettingBloc(setting) ..add(const AppFlowyCloudSettingEvent.initial()), - child: Column( - children: [ - const AppFlowyCloudEnableSync(), - const VSpace(12), - RestartButton( - onClick: () { - NavigatorAlertDialog( - title: LocaleKeys.settings_menu_restartAppTip.tr(), - confirm: () async { - await setAppFlowyCloudUrl(Some(serverURL)); - await setAuthenticatorType(authenticatorType); - restartAppFlowy(); + child: BlocBuilder( + builder: (context, state) { + return Column( + children: [ + const AppFlowyCloudEnableSync(), + const VSpace(12), + RestartButton( + onClick: () { + NavigatorAlertDialog( + title: LocaleKeys.settings_menu_restartAppTip.tr(), + confirm: () async { + await useAppFlowyBetaCloudWithURL(serverURL); + restartAppFlowy(); + }, + ).show(context); }, - ).show(context); - }, - ), - ], + showRestartHint: state.showRestartHint, + ), + ], + ); + }, ), ); } @@ -153,7 +157,6 @@ class AppFlowyCloudURLs extends StatelessWidget { child: BlocListener( listener: (context, state) async { if (state.restartApp) { - await setAuthenticatorType(AuthenticatorType.appflowyCloudSelfHost); restartAppFlowy(); } }, @@ -186,6 +189,7 @@ class AppFlowyCloudURLs extends StatelessWidget { }, ).show(context); }, + showRestartHint: state.showRestartHint, ), ], ); diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart index ef9ba39482..78f21c4485 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart @@ -7,6 +7,7 @@ import 'package:appflowy/mobile/presentation/widgets/widgets.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/application/settings/cloud_setting_bloc.dart'; import 'package:appflowy/workspace/presentation/settings/widgets/setting_local_cloud.dart'; +import 'package:appflowy/workspace/presentation/widgets/dialogs.dart'; import 'package:appflowy_editor/appflowy_editor.dart'; import 'package:appflowy_popover/appflowy_popover.dart'; import 'package:collection/collection.dart'; @@ -20,9 +21,9 @@ import 'setting_appflowy_cloud.dart'; import 'setting_supabase_cloud.dart'; class SettingCloud extends StatelessWidget { - const SettingCloud({required this.didResetServerUrl, super.key}); + const SettingCloud({required this.restartAppFlowy, super.key}); - final VoidCallback didResetServerUrl; + final VoidCallback restartAppFlowy; @override Widget build(BuildContext context) { @@ -46,19 +47,15 @@ class SettingCloud extends StatelessWidget { LocaleKeys.settings_menu_cloudServerType.tr(), ), ), - Tooltip( - message: LocaleKeys.settings_menu_cloudServerTypeTip - .tr(), - child: CloudTypeSwitcher( - cloudType: state.cloudType, - onSelected: (newCloudType) { - context.read().add( - CloudSettingEvent.updateCloudType( - newCloudType, - ), - ); - }, - ), + CloudTypeSwitcher( + cloudType: state.cloudType, + onSelected: (newCloudType) { + context.read().add( + CloudSettingEvent.updateCloudType( + newCloudType, + ), + ); + }, ), ], ), @@ -82,25 +79,25 @@ class SettingCloud extends StatelessWidget { switch (cloudType) { case AuthenticatorType.local: return SettingLocalCloud( - didResetServerUrl: didResetServerUrl, + restartAppFlowy: restartAppFlowy, ); case AuthenticatorType.supabase: return SettingSupabaseCloudView( - didResetServerUrl: didResetServerUrl, + restartAppFlowy: restartAppFlowy, ); case AuthenticatorType.appflowyCloud: return AppFlowyCloudViewSetting( - restartAppFlowy: didResetServerUrl, + restartAppFlowy: restartAppFlowy, ); case AuthenticatorType.appflowyCloudSelfHost: return CustomAppFlowyCloudView( - restartAppFlowy: didResetServerUrl, + restartAppFlowy: restartAppFlowy, ); case AuthenticatorType.appflowyCloudDevelop: return AppFlowyCloudViewSetting( serverURL: "http://localhost", authenticatorType: AuthenticatorType.appflowyCloudDevelop, - restartAppFlowy: didResetServerUrl, + restartAppFlowy: restartAppFlowy, ); } } @@ -215,7 +212,13 @@ class CloudTypeItem extends StatelessWidget { : null, onTap: () { if (currentCloudtype != cloudType) { - onSelected(cloudType); + NavigatorAlertDialog( + title: LocaleKeys.settings_menu_changeServerTip.tr(), + confirm: () async { + onSelected(cloudType); + }, + hideCancleButton: true, + ).show(context); } PopoverContainer.of(context).close(); }, diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_local_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_local_cloud.dart index 365933b7b4..68680c0dd0 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_local_cloud.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_local_cloud.dart @@ -6,14 +6,15 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; class SettingLocalCloud extends StatelessWidget { - const SettingLocalCloud({super.key, required this.didResetServerUrl}); + const SettingLocalCloud({super.key, required this.restartAppFlowy}); - final VoidCallback didResetServerUrl; + final VoidCallback restartAppFlowy; @override Widget build(BuildContext context) { return RestartButton( onClick: () => onPressed(context), + showRestartHint: true, ); } @@ -21,10 +22,8 @@ class SettingLocalCloud extends StatelessWidget { NavigatorAlertDialog( title: LocaleKeys.settings_menu_restartAppTip.tr(), confirm: () async { - await setAuthenticatorType( - AuthenticatorType.local, - ); - didResetServerUrl(); + await useLocalServer(); + restartAppFlowy(); }, ).show(context); } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_supabase_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_supabase_cloud.dart index 6d740380ed..56a59aa58d 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_supabase_cloud.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_supabase_cloud.dart @@ -1,4 +1,3 @@ -import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/workspace/application/settings/supabase_cloud_setting_bloc.dart'; import 'package:appflowy/workspace/application/settings/supabase_cloud_urls_bloc.dart'; @@ -22,9 +21,9 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:url_launcher/url_launcher.dart'; class SettingSupabaseCloudView extends StatelessWidget { - const SettingSupabaseCloudView({required this.didResetServerUrl, super.key}); + const SettingSupabaseCloudView({required this.restartAppFlowy, super.key}); - final VoidCallback didResetServerUrl; + final VoidCallback restartAppFlowy; @override Widget build(BuildContext context) { @@ -55,7 +54,7 @@ class SettingSupabaseCloudView extends StatelessWidget { const VSpace(40), const SupabaseSelfhostTip(), SupabaseCloudURLs( - didUpdateUrls: didResetServerUrl, + didUpdateUrls: restartAppFlowy, ), ], ), @@ -87,7 +86,6 @@ class SupabaseCloudURLs extends StatelessWidget { child: BlocListener( listener: (context, state) async { if (state.restartApp) { - await setAuthenticatorType(AuthenticatorType.supabase); didUpdateUrls(); } }, @@ -119,7 +117,8 @@ class SupabaseCloudURLs extends StatelessWidget { ), const VSpace(20), RestartButton( - onClick: () => _restartApp, + onClick: () => _restartApp(context), + showRestartHint: state.showRestartHint, ), ], ); diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart index 4fcec48065..24305ad7e3 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart @@ -100,11 +100,13 @@ class NavigatorAlertDialog extends StatefulWidget { required this.title, this.cancel, this.confirm, + this.hideCancleButton = false, }); final String title; final void Function()? cancel; final void Function()? confirm; + final bool hideCancleButton; @override State createState() => _CreateFlowyAlertDialog(); @@ -145,10 +147,12 @@ class _CreateFlowyAlertDialog extends State { widget.confirm?.call(); Navigator.of(context).pop(); }, - onCancelPressed: () { - widget.cancel?.call(); - Navigator.of(context).pop(); - }, + onCancelPressed: widget.hideCancleButton + ? null + : () { + widget.cancel?.call(); + Navigator.of(context).pop(); + }, ), ], ], @@ -249,7 +253,7 @@ class OkCancelButton extends StatelessWidget { onPressed: onCancelPressed, mode: mode, ), - HSpace(Insets.m), + if (onCancelPressed != null) HSpace(Insets.m), if (onOkPressed != null) PrimaryTextButton( okTitle ?? LocaleKeys.button_ok.tr(), diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.lock b/frontend/appflowy_tauri/src-tauri/Cargo.lock index 63734c7d0c..a107bc046e 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=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" 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=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "again", "anyhow", @@ -816,7 +816,7 @@ dependencies = [ [[package]] name = "collab" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "async-trait", @@ -838,7 +838,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "async-trait", @@ -846,6 +846,7 @@ dependencies = [ "collab", "collab-entity", "collab-plugins", + "getrandom 0.2.10", "js-sys", "lazy_static", "lru", @@ -866,11 +867,12 @@ dependencies = [ [[package]] name = "collab-document" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "collab", "collab-entity", + "getrandom 0.2.10", "nanoid", "parking_lot 0.12.1", "serde", @@ -884,11 +886,12 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "bytes", "collab", + "getrandom 0.2.10", "serde", "serde_json", "serde_repr", @@ -898,12 +901,13 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "chrono", "collab", "collab-entity", + "getrandom 0.2.10", "parking_lot 0.12.1", "serde", "serde_json", @@ -934,7 +938,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "async-stream", @@ -946,6 +950,7 @@ dependencies = [ "collab-entity", "futures", "futures-util", + "getrandom 0.2.10", "indexed_db_futures", "js-sys", "lazy_static", @@ -972,11 +977,12 @@ dependencies = [ [[package]] name = "collab-user" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "collab", "collab-entity", + "getrandom 0.2.10", "parking_lot 0.12.1", "serde", "serde_json", @@ -1194,7 +1200,7 @@ dependencies = [ "cssparser-macros", "dtoa-short", "itoa 1.0.6", - "phf 0.8.0", + "phf 0.11.2", "smallvec", ] @@ -1305,7 +1311,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "database-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -2568,7 +2574,7 @@ dependencies = [ [[package]] name = "gotrue" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "futures-util", @@ -2585,7 +2591,7 @@ dependencies = [ [[package]] name = "gotrue-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -3022,7 +3028,7 @@ dependencies = [ [[package]] name = "infra" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "reqwest", @@ -4700,7 +4706,7 @@ dependencies = [ [[package]] name = "realtime-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "bincode", @@ -4723,7 +4729,7 @@ dependencies = [ [[package]] name = "realtime-protocol" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "bincode", @@ -5371,7 +5377,7 @@ dependencies = [ [[package]] name = "shared-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -6851,7 +6857,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websocket" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "futures-channel", "futures-util", @@ -7251,7 +7257,7 @@ dependencies = [ [[package]] name = "workspace-template" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "async-trait", diff --git a/frontend/appflowy_tauri/src-tauri/Cargo.toml b/frontend/appflowy_tauri/src-tauri/Cargo.toml index 9aa9052e04..b16784524a 100644 --- a/frontend/appflowy_tauri/src-tauri/Cargo.toml +++ b/frontend/appflowy_tauri/src-tauri/Cargo.toml @@ -62,7 +62,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 = "69c69f6474eaa531fd822e9353cc5955b98e45eb" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "199452d3b77a352c03810d4146b39d76bab0313c" } # Please use the following script to update collab. # Working directory: frontend # @@ -72,10 +72,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "69c # To switch to the local path, run: # scripts/tool/update_collab_source.sh # ⚠️⚠️⚠️️ -collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } +collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } diff --git a/frontend/appflowy_tauri/src-tauri/src/init.rs b/frontend/appflowy_tauri/src-tauri/src/init.rs index 0fa40f4997..b226251b59 100644 --- a/frontend/appflowy_tauri/src-tauri/src/init.rs +++ b/frontend/appflowy_tauri/src-tauri/src/init.rs @@ -17,7 +17,9 @@ pub fn init_flowy_core() -> AppFlowyCore { let device_id = uuid::Uuid::new_v4().to_string(); std::env::set_var("RUST_LOG", "trace"); + // TODO(nathan): pass the real version here let config = AppFlowyCoreConfig::new( + "1.0.0".to_string(), custom_application_path, application_path, device_id, diff --git a/frontend/appflowy_web/wasm-libs/Cargo.lock b/frontend/appflowy_web/wasm-libs/Cargo.lock index 4eae41bedc..8cc4e86da7 100644 --- a/frontend/appflowy_web/wasm-libs/Cargo.lock +++ b/frontend/appflowy_web/wasm-libs/Cargo.lock @@ -216,7 +216,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "app-error" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "bincode", @@ -534,7 +534,7 @@ dependencies = [ [[package]] name = "client-api" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "again", "anyhow", @@ -605,7 +605,7 @@ dependencies = [ [[package]] name = "collab" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "async-trait", @@ -627,7 +627,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "collab", @@ -646,11 +646,12 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "bytes", "collab", + "getrandom 0.2.12", "serde", "serde_json", "serde_repr", @@ -660,12 +661,13 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "chrono", "collab", "collab-entity", + "getrandom 0.2.12", "parking_lot 0.12.1", "serde", "serde_json", @@ -696,7 +698,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "async-stream", @@ -734,11 +736,12 @@ dependencies = [ [[package]] name = "collab-user" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "collab", "collab-entity", + "getrandom 0.2.12", "parking_lot 0.12.1", "serde", "serde_json", @@ -885,7 +888,7 @@ dependencies = [ "cssparser-macros", "dtoa-short", "itoa", - "phf 0.11.2", + "phf 0.8.0", "smallvec", ] @@ -930,7 +933,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "database-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -1643,7 +1646,7 @@ dependencies = [ [[package]] name = "gotrue" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "futures-util", @@ -1660,7 +1663,7 @@ dependencies = [ [[package]] name = "gotrue-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -1976,7 +1979,7 @@ dependencies = [ [[package]] name = "infra" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "reqwest", @@ -2678,7 +2681,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ - "phf_macros 0.8.0", + "phf_macros", "phf_shared 0.8.0", "proc-macro-hack", ] @@ -2698,7 +2701,6 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ - "phf_macros 0.11.2", "phf_shared 0.11.2", ] @@ -2766,19 +2768,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "phf_shared" version = "0.8.0" @@ -3182,7 +3171,7 @@ dependencies = [ [[package]] name = "realtime-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "bincode", @@ -3205,7 +3194,7 @@ dependencies = [ [[package]] name = "realtime-protocol" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "bincode", @@ -3652,7 +3641,7 @@ dependencies = [ [[package]] name = "shared-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -4594,7 +4583,7 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "websocket" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "futures-channel", "futures-util", @@ -4889,4 +4878,4 @@ dependencies = [ [[patch.unused]] name = "collab-database" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" diff --git a/frontend/appflowy_web/wasm-libs/Cargo.toml b/frontend/appflowy_web/wasm-libs/Cargo.toml index 2c27eeafd0..2c20f888ac 100644 --- a/frontend/appflowy_web/wasm-libs/Cargo.toml +++ b/frontend/appflowy_web/wasm-libs/Cargo.toml @@ -62,7 +62,7 @@ lto = 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 = "69c69f6474eaa531fd822e9353cc5955b98e45eb" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "199452d3b77a352c03810d4146b39d76bab0313c" } # Please use the following script to update collab. # Working directory: frontend # @@ -72,10 +72,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "69c # To switch to the local path, run: # scripts/tool/update_collab_source.sh # ⚠️⚠️⚠️️ -collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } +collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } diff --git a/frontend/appflowy_web/wasm-libs/af-user/Cargo.toml b/frontend/appflowy_web/wasm-libs/af-user/Cargo.toml index 6f2694acb5..2d7cb31980 100644 --- a/frontend/appflowy_web/wasm-libs/af-user/Cargo.toml +++ b/frontend/appflowy_web/wasm-libs/af-user/Cargo.toml @@ -16,10 +16,10 @@ flowy-user-pub = { workspace = true } strum_macros = "0.25.2" tracing.workspace = true lib-infra = { workspace = true } -collab = { workspace = true, features = ["wasm_build", "async-plugin"] } +collab = { workspace = true, features = ["async-plugin"] } collab-entity.workspace = true collab-user.workspace = true -collab-integrate = { workspace = true, features = ["enable_wasm"] } +collab-integrate = { workspace = true } protobuf.workspace = true bytes.workspace = true anyhow.workspace = true diff --git a/frontend/appflowy_web/wasm-libs/af-wasm/Cargo.toml b/frontend/appflowy_web/wasm-libs/af-wasm/Cargo.toml index 8e2e4ff2ed..4f1781dd05 100644 --- a/frontend/appflowy_web/wasm-libs/af-wasm/Cargo.toml +++ b/frontend/appflowy_web/wasm-libs/af-wasm/Cargo.toml @@ -16,18 +16,18 @@ tracing.workspace = true tracing-core = { version = "0.1.32" } tracing-wasm = "0.2.1" serde.workspace = true -collab-integrate = { workspace = true, features = ["enable_wasm"] } +collab-integrate = { workspace = true } tokio-stream.workspace = true af-user.workspace = true flowy-notification = { workspace = true, features = ["web_ts"] } flowy-user-pub = { workspace = true } -flowy-server = { workspace = true, features = ["enable_wasm"] } +flowy-server = { workspace = true } flowy-server-pub = { workspace = true } flowy-error = { workspace = true, features = ["impl_from_dispatch_error", "web_ts"] } flowy-document = { workspace = true, features = ["web_ts"] } lib-infra = { workspace = true } -collab = { workspace = true, features = ["wasm_build", "async-plugin"] } +collab = { workspace = true, features = ["async-plugin"] } web-sys = "0.3" wasm-bindgen-futures.workspace = true uuid.workspace = true diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.json index 60d989cb67..7d6a1a158b 100644 --- a/frontend/resources/translations/en.json +++ b/frontend/resources/translations/en.json @@ -280,10 +280,12 @@ "cloudLocal": "Local", "cloudSupabase": "Supabase", "cloudSupabaseUrl": "Supabase URL", + "cloudSupabaseUrlCanNotBeEmpty": "The supabase url can't be empty", "cloudSupabaseAnonKey": "Supabase anon key", - "cloudSupabaseAnonKeyCanNotBeEmpty": "The anon key can't be empty if the supabase url is not empty", + "cloudSupabaseAnonKeyCanNotBeEmpty": "The anon key can't be empty", "cloudAppFlowy": "AppFlowy Cloud Beta", "cloudAppFlowySelfHost": "AppFlowy Cloud Self-hosted", + "appFlowyCloudUrlCanNotBeEmpty": "The cloud url can't be empty", "clickToCopy": "Click to copy", "selfHostStart": "If you don't have a server, please refer to the", "selfHostContent": "document", @@ -293,6 +295,7 @@ "cloudWSURLHint": "Input the websocket address of your server", "restartApp": "Restart", "restartAppTip": "Restart the application for the changes to take effect. Please note that this might log out your current account", + "changeServerTip": "After changing the server, you must click the restart button for the changes to take effect", "enableEncryptPrompt": "Activate encryption to secure your data with this secret. Store it safely; once enabled, it can't be turned off. If lost, your data becomes irretrievable. Click to copy", "inputEncryptPrompt": "Please enter your encryption secret for", "clickToCopySecret": "Click to copy secret", diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock index 07cc1a8f34..d9c755fa9f 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=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" 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=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "again", "anyhow", @@ -744,7 +744,7 @@ dependencies = [ [[package]] name = "collab" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "async-trait", @@ -766,7 +766,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "async-trait", @@ -774,6 +774,7 @@ dependencies = [ "collab", "collab-entity", "collab-plugins", + "getrandom 0.2.10", "js-sys", "lazy_static", "lru", @@ -794,7 +795,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "collab", @@ -813,11 +814,12 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "bytes", "collab", + "getrandom 0.2.10", "serde", "serde_json", "serde_repr", @@ -827,12 +829,13 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "chrono", "collab", "collab-entity", + "getrandom 0.2.10", "parking_lot 0.12.1", "serde", "serde_json", @@ -863,7 +866,7 @@ dependencies = [ [[package]] name = "collab-plugins" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "async-stream", @@ -902,11 +905,12 @@ dependencies = [ [[package]] name = "collab-user" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=e3620ae820e921955b9c3ca3ffee24aad544f972#e3620ae820e921955b9c3ca3ffee24aad544f972" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=d00b477a9b844d86b5caeff573ca395dc5bf7198#d00b477a9b844d86b5caeff573ca395dc5bf7198" dependencies = [ "anyhow", "collab", "collab-entity", + "getrandom 0.2.10", "parking_lot 0.12.1", "serde", "serde_json", @@ -1098,7 +1102,7 @@ dependencies = [ "cssparser-macros", "dtoa-short", "itoa", - "phf 0.11.2", + "phf 0.8.0", "smallvec", ] @@ -1231,7 +1235,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "database-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -2400,7 +2404,7 @@ dependencies = [ [[package]] name = "gotrue" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "futures-util", @@ -2417,7 +2421,7 @@ dependencies = [ [[package]] name = "gotrue-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -2793,7 +2797,7 @@ dependencies = [ [[package]] name = "infra" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "reqwest", @@ -3583,7 +3587,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ - "phf_macros 0.8.0", + "phf_macros", "phf_shared 0.8.0", "proc-macro-hack", ] @@ -3603,7 +3607,6 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ - "phf_macros 0.11.2", "phf_shared 0.11.2", ] @@ -3671,19 +3674,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", - "proc-macro2", - "quote", - "syn 2.0.47", -] - [[package]] name = "phf_shared" version = "0.8.0" @@ -4237,7 +4227,7 @@ dependencies = [ [[package]] name = "realtime-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "bincode", @@ -4260,7 +4250,7 @@ dependencies = [ [[package]] name = "realtime-protocol" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "bincode", @@ -4848,7 +4838,7 @@ dependencies = [ [[package]] name = "shared-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "app-error", @@ -6023,7 +6013,7 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "websocket" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "futures-channel", "futures-util", @@ -6244,7 +6234,7 @@ dependencies = [ [[package]] name = "workspace-template" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=69c69f6474eaa531fd822e9353cc5955b98e45eb#69c69f6474eaa531fd822e9353cc5955b98e45eb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=199452d3b77a352c03810d4146b39d76bab0313c#199452d3b77a352c03810d4146b39d76bab0313c" dependencies = [ "anyhow", "async-trait", diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml index 9bc2dcca26..4b53bbbadf 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 = "69c69f6474eaa531fd822e9353cc5955b98e45eb" } +client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "199452d3b77a352c03810d4146b39d76bab0313c" } # Please use the following script to update collab. # Working directory: frontend # @@ -115,10 +115,10 @@ client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "69c # To switch to the local path, run: # scripts/tool/update_collab_source.sh # ⚠️⚠️⚠️️ -collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } -collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "e3620ae820e921955b9c3ca3ffee24aad544f972" } +collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-plugins = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } +collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d00b477a9b844d86b5caeff573ca395dc5bf7198" } diff --git a/frontend/rust-lib/collab-integrate/Cargo.toml b/frontend/rust-lib/collab-integrate/Cargo.toml index c96b0dfa53..19f5e879ab 100644 --- a/frontend/rust-lib/collab-integrate/Cargo.toml +++ b/frontend/rust-lib/collab-integrate/Cargo.toml @@ -21,5 +21,4 @@ tokio = { workspace = true, features = ["sync"]} lib-infra = { workspace = true } [features] -default = [] -enable_wasm = ["collab-plugins/wasm_build"] \ No newline at end of file +default = [] \ No newline at end of file diff --git a/frontend/rust-lib/dart-ffi/src/env_serde.rs b/frontend/rust-lib/dart-ffi/src/env_serde.rs index 055ea37cf5..48a3e13422 100644 --- a/frontend/rust-lib/dart-ffi/src/env_serde.rs +++ b/frontend/rust-lib/dart-ffi/src/env_serde.rs @@ -10,6 +10,7 @@ use flowy_server_pub::AuthenticatorType; pub struct AppFlowyDartConfiguration { /// The root path of the application pub root: String, + pub app_version: String, /// This path will be used to store the user data pub custom_app_path: String, pub origin_app_path: String, diff --git a/frontend/rust-lib/dart-ffi/src/lib.rs b/frontend/rust-lib/dart-ffi/src/lib.rs index 1640d91bb3..6f3c06064f 100644 --- a/frontend/rust-lib/dart-ffi/src/lib.rs +++ b/frontend/rust-lib/dart-ffi/src/lib.rs @@ -64,6 +64,7 @@ pub extern "C" fn init_sdk(data: *mut c_char) -> i64 { let log_crates = vec!["flowy-ffi".to_string()]; let config = AppFlowyCoreConfig::new( + configuration.app_version, configuration.custom_app_path, configuration.origin_app_path, configuration.device_id, diff --git a/frontend/rust-lib/event-integration/Cargo.toml b/frontend/rust-lib/event-integration/Cargo.toml index d79ea67bc9..ef8275004f 100644 --- a/frontend/rust-lib/event-integration/Cargo.toml +++ b/frontend/rust-lib/event-integration/Cargo.toml @@ -56,4 +56,4 @@ zip = "0.6.6" default = ["supabase_cloud_test"] dart = ["flowy-core/dart"] supabase_cloud_test = [] -single_thread = ["flowy-core/enable_wasm"] \ No newline at end of file +single_thread = [] \ No newline at end of file diff --git a/frontend/rust-lib/event-integration/src/lib.rs b/frontend/rust-lib/event-integration/src/lib.rs index dd1e697bb0..7eaed452e9 100644 --- a/frontend/rust-lib/event-integration/src/lib.rs +++ b/frontend/rust-lib/event-integration/src/lib.rs @@ -53,14 +53,15 @@ impl EventIntegrationTest { let path = path_buf.to_str().unwrap().to_string(); let device_id = uuid::Uuid::new_v4().to_string(); - let config = AppFlowyCoreConfig::new(path.clone(), path, device_id, name).log_filter( - "trace", - vec![ - "flowy_test".to_string(), - "tokio".to_string(), - // "lib_dispatch".to_string(), - ], - ); + let config = AppFlowyCoreConfig::new("".to_string(), path.clone(), path, device_id, name) + .log_filter( + "trace", + vec![ + "flowy_test".to_string(), + "tokio".to_string(), + // "lib_dispatch".to_string(), + ], + ); let inner = init_core(config).await; let notification_sender = TestNotificationSender::new(); diff --git a/frontend/rust-lib/flowy-core/Cargo.toml b/frontend/rust-lib/flowy-core/Cargo.toml index 02223469a9..be19eb845b 100644 --- a/frontend/rust-lib/flowy-core/Cargo.toml +++ b/frontend/rust-lib/flowy-core/Cargo.toml @@ -66,4 +66,3 @@ ts = [ ] rev-sqlite = ["flowy-user/rev-sqlite"] openssl_vendored = ["flowy-sqlite/openssl_vendored"] -enable_wasm = ["collab-integrate/enable_wasm"] diff --git a/frontend/rust-lib/flowy-core/src/config.rs b/frontend/rust-lib/flowy-core/src/config.rs index f298aa46e6..9501b05716 100644 --- a/frontend/rust-lib/flowy-core/src/config.rs +++ b/frontend/rust-lib/flowy-core/src/config.rs @@ -14,6 +14,7 @@ use crate::integrate::log::create_log_filter; #[derive(Clone)] pub struct AppFlowyCoreConfig { /// Different `AppFlowyCoreConfig` instance should have different name + pub(crate) app_version: String, pub(crate) name: String, pub(crate) device_id: String, /// Used to store the user data @@ -30,6 +31,7 @@ pub struct AppFlowyCoreConfig { impl fmt::Debug for AppFlowyCoreConfig { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut debug = f.debug_struct("AppFlowy Configuration"); + debug.field("app_version", &self.app_version); debug.field("storage_path", &self.storage_path); debug.field("application_path", &self.application_path); if let Some(config) = &self.cloud_config { @@ -71,6 +73,7 @@ fn make_user_data_folder(root: &str, url: &str) -> String { impl AppFlowyCoreConfig { pub fn new( + app_version: String, custom_application_path: String, application_path: String, device_id: String, @@ -89,6 +92,7 @@ impl AppFlowyCoreConfig { }; AppFlowyCoreConfig { + app_version, name, storage_path, application_path, diff --git a/frontend/rust-lib/flowy-database2/Cargo.toml b/frontend/rust-lib/flowy-database2/Cargo.toml index f2af30c3f1..32badce3f2 100644 --- a/frontend/rust-lib/flowy-database2/Cargo.toml +++ b/frontend/rust-lib/flowy-database2/Cargo.toml @@ -55,5 +55,4 @@ flowy-codegen.workspace = true [features] dart = ["flowy-codegen/dart", "flowy-notification/dart"] -ts = ["flowy-codegen/ts", "flowy-notification/tauri_ts"] -enable_wasm = ["collab-plugins/wasm_build"] \ No newline at end of file +ts = ["flowy-codegen/ts", "flowy-notification/tauri_ts"] \ No newline at end of file diff --git a/frontend/rust-lib/flowy-document/Cargo.toml b/frontend/rust-lib/flowy-document/Cargo.toml index efc07b5260..52d688d8ac 100644 --- a/frontend/rust-lib/flowy-document/Cargo.toml +++ b/frontend/rust-lib/flowy-document/Cargo.toml @@ -54,8 +54,5 @@ dart = ["flowy-codegen/dart"] tauri_ts = ["flowy-codegen/ts"] web_ts = [ "flowy-codegen/ts", - "collab-plugins/wasm_build", - "collab/wasm_build", - "collab-document/wasm_build", ] diff --git a/frontend/rust-lib/flowy-encrypt/Cargo.toml b/frontend/rust-lib/flowy-encrypt/Cargo.toml index 2046bffc72..5ea42c60e2 100644 --- a/frontend/rust-lib/flowy-encrypt/Cargo.toml +++ b/frontend/rust-lib/flowy-encrypt/Cargo.toml @@ -17,7 +17,4 @@ anyhow.workspace = true base64 = "0.21.2" [target.'cfg(target_arch = "wasm32")'.dependencies] -getrandom = { version = "0.2", features = ["js"]} - -[features] -enable_wasm = [] +getrandom = { version = "0.2", features = ["js"]} \ No newline at end of file diff --git a/frontend/rust-lib/flowy-folder/Cargo.toml b/frontend/rust-lib/flowy-folder/Cargo.toml index 6a5cf7c999..98b5fa1b08 100644 --- a/frontend/rust-lib/flowy-folder/Cargo.toml +++ b/frontend/rust-lib/flowy-folder/Cargo.toml @@ -40,4 +40,3 @@ flowy-codegen.workspace = true dart = ["flowy-codegen/dart", "flowy-notification/dart"] ts = ["flowy-codegen/ts", "flowy-notification/tauri_ts"] test_helper = [] -enable_wasm = ["collab-plugins/wasm_build"] diff --git a/frontend/rust-lib/flowy-server/Cargo.toml b/frontend/rust-lib/flowy-server/Cargo.toml index 3149b96b85..a7f1baba94 100644 --- a/frontend/rust-lib/flowy-server/Cargo.toml +++ b/frontend/rust-lib/flowy-server/Cargo.toml @@ -58,5 +58,4 @@ serde_json.workspace = true client-api = { version = "0.1.0" } [features] -enable_wasm = ["collab/async-plugin"] enable_supabase = ["collab-plugins/postgres_plugin"] \ No newline at end of file diff --git a/frontend/rust-lib/flowy-storage/Cargo.toml b/frontend/rust-lib/flowy-storage/Cargo.toml index 4b1173eb95..d35c17565e 100644 --- a/frontend/rust-lib/flowy-storage/Cargo.toml +++ b/frontend/rust-lib/flowy-storage/Cargo.toml @@ -20,8 +20,4 @@ flowy-error = { workspace = true, features = ["impl_from_reqwest"] } mime = "0.3.17" tokio = { workspace = true, features = ["sync", "io-util"]} tracing.workspace = true -fxhash = "0.2.1" - - -[features] -enable_wasm = [] \ No newline at end of file +fxhash = "0.2.1" \ No newline at end of file diff --git a/frontend/rust-lib/flowy-user-pub/Cargo.toml b/frontend/rust-lib/flowy-user-pub/Cargo.toml index 548823d6c6..9d29234b34 100644 --- a/frontend/rust-lib/flowy-user-pub/Cargo.toml +++ b/frontend/rust-lib/flowy-user-pub/Cargo.toml @@ -21,7 +21,3 @@ tokio-stream = "0.1.14" flowy-folder-pub.workspace = true tracing.workspace = true base64 = "0.21" - - -[features] -enable_wasm = [] \ No newline at end of file diff --git a/frontend/rust-lib/flowy-user/src/event_handler.rs b/frontend/rust-lib/flowy-user/src/event_handler.rs index 8553db741c..6896c6ab2a 100644 --- a/frontend/rust-lib/flowy-user/src/event_handler.rs +++ b/frontend/rust-lib/flowy-user/src/event_handler.rs @@ -497,7 +497,7 @@ pub async fn update_network_state_handler( Ok(()) } -#[tracing::instrument(level = "debug", skip_all, err)] +#[tracing::instrument(level = "debug", skip_all)] pub async fn get_anon_user_handler( manager: AFPluginState>, ) -> DataResult { diff --git a/frontend/scripts/makefile/web.toml b/frontend/scripts/makefile/web.toml index ef1676d642..f0d50a4612 100644 --- a/frontend/scripts/makefile/web.toml +++ b/frontend/scripts/makefile/web.toml @@ -12,7 +12,7 @@ script = [ echo "🔥🔥🔥 Building $crate with wasm-pack..." cd "$BASE_DIR/rust-lib/$crate" || { echo "Failed to enter directory $crate"; exit 1; } - wasm-pack build --features="enable_wasm" || { echo "Build failed for $crate"; exit 1; } + wasm-pack build || { echo "Build failed for $crate"; exit 1; } done """ ]