Various fixes

This commit is contained in:
crschnick 2025-02-11 09:04:33 +00:00
parent 5225dd03f4
commit 2845a06acb
8 changed files with 49 additions and 24 deletions

View file

@ -1,6 +1,7 @@
package io.xpipe.app.ext;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.util.Hyperlinks;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.FileEntry;
@ -50,7 +51,7 @@ public class ConnectionFileSystem implements FileSystem {
if (!shellControl.getTtyState().isPreservesOutput()
|| !shellControl.getTtyState().isSupportsInput()) {
throw new UnsupportedOperationException(
"Shell has a PTY allocated and as a result does not support file system operations");
"Shell has a PTY allocated and as a result does not support file system operations. For more information see " + Hyperlinks.DOCS_TTY);
}
shellControl.checkLicenseOrThrow();

View file

@ -47,14 +47,14 @@ public class AboutCategory extends AppPrefsCategory {
null)
.addComp(
new TileButtonComp("securityPolicy", "securityPolicyDescription", "mdrmz-security", e -> {
Hyperlinks.open(Hyperlinks.SECURITY);
Hyperlinks.open(Hyperlinks.DOCS_SECURITY);
e.consume();
})
.grow(true, false),
null)
.addComp(
new TileButtonComp("privacy", "privacyDescription", "mdomz-privacy_tip", e -> {
Hyperlinks.open(Hyperlinks.PRIVACY);
Hyperlinks.open(Hyperlinks.DOCS_PRIVACY);
e.consume();
})
.grow(true, false),
@ -69,7 +69,7 @@ public class AboutCategory extends AppPrefsCategory {
}))
.addComp(
new TileButtonComp("eula", "eulaDescription", "mdi2c-card-text-outline", e -> {
Hyperlinks.open(Hyperlinks.EULA);
Hyperlinks.open(Hyperlinks.DOCS_EULA);
e.consume();
})
.grow(true, false),

View file

@ -55,17 +55,20 @@ public class MobaXTermTerminalType extends ExternalTerminalType.WindowsType {
try (var sc = LocalShell.getShell()) {
SshLocalBridge.init();
var b = SshLocalBridge.get();
var abs = b.getIdentityKey().toAbsolutePath();
var drivePath = "/drives/" + abs.getRoot().toString().substring(0, 1).toLowerCase() + "/" + abs.getRoot().relativize(abs).toString().replaceAll("\\\\", "/");
var winPath = b.getIdentityKey().toString().replaceAll("\\\\", "\\\\\\\\");
var command = CommandBuilder.of()
.addFile("ssh")
.add("ssh")
.addQuoted(b.getUser() + "@localhost")
.add("-i")
.add("\"$(cygpath \"" + b.getIdentityKey().toString() + "\")\"")
.add("\"$(cygpath -u \"" + winPath + "\" || echo \"" + drivePath + "\")\"")
.add("-p")
.add("" + b.getPort());
// Don't use local shell to build as it uses cygwin
var rawCommand = command.buildSimple();
var script = ScriptHelper.getExecScriptFile(sc, "sh");
Files.writeString(Path.of(script.toString()), rawCommand);
Files.writeString(Path.of(script.toString()), "#!/usr/bin/env bash\n" + rawCommand);
var fixedFile = script.toString().replaceAll("\\\\", "/").replaceAll("\\s", "\\$0");
sc.command(CommandBuilder.of()
.addFile(file.toString())

View file

@ -33,7 +33,7 @@ public class AskpassAlert {
alert.getButtonTypes().add(type);
var button = alert.getDialogPane().lookupButton(type);
button.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
Hyperlinks.open(Hyperlinks.DOUBLE_PROMPT);
Hyperlinks.open(Hyperlinks.DOCS_DOUBLE_PROMPT);
event.consume();
});
}

View file

@ -4,19 +4,22 @@ import io.xpipe.app.issue.ErrorEvent;
public class Hyperlinks {
public static final String DOUBLE_PROMPT = "https://docs.xpipe.io/troubleshoot/two-step-connections";
public static final String AGENT_SETUP = "https://docs.xpipe.io/troubleshoot/ssh-agent-socket";
public static final String DOCS = "https://docs.xpipe.io";
public static final String DOCS_DOUBLE_PROMPT = "https://docs.xpipe.io/troubleshoot/two-step-connections";
public static final String DOCS_AGENT_SETUP = "https://docs.xpipe.io/troubleshoot/ssh-agent-socket";
public static final String DOCS_TTY = "https://docs.xpipe.io/troubleshoot/tty";
public static final String DOCS_LICENSE_ACTIVATION = "https://docs.xpipe.io/troubleshoot/license-activation";
public static final String DOCS_PRIVACY = "https://docs.xpipe.io/legal/privacy-policy";
public static final String DOCS_EULA = "https://docs.xpipe.io/legal/end-user-license-agreement";
public static final String DOCS_SECURITY = "https://docs.xpipe.io/reference/security";
public static final String GITHUB = "https://github.com/xpipe-io/xpipe";
public static final String GITHUB_PTB = "https://github.com/xpipe-io/xpipe-ptb";
public static final String GITHUB_LATEST = "https://github.com/xpipe-io/xpipe/releases/latest";
public static final String GITHUB_PYTHON_API = "https://github.com/xpipe-io/xpipe-python-api";
public static final String PRIVACY = "https://docs.xpipe.io/legal/privacy-policy";
public static final String EULA = "https://docs.xpipe.io/legal/end-user-license-agreement";
public static final String SECURITY = "https://docs.xpipe.io/reference/security";
public static final String TRANSLATE = "https://github.com/xpipe-io/xpipe/tree/master/lang";
public static final String DISCORD = "https://discord.gg/8y89vS8cRb";
public static final String GITHUB_WEBTOP = "https://github.com/xpipe-io/xpipe-webtop";
public static final String DOCS = "https://docs.xpipe.io";
public static final String SLACK =
"https://join.slack.com/t/XPipe/shared_invite/zt-1awjq0t5j-5i4UjNJfNe1VN4b_auu6Cg";

View file

@ -7,6 +7,7 @@ import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.process.ShellDialects;
import io.xpipe.core.util.XPipeInstallation;
import lombok.Getter;
@ -86,12 +87,20 @@ public class SshLocalBridge {
.createFileExistsCommand(sc, hostKey.toString())
.executeAndCheck()) {
sc.command(CommandBuilder.of()
.add("ssh-keygen", "-q", "-N")
.addQuoted("")
.add("ssh-keygen", "-q")
.add("-C")
.addQuoted("XPipe SSH bridge host key")
.add("-t", "ed25519", "-f")
.addFile(hostKey.toString()))
.add("-t", "ed25519")
.add("-f")
.addQuoted(hostKey.toString())
.add(ssc -> {
// Powershell breaks when just using quotes
if (ShellDialects.isPowershell(ssc)) {
return "-N '\"\"'";
} else {
return "-N \"\"";
}
}))
.execute();
}
@ -100,12 +109,20 @@ public class SshLocalBridge {
.createFileExistsCommand(sc, idKey.toString())
.executeAndCheck()) {
sc.command(CommandBuilder.of()
.add("ssh-keygen", "-q", "-N")
.addQuoted("")
.add("ssh-keygen", "-q")
.add("-C")
.addQuoted("XPipe SSH bridge identity")
.add("-t", "ed25519", "-f")
.addFile(idKey.toString()))
.add("-t", "ed25519")
.add("-f")
.addQuoted(idKey.toString())
.add(ssc -> {
// Powershell breaks when just using quotes
if (ShellDialects.isPowershell(ssc)) {
return "-N '\"\"'";
} else {
return "-N \"\"";
}
}))
.execute();
}

View file

@ -46,6 +46,7 @@ There is a new documentation site https://docs.xpipe.io. The goal is to expand t
- Fix some icons resetting on updates
- Fix desktop shortcuts not launching actions properly
- Fix teleport integration failing for newer teleport versions
- Fix MobaXterm integration not working correctly
- Fix git sync SSH key password always prompting, even if it is specified in place
- Fix creation dialog for scripts and identities still referring to the name as connection name
- Fix password prompts for tunneled VM SSH connections showing wrong hostname as localhost

View file

@ -146,7 +146,7 @@ public class SshIdentityStateManager {
var r = c.readStdoutAndStderr();
if (c.getExitCode() != 0) {
var posixMessage = sc.getOsType() != OsType.WINDOWS
? " and the SSH_AUTH_SOCK variable. See " + Hyperlinks.AGENT_SETUP + " for details"
? " and the SSH_AUTH_SOCK variable. See " + Hyperlinks.DOCS_AGENT_SETUP + " for details"
: "";
var ex =
new IllegalStateException("Unable to list agent identities via command ssh-add -l:\n" + r[0]
@ -156,7 +156,7 @@ public class SshIdentityStateManager {
ErrorEvent.preconfigure(ErrorEvent.fromThrowable(ex)
.noDefaultActions()
.expected()
.customAction(ErrorAction.openDocumentation(Hyperlinks.AGENT_SETUP)));
.customAction(ErrorAction.openDocumentation(Hyperlinks.DOCS_AGENT_SETUP)));
throw ex;
}
}