mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-03 19:30:31 +00:00
Use custom default vnc client impl
This commit is contained in:
@@ -245,7 +245,7 @@ public final class AppPrefs {
|
||||
public final BooleanProperty dontCachePasswords =
|
||||
mapVaultShared(new GlobalBooleanProperty(false), "dontCachePasswords", Boolean.class, false);
|
||||
public final Property<ExternalVncClient> vncClient = map(Mapping.builder()
|
||||
.property(new GlobalObjectProperty<>(InternalVncClient.builder().build()))
|
||||
.property(new GlobalObjectProperty<>())
|
||||
.key("vncClient")
|
||||
.valueClass(ExternalVncClient.class)
|
||||
.documentationLink(DocumentationLink.VNC)
|
||||
@@ -835,6 +835,7 @@ public final class AppPrefs {
|
||||
terminalType.set(ExternalTerminalType.determineDefault(terminalType.get()));
|
||||
rdpClientType.setValue(ExternalRdpClient.determineDefault(rdpClientType.get()));
|
||||
spiceClient.setValue(ExternalSpiceClient.determineDefault(spiceClient.getValue()));
|
||||
vncClient.setValue(ExternalVncClient.determineDefault(vncClient.getValue()));
|
||||
|
||||
PrefsProvider.getAll().forEach(prov -> prov.initDefaultValues());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package io.xpipe.app.vnc;
|
||||
|
||||
import io.xpipe.app.ext.PrefsValue;
|
||||
import io.xpipe.app.platform.ClipboardHelper;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.rdp.*;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
@@ -10,7 +12,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
|
||||
public interface ExternalVncClient {
|
||||
public interface ExternalVncClient extends PrefsValue {
|
||||
|
||||
static void launchClient(VncLaunchConfig configuration) throws Exception {
|
||||
var client = AppPrefs.get().vncClient.getValue();
|
||||
@@ -55,6 +57,34 @@ public interface ExternalVncClient {
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
static ExternalVncClient determineDefault(ExternalVncClient existing) {
|
||||
// Verify that our selection is still valid
|
||||
if (existing != null && existing.isAvailable()) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
var l = new ArrayList<ExternalVncClient>();
|
||||
switch (OsType.ofLocal()) {
|
||||
case OsType.Linux ignored -> {
|
||||
l.add(new TigerVncClient.Linux());
|
||||
l.add(new RealVncClient.Linux());
|
||||
}
|
||||
case OsType.MacOs ignored -> {}
|
||||
case OsType.Windows ignored -> {
|
||||
l.add(new TightVncClient());
|
||||
}
|
||||
}
|
||||
|
||||
var found = l.stream().filter(externalVncClient -> externalVncClient.isAvailable()).findFirst();
|
||||
if (found.isPresent()) {
|
||||
return found.get();
|
||||
}
|
||||
|
||||
return new InternalVncClient();
|
||||
}
|
||||
|
||||
|
||||
void launch(VncLaunchConfig configuration) throws Exception;
|
||||
|
||||
boolean supportsPasswords();
|
||||
|
||||
Reference in New Issue
Block a user