From f1c53373550978f1778f0391ef51d7d661ea0a7e Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 8 Sep 2024 22:07:53 +0000 Subject: [PATCH] Shell environmentally factoring and default option implementation --- .../beacon/impl/SshLaunchExchangeImpl.java | 2 +- .../xpipe/app/browser/BrowserClipboard.java | 2 +- .../app/browser/file/LocalFileSystem.java | 2 +- .../app/browser/fs/OpenFileSystemModel.java | 2 +- .../xpipe/app/core/AppExtensionManager.java | 2 +- .../xpipe/app/core/check/AppShellCheck.java | 2 +- .../java/io/xpipe/app/ext}/LocalStore.java | 7 +++++-- .../app/ext}/ProcessControlProvider.java | 7 ++++++- .../app/fxcomps/impl/DataStoreChoiceComp.java | 2 +- .../app/prefs/PasswordManagerCategory.java | 4 ++-- .../io/xpipe/app/prefs/TerminalCategory.java | 2 +- .../io/xpipe/app/storage/DataStorage.java | 2 +- .../app/storage/DataStorageSyncHandler.java | 2 +- .../app/storage/ImpersistentStorage.java | 2 +- .../io/xpipe/app/storage/StandardStorage.java | 2 +- .../app/terminal/ExternalTerminalType.java | 1 + .../io/xpipe/app/update/AppInstaller.java | 2 +- .../io/xpipe/app/update/ChocoUpdater.java | 2 +- .../io/xpipe/app/util/AppJacksonModule.java | 2 +- .../java/io/xpipe/app/util/FileReference.java | 2 +- .../java/io/xpipe/app/util/LocalShell.java | 2 +- .../app/util/SecretRetrievalStrategy.java | 2 +- .../io/xpipe/app/util/SshLocalBridge.java | 2 +- .../io/xpipe/app/util/TerminalLauncher.java | 1 + app/src/main/java/module-info.java | 1 + .../io/xpipe/core/process/ShellControl.java | 5 +---- ...e.java => ShellEnvironmentStoreState.java} | 7 ++++--- .../java/io/xpipe/core/store/ShellStore.java | 4 ---- .../io/xpipe/core/util/CoreJacksonModule.java | 21 ++++++++----------- core/src/main/java/module-info.java | 2 -- .../ext/base/action/BrowseStoreAction.java | 5 ++++- .../ext/base/action/SampleStoreAction.java | 5 ++--- lang/proc/strings/translations_da.properties | 2 ++ lang/proc/strings/translations_de.properties | 2 ++ lang/proc/strings/translations_en.properties | 2 ++ lang/proc/strings/translations_es.properties | 2 ++ lang/proc/strings/translations_fr.properties | 2 ++ lang/proc/strings/translations_it.properties | 2 ++ lang/proc/strings/translations_ja.properties | 2 ++ lang/proc/strings/translations_nl.properties | 2 ++ lang/proc/strings/translations_pt.properties | 2 ++ lang/proc/strings/translations_ru.properties | 2 ++ lang/proc/strings/translations_tr.properties | 2 ++ lang/proc/strings/translations_zh.properties | 2 ++ 44 files changed, 79 insertions(+), 53 deletions(-) rename {core/src/main/java/io/xpipe/core/store => app/src/main/java/io/xpipe/app/ext}/LocalStore.java (80%) rename {core/src/main/java/io/xpipe/core/process => app/src/main/java/io/xpipe/app/ext}/ProcessControlProvider.java (83%) rename core/src/main/java/io/xpipe/core/process/{ShellNameStoreState.java => ShellEnvironmentStoreState.java} (64%) diff --git a/app/src/main/java/io/xpipe/app/beacon/impl/SshLaunchExchangeImpl.java b/app/src/main/java/io/xpipe/app/beacon/impl/SshLaunchExchangeImpl.java index 134c8ccea..e9d4bfeff 100644 --- a/app/src/main/java/io/xpipe/app/beacon/impl/SshLaunchExchangeImpl.java +++ b/app/src/main/java/io/xpipe/app/beacon/impl/SshLaunchExchangeImpl.java @@ -3,7 +3,7 @@ package io.xpipe.app.beacon.impl; import com.sun.net.httpserver.HttpExchange; import io.xpipe.app.util.TerminalLauncherManager; import io.xpipe.beacon.api.SshLaunchExchange; -import io.xpipe.core.process.ProcessControlProvider; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.core.process.ShellDialects; import java.util.List; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java b/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java index 672ab588d..1921d9a3a 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java @@ -5,7 +5,7 @@ import io.xpipe.app.browser.file.BrowserFileTransferMode; import io.xpipe.app.browser.file.LocalFileSystem; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.util.ThreadHelper; -import io.xpipe.core.process.ProcessControlProvider; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.core.store.FileEntry; import io.xpipe.core.util.FailableRunnable; diff --git a/app/src/main/java/io/xpipe/app/browser/file/LocalFileSystem.java b/app/src/main/java/io/xpipe/app/browser/file/LocalFileSystem.java index 1c15ba45a..6b07cd7c8 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/LocalFileSystem.java +++ b/app/src/main/java/io/xpipe/app/browser/file/LocalFileSystem.java @@ -3,7 +3,7 @@ package io.xpipe.app.browser.file; import io.xpipe.core.store.FileEntry; import io.xpipe.core.store.FileKind; import io.xpipe.core.store.FileSystem; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import java.nio.file.Files; import java.nio.file.Path; diff --git a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java index 614caeb30..3697c98e0 100644 --- a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java +++ b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java @@ -18,7 +18,7 @@ import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.BooleanScope; import io.xpipe.app.util.TerminalLauncher; import io.xpipe.app.util.ThreadHelper; -import io.xpipe.core.process.ProcessControlProvider; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialects; import io.xpipe.core.process.ShellOpenFunction; diff --git a/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java b/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java index 50ca49aaf..6a9f064a0 100644 --- a/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java +++ b/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java @@ -4,7 +4,7 @@ import io.xpipe.app.ext.ExtensionException; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.process.OsType; -import io.xpipe.core.process.ProcessControlProvider; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.core.util.ModuleHelper; import io.xpipe.core.util.ModuleLayerLoader; import io.xpipe.core.util.XPipeInstallation; diff --git a/app/src/main/java/io/xpipe/app/core/check/AppShellCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppShellCheck.java index c3000bc37..9d792cea7 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppShellCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppShellCheck.java @@ -3,7 +3,7 @@ package io.xpipe.app.core.check; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.util.LocalShell; import io.xpipe.core.process.OsType; -import io.xpipe.core.process.ProcessControlProvider; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.core.process.ProcessOutputException; import lombok.Value; diff --git a/core/src/main/java/io/xpipe/core/store/LocalStore.java b/app/src/main/java/io/xpipe/app/ext/LocalStore.java similarity index 80% rename from core/src/main/java/io/xpipe/core/store/LocalStore.java rename to app/src/main/java/io/xpipe/app/ext/LocalStore.java index ead641103..fe2c79287 100644 --- a/core/src/main/java/io/xpipe/core/store/LocalStore.java +++ b/app/src/main/java/io/xpipe/app/ext/LocalStore.java @@ -1,8 +1,11 @@ -package io.xpipe.core.store; +package io.xpipe.app.ext; -import io.xpipe.core.process.ProcessControlProvider; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellStoreState; +import io.xpipe.core.store.DataStore; +import io.xpipe.core.store.NetworkTunnelStore; +import io.xpipe.core.store.ShellStore; +import io.xpipe.core.store.StatefulDataStore; import io.xpipe.core.util.JacksonizedValue; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/core/src/main/java/io/xpipe/core/process/ProcessControlProvider.java b/app/src/main/java/io/xpipe/app/ext/ProcessControlProvider.java similarity index 83% rename from core/src/main/java/io/xpipe/core/process/ProcessControlProvider.java rename to app/src/main/java/io/xpipe/app/ext/ProcessControlProvider.java index dd7f2a515..3196ac000 100644 --- a/core/src/main/java/io/xpipe/core/process/ProcessControlProvider.java +++ b/app/src/main/java/io/xpipe/app/ext/ProcessControlProvider.java @@ -1,5 +1,8 @@ -package io.xpipe.core.process; +package io.xpipe.app.ext; +import io.xpipe.app.storage.DataStoreEntryRef; +import io.xpipe.core.process.*; +import io.xpipe.core.store.DataStore; import lombok.NonNull; import java.util.ServiceLoader; @@ -37,4 +40,6 @@ public abstract class ProcessControlProvider { public abstract ShellDialect getDefaultLocalDialect(); public abstract ShellDialect getFallbackDialect(); + + public abstract DataStoreEntryRef replace(DataStoreEntryRef ref); } diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreChoiceComp.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreChoiceComp.java index e55ab8238..24e8ecc9c 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreChoiceComp.java @@ -11,7 +11,7 @@ import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.util.DataStoreCategoryChoiceComp; import io.xpipe.core.store.DataStore; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import io.xpipe.core.store.ShellStore; import javafx.beans.binding.Bindings; diff --git a/app/src/main/java/io/xpipe/app/prefs/PasswordManagerCategory.java b/app/src/main/java/io/xpipe/app/prefs/PasswordManagerCategory.java index 7fdd311d2..4e98b1705 100644 --- a/app/src/main/java/io/xpipe/app/prefs/PasswordManagerCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/PasswordManagerCategory.java @@ -12,8 +12,8 @@ import io.xpipe.app.util.TerminalLauncher; import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.CommandControl; -import io.xpipe.core.process.ProcessControlProvider; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.ProcessControlProvider; +import io.xpipe.app.ext.LocalStore; import javafx.beans.property.SimpleStringProperty; import javafx.geometry.Insets; diff --git a/app/src/main/java/io/xpipe/app/prefs/TerminalCategory.java b/app/src/main/java/io/xpipe/app/prefs/TerminalCategory.java index 0231a02b3..2ebdd1bac 100644 --- a/app/src/main/java/io/xpipe/app/prefs/TerminalCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/TerminalCategory.java @@ -13,7 +13,7 @@ import io.xpipe.app.util.Hyperlinks; import io.xpipe.app.util.OptionsBuilder; import io.xpipe.app.util.TerminalLauncher; import io.xpipe.app.util.ThreadHelper; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import javafx.beans.binding.Bindings; import javafx.geometry.Insets; diff --git a/app/src/main/java/io/xpipe/app/storage/DataStorage.java b/app/src/main/java/io/xpipe/app/storage/DataStorage.java index b7fd55379..3ce2fd280 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorage.java @@ -8,7 +8,7 @@ import io.xpipe.app.util.FixedHierarchyStore; import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.store.DataStore; import io.xpipe.core.store.FixedChildStore; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import io.xpipe.core.store.StorePath; import io.xpipe.core.util.UuidHelper; diff --git a/app/src/main/java/io/xpipe/app/storage/DataStorageSyncHandler.java b/app/src/main/java/io/xpipe/app/storage/DataStorageSyncHandler.java index 0a6b584e7..e610cdc5f 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorageSyncHandler.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorageSyncHandler.java @@ -1,6 +1,6 @@ package io.xpipe.app.storage; -import io.xpipe.core.process.ProcessControlProvider; +import io.xpipe.app.ext.ProcessControlProvider; import java.nio.file.Path; diff --git a/app/src/main/java/io/xpipe/app/storage/ImpersistentStorage.java b/app/src/main/java/io/xpipe/app/storage/ImpersistentStorage.java index 247fa8b3c..80f546327 100644 --- a/app/src/main/java/io/xpipe/app/storage/ImpersistentStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/ImpersistentStorage.java @@ -1,7 +1,7 @@ package io.xpipe.app.storage; import io.xpipe.app.comp.store.StoreSortMode; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import java.time.Instant; import java.util.UUID; diff --git a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java index dfa1108d1..2d4e18709 100644 --- a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java @@ -5,7 +5,7 @@ import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.process.OsType; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import io.xpipe.core.util.JacksonMapper; import com.fasterxml.jackson.core.JacksonException; diff --git a/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java index af6fb9441..6cf1ed66b 100644 --- a/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java @@ -5,6 +5,7 @@ import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.window.AppWindowHelper; import io.xpipe.app.ext.PrefsChoiceValue; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.prefs.ExternalApplicationType; import io.xpipe.app.storage.DataColor; diff --git a/app/src/main/java/io/xpipe/app/update/AppInstaller.java b/app/src/main/java/io/xpipe/app/update/AppInstaller.java index dd304cce1..8cacf61af 100644 --- a/app/src/main/java/io/xpipe/app/update/AppInstaller.java +++ b/app/src/main/java/io/xpipe/app/update/AppInstaller.java @@ -12,7 +12,7 @@ import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.process.OsType; import io.xpipe.core.process.ShellDialects; import io.xpipe.core.store.FileNames; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import io.xpipe.core.util.FailableRunnable; import io.xpipe.core.util.XPipeInstallation; diff --git a/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java b/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java index 1d0358217..ff0d80717 100644 --- a/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/ChocoUpdater.java @@ -3,7 +3,7 @@ package io.xpipe.app.update; import io.xpipe.app.core.AppProperties; import io.xpipe.app.fxcomps.impl.CodeSnippet; import io.xpipe.app.fxcomps.impl.CodeSnippetComp; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import javafx.beans.property.SimpleObjectProperty; import javafx.scene.layout.Region; diff --git a/app/src/main/java/io/xpipe/app/util/AppJacksonModule.java b/app/src/main/java/io/xpipe/app/util/AppJacksonModule.java index f8493ff42..5723810f7 100644 --- a/app/src/main/java/io/xpipe/app/util/AppJacksonModule.java +++ b/app/src/main/java/io/xpipe/app/util/AppJacksonModule.java @@ -2,7 +2,7 @@ package io.xpipe.app.util; import io.xpipe.app.storage.*; import io.xpipe.app.terminal.ExternalTerminalType; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import io.xpipe.core.util.EncryptedSecretValue; import io.xpipe.core.util.JacksonMapper; import io.xpipe.core.util.SecretValue; diff --git a/app/src/main/java/io/xpipe/app/util/FileReference.java b/app/src/main/java/io/xpipe/app/util/FileReference.java index 51a922901..cf4ed4137 100644 --- a/app/src/main/java/io/xpipe/app/util/FileReference.java +++ b/app/src/main/java/io/xpipe/app/util/FileReference.java @@ -3,7 +3,7 @@ package io.xpipe.app.util; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.core.store.FileSystemStore; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import io.xpipe.core.util.JacksonizedValue; import com.fasterxml.jackson.annotation.JsonTypeName; diff --git a/app/src/main/java/io/xpipe/app/util/LocalShell.java b/app/src/main/java/io/xpipe/app/util/LocalShell.java index 939ceaaa7..bea8ff57c 100644 --- a/app/src/main/java/io/xpipe/app/util/LocalShell.java +++ b/app/src/main/java/io/xpipe/app/util/LocalShell.java @@ -1,6 +1,6 @@ package io.xpipe.app.util; -import io.xpipe.core.process.ProcessControlProvider; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialects; diff --git a/app/src/main/java/io/xpipe/app/util/SecretRetrievalStrategy.java b/app/src/main/java/io/xpipe/app/util/SecretRetrievalStrategy.java index 3645b97e1..5ba54ca15 100644 --- a/app/src/main/java/io/xpipe/app/util/SecretRetrievalStrategy.java +++ b/app/src/main/java/io/xpipe/app/util/SecretRetrievalStrategy.java @@ -3,7 +3,7 @@ package io.xpipe.app.util; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStoreSecret; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import io.xpipe.core.util.InPlaceSecretValue; import com.fasterxml.jackson.annotation.JsonSubTypes; diff --git a/app/src/main/java/io/xpipe/app/util/SshLocalBridge.java b/app/src/main/java/io/xpipe/app/util/SshLocalBridge.java index 240b6777a..63d973c65 100644 --- a/app/src/main/java/io/xpipe/app/util/SshLocalBridge.java +++ b/app/src/main/java/io/xpipe/app/util/SshLocalBridge.java @@ -5,7 +5,7 @@ import io.xpipe.app.core.AppProperties; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.OsType; -import io.xpipe.core.process.ProcessControlProvider; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.core.process.ShellControl; import io.xpipe.core.util.XPipeInstallation; diff --git a/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java b/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java index 6d6a82fdf..7f58c9a51 100644 --- a/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java +++ b/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java @@ -1,6 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.core.AppI18n; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; diff --git a/app/src/main/java/module-info.java b/app/src/main/java/module-info.java index f55981ef6..8826cf215 100644 --- a/app/src/main/java/module-info.java +++ b/app/src/main/java/module-info.java @@ -110,6 +110,7 @@ open module io.xpipe.app { uses io.xpipe.app.util.LicensedFeature; uses io.xpipe.beacon.BeaconInterface; uses DataStorageExtensionProvider; + uses ProcessControlProvider; provides Module with AppJacksonModule; diff --git a/core/src/main/java/io/xpipe/core/process/ShellControl.java b/core/src/main/java/io/xpipe/core/process/ShellControl.java index f0cb5af7d..8ca6c946a 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellControl.java +++ b/core/src/main/java/io/xpipe/core/process/ShellControl.java @@ -220,10 +220,7 @@ public interface ShellControl extends ProcessControl { return command(b); } - default CommandControl command(CommandBuilder builder) { - var sc = ProcessControlProvider.get().command(this, builder, builder); - return sc; - } + CommandControl command(CommandBuilder builder); void exitAndWait() throws IOException; } diff --git a/core/src/main/java/io/xpipe/core/process/ShellNameStoreState.java b/core/src/main/java/io/xpipe/core/process/ShellEnvironmentStoreState.java similarity index 64% rename from core/src/main/java/io/xpipe/core/process/ShellNameStoreState.java rename to core/src/main/java/io/xpipe/core/process/ShellEnvironmentStoreState.java index 6042b4c4c..d24991292 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellNameStoreState.java +++ b/core/src/main/java/io/xpipe/core/process/ShellEnvironmentStoreState.java @@ -11,15 +11,16 @@ import lombok.extern.jackson.Jacksonized; @EqualsAndHashCode(callSuper = true) @SuperBuilder(toBuilder = true) @Jacksonized -public class ShellNameStoreState extends ShellStoreState { +public class ShellEnvironmentStoreState extends ShellStoreState { String shellName; + Boolean setDefault; @Override public DataStoreState mergeCopy(DataStoreState newer) { - var n = (ShellNameStoreState) newer; + var n = (ShellEnvironmentStoreState) newer; var b = toBuilder(); mergeBuilder(n, b); - return b.shellName(useNewer(shellName, n.shellName)).build(); + return b.shellName(useNewer(shellName, n.shellName)).setDefault(useNewer(setDefault,n.setDefault)).build(); } } diff --git a/core/src/main/java/io/xpipe/core/store/ShellStore.java b/core/src/main/java/io/xpipe/core/store/ShellStore.java index 3401dcde9..b64ad2bbf 100644 --- a/core/src/main/java/io/xpipe/core/store/ShellStore.java +++ b/core/src/main/java/io/xpipe/core/store/ShellStore.java @@ -5,10 +5,6 @@ import io.xpipe.core.process.ShellControl; public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore { - static boolean isLocal(ShellStore s) { - return s instanceof LocalStore; - } - @Override default FileSystem createFileSystem() { return new ConnectionFileSystem(control()); diff --git a/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java b/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java index a1da2051c..68f0c63a5 100644 --- a/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java +++ b/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java @@ -1,16 +1,5 @@ package io.xpipe.core.util; -import io.xpipe.core.dialog.BaseQueryElement; -import io.xpipe.core.dialog.BusyElement; -import io.xpipe.core.dialog.ChoiceElement; -import io.xpipe.core.dialog.HeaderElement; -import io.xpipe.core.process.OsType; -import io.xpipe.core.process.ShellDialect; -import io.xpipe.core.process.ShellDialects; -import io.xpipe.core.store.FilePath; -import io.xpipe.core.store.LocalStore; -import io.xpipe.core.store.StorePath; - import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import com.fasterxml.jackson.core.JsonGenerator; @@ -19,6 +8,15 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.databind.module.SimpleModule; +import io.xpipe.core.dialog.BaseQueryElement; +import io.xpipe.core.dialog.BusyElement; +import io.xpipe.core.dialog.ChoiceElement; +import io.xpipe.core.dialog.HeaderElement; +import io.xpipe.core.process.OsType; +import io.xpipe.core.process.ShellDialect; +import io.xpipe.core.process.ShellDialects; +import io.xpipe.core.store.FilePath; +import io.xpipe.core.store.StorePath; import java.io.IOException; import java.nio.charset.Charset; @@ -32,7 +30,6 @@ public class CoreJacksonModule extends SimpleModule { public void setupModule(SetupContext context) { context.registerSubtypes( new NamedType(InPlaceSecretValue.class), - new NamedType(LocalStore.class), new NamedType(BaseQueryElement.class), new NamedType(ChoiceElement.class), new NamedType(BusyElement.class), diff --git a/core/src/main/java/module-info.java b/core/src/main/java/module-info.java index 1ccf7cf3f..237e07fc3 100644 --- a/core/src/main/java/module-info.java +++ b/core/src/main/java/module-info.java @@ -1,4 +1,3 @@ -import io.xpipe.core.process.ProcessControlProvider; import io.xpipe.core.process.ShellDialect; import io.xpipe.core.process.ShellDialects; import io.xpipe.core.util.CoreJacksonModule; @@ -19,7 +18,6 @@ open module io.xpipe.core { requires static lombok; uses com.fasterxml.jackson.databind.Module; - uses ProcessControlProvider; uses io.xpipe.core.util.ProxyManagerProvider; uses io.xpipe.core.util.DataStateProvider; uses ModuleLayerLoader; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/action/BrowseStoreAction.java b/ext/base/src/main/java/io/xpipe/ext/base/action/BrowseStoreAction.java index 66090086b..2e8625895 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/action/BrowseStoreAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/action/BrowseStoreAction.java @@ -4,8 +4,10 @@ import io.xpipe.app.browser.session.BrowserSessionModel; import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppLayoutModel; import io.xpipe.app.ext.ActionProvider; +import io.xpipe.app.ext.ProcessControlProvider; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntryRef; +import io.xpipe.core.store.FileSystemStore; import io.xpipe.core.store.ShellStore; import javafx.beans.property.SimpleBooleanProperty; @@ -53,7 +55,8 @@ public class BrowseStoreAction implements ActionProvider { @Override public void execute() { - BrowserSessionModel.DEFAULT.openFileSystemAsync(entry.ref(), null, new SimpleBooleanProperty()); + DataStoreEntryRef replacement = ProcessControlProvider.get().replace(entry.ref()); + BrowserSessionModel.DEFAULT.openFileSystemAsync(replacement, null, new SimpleBooleanProperty()); AppLayoutModel.get().selectBrowser(); } } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/action/SampleStoreAction.java b/ext/base/src/main/java/io/xpipe/ext/base/action/SampleStoreAction.java index fec7bdd8e..246d73fc7 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/action/SampleStoreAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/action/SampleStoreAction.java @@ -8,7 +8,7 @@ import io.xpipe.core.process.CommandControl; import io.xpipe.core.process.ElevationFunction; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialects; -import io.xpipe.core.store.LocalStore; +import io.xpipe.app.ext.LocalStore; import io.xpipe.core.store.ShellStore; import javafx.beans.value.ObservableValue; @@ -40,8 +40,7 @@ public class SampleStoreAction implements ActionProvider { @Override public boolean isApplicable(DataStoreEntryRef o) { // Allows you to individually check whether this action should be available for the specific store. - // In this case it should only be available for remote shell connections, not local ones. - return !ShellStore.isLocal(o.getStore()); + return true; } @Override diff --git a/lang/proc/strings/translations_da.properties b/lang/proc/strings/translations_da.properties index bd01865ee..3b90b9a0b 100644 --- a/lang/proc/strings/translations_da.properties +++ b/lang/proc/strings/translations_da.properties @@ -405,3 +405,5 @@ vncDirect.displayName=Direkte VNC-forbindelse vncDirect.displayDescription=Opret direkte forbindelse til et system via VNC editConfiguration=Rediger konfiguration viewInDashboard=Visning i dashboard +setDefault=Indstil standard +removeDefault=Fjern standard diff --git a/lang/proc/strings/translations_de.properties b/lang/proc/strings/translations_de.properties index 841e580d5..5e3e484de 100644 --- a/lang/proc/strings/translations_de.properties +++ b/lang/proc/strings/translations_de.properties @@ -383,3 +383,5 @@ vncDirect.displayName=Direkte VNC-Verbindung vncDirect.displayDescription=Über VNC direkt mit einem System verbinden editConfiguration=Konfiguration bearbeiten viewInDashboard=Ansicht im Dashboard +setDefault=Standard einstellen +removeDefault=Standard entfernen diff --git a/lang/proc/strings/translations_en.properties b/lang/proc/strings/translations_en.properties index 9638afd4e..b22c5623f 100644 --- a/lang/proc/strings/translations_en.properties +++ b/lang/proc/strings/translations_en.properties @@ -381,3 +381,5 @@ vncDirect.displayName=Direct VNC connection vncDirect.displayDescription=Connect to a system via VNC directly editConfiguration=Edit configuration viewInDashboard=View in dashboard +setDefault=Set default +removeDefault=Remove default diff --git a/lang/proc/strings/translations_es.properties b/lang/proc/strings/translations_es.properties index 8ba6e85b2..3a2885241 100644 --- a/lang/proc/strings/translations_es.properties +++ b/lang/proc/strings/translations_es.properties @@ -379,3 +379,5 @@ vncDirect.displayName=Conexión VNC directa vncDirect.displayDescription=Conectarse directamente a un sistema mediante VNC editConfiguration=Editar configuración viewInDashboard=Vista en el panel de control +setDefault=Establecer por defecto +removeDefault=Eliminar por defecto diff --git a/lang/proc/strings/translations_fr.properties b/lang/proc/strings/translations_fr.properties index 9b83921e6..3faabd80f 100644 --- a/lang/proc/strings/translations_fr.properties +++ b/lang/proc/strings/translations_fr.properties @@ -379,3 +379,5 @@ vncDirect.displayName=Connexion directe VNC vncDirect.displayDescription=Se connecter directement à un système via VNC editConfiguration=Modifier la configuration viewInDashboard=Vue dans le tableau de bord +setDefault=Définir par défaut +removeDefault=Supprimer la valeur par défaut diff --git a/lang/proc/strings/translations_it.properties b/lang/proc/strings/translations_it.properties index 6f837b52b..449f984a3 100644 --- a/lang/proc/strings/translations_it.properties +++ b/lang/proc/strings/translations_it.properties @@ -379,3 +379,5 @@ vncDirect.displayName=Connessione diretta VNC vncDirect.displayDescription=Connettersi direttamente a un sistema tramite VNC editConfiguration=Modifica la configurazione viewInDashboard=Vista nel cruscotto +setDefault=Imposta predefinito +removeDefault=Rimuovi l'impostazione predefinita diff --git a/lang/proc/strings/translations_ja.properties b/lang/proc/strings/translations_ja.properties index 8a3cce65c..f71fdb6a3 100644 --- a/lang/proc/strings/translations_ja.properties +++ b/lang/proc/strings/translations_ja.properties @@ -379,3 +379,5 @@ vncDirect.displayName=直接VNC接続 vncDirect.displayDescription=VNC経由でシステムに直接接続する editConfiguration=設定を編集する viewInDashboard=ダッシュボードで見る +setDefault=デフォルトを設定する +removeDefault=デフォルトを削除する diff --git a/lang/proc/strings/translations_nl.properties b/lang/proc/strings/translations_nl.properties index 0fd73be8e..094a071c0 100644 --- a/lang/proc/strings/translations_nl.properties +++ b/lang/proc/strings/translations_nl.properties @@ -379,3 +379,5 @@ vncDirect.displayName=Directe VNC-verbinding vncDirect.displayDescription=Rechtstreeks verbinding maken met een systeem via VNC editConfiguration=Configuratie bewerken viewInDashboard=Weergave in dashboard +setDefault=Standaard instellen +removeDefault=Standaard verwijderen diff --git a/lang/proc/strings/translations_pt.properties b/lang/proc/strings/translations_pt.properties index 4415613c3..ae8e536fc 100644 --- a/lang/proc/strings/translations_pt.properties +++ b/lang/proc/strings/translations_pt.properties @@ -379,3 +379,5 @@ vncDirect.displayName=Ligação VNC direta vncDirect.displayDescription=Liga-te diretamente a um sistema através do VNC editConfiguration=Edita a configuração viewInDashboard=Ver no painel de controlo +setDefault=Definir predefinição +removeDefault=Remover predefinição diff --git a/lang/proc/strings/translations_ru.properties b/lang/proc/strings/translations_ru.properties index b8f4bedd5..ae241690f 100644 --- a/lang/proc/strings/translations_ru.properties +++ b/lang/proc/strings/translations_ru.properties @@ -379,3 +379,5 @@ vncDirect.displayName=Прямое VNC-соединение vncDirect.displayDescription=Подключись к системе через VNC напрямую editConfiguration=Редактирование конфигурации viewInDashboard=Вид в приборной панели +setDefault=Установить по умолчанию +removeDefault=Убрать значение по умолчанию diff --git a/lang/proc/strings/translations_tr.properties b/lang/proc/strings/translations_tr.properties index e0769f995..4a8c50c84 100644 --- a/lang/proc/strings/translations_tr.properties +++ b/lang/proc/strings/translations_tr.properties @@ -379,3 +379,5 @@ vncDirect.displayName=Doğrudan VNC bağlantısı vncDirect.displayDescription=Doğrudan VNC aracılığıyla bir sisteme bağlanma editConfiguration=Yapılandırmayı düzenle viewInDashboard=Gösterge tablosunda görüntüle +setDefault=Varsayılanı ayarla +removeDefault=Varsayılanı kaldır diff --git a/lang/proc/strings/translations_zh.properties b/lang/proc/strings/translations_zh.properties index 4584f1f98..40e5fb610 100644 --- a/lang/proc/strings/translations_zh.properties +++ b/lang/proc/strings/translations_zh.properties @@ -379,3 +379,5 @@ vncDirect.displayName=直接 VNC 连接 vncDirect.displayDescription=直接通过 VNC 连接到系统 editConfiguration=编辑配置 viewInDashboard=在仪表板中查看 +setDefault=设置默认值 +removeDefault=删除默认值