Merge pull request #3196 from 21pages/relay_id

force relay when id is suffixed with "/r"
This commit is contained in:
RustDesk
2023-02-16 12:50:40 +08:00
committed by GitHub
50 changed files with 301 additions and 117 deletions

View File

@@ -66,7 +66,8 @@ class _ConnectionPageState extends State<ConnectionPage>
_idFocusNode.addListener(() {
_idInputFocused.value = _idFocusNode.hasFocus;
// select all to faciliate removing text, just following the behavior of address input of chrome
_idController.selection = TextSelection(baseOffset: 0, extentOffset: _idController.value.text.length);
_idController.selection = TextSelection(
baseOffset: 0, extentOffset: _idController.value.text.length);
});
windowManager.addListener(this);
}
@@ -149,8 +150,11 @@ class _ConnectionPageState extends State<ConnectionPage>
/// Callback for the connect button.
/// Connects to the selected peer.
void onConnect({bool isFileTransfer = false}) {
final id = _idController.id;
connect(context, id, isFileTransfer: isFileTransfer);
var id = _idController.id;
var forceRelay = id.endsWith(r'/r');
if (forceRelay) id = id.substring(0, id.length - 2);
connect(context, id,
isFileTransfer: isFileTransfer, forceRelay: forceRelay);
}
/// UI for the remote ID TextField.