mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-26 09:28:26 -04:00
Various fixes
This commit is contained in:
@@ -83,8 +83,8 @@ public class ShellSession extends Session {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Don't run commands while in exit
|
||||
if (shellControl.isExiting()) {
|
||||
// Don't run commands while in startup / exit
|
||||
if (shellControl.isInitializing() || shellControl.isExiting()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BitwardenPasswordManager implements PasswordManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!sc.view().getEnvironmentVariable("BW_SESSION").isEmpty() && r[1].contains("Vault is locked")) {
|
||||
if (r[1].contains("Vault is locked")) {
|
||||
var pw = AskpassAlert.queryRaw("Unlock vault with your Bitwarden master password", null, false);
|
||||
if (pw.getSecret() == null) {
|
||||
return null;
|
||||
|
||||
@@ -189,8 +189,8 @@ public final class FilePath {
|
||||
return r;
|
||||
}
|
||||
|
||||
public FilePath resolveTildeHome(String dir) {
|
||||
return value.startsWith("~") ? FilePath.of(value.replace("~", dir)) : this;
|
||||
public FilePath resolveTildeHome(FilePath dir) {
|
||||
return value.startsWith("~") ? FilePath.of(value.replace("~", dir.toString())) : this;
|
||||
}
|
||||
|
||||
public List<String> split() {
|
||||
|
||||
@@ -223,7 +223,7 @@ public class SshIdentityStateManager {
|
||||
if (socket == null) {
|
||||
socket = AppPrefs.get().defaultSshAgentSocket().getValue();
|
||||
}
|
||||
checkLocalAgentIdentities(socket != null ? socket.toString() : null);
|
||||
checkLocalAgentIdentities(socket != null ? socket.resolveTildeHome(sc.view().userHome()).toString() : null);
|
||||
}
|
||||
|
||||
runningAgent = RunningAgent.SSH_AGENT;
|
||||
|
||||
@@ -118,8 +118,28 @@ public interface SshIdentityStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void buildCommand(CommandBuilder builder) {}
|
||||
public void buildCommand(CommandBuilder builder) {
|
||||
builder.environment("SSH_AUTH_SOCK", sc -> {
|
||||
if (sc.getOsType() == OsType.WINDOWS) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (AppPrefs.get() != null) {
|
||||
var socket = AppPrefs.get().sshAgentSocket().getValue();
|
||||
if (socket == null) {
|
||||
socket = AppPrefs.get().defaultSshAgentSocket().getValue();
|
||||
}
|
||||
|
||||
if (socket != null) {
|
||||
return socket.resolveTildeHome(sc.view().userHome()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KeyValue> configOptions(ShellControl parent) throws Exception {
|
||||
@@ -308,7 +328,7 @@ public interface SshIdentityStrategy {
|
||||
var s = file.toAbsoluteFilePath(parent);
|
||||
// The ~ is supported on all platforms, so manually replace it here for Windows
|
||||
if (s.startsWith("~")) {
|
||||
s = s.resolveTildeHome(parent.view().userHome().toString());
|
||||
s = s.resolveTildeHome(parent.view().userHome());
|
||||
}
|
||||
var resolved = parent.getShellDialect()
|
||||
.evaluateExpression(parent, s.toString())
|
||||
@@ -374,7 +394,7 @@ public interface SshIdentityStrategy {
|
||||
var s = file.toAbsoluteFilePath(sc);
|
||||
// The ~ is supported on all platforms, so manually replace it here for Windows
|
||||
if (s.startsWith("~")) {
|
||||
s = s.resolveTildeHome(sc.view().userHome().toString());
|
||||
s = s.resolveTildeHome(sc.view().userHome());
|
||||
}
|
||||
var resolved =
|
||||
sc.getShellDialect().evaluateExpression(sc, s.toString()).readStdoutOrThrow();
|
||||
|
||||
Reference in New Issue
Block a user