mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-26 10:25:44 +00:00
Rework
This commit is contained in:
@@ -54,7 +54,7 @@ public class CustomRdpClient implements ExternalApplicationType, ExternalRdpClie
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPasswordPassing() {
|
||||
public boolean supportsPasswordPassing(RdpLaunchConfig config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class DevolutionsRdpClient implements ExternalApplicationType.WindowsType
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPasswordPassing() {
|
||||
public boolean supportsPasswordPassing(RdpLaunchConfig config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public interface ExternalRdpClient extends PrefsValue {
|
||||
|
||||
void launch(RdpLaunchConfig configuration) throws Exception;
|
||||
|
||||
boolean supportsPasswordPassing();
|
||||
boolean supportsPasswordPassing(RdpLaunchConfig config);
|
||||
|
||||
String getWebsite();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class FreeRdpClient implements ExternalRdpClient {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPasswordPassing() {
|
||||
public boolean supportsPasswordPassing(RdpLaunchConfig config) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ public class MstscRdpClient implements ExternalApplicationType.PathApplication,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPasswordPassing() {
|
||||
public boolean supportsPasswordPassing(RdpLaunchConfig config) {
|
||||
return LocalShell.getLocalPowershell().isPresent();
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ public class MstscRdpClient implements ExternalApplicationType.PathApplication,
|
||||
private RdpConfig getAdaptedConfig(RdpLaunchConfig configuration) throws Exception {
|
||||
var input = configuration.getConfig();
|
||||
var pass = configuration.getPassword();
|
||||
if (input.get("password 51").isPresent() || !supportsPasswordPassing() || pass == null) {
|
||||
if (input.get("password 51").isPresent() || !supportsPasswordPassing(configuration) || pass == null) {
|
||||
return input.overlay(Map.of("smart sizing", new RdpConfig.TypedValue("i", smartSizing ? "1" : "0")));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,14 @@ public class RemminaRdpClient implements ExternalApplicationType.LinuxApplicatio
|
||||
return List.of("auto connect", "password 51", "prompt for credentials", "smart sizing");
|
||||
}
|
||||
|
||||
private boolean containsOnlyRecognizedOptions(RdpLaunchConfig configuration) {
|
||||
var l = new HashSet<>(configuration.getConfig().getContent().keySet());
|
||||
toStrip().forEach(l::remove);
|
||||
return l.size() == 2 && l.contains("username") && l.contains("full address");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch(RdpLaunchConfig configuration) throws Exception {
|
||||
RdpConfig c = configuration.getConfig();
|
||||
|
||||
// Remmina does not support RemoteApps
|
||||
if (configuration.isRemoteApp()) {
|
||||
var freerdp = new FreeRdpClient();
|
||||
@@ -34,9 +38,7 @@ public class RemminaRdpClient implements ExternalApplicationType.LinuxApplicatio
|
||||
}
|
||||
}
|
||||
|
||||
var l = new HashSet<>(c.getContent().keySet());
|
||||
toStrip().forEach(l::remove);
|
||||
if (l.size() == 2 && l.contains("username") && l.contains("full address")) {
|
||||
if (containsOnlyRecognizedOptions(configuration)) {
|
||||
var encrypted = RemminaHelper.encryptPassword(configuration.getPassword());
|
||||
if (encrypted.isPresent()) {
|
||||
var file = RemminaHelper.writeRemminaRdpConfigFile(configuration, encrypted.get());
|
||||
@@ -45,14 +47,15 @@ public class RemminaRdpClient implements ExternalApplicationType.LinuxApplicatio
|
||||
}
|
||||
}
|
||||
|
||||
RdpConfig c = configuration.getConfig();
|
||||
var file = writeRdpConfigFile(configuration.getTitle(), c);
|
||||
launch(CommandBuilder.of().add("-c").addFile(file.toString()));
|
||||
LocalFileTracker.deleteOnExit(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPasswordPassing() {
|
||||
return false;
|
||||
public boolean supportsPasswordPassing(RdpLaunchConfig config) {
|
||||
return config.isRemoteApp() || containsOnlyRecognizedOptions(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ public class RemoteDesktopAppRdpClient implements ExternalApplicationType.MacApp
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPasswordPassing() {
|
||||
public boolean supportsPasswordPassing(RdpLaunchConfig config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class WindowsAppRdpClient implements ExternalApplicationType.MacApplicati
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPasswordPassing() {
|
||||
public boolean supportsPasswordPassing(RdpLaunchConfig config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user