This commit is contained in:
crschnick
2024-06-23 22:40:50 +00:00
parent d1b506415c
commit eeeef57b8f
74 changed files with 314 additions and 187 deletions
@@ -1,7 +1,8 @@
package io.xpipe.beacon;
import com.sun.net.httpserver.HttpExchange;
import io.xpipe.core.util.ModuleLayerLoader;
import com.sun.net.httpserver.HttpExchange;
import lombok.SneakyThrows;
import java.util.List;
@@ -71,8 +72,7 @@ public abstract class BeaconInterface<T> {
public abstract String getPath();
public Object handle(HttpExchange exchange, T body)
throws BeaconClientException, BeaconServerException {
public Object handle(HttpExchange exchange, T body) throws BeaconClientException, BeaconServerException {
throw new UnsupportedOperationException();
}
@@ -28,8 +28,11 @@ public class BeaconServer {
}
private static List<String> toProcessCommand(String toExec) {
// Having the trailing space is very important to force cmd to not interpret surrounding spaces and removing them
return OsType.getLocal().equals(OsType.WINDOWS) ? List.of("cmd", "/c", toExec + " ") : List.of("sh", "-c", toExec);
// Having the trailing space is very important to force cmd to not interpret surrounding spaces and removing
// them
return OsType.getLocal().equals(OsType.WINDOWS)
? List.of("cmd", "/c", toExec + " ")
: List.of("sh", "-c", toExec);
}
public static Process tryStartCustom() throws Exception {
@@ -1,6 +1,7 @@
package io.xpipe.beacon.api;
import io.xpipe.beacon.BeaconInterface;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@@ -2,6 +2,7 @@ package io.xpipe.beacon.api;
import io.xpipe.beacon.BeaconInterface;
import io.xpipe.core.store.FilePath;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@@ -22,6 +23,7 @@ public class FsReadExchange extends BeaconInterface<FsReadExchange.Request> {
public static class Request {
@NonNull
UUID connection;
@NonNull
FilePath path;
}
@@ -2,6 +2,7 @@ package io.xpipe.beacon.api;
import io.xpipe.beacon.BeaconInterface;
import io.xpipe.core.store.FilePath;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@@ -22,6 +23,7 @@ public class FsScriptExchange extends BeaconInterface<FsScriptExchange.Request>
public static class Request {
@NonNull
UUID connection;
@NonNull
UUID blob;
}
@@ -2,6 +2,7 @@ package io.xpipe.beacon.api;
import io.xpipe.beacon.BeaconInterface;
import io.xpipe.core.store.FilePath;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@@ -22,8 +23,10 @@ public class FsWriteExchange extends BeaconInterface<FsWriteExchange.Request> {
public static class Request {
@NonNull
UUID connection;
@NonNull
UUID blob;
@NonNull
FilePath path;
}
@@ -4,6 +4,7 @@ import io.xpipe.beacon.BeaconInterface;
import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ShellDialect;
import io.xpipe.core.store.FilePath;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;
@@ -32,10 +33,13 @@ public class ShellStartExchange extends BeaconInterface<ShellStartExchange.Reque
public static class Response {
@NonNull
ShellDialect shellDialect;
@NonNull
OsType osType;
@NonNull
String osName;
@NonNull
FilePath temp;
}
+2 -1
View File
@@ -1,9 +1,10 @@
import com.fasterxml.jackson.databind.Module;
import io.xpipe.beacon.BeaconInterface;
import io.xpipe.beacon.BeaconJacksonModule;
import io.xpipe.beacon.api.*;
import io.xpipe.core.util.ModuleLayerLoader;
import com.fasterxml.jackson.databind.Module;
open module io.xpipe.beacon {
exports io.xpipe.beacon;
exports io.xpipe.beacon.test;