mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 03:28:03 +00:00
@@ -161,6 +161,7 @@ class WebHomePage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
stateGlobal.isInMainPage = true;
|
||||
handleUnilink(context);
|
||||
return Scaffold(
|
||||
// backgroundColor: MyTheme.grayBg,
|
||||
appBar: AppBar(
|
||||
@@ -171,4 +172,63 @@ class WebHomePage extends StatelessWidget {
|
||||
body: connectionPage,
|
||||
);
|
||||
}
|
||||
|
||||
handleUnilink(BuildContext context) {
|
||||
if (webInitialLink.isEmpty) {
|
||||
return;
|
||||
}
|
||||
final link = webInitialLink;
|
||||
webInitialLink = '';
|
||||
final splitter = ["/#/", "/#", "#/", "#"];
|
||||
var fakelink = '';
|
||||
for (var s in splitter) {
|
||||
if (link.contains(s)) {
|
||||
var list = link.split(s);
|
||||
if (list.length < 2 || list[1].isEmpty) {
|
||||
return;
|
||||
}
|
||||
list.removeAt(0);
|
||||
fakelink = "rustdesk://${list.join(s)}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fakelink.isEmpty) {
|
||||
return;
|
||||
}
|
||||
final uri = Uri.tryParse(fakelink);
|
||||
if (uri == null) {
|
||||
return;
|
||||
}
|
||||
final args = urlLinkToCmdArgs(uri);
|
||||
if (args == null || args.isEmpty) {
|
||||
return;
|
||||
}
|
||||
bool isFileTransfer = false;
|
||||
String? id;
|
||||
String? password;
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
switch (args[i]) {
|
||||
case '--connect':
|
||||
case '--play':
|
||||
isFileTransfer = false;
|
||||
id = args[i + 1];
|
||||
i++;
|
||||
break;
|
||||
case '--file-transfer':
|
||||
isFileTransfer = true;
|
||||
id = args[i + 1];
|
||||
i++;
|
||||
break;
|
||||
case '--password':
|
||||
password = args[i + 1];
|
||||
i++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (id != null) {
|
||||
connect(context, id, isFileTransfer: isFileTransfer, password: password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user