mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
mobaxterm fixes
This commit is contained in:
parent
63dba2d33c
commit
41d419f19d
1 changed files with 12 additions and 24 deletions
|
@ -1,6 +1,5 @@
|
||||||
package io.xpipe.app.terminal;
|
package io.xpipe.app.terminal;
|
||||||
|
|
||||||
import io.xpipe.app.beacon.AppBeaconServer;
|
|
||||||
import io.xpipe.app.comp.base.MarkdownComp;
|
import io.xpipe.app.comp.base.MarkdownComp;
|
||||||
import io.xpipe.app.core.AppCache;
|
import io.xpipe.app.core.AppCache;
|
||||||
import io.xpipe.app.core.AppI18n;
|
import io.xpipe.app.core.AppI18n;
|
||||||
|
@ -13,12 +12,9 @@ import io.xpipe.app.util.*;
|
||||||
import io.xpipe.core.process.*;
|
import io.xpipe.core.process.*;
|
||||||
import io.xpipe.core.store.FilePath;
|
import io.xpipe.core.store.FilePath;
|
||||||
import io.xpipe.core.util.FailableFunction;
|
import io.xpipe.core.util.FailableFunction;
|
||||||
import io.xpipe.core.util.XPipeInstallation;
|
|
||||||
|
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.ButtonBar;
|
import javafx.scene.control.ButtonBar;
|
||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
import lombok.With;
|
import lombok.With;
|
||||||
|
@ -240,32 +236,24 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
@Override
|
@Override
|
||||||
protected void execute(Path file, LaunchConfiguration configuration) throws Exception {
|
protected void execute(Path file, LaunchConfiguration configuration) throws Exception {
|
||||||
try (var sc = LocalShell.getShell()) {
|
try (var sc = LocalShell.getShell()) {
|
||||||
// Since mobaxterm uses its own cygwin environment, we have to provide the beacon auth secret to the tmp
|
SshLocalBridge.init();
|
||||||
// there as well
|
var b = SshLocalBridge.get();
|
||||||
// Otherwise it can't connect
|
var command = CommandBuilder.of()
|
||||||
var slashTemp = Path.of(System.getenv("APPDATA"), "MobaXterm", "slash", "tmp");
|
.addFile("ssh")
|
||||||
if (Files.exists(slashTemp)) {
|
.addQuoted(b.getUser() + "@localhost")
|
||||||
var authFileName = XPipeInstallation.getLocalBeaconAuthFile()
|
.add("-i")
|
||||||
.getFileName()
|
.add("\"$(cygpath \"" + b.getIdentityKey().toString() + "\")\"")
|
||||||
.toString();
|
.add("-p")
|
||||||
Files.writeString(
|
.add("" + b.getPort());
|
||||||
Path.of(slashTemp.toString(), authFileName),
|
var script = ScriptHelper.createExecScript(ShellDialects.BASH, sc, command.buildFull(sc));
|
||||||
AppBeaconServer.get().getLocalAuthSecret());
|
var fixedFile = script
|
||||||
}
|
|
||||||
|
|
||||||
var fixedFile = configuration
|
|
||||||
.getScriptFile()
|
|
||||||
.toString()
|
.toString()
|
||||||
.replaceAll("\\\\", "/")
|
.replaceAll("\\\\", "/")
|
||||||
.replaceAll("\\s", "\\$0");
|
.replaceAll("\\s", "\\$0");
|
||||||
var command = sc.getShellDialect() == ShellDialects.CMD
|
|
||||||
? CommandBuilder.of().addQuoted("cmd /c " + fixedFile)
|
|
||||||
: CommandBuilder.of()
|
|
||||||
.addQuoted("powershell -NoProfile -ExecutionPolicy Bypass -File " + fixedFile);
|
|
||||||
sc.command(CommandBuilder.of()
|
sc.command(CommandBuilder.of()
|
||||||
.addFile(file.toString())
|
.addFile(file.toString())
|
||||||
.add("-newtab")
|
.add("-newtab")
|
||||||
.add(command))
|
.add(fixedFile))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue