mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
add password to --connect command in flutter, --connect id [passord]
This commit is contained in:
@@ -1523,6 +1523,11 @@ bool checkArguments() {
|
||||
}
|
||||
String? id =
|
||||
kBootArgs.length < connectIndex + 1 ? null : kBootArgs[connectIndex + 1];
|
||||
String? password =
|
||||
kBootArgs.length < connectIndex + 2 ? null : kBootArgs[connectIndex + 2];
|
||||
if (password != null && password.startsWith("--")) {
|
||||
password = null;
|
||||
}
|
||||
final switchUuidIndex = kBootArgs.indexOf("--switch_uuid");
|
||||
String? switchUuid = kBootArgs.length < switchUuidIndex + 1
|
||||
? null
|
||||
@@ -1536,7 +1541,8 @@ bool checkArguments() {
|
||||
kBootArgs.removeAt(connectIndex);
|
||||
// fallback to peer id
|
||||
Future.delayed(Duration.zero, () {
|
||||
rustDeskWinManager.newRemoteDesktop(id, switch_uuid: switchUuid);
|
||||
rustDeskWinManager.newRemoteDesktop(id,
|
||||
password: password, switch_uuid: switchUuid);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,19 +25,20 @@ import '../../utils/image.dart';
|
||||
import '../widgets/remote_toolbar.dart';
|
||||
import '../widgets/kb_layout_type_chooser.dart';
|
||||
|
||||
bool _isCustomCursorInited = false;
|
||||
final SimpleWrapper<bool> _firstEnterImage = SimpleWrapper(false);
|
||||
|
||||
class RemotePage extends StatefulWidget {
|
||||
RemotePage({
|
||||
Key? key,
|
||||
required this.id,
|
||||
required this.password,
|
||||
required this.menubarState,
|
||||
this.switchUuid,
|
||||
this.forceRelay,
|
||||
}) : super(key: key);
|
||||
|
||||
final String id;
|
||||
final String? password;
|
||||
final MenubarState menubarState;
|
||||
final String? switchUuid;
|
||||
final bool? forceRelay;
|
||||
@@ -113,6 +114,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
});
|
||||
_ffi.start(
|
||||
widget.id,
|
||||
password: widget.password,
|
||||
switchUuid: widget.switchUuid,
|
||||
forceRelay: widget.forceRelay,
|
||||
);
|
||||
|
||||
@@ -23,9 +23,6 @@ import '../../models/platform_model.dart';
|
||||
|
||||
class _MenuTheme {
|
||||
static const Color blueColor = MyTheme.button;
|
||||
static const Color hoverBlueColor = MyTheme.accent;
|
||||
static const Color redColor = Colors.redAccent;
|
||||
static const Color hoverRedColor = Colors.red;
|
||||
// kMinInteractiveDimension
|
||||
static const double height = 20.0;
|
||||
static const double dividerHeight = 12.0;
|
||||
@@ -71,6 +68,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
page: RemotePage(
|
||||
key: ValueKey(peerId),
|
||||
id: peerId,
|
||||
password: params['password'],
|
||||
menubarState: _menubarState,
|
||||
switchUuid: params['switch_uuid'],
|
||||
forceRelay: params['forceRelay'],
|
||||
@@ -106,6 +104,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
page: RemotePage(
|
||||
key: ValueKey(id),
|
||||
id: id,
|
||||
password: args['password'],
|
||||
menubarState: _menubarState,
|
||||
switchUuid: switchUuid,
|
||||
forceRelay: args['forceRelay'],
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi' hide Size;
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:ffi/ffi.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hbb/consts.dart';
|
||||
@@ -1534,6 +1531,7 @@ class FFI {
|
||||
{bool isFileTransfer = false,
|
||||
bool isPortForward = false,
|
||||
String? switchUuid,
|
||||
String? password,
|
||||
bool? forceRelay}) {
|
||||
assert(!(isFileTransfer && isPortForward), 'more than one connect type');
|
||||
if (isFileTransfer) {
|
||||
@@ -1550,11 +1548,13 @@ class FFI {
|
||||
}
|
||||
// ignore: unused_local_variable
|
||||
final addRes = bind.sessionAddSync(
|
||||
id: id,
|
||||
isFileTransfer: isFileTransfer,
|
||||
isPortForward: isPortForward,
|
||||
switchUuid: switchUuid ?? "",
|
||||
forceRelay: forceRelay ?? false);
|
||||
id: id,
|
||||
isFileTransfer: isFileTransfer,
|
||||
isPortForward: isPortForward,
|
||||
switchUuid: switchUuid ?? "",
|
||||
forceRelay: forceRelay ?? false,
|
||||
password: password ?? "",
|
||||
);
|
||||
final stream = bind.sessionStart(id: id);
|
||||
final cb = ffiModel.startEventListener(id);
|
||||
() async {
|
||||
|
||||
@@ -43,12 +43,14 @@ class RustDeskMultiWindowManager {
|
||||
|
||||
Future<dynamic> newRemoteDesktop(
|
||||
String remoteId, {
|
||||
String? password,
|
||||
String? switch_uuid,
|
||||
bool? forceRelay,
|
||||
}) async {
|
||||
var params = {
|
||||
"type": WindowType.RemoteDesktop.index,
|
||||
"id": remoteId,
|
||||
"password": password,
|
||||
"forceRelay": forceRelay
|
||||
};
|
||||
if (switch_uuid != null) {
|
||||
|
||||
Reference in New Issue
Block a user