From 9dbb6217f7c97523c4fc401ed4d8434dc709dea9 Mon Sep 17 00:00:00 2001 From: 21pages Date: Sat, 10 May 2025 21:40:55 +0800 Subject: [PATCH 1/3] fix pull ab twice in log (#11699) The reason for calling `pullAb` twice is that when `pullAb` is called for the first time, `setCurrentName` is also called. In `setCurrentName`, if the current address book has not been initialized, it will also attempt to pull. Because `quiet` is false during the first call and `setCurrentName` is not `await` synchronously, the `abLoading` can prevent the two calls. However, `abLoading` depends on `quiet`, so we need to add a new variable `_abLoadingLock`. Signed-off-by: 21pages --- flutter/lib/models/ab_model.dart | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/flutter/lib/models/ab_model.dart b/flutter/lib/models/ab_model.dart index 5efbd9e5fde..39015050544 100644 --- a/flutter/lib/models/ab_model.dart +++ b/flutter/lib/models/ab_model.dart @@ -775,7 +775,10 @@ abstract class BaseAb { final pullError = "".obs; final pushError = "".obs; - final abLoading = false.obs; + final abLoading = false + .obs; // Indicates whether the UI should show a loading state for the address book. + var abPulling = + false; // Tracks whether a pull operation is currently in progress to prevent concurrent pulls. Unlike abLoading, this is not tied to UI updates. bool initialized = false; String name(); @@ -790,17 +793,22 @@ abstract class BaseAb { } Future pullAb({quiet = false}) async { - debugPrint("pull ab \"${name()}\""); - if (abLoading.value) return; + if (abPulling) return; + abPulling = true; if (!quiet) { abLoading.value = true; pullError.value = ""; } initialized = false; + debugPrint("pull ab \"${name()}\""); try { initialized = await pullAbImpl(quiet: quiet); - } catch (_) {} - abLoading.value = false; + } catch (e) { + debugPrint("Error occurred while pulling address book: $e"); + } finally { + abLoading.value = false; + abPulling = false; + } } Future pullAbImpl({quiet = false}); From 2c976eb1e29e72603acac9c0362fa462a40def55 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 10 May 2025 21:49:23 +0800 Subject: [PATCH 2/3] prepare self-hosting web client --- flutter/lib/common/hbbs/hbbs.dart | 2 ++ flutter/lib/models/user_model.dart | 4 ++++ flutter/lib/models/web_model.dart | 8 ++++++++ flutter/lib/web/bridge.dart | 10 ++++++++++ 4 files changed, 24 insertions(+) diff --git a/flutter/lib/common/hbbs/hbbs.dart b/flutter/lib/common/hbbs/hbbs.dart index a58ecf01e8d..97baf546a64 100644 --- a/flutter/lib/common/hbbs/hbbs.dart +++ b/flutter/lib/common/hbbs/hbbs.dart @@ -27,6 +27,7 @@ class UserPayload { String name = ''; String email = ''; String note = ''; + String? verifier; UserStatus status; bool isAdmin = false; @@ -34,6 +35,7 @@ class UserPayload { : name = json['name'] ?? '', email = json['email'] ?? '', note = json['note'] ?? '', + verifier = json['verifier'], status = json['status'] == 0 ? UserStatus.kDisabled : json['status'] == -1 diff --git a/flutter/lib/models/user_model.dart b/flutter/lib/models/user_model.dart index 9d9c762d998..df65563ae6c 100644 --- a/flutter/lib/models/user_model.dart +++ b/flutter/lib/models/user_model.dart @@ -116,6 +116,10 @@ class UserModel { userName.value = user.name; isAdmin.value = user.isAdmin; bind.mainSetLocalOption(key: 'user_info', value: jsonEncode(user)); + if (isWeb) { + // ugly here, tmp solution + bind.mainSetLocalOption(key: 'verifier', value: user.verifier ?? ''); + } } // update ab and group status diff --git a/flutter/lib/models/web_model.dart b/flutter/lib/models/web_model.dart index 7fd6993dbe2..565af72ab08 100644 --- a/flutter/lib/models/web_model.dart +++ b/flutter/lib/models/web_model.dart @@ -8,6 +8,7 @@ import 'dart:html'; import 'dart:async'; import 'package:flutter/foundation.dart'; +import 'package:flutter_hbb/common/widgets/login.dart'; import 'package:flutter_hbb/models/state_model.dart'; import 'package:flutter_hbb/web/bridge.dart'; @@ -113,6 +114,13 @@ class PlatformFFI { context["onInitFinished"] = () { completer.complete(); }; + context['loginDialog'] = () { + loginDialog(); + }; + context['closeConnection'] = () { + gFFI.dialogManager.dismissAll(); + closeConnection(); + }; context.callMethod('init'); version = getByName('version'); window.onContextMenu.listen((event) { diff --git a/flutter/lib/web/bridge.dart b/flutter/lib/web/bridge.dart index d831e7bdc1d..a002501715f 100644 --- a/flutter/lib/web/bridge.dart +++ b/flutter/lib/web/bridge.dart @@ -267,6 +267,16 @@ class RustdeskImpl { ])); } + Future sessionGetTrackpadSpeed( + {required UuidValue sessionId, dynamic hint}) { + throw UnimplementedError("sessionGetTrackpadSpeed"); + } + + Future sessionSetTrackpadSpeed( + {required UuidValue sessionId, required int value, dynamic hint}) { + throw UnimplementedError("sessionSetTrackpadSpeed"); + } + Future sessionGetScrollStyle( {required UuidValue sessionId, dynamic hint}) { return Future(() => From a73be6fc94df9019ae2f231ca5a590968e0b20b3 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sun, 11 May 2025 01:15:29 +0800 Subject: [PATCH 3/3] fix some build command --- flutter/build_ios.sh | 1 + flutter/ios_arm64.sh | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/flutter/build_ios.sh b/flutter/build_ios.sh index 50f2f0056b4..cd12626263d 100755 --- a/flutter/build_ios.sh +++ b/flutter/build_ios.sh @@ -4,4 +4,5 @@ # no obfuscate, because no easy to check errors cd $(dirname $(dirname $(which flutter))) git apply ~/rustdesk/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff +cd - flutter build ipa --release diff --git a/flutter/ios_arm64.sh b/flutter/ios_arm64.sh index 2d8410c7a4e..579baaa6dda 100755 --- a/flutter/ios_arm64.sh +++ b/flutter/ios_arm64.sh @@ -1,4 +1,2 @@ #!/usr/bin/env bash -cd $(dirname $(dirname $(which flutter))) -git apply ~/rustdesk/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff cargo build --features flutter,hwcodec --release --target aarch64-apple-ios --lib