mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-08-23 01:36:33 +00:00
Rework
This commit is contained in:
@@ -875,7 +875,9 @@ public final class AppPrefs {
|
||||
rdpClientType.setValue(ExternalRdpClient.determineDefault(rdpClientType.get()));
|
||||
spiceClient.setValue(ExternalSpiceClient.determineDefault(spiceClient.getValue()));
|
||||
passwordManager.setValue(PasswordManager.determineDefault(passwordManager.getValue()));
|
||||
terminalMultiplexer.setValue(TerminalMultiplexer.determineDefault(terminalMultiplexer.getValue()));
|
||||
|
||||
// We don't want to set a multiplexer by default really
|
||||
// terminalMultiplexer.setValue(TerminalMultiplexer.determineDefault(terminalMultiplexer.getValue()));
|
||||
|
||||
PrefsProvider.getAll().forEach(prov -> prov.initDefaultValues());
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ public class TerminalCategory extends AppPrefsCategory {
|
||||
return false;
|
||||
}
|
||||
|
||||
return TerminalProxyManager.getProxy().isEmpty()
|
||||
return !TerminalProxyManager.hasConfiguredProxy()
|
||||
&& !TerminalMultiplexerManager.isAvailableOnWindows();
|
||||
},
|
||||
prefs.terminalProxy(),
|
||||
|
||||
@@ -252,7 +252,7 @@ public class TerminalLauncher {
|
||||
// Throw if not supported
|
||||
multiplexer.get().checkSupported(control);
|
||||
|
||||
var session = TerminalMultiplexerManager.getActiveMultiplexerSession();
|
||||
var session = TerminalMultiplexerManager.getActiveMultiplexerSession(true);
|
||||
if (session.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,16 @@ public class TerminalMultiplexerManager {
|
||||
if (pendingMultiplexerLaunch == null) {
|
||||
// Give it a bit more time if it just started
|
||||
ThreadHelper.sleep(1000);
|
||||
|
||||
// Wait for max 10s
|
||||
for (int j = 0; j < 100; j++) {
|
||||
if (getActiveMultiplexerSession(false).isPresent()) {
|
||||
break;
|
||||
}
|
||||
|
||||
ThreadHelper.sleep(100);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -149,7 +159,7 @@ public class TerminalMultiplexerManager {
|
||||
return Optional.ofNullable(runningMultiplexerContainer);
|
||||
}
|
||||
|
||||
public static Optional<TerminalView.TerminalSession> getActiveMultiplexerSession() {
|
||||
public static Optional<TerminalView.TerminalSession> getActiveMultiplexerSession(boolean includeStarting) {
|
||||
var mult = getEffectiveMultiplexer();
|
||||
if (mult.isEmpty()) {
|
||||
return Optional.empty();
|
||||
@@ -158,7 +168,7 @@ public class TerminalMultiplexerManager {
|
||||
var noSessions = TerminalView.get().getSessions().stream()
|
||||
.noneMatch(shellSession -> shellSession.getTerminal().isRunning()
|
||||
&& (mult.get() == connectionHubRequests.get(shellSession.getRequest())));
|
||||
if (noSessions) {
|
||||
if (includeStarting && noSessions) {
|
||||
var starting = TerminalView.get().getSessions().stream()
|
||||
.filter(shellSession -> shellSession.getTerminal().isRunning()
|
||||
&& runningMultiplexerContainerType == mult.get()
|
||||
|
||||
@@ -40,6 +40,21 @@ public class TerminalProxyManager {
|
||||
return id.equals("wsl");
|
||||
}
|
||||
|
||||
public static boolean hasConfiguredProxy() {
|
||||
var uuid = AppPrefs.get().terminalProxy().getValue();
|
||||
var hasCustomTerminalShell = uuid != null && !DataStorage.get().local().getUuid().equals(uuid);
|
||||
if (!hasCustomTerminalShell) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var foundEntry = DataStorage.get().getStoreEntryIfPresent(uuid);
|
||||
if (foundEntry.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Optional<ShellControl> getProxy() {
|
||||
var uuid = AppPrefs.get().terminalProxy().getValue();
|
||||
var hasCustomTerminalShell =
|
||||
|
||||
Reference in New Issue
Block a user