Merge branch 'jump-server' into 17-release

This commit is contained in:
crschnick
2025-06-05 19:12:55 +00:00
parent 1c94d64e10
commit 40bb286267
9 changed files with 95 additions and 75 deletions
@@ -31,6 +31,7 @@ public class ShellDialects {
public static ShellDialect CONSTRAINED_POWERSHELL;
public static ShellDialect OVH_BASTION;
public static ShellDialect HETZNER_BOX;
public static ShellDialect JUMP_SERVER;
public static List<ShellDialect> getStartableDialects() {
return ALL.stream()
@@ -96,6 +97,7 @@ public class ShellDialects {
CONSTRAINED_POWERSHELL = byId("constrainedPowershell");
OVH_BASTION = byId("ovhBastion");
HETZNER_BOX = byId("hetznerBox");
JUMP_SERVER = byId("jumpServer");
}
}
}
@@ -21,7 +21,8 @@ public class ShellView {
public FilePath writeTextFileDeterministic(FilePath base, String text) throws Exception {
var hash = Math.abs(text.hashCode());
var target = FilePath.of(base.getBaseName().toString() + "-" + hash + "." + base.getExtension());
var ext = base.getExtension();
var target = FilePath.of(base.getBaseName().toString() + "-" + hash + (ext.isPresent() ? "." + ext.get() : ""));
if (fileExists(target)) {
return target;
}
@@ -6,10 +6,7 @@ import lombok.EqualsAndHashCode;
import lombok.NonNull;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.regex.Pattern;
public final class FilePath {
@@ -156,13 +153,13 @@ public final class FilePath {
return FilePath.of(value.substring(0, split));
}
public String getExtension() {
var name = FileNames.getFileName(value);
public Optional<String> getExtension() {
var name = getFileName();
var split = name.split("\\.");
if (split.length == 0) {
return null;
if (split.length < 2) {
return Optional.empty();
}
return split[split.length - 1];
return Optional.of(split[split.length - 1]);
}
public FilePath join(String... parts) {
@@ -0,0 +1,15 @@
package io.xpipe.core.util;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;
@Value
@Builder
@Jacksonized
@AllArgsConstructor
public class KeyValue {
String key;
String value;
}