From de03207d90f225af294601476fd9d066754b07f1 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 10 Aug 2024 10:50:18 +0000 Subject: [PATCH] Fixes [stage] --- .../xpipe/app/comp/base/TtyWarningComp.java | 50 ------------------- .../io/xpipe/app/util/DataStoreFormatter.java | 2 +- .../core/store/ConnectionFileSystem.java | 5 ++ core/src/main/java/module-info.java | 1 + .../ext/base/store/ShellStoreProvider.java | 13 ----- version | 2 +- 6 files changed, 8 insertions(+), 65 deletions(-) delete mode 100644 app/src/main/java/io/xpipe/app/comp/base/TtyWarningComp.java diff --git a/app/src/main/java/io/xpipe/app/comp/base/TtyWarningComp.java b/app/src/main/java/io/xpipe/app/comp/base/TtyWarningComp.java deleted file mode 100644 index 34e760b4e..000000000 --- a/app/src/main/java/io/xpipe/app/comp/base/TtyWarningComp.java +++ /dev/null @@ -1,50 +0,0 @@ -package io.xpipe.app.comp.base; - -import atlantafx.base.theme.Styles; -import io.xpipe.app.fxcomps.SimpleComp; -import io.xpipe.app.fxcomps.impl.TooltipAugment; -import javafx.geometry.Pos; -import javafx.scene.layout.Region; -import lombok.Getter; -import org.kordamp.ikonli.javafx.FontIcon; -import org.kordamp.ikonli.javafx.StackedFontIcon; - -@Getter -public class TtyWarningComp extends SimpleComp { - - @Override - protected Region createSimple() { - var fi = new FontIcon("mdi2l-lightning-bolt"); - fi.getStyleClass().add("inner-icon"); - - var border = new FontIcon("mdi2s-square-rounded-outline"); - border.getStyleClass().add("outer-icon"); - border.setOpacity(0.5); - - var bg = new FontIcon("mdi2s-square-rounded"); - bg.getStyleClass().add("background-icon"); - - var pane = new StackedFontIcon(); - pane.getChildren().addAll(bg, fi, border); - pane.setAlignment(Pos.CENTER); - - var style = - """ - .stacked-ikonli-font-icon > .outer-icon { -fx-icon-color: -color-danger-emphasis; } - - .stacked-ikonli-font-icon > .outer-icon { - -fx-icon-size: 26px; - } - .stacked-ikonli-font-icon > .background-icon { - -fx-icon-size: 26px; - -fx-icon-color: -color-danger-9; - } - .stacked-ikonli-font-icon > .inner-icon { - -fx-icon-size: 12px; - } - """; - pane.getStylesheets().add(Styles.toDataURI(style)); - new TooltipAugment<>("ttyWarning", null).augment(pane); - return pane; - } -} diff --git a/app/src/main/java/io/xpipe/app/util/DataStoreFormatter.java b/app/src/main/java/io/xpipe/app/util/DataStoreFormatter.java index 30988d1fc..0a7920c44 100644 --- a/app/src/main/java/io/xpipe/app/util/DataStoreFormatter.java +++ b/app/src/main/java/io/xpipe/app/util/DataStoreFormatter.java @@ -42,7 +42,7 @@ public class DataStoreFormatter { return s.getShellDialect().getDisplayName(); } - var prefix = s.getTtyState() != ShellTtyState.NONE ? "[PTY] " : ""; + var prefix = s.getTtyState() != null && s.getTtyState() != ShellTtyState.NONE ? "[PTY] " : ""; return s.isRunning() ? prefix + formattedOsName(s.getOsName()) : "Connection failed"; } diff --git a/core/src/main/java/io/xpipe/core/store/ConnectionFileSystem.java b/core/src/main/java/io/xpipe/core/store/ConnectionFileSystem.java index c5331bbc9..04888e5af 100644 --- a/core/src/main/java/io/xpipe/core/store/ConnectionFileSystem.java +++ b/core/src/main/java/io/xpipe/core/store/ConnectionFileSystem.java @@ -36,6 +36,11 @@ public class ConnectionFileSystem implements FileSystem { @Override public FileSystem open() throws Exception { shellControl.start(); + + if (!shellControl.getTtyState().isPreservesOutput() || !shellControl.getTtyState().isSupportsInput()) { + throw new UnsupportedOperationException("Shell has a PTY allocated and does not support file system operations"); + } + var d = shellControl.getShellDialect().getDumbMode(); if (!d.supportsAnyPossibleInteraction()) { shellControl.close(); diff --git a/core/src/main/java/module-info.java b/core/src/main/java/module-info.java index 1ccf7cf3f..692574970 100644 --- a/core/src/main/java/module-info.java +++ b/core/src/main/java/module-info.java @@ -17,6 +17,7 @@ open module io.xpipe.core { requires com.fasterxml.jackson.databind; requires java.net.http; requires static lombok; + requires java.sql; uses com.fasterxml.jackson.databind.Module; uses ProcessControlProvider; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/store/ShellStoreProvider.java b/ext/base/src/main/java/io/xpipe/ext/base/store/ShellStoreProvider.java index 53e6535ba..424b176a1 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/store/ShellStoreProvider.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/store/ShellStoreProvider.java @@ -3,7 +3,6 @@ package io.xpipe.ext.base.store; import io.xpipe.app.browser.session.BrowserSessionModel; import io.xpipe.app.comp.base.OsLogoComp; import io.xpipe.app.comp.base.SystemStateComp; -import io.xpipe.app.comp.base.TtyWarningComp; import io.xpipe.app.comp.store.StoreEntryWrapper; import io.xpipe.app.comp.store.StoreSection; import io.xpipe.app.ext.ActionProvider; @@ -14,25 +13,13 @@ import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.util.DataStoreFormatter; import io.xpipe.app.util.TerminalLauncher; -import io.xpipe.core.process.ShellStoreState; -import io.xpipe.core.process.ShellTtyState; import io.xpipe.core.store.ShellStore; import io.xpipe.ext.base.script.ScriptStore; -import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; import javafx.beans.value.ObservableValue; public interface ShellStoreProvider extends DataStoreProvider { - default Comp createTtyWarning(StoreEntryWrapper w) { - return new TtyWarningComp().hide(Bindings.createObjectBinding( - () -> { - ShellStoreState state = (ShellStoreState) w.getPersistentState().getValue(); - return state.getTtyState() == ShellTtyState.NONE; - }, - w.getPersistentState())); - } - @Override default ActionProvider.Action launchAction(DataStoreEntry entry) { return new ActionProvider.Action() { diff --git a/version b/version index db6498e92..fadbd96c4 100644 --- a/version +++ b/version @@ -1 +1 @@ -11.0-1 +11.0-2