mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
feat: add dbus and cli connect support
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
|
||||
import 'package:flutter_hbb/main.dart';
|
||||
import 'package:flutter_hbb/models/peer_model.dart';
|
||||
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -1128,6 +1129,19 @@ Future<bool> restoreWindowPosition(WindowType type, {int? windowId}) async {
|
||||
return false;
|
||||
}
|
||||
|
||||
void checkArguments() {
|
||||
// check connect args
|
||||
final connectIndex = bootArgs.indexOf("--connect");
|
||||
if (connectIndex == -1) {
|
||||
return;
|
||||
}
|
||||
String? peerId = bootArgs.length < connectIndex + 1 ? null: bootArgs[connectIndex + 1];
|
||||
if (peerId != null) {
|
||||
rustDeskWinManager.newRemoteDesktop(peerId);
|
||||
bootArgs.removeAt(connectIndex); bootArgs.removeAt(connectIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// Connect to a peer with [id].
|
||||
/// If [isFileTransfer], starts a session only for file transfer.
|
||||
/// If [isTcpTunneling], starts a session only for tcp tunneling.
|
||||
|
||||
@@ -452,6 +452,9 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
}
|
||||
}
|
||||
});
|
||||
Future.delayed(Duration.zero, () {
|
||||
checkArguments();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -24,10 +24,12 @@ import 'mobile/pages/server_page.dart';
|
||||
import 'models/platform_model.dart';
|
||||
|
||||
int? windowId;
|
||||
late List<String> bootArgs;
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
debugPrint("launch args: $args");
|
||||
bootArgs = args;
|
||||
|
||||
if (!isDesktop) {
|
||||
runMobileApp();
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:flutter_hbb/models/chat_model.dart';
|
||||
import 'package:flutter_hbb/models/file_model.dart';
|
||||
import 'package:flutter_hbb/models/server_model.dart';
|
||||
import 'package:flutter_hbb/models/user_model.dart';
|
||||
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import 'package:flutter_custom_cursor/flutter_custom_cursor.dart';
|
||||
@@ -176,6 +177,9 @@ class FfiModel with ChangeNotifier {
|
||||
updateBlockInputState(evt, peerId);
|
||||
} else if (name == 'update_privacy_mode') {
|
||||
updatePrivacyMode(evt, peerId);
|
||||
} else if (name == 'new_connection') {
|
||||
final remoteId = evt['peer_id'];
|
||||
rustDeskWinManager.newRemoteDesktop(remoteId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -113,6 +113,10 @@ class PlatformFFI {
|
||||
debugPrint('Failed to get documents directory: $e');
|
||||
}
|
||||
_ffiBind = RustdeskImpl(dylib);
|
||||
if (Platform.isLinux) {
|
||||
// start dbus service, no need to await
|
||||
await _ffiBind.mainStartDbusServer();
|
||||
}
|
||||
_startListenEvent(_ffiBind); // global event
|
||||
try {
|
||||
if (isAndroid) {
|
||||
|
||||
@@ -140,7 +140,7 @@ packages:
|
||||
name: characters
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -161,7 +161,7 @@ packages:
|
||||
name: clock
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -369,8 +369,8 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: "4a950fd3a5a228bf5381070a4c803919d5787c07"
|
||||
resolved-ref: "4a950fd3a5a228bf5381070a4c803919d5787c07"
|
||||
ref: dec2166e881c47d922e1edc484d10d2cd5c2103b
|
||||
resolved-ref: dec2166e881c47d922e1edc484d10d2cd5c2103b
|
||||
url: "https://github.com/Kingtous/rustdesk_flutter_custom_cursor"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
@@ -602,7 +602,7 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.1.4"
|
||||
version: "0.1.5"
|
||||
menu_base:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -616,7 +616,7 @@ packages:
|
||||
name: meta
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.8.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -693,7 +693,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
path_drawing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user