rdp and tcpTunnel use same tabPage
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
d939a5ebc6
commit
f5dba0f7aa
@ -52,7 +52,6 @@ enum DesktopType {
|
|||||||
fileTransfer,
|
fileTransfer,
|
||||||
cm,
|
cm,
|
||||||
portForward,
|
portForward,
|
||||||
rdp,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class IconFont {
|
class IconFont {
|
||||||
@ -572,9 +571,7 @@ void msgBox(
|
|||||||
submit() {
|
submit() {
|
||||||
dialogManager.dismissAll();
|
dialogManager.dismissAll();
|
||||||
// https://github.com/fufesou/rustdesk/blob/5e9a31340b899822090a3731769ae79c6bf5f3e5/src/ui/common.tis#L263
|
// https://github.com/fufesou/rustdesk/blob/5e9a31340b899822090a3731769ae79c6bf5f3e5/src/ui/common.tis#L263
|
||||||
if (!type.contains("custom") &&
|
if (!type.contains("custom") && desktopType != DesktopType.portForward) {
|
||||||
!(desktopType == DesktopType.portForward ||
|
|
||||||
desktopType == DesktopType.rdp)) {
|
|
||||||
closeConnection();
|
closeConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ const String kAppTypeMain = "main";
|
|||||||
const String kAppTypeDesktopRemote = "remote";
|
const String kAppTypeDesktopRemote = "remote";
|
||||||
const String kAppTypeDesktopFileTransfer = "file transfer";
|
const String kAppTypeDesktopFileTransfer = "file transfer";
|
||||||
const String kAppTypeDesktopPortForward = "port forward";
|
const String kAppTypeDesktopPortForward = "port forward";
|
||||||
const String kAppTypeDesktopRDP = "rdp";
|
|
||||||
|
|
||||||
const String kTabLabelHomePage = "Home";
|
const String kTabLabelHomePage = "Home";
|
||||||
const String kTabLabelSettingPage = "Settings";
|
const String kTabLabelSettingPage = "Settings";
|
||||||
|
@ -37,7 +37,6 @@ class PortForwardPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _PortForwardPageState extends State<PortForwardPage>
|
class _PortForwardPageState extends State<PortForwardPage>
|
||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
final bool isRdp = false;
|
|
||||||
final TextEditingController localPortController = TextEditingController();
|
final TextEditingController localPortController = TextEditingController();
|
||||||
final TextEditingController remoteHostController = TextEditingController();
|
final TextEditingController remoteHostController = TextEditingController();
|
||||||
final TextEditingController remotePortController = TextEditingController();
|
final TextEditingController remotePortController = TextEditingController();
|
||||||
@ -53,7 +52,7 @@ class _PortForwardPageState extends State<PortForwardPage>
|
|||||||
if (!Platform.isLinux) {
|
if (!Platform.isLinux) {
|
||||||
Wakelock.enable();
|
Wakelock.enable();
|
||||||
}
|
}
|
||||||
print("init success with id ${widget.id}");
|
debugPrint("init success with id ${widget.id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -73,7 +72,7 @@ class _PortForwardPageState extends State<PortForwardPage>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: MyTheme.color(context).grayBg,
|
backgroundColor: MyTheme.color(context).grayBg,
|
||||||
body: FutureBuilder(future: () async {
|
body: FutureBuilder(future: () async {
|
||||||
if (!isRdp) {
|
if (!widget.isRDP) {
|
||||||
refreshTunnelConfig();
|
refreshTunnelConfig();
|
||||||
}
|
}
|
||||||
}(), builder: (context, snapshot) {
|
}(), builder: (context, snapshot) {
|
||||||
@ -288,7 +287,7 @@ class _PortForwardPageState extends State<PortForwardPage>
|
|||||||
text2(String lable) => Expanded(
|
text2(String lable) => Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
lable,
|
lable,
|
||||||
style: TextStyle(fontSize: 20),
|
style: const TextStyle(fontSize: 20),
|
||||||
).marginOnly(left: _kTextLeftMargin));
|
).marginOnly(left: _kTextLeftMargin));
|
||||||
return Theme(
|
return Theme(
|
||||||
data: Theme.of(context)
|
data: Theme.of(context)
|
||||||
@ -321,10 +320,10 @@ class _PortForwardPageState extends State<PortForwardPage>
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
side: const BorderSide(color: MyTheme.border)),
|
side: const BorderSide(color: MyTheme.border)),
|
||||||
onPressed: () {},
|
onPressed: () => bind.sessionNewRdp(id: widget.id),
|
||||||
child: Text(
|
child: Text(
|
||||||
translate('New RDP'),
|
translate('New RDP'),
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w300, fontSize: 14),
|
fontWeight: FontWeight.w300, fontSize: 14),
|
||||||
),
|
),
|
||||||
).marginSymmetric(vertical: 10),
|
).marginSymmetric(vertical: 10),
|
||||||
|
@ -26,8 +26,8 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
|||||||
|
|
||||||
_PortForwardTabPageState(Map<String, dynamic> params) {
|
_PortForwardTabPageState(Map<String, dynamic> params) {
|
||||||
isRDP = params['isRDP'];
|
isRDP = params['isRDP'];
|
||||||
tabController = Get.put(DesktopTabController(
|
tabController =
|
||||||
tabType: isRDP ? DesktopTabType.rdp : DesktopTabType.portForward));
|
Get.put(DesktopTabController(tabType: DesktopTabType.portForward));
|
||||||
tabController.add(TabInfo(
|
tabController.add(TabInfo(
|
||||||
key: params['id'],
|
key: params['id'],
|
||||||
label: params['id'],
|
label: params['id'],
|
||||||
@ -55,6 +55,11 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
|||||||
final id = args['id'];
|
final id = args['id'];
|
||||||
final isRDP = args['isRDP'];
|
final isRDP = args['isRDP'];
|
||||||
window_on_top(windowId());
|
window_on_top(windowId());
|
||||||
|
if (tabController.state.value.tabs.indexWhere((e) => e.key == id) >=
|
||||||
|
0) {
|
||||||
|
debugPrint("port forward $id exists");
|
||||||
|
return;
|
||||||
|
}
|
||||||
tabController.add(TabInfo(
|
tabController.add(TabInfo(
|
||||||
key: id,
|
key: id,
|
||||||
label: id,
|
label: id,
|
||||||
|
@ -44,7 +44,6 @@ enum DesktopTabType {
|
|||||||
remoteScreen,
|
remoteScreen,
|
||||||
fileTransfer,
|
fileTransfer,
|
||||||
portForward,
|
portForward,
|
||||||
rdp,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DesktopTabState {
|
class DesktopTabState {
|
||||||
|
@ -51,8 +51,7 @@ Future<Null> main(List<String> args) async {
|
|||||||
runFileTransferScreen(argument);
|
runFileTransferScreen(argument);
|
||||||
break;
|
break;
|
||||||
case WindowType.PortForward:
|
case WindowType.PortForward:
|
||||||
desktopType =
|
desktopType = DesktopType.portForward;
|
||||||
argument['isRDP'] ? DesktopType.rdp : DesktopType.portForward;
|
|
||||||
runPortForwardScreen(argument);
|
runPortForwardScreen(argument);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -18,7 +18,6 @@ pub(super) const APP_TYPE_MAIN: &str = "main";
|
|||||||
pub(super) const APP_TYPE_DESKTOP_REMOTE: &str = "remote";
|
pub(super) const APP_TYPE_DESKTOP_REMOTE: &str = "remote";
|
||||||
pub(super) const APP_TYPE_DESKTOP_FILE_TRANSFER: &str = "file transfer";
|
pub(super) const APP_TYPE_DESKTOP_FILE_TRANSFER: &str = "file transfer";
|
||||||
pub(super) const APP_TYPE_DESKTOP_PORT_FORWARD: &str = "port forward";
|
pub(super) const APP_TYPE_DESKTOP_PORT_FORWARD: &str = "port forward";
|
||||||
pub(super) const APP_TYPE_DESKTOP_RDP: &str = "rdp";
|
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
pub static ref SESSIONS: RwLock<HashMap<String,Session<FlutterHandler>>> = Default::default();
|
pub static ref SESSIONS: RwLock<HashMap<String,Session<FlutterHandler>>> = Default::default();
|
||||||
|
@ -663,7 +663,6 @@ fn main_broadcast_message(data: &HashMap<&str, &str>) {
|
|||||||
flutter::APP_TYPE_DESKTOP_REMOTE,
|
flutter::APP_TYPE_DESKTOP_REMOTE,
|
||||||
flutter::APP_TYPE_DESKTOP_FILE_TRANSFER,
|
flutter::APP_TYPE_DESKTOP_FILE_TRANSFER,
|
||||||
flutter::APP_TYPE_DESKTOP_PORT_FORWARD,
|
flutter::APP_TYPE_DESKTOP_PORT_FORWARD,
|
||||||
flutter::APP_TYPE_DESKTOP_RDP,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
for app in apps {
|
for app in apps {
|
||||||
@ -703,6 +702,12 @@ pub fn session_remove_port_forward(id: String, local_port: i32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn session_new_rdp(id: String) {
|
||||||
|
if let Some(session) = SESSIONS.write().unwrap().get_mut(&id) {
|
||||||
|
session.new_rdp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn main_get_last_remote_id() -> String {
|
pub fn main_get_last_remote_id() -> String {
|
||||||
// if !config::APP_DIR.read().unwrap().is_empty() {
|
// if !config::APP_DIR.read().unwrap().is_empty() {
|
||||||
// res = LocalConfig::get_remote_id();
|
// res = LocalConfig::get_remote_id();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user