From 45f0b1638eb137c7e09a19a9fc73d425922fd8ef Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 20 Jun 2026 14:21:06 +0000 Subject: [PATCH] Rework --- .../io/xpipe/app/beacon/api/FsReadExchange.java | 4 ++-- .../io/xpipe/app/beacon/api/FsWriteExchange.java | 5 ++--- .../java/io/xpipe/app/beacon/mcp/McpTools.java | 14 +++++++------- .../xpipe/app/browser/BrowserFullSessionComp.java | 3 +++ .../xpipe/app/browser/file/BrowserFileInput.java | 4 ++-- .../xpipe/app/browser/file/BrowserFileOutput.java | 4 ++-- .../app/browser/file/BrowserStatusBarComp.java | 1 + ...nectionFileSystem.java => ShellFileSystem.java} | 8 ++++---- app/src/main/java/io/xpipe/app/ext/ShellStore.java | 2 +- .../io/xpipe/app/resources/style/prefs.css | 6 +++--- 10 files changed, 27 insertions(+), 24 deletions(-) rename app/src/main/java/io/xpipe/app/ext/{ConnectionFileSystem.java => ShellFileSystem.java} (98%) diff --git a/app/src/main/java/io/xpipe/app/beacon/api/FsReadExchange.java b/app/src/main/java/io/xpipe/app/beacon/api/FsReadExchange.java index 652ef65e0..c3fdf7e26 100644 --- a/app/src/main/java/io/xpipe/app/beacon/api/FsReadExchange.java +++ b/app/src/main/java/io/xpipe/app/beacon/api/FsReadExchange.java @@ -5,7 +5,7 @@ import io.xpipe.app.beacon.AppBeaconServer; import io.xpipe.app.beacon.BeaconClientException; import io.xpipe.app.beacon.BeaconInterface; import io.xpipe.app.beacon.BlobManager; -import io.xpipe.app.ext.ConnectionFileSystem; +import io.xpipe.app.ext.ShellFileSystem; import io.xpipe.app.util.FilePath; import io.xpipe.app.util.FixedSizeInputStream; @@ -31,7 +31,7 @@ public class FsReadExchange extends BeaconInterface { @SneakyThrows public Object handle(HttpExchange exchange, Request msg) { var shell = AppBeaconServer.get().getCache().getShellSession(msg.getStore()); - var fs = new ConnectionFileSystem(shell.getControl()); + var fs = new ShellFileSystem(shell.getControl()); if (!fs.fileExists(msg.getPath())) { throw new BeaconClientException("File does not exist"); diff --git a/app/src/main/java/io/xpipe/app/beacon/api/FsWriteExchange.java b/app/src/main/java/io/xpipe/app/beacon/api/FsWriteExchange.java index 5f13d74de..a65dc1bef 100644 --- a/app/src/main/java/io/xpipe/app/beacon/api/FsWriteExchange.java +++ b/app/src/main/java/io/xpipe/app/beacon/api/FsWriteExchange.java @@ -4,7 +4,7 @@ import com.sun.net.httpserver.HttpExchange; import io.xpipe.app.beacon.AppBeaconServer; import io.xpipe.app.beacon.BeaconInterface; import io.xpipe.app.beacon.BlobManager; -import io.xpipe.app.ext.ConnectionFileSystem; +import io.xpipe.app.ext.ShellFileSystem; import io.xpipe.app.util.FilePath; import lombok.Builder; @@ -13,7 +13,6 @@ import lombok.SneakyThrows; import lombok.Value; import lombok.extern.jackson.Jacksonized; -import java.nio.file.Files; import java.util.UUID; public class FsWriteExchange extends BeaconInterface { @@ -27,7 +26,7 @@ public class FsWriteExchange extends BeaconInterface { @SneakyThrows public Object handle(HttpExchange exchange, Request msg) { var shell = AppBeaconServer.get().getCache().getShellSession(msg.getStore()); - var fs = new ConnectionFileSystem(shell.getControl()); + var fs = new ShellFileSystem(shell.getControl()); try (var in = BlobManager.get().getBlob(msg.getBlob()); var os = fs.openOutput(msg.getPath(), BlobManager.get().getSize(msg.getBlob()))) { in.transferTo(os); diff --git a/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java b/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java index 7b3822d3e..52e708548 100644 --- a/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java +++ b/app/src/main/java/io/xpipe/app/beacon/mcp/McpTools.java @@ -184,7 +184,7 @@ public final class McpTools { var shellStore = req.getShellStoreRef(system, false); var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore); var path = req.getFilePath(shellSession.getControl(), "path"); - var fs = new ConnectionFileSystem(shellSession.getControl()); + var fs = new ShellFileSystem(shellSession.getControl()); if (!fs.fileExists(path)) { throw new BeaconClientException("File " + path + " does not exist"); @@ -210,7 +210,7 @@ public final class McpTools { var recursive = req.getOptionalBooleanArgument("recursive").orElse(false); var shellStore = req.getShellStoreRef(system, false); var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore); - var fs = new ConnectionFileSystem(shellSession.getControl()); + var fs = new ShellFileSystem(shellSession.getControl()); var path = req.getFilePath(shellSession.getControl(), "path"); if (!fs.directoryExists(path)) { @@ -239,7 +239,7 @@ public final class McpTools { var shellStore = req.getShellStoreRef(system, false); var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore); var path = req.getFilePath(shellSession.getControl(), "path"); - var fs = new ConnectionFileSystem(shellSession.getControl()); + var fs = new ShellFileSystem(shellSession.getControl()); if (!fs.directoryExists(path)) { throw new BeaconClientException("Directory " + path + " does not exist"); @@ -271,7 +271,7 @@ public final class McpTools { var shellStore = req.getShellStoreRef(system, false); var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore); var path = req.getFilePath(shellSession.getControl(), "path"); - var fs = new ConnectionFileSystem(shellSession.getControl()); + var fs = new ShellFileSystem(shellSession.getControl()); if (!fs.fileExists(path) && !fs.directoryExists(path)) { throw new BeaconClientException("Path " + path + " does not exist"); @@ -312,7 +312,7 @@ public final class McpTools { var shellStore = req.getShellStoreRef(system, true); var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore); var path = req.getFilePath(shellSession.getControl(), "path"); - var fs = new ConnectionFileSystem(shellSession.getControl()); + var fs = new ShellFileSystem(shellSession.getControl()); if (fs.fileExists(path)) { throw new BeaconClientException("File " + path + " does already exist"); @@ -345,7 +345,7 @@ public final class McpTools { var shellStore = req.getShellStoreRef(system, true); var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore); var path = req.getFilePath(shellSession.getControl(), "path"); - var fs = new ConnectionFileSystem(shellSession.getControl()); + var fs = new ShellFileSystem(shellSession.getControl()); var b = content.getBytes(StandardCharsets.UTF_8); try (var out = fs.openOutput(path, b.length)) { @@ -368,7 +368,7 @@ public final class McpTools { var shellStore = req.getShellStoreRef(system, true); var shellSession = AppBeaconServer.get().getCache().getOrStart(shellStore); var path = req.getFilePath(shellSession.getControl(), "path"); - var fs = new ConnectionFileSystem(shellSession.getControl()); + var fs = new ShellFileSystem(shellSession.getControl()); if (fs.fileExists(path)) { throw new BeaconClientException("Directory " + path + " does already exist"); diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserFullSessionComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserFullSessionComp.java index 0bcf51a26..466ed067c 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserFullSessionComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserFullSessionComp.java @@ -200,6 +200,9 @@ public class BrowserFullSessionComp extends SimpleRegionBuilder { cache.keySet().removeIf(browserSessionTab -> !all.contains(browserSessionTab)); if (newValue == null) { + struc.setMinWidth(0); + struc.setPrefWidth(Region.USE_COMPUTED_SIZE); + struc.setMaxWidth(Region.USE_COMPUTED_SIZE); struc.getChildren().clear(); return; } diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileInput.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileInput.java index 063538ae0..e166f71cf 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileInput.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileInput.java @@ -1,7 +1,7 @@ package io.xpipe.app.browser.file; import io.xpipe.app.core.window.AppDialog; -import io.xpipe.app.ext.ConnectionFileSystem; +import io.xpipe.app.ext.ShellFileSystem; import io.xpipe.app.ext.FileEntry; import io.xpipe.app.ext.FileInfo; import io.xpipe.app.process.CommandBuilder; @@ -81,7 +81,7 @@ public interface BrowserFileInput { .elevated(ElevationFunction.elevated(null)) .start() : model.getFileSystem().getShell().orElseThrow().start(); - var fs = elevate ? new ConnectionFileSystem(sc) : model.getFileSystem(); + var fs = elevate ? new ShellFileSystem(sc) : model.getFileSystem(); var output = new BrowserFileInput() { @Override diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileOutput.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileOutput.java index 64d4b338e..17d697a3a 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileOutput.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileOutput.java @@ -1,7 +1,7 @@ package io.xpipe.app.browser.file; import io.xpipe.app.core.window.AppDialog; -import io.xpipe.app.ext.ConnectionFileSystem; +import io.xpipe.app.ext.ShellFileSystem; import io.xpipe.app.ext.FileEntry; import io.xpipe.app.ext.FileInfo; import io.xpipe.app.issue.ErrorEventFactory; @@ -87,7 +87,7 @@ public interface BrowserFileOutput { .elevated(ElevationFunction.elevated(null)) .start() : model.getFileSystem().getShell().orElseThrow().start(); - var fs = elevate ? new ConnectionFileSystem(sc) : model.getFileSystem(); + var fs = elevate ? new ShellFileSystem(sc) : model.getFileSystem(); var checkSudoersFile = shell.isPresent() && file.getPath().startsWith("/etc/sudo"); var output = new BrowserFileOutput() { diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserStatusBarComp.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserStatusBarComp.java index 67765907b..4b947cde0 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserStatusBarComp.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserStatusBarComp.java @@ -39,6 +39,7 @@ public class BrowserStatusBarComp extends SimpleRegionBuilder { createClipboardStatus(), createSelectionStatus(), createKillButton())); + bar.minWidth(0); bar.spacing(15); bar.style("status-bar"); diff --git a/app/src/main/java/io/xpipe/app/ext/ConnectionFileSystem.java b/app/src/main/java/io/xpipe/app/ext/ShellFileSystem.java similarity index 98% rename from app/src/main/java/io/xpipe/app/ext/ConnectionFileSystem.java rename to app/src/main/java/io/xpipe/app/ext/ShellFileSystem.java index 81f06ef07..2afb1b9a8 100644 --- a/app/src/main/java/io/xpipe/app/ext/ConnectionFileSystem.java +++ b/app/src/main/java/io/xpipe/app/ext/ShellFileSystem.java @@ -25,12 +25,12 @@ import java.util.UUID; import java.util.stream.Stream; @Getter -public class ConnectionFileSystem implements FileSystem { +public class ShellFileSystem implements FileSystem { @JsonIgnore protected final ShellControl shellControl; - public ConnectionFileSystem(ShellControl shellControl) { + public ShellFileSystem(ShellControl shellControl) { this.shellControl = shellControl; } @@ -196,7 +196,7 @@ public class ConnectionFileSystem implements FileSystem { .findProgram(ShellDialects.POWERSHELL_CORE.getExecutableName()) .isPresent(); if (pwsh) { - return new ConnectionFileSystem( + return new ShellFileSystem( shellControl.subShell(ShellDialects.POWERSHELL_CORE).start()); } @@ -205,7 +205,7 @@ public class ConnectionFileSystem implements FileSystem { .findProgram(ShellDialects.POWERSHELL.getExecutableName()) .isPresent(); if (powershell) { - return new ConnectionFileSystem( + return new ShellFileSystem( shellControl.subShell(ShellDialects.POWERSHELL).start()); } } diff --git a/app/src/main/java/io/xpipe/app/ext/ShellStore.java b/app/src/main/java/io/xpipe/app/ext/ShellStore.java index 5de9f13cb..ffb68dd3a 100644 --- a/app/src/main/java/io/xpipe/app/ext/ShellStore.java +++ b/app/src/main/java/io/xpipe/app/ext/ShellStore.java @@ -47,7 +47,7 @@ public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore @Override default FileSystem createFileSystem() throws Exception { var func = shellFunction(); - return new ConnectionFileSystem(func.control()); + return new ShellFileSystem(func.control()); } ShellControlFunction shellFunction(); diff --git a/app/src/main/resources/io/xpipe/app/resources/style/prefs.css b/app/src/main/resources/io/xpipe/app/resources/style/prefs.css index 389c916d2..98b205bca 100644 --- a/app/src/main/resources/io/xpipe/app/resources/style/prefs.css +++ b/app/src/main/resources/io/xpipe/app/resources/style/prefs.css @@ -2,7 +2,7 @@ -fx-padding: 40 40 0 80; } -.root:portrait .prefs-box { +.root:compact .prefs-box { -fx-padding: 20 20 20 20; } @@ -20,7 +20,7 @@ -fx-padding: 0 0 0 1em; } -.root:portrait .prefs .prefs-container.options-comp > .options-comp { +.root:compact .prefs .prefs-container.options-comp > .options-comp { -fx-padding: 0 0 0 0.2em; } @@ -48,7 +48,7 @@ -fx-font-size: 1.5em; } -.root:portrait .prefs-container > .title-header { +.root:compact .prefs-container > .title-header { -fx-padding: 1.5em 0 -0.5em 0; }