This commit is contained in:
crschnick
2025-11-07 09:24:42 +00:00
parent 809baacc0d
commit cd9c66b236
19 changed files with 68 additions and 56 deletions
@@ -4,7 +4,6 @@ import io.xpipe.app.browser.action.BrowserAction;
import io.xpipe.app.browser.action.BrowserActionProvider;
import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
import io.xpipe.app.process.LocalShell;
import io.xpipe.app.process.ShellControl;
import io.xpipe.app.util.DesktopHelper;
@@ -4,12 +4,9 @@ import io.xpipe.app.browser.action.BrowserAction;
import io.xpipe.app.browser.action.BrowserActionProvider;
import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
import io.xpipe.app.ext.FileKind;
import io.xpipe.app.process.CommandBuilder;
import io.xpipe.app.process.LocalShell;
import io.xpipe.app.process.ShellControl;
import io.xpipe.app.util.DesktopHelper;
import io.xpipe.core.OsType;
import lombok.experimental.SuperBuilder;
import lombok.extern.jackson.Jacksonized;
@@ -5,7 +5,6 @@ import io.xpipe.app.process.LocalShell;
import io.xpipe.app.process.ShellDialect;
import io.xpipe.app.process.ShellDialects;
import io.xpipe.app.update.AppDistributionType;
import io.xpipe.app.util.DesktopShortcuts;
import io.xpipe.core.OsType;
import java.util.List;
@@ -59,10 +59,12 @@ public class AppTheme {
}
stage.getScene().rootProperty().subscribe(parent -> {
applyClasses(parent, AppPrefs.get().theme().getValue(), AppPrefs.get().performanceMode().getValue());
applyClasses(
parent,
AppPrefs.get().theme().getValue(),
AppPrefs.get().performanceMode().getValue());
});
// Allow for GC
var ref = new WeakReference<>(stage);
@@ -94,8 +96,7 @@ public class AppTheme {
return;
}
r.pseudoClassStateChanged(
PseudoClass.getPseudoClass(OsType.ofLocal().getId()), true);
r.pseudoClassStateChanged(PseudoClass.getPseudoClass(OsType.ofLocal().getId()), true);
Theme.ALL.forEach(theme -> {
r.pseudoClassStateChanged(
@@ -211,8 +211,8 @@ public class StoreCategoryComp extends SimpleComp {
if (AppPrefs.get().developerMode().getValue()) {
var browse = new MenuItem(AppI18n.get("browseInternalStorage"), new FontIcon("mdi2f-folder-open-outline"));
browse.setOnAction(event ->
DesktopHelper.browseFile(category.getCategory().getDirectory()));
browse.setOnAction(
event -> DesktopHelper.browseFile(category.getCategory().getDirectory()));
contextMenu.getItems().add(browse);
}
@@ -448,8 +448,8 @@ public abstract class StoreEntryComp extends SimpleComp {
if (AppPrefs.get().developerMode().getValue()) {
var browse = new MenuItem(
AppI18n.get("browseInternalStorage"), new FontIcon("mdi2f-folder-open-outline"));
browse.setOnAction(event -> DesktopHelper.browseFile(
getWrapper().getEntry().getDirectory()));
browse.setOnAction(event ->
DesktopHelper.browseFile(getWrapper().getEntry().getDirectory()));
items.add(browse);
}
@@ -10,6 +10,7 @@ import javafx.beans.property.SimpleBooleanProperty;
import javafx.geometry.Insets;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.*;
import net.synedra.validatorfx.GraphicDecorationStackPane;
public class AppPrefsComp extends SimpleComp {
@@ -5,7 +5,9 @@ import io.xpipe.app.core.mode.AppOperationMode;
import io.xpipe.app.ext.PrefsChoiceValue;
import io.xpipe.app.storage.DataStorageUserHandler;
import io.xpipe.app.util.ThreadHelper;
import javafx.beans.value.ObservableValue;
import lombok.Getter;
@Getter
@@ -2,12 +2,10 @@ package io.xpipe.app.prefs;
import io.xpipe.app.comp.Comp;
import io.xpipe.app.comp.base.ButtonComp;
import io.xpipe.app.comp.base.ChoiceComp;
import io.xpipe.app.comp.base.ModalButton;
import io.xpipe.app.comp.base.ModalOverlay;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.core.window.AppDialog;
import io.xpipe.app.ext.PrefsChoiceValue;
import io.xpipe.app.platform.LabelGraphic;
import io.xpipe.app.platform.OptionsBuilder;
import io.xpipe.app.storage.DataStorageSyncHandler;
@@ -87,9 +85,7 @@ public class VaultCategory extends AppPrefsCategory {
.disable(!LicenseProvider.get().getFeature("team").isSupported())
.hide(new SimpleBooleanProperty(
DataStorageSyncHandler.getInstance().supportsSync())));
builder.sub(new OptionsBuilder()
.pref(prefs.encryptAllVaultData)
.addToggle(encryptVault));
builder.sub(new OptionsBuilder().pref(prefs.encryptAllVaultData).addToggle(encryptVault));
return builder.buildComp();
}
}
@@ -14,7 +14,8 @@ public class ProcessOutputException extends Exception {
private final String prefix;
private final String suffix;
private ProcessOutputException(String command, long exitCode, String output, String prefix, String suffix, Exception cause) {
private ProcessOutputException(
String command, long exitCode, String output, String prefix, String suffix, Exception cause) {
super(cause);
this.exitCode = exitCode;
this.output = output;
@@ -58,10 +59,10 @@ public class ProcessOutputException extends Exception {
var message =
switch ((int) exitCode) {
case CommandControl.START_FAILED_EXIT_CODE ->
start + "did not start up properly and had to be killed";
start + "did not start up properly and had to be killed";
case CommandControl.EXIT_TIMEOUT_EXIT_CODE -> "Wait for exit of " + center + "timed out";
case CommandControl.UNASSIGNED_EXIT_CODE ->
start + "exited with unknown state. Did an external process interfere?";
start + "exited with unknown state. Did an external process interfere?";
case CommandControl.INTERNAL_ERROR_EXIT_CODE -> start + "execution failed";
case CommandControl.ELEVATION_FAILED_EXIT_CODE -> start + "elevation failed";
default -> start + "failed with exit code " + exitCode;
@@ -120,7 +120,8 @@ public class KeePassXcProxyClient {
sendNativeMessage(keyExchangeMessage);
} catch (IOException e) {
var ex = new IllegalStateException(
"KeePassXC client did not respond. Is the browser integration enabled for your KeePassXC database?", e);
"KeePassXC client did not respond. Is the browser integration enabled for your KeePassXC database?",
e);
ErrorEventFactory.preconfigure(
ErrorEventFactory.fromThrowable(ex).expected().documentationLink(DocumentationLink.KEEPASSXC));
throw ex;
@@ -286,7 +286,7 @@ public abstract class DataStorage {
&& getStoreEntries().stream().noneMatch(e -> {
var hierarchy = getCategoryParentHierarchy(getStoreCategory(e));
return hierarchy.stream().anyMatch(h -> h.getUuid().equals(SYNCED_IDENTITIES_CATEGORY_UUID));
})) {
})) {
return false;
}
@@ -4,7 +4,6 @@ import io.xpipe.app.core.AppSystemInfo;
import io.xpipe.app.prefs.ExternalApplicationType;
import io.xpipe.app.process.*;
import io.xpipe.app.util.*;
import io.xpipe.core.FilePath;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
@@ -89,7 +88,8 @@ public interface WarpTerminalType extends ExternalTerminalType, TrackableTermina
// Move to subdir as Warp tries to index the parent dir, which would be temp in this case
var scriptFile = ScriptHelper.createExecScript(configuration.getScriptDialect(), sc, command);
var movedScriptFile = AppSystemInfo.ofCurrent().getTemp().resolve("warp").resolve(scriptFile.getFileName());
var movedScriptFile =
AppSystemInfo.ofCurrent().getTemp().resolve("warp").resolve(scriptFile.getFileName());
Files.createDirectories(movedScriptFile.getParent());
Files.move(scriptFile.asLocalPath(), movedScriptFile);
@@ -165,14 +165,19 @@ public enum AppDistributionType implements Translatable {
return SCOOP;
}
if (OsType.ofLocal() == OsType.LINUX && System.getenv("APPDIR") != null && System.getenv("APPIMAGE") != null) {
if (OsType.ofLocal() == OsType.LINUX
&& System.getenv("APPDIR") != null
&& System.getenv("APPIMAGE") != null) {
try {
var dir = Path.of(System.getenv("APPDIR"));
if (AppInstallation.ofCurrent().getBaseInstallationPath().startsWith(dir)) {
if (AppInstallation.ofCurrent()
.getBaseInstallationPath()
.startsWith(dir)) {
return APP_IMAGE;
}
} catch (InvalidPathException ignored) {}
} catch (InvalidPathException ignored) {
}
}
return PORTABLE;
@@ -3,15 +3,12 @@ package io.xpipe.app.util;
import io.xpipe.app.ext.FileKind;
import io.xpipe.app.issue.ErrorEventFactory;
import io.xpipe.app.process.CommandBuilder;
import io.xpipe.app.process.LocalShell;
import io.xpipe.app.process.ShellControl;
import io.xpipe.app.update.AppDistributionType;
import io.xpipe.core.FilePath;
import io.xpipe.core.OsType;
import java.awt.*;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
@@ -55,7 +52,10 @@ public class DesktopHelper {
return;
} catch (Exception e) {
// Some basic linux systems have trouble with the API call
ErrorEventFactory.fromThrowable(e).expected().omitted(OsType.ofLocal() == OsType.LINUX).handle();
ErrorEventFactory.fromThrowable(e)
.expected()
.omitted(OsType.ofLocal() == OsType.LINUX)
.handle();
}
}
@@ -89,11 +89,18 @@ public class DesktopHelper {
? "org.freedesktop.FileManager1.ShowFolders"
: "org.freedesktop.FileManager1.ShowItems";
var args = List.of(
"dbus-send", "--session", "--print-reply", "--dest=org.freedesktop.FileManager1", "--type=method_call",
"/org/freedesktop/FileManager1", action, "array:string:file://" + file, "string:"
);
"dbus-send",
"--session",
"--print-reply",
"--dest=org.freedesktop.FileManager1",
"--type=method_call",
"/org/freedesktop/FileManager1",
action,
"array:string:file://" + file,
"string:");
try {
var success = LocalExec.readStdoutIfPossible(args.toArray(String[]::new)).isPresent();
var success = LocalExec.readStdoutIfPossible(args.toArray(String[]::new))
.isPresent();
if (success) {
return;
}
@@ -111,7 +118,10 @@ public class DesktopHelper {
Desktop.getDesktop().browseFileDirectory(file.toFile());
} catch (Exception e) {
// Some basic linux systems have trouble with the API call
ErrorEventFactory.fromThrowable(e).expected().omitted(OsType.ofLocal() == OsType.LINUX).handle();
ErrorEventFactory.fromThrowable(e)
.expected()
.omitted(OsType.ofLocal() == OsType.LINUX)
.handle();
if (OsType.ofLocal() == OsType.LINUX) {
browseFile(file.getParent());
}
@@ -8,7 +8,6 @@ import io.xpipe.app.rdp.RdpLaunchConfig;
import io.xpipe.app.vnc.VncLaunchConfig;
import io.xpipe.core.SecretValue;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
@@ -34,7 +34,8 @@ public class HostAddressSwitchBranchProvider implements HubBranchProvider<HostAd
@Override
public boolean isApplicable(DataStoreEntryRef<HostAddressSwitchStore> o) {
return o.getStore().getHostAddress() != null && !o.getStore().getHostAddress().isSingle();
return o.getStore().getHostAddress() != null
&& !o.getStore().getHostAddress().isSingle();
}
@Override
@@ -1,35 +1,29 @@
package io.xpipe.ext.base.identity.ssh;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.xpipe.app.comp.base.TextAreaComp;
import io.xpipe.app.core.AppSystemInfo;
import io.xpipe.app.ext.ValidationException;
import io.xpipe.app.issue.ErrorEventFactory;
import io.xpipe.app.platform.OptionsBuilder;
import io.xpipe.app.platform.OptionsChoiceBuilder;
import io.xpipe.app.process.CommandBuilder;
import io.xpipe.app.process.ShellControl;
import io.xpipe.app.secret.SecretRetrievalStrategy;
import io.xpipe.app.secret.SecretStrategyChoiceConfig;
import io.xpipe.app.storage.ContextualFileReference;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.util.LocalFileTracker;
import io.xpipe.app.util.Validators;
import io.xpipe.core.*;
import javafx.beans.property.Property;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Value
@Jacksonized
@@ -40,7 +34,8 @@ public class InPlaceKeyStrategy implements SshIdentityStrategy {
@SuppressWarnings("unused")
public static OptionsBuilder createOptions(Property<InPlaceKeyStrategy> p, SshIdentityStrategyChoiceConfig config) {
var key = new SimpleStringProperty(p.getValue().getKey() != null ? p.getValue().getKey().getSecretValue() : null);
var key = new SimpleStringProperty(
p.getValue().getKey() != null ? p.getValue().getKey().getSecretValue() : null);
var keyPasswordProperty =
new SimpleObjectProperty<>(p.getValue() != null ? p.getValue().getPassword() : null);
@@ -55,13 +50,17 @@ public class InPlaceKeyStrategy implements SshIdentityStrategy {
return new OptionsBuilder()
.nameAndDescription("inPlaceKeyText")
.addComp(new TextAreaComp(key).apply(struc -> {
struc.getTextArea().setPromptText("""
.addComp(
new TextAreaComp(key).apply(struc -> {
struc.getTextArea()
.setPromptText(
"""
-----BEGIN ... PRIVATE KEY-----
-----END ... PRIVATE KEY-----
""");
}), key)
}),
key)
.nonNull()
.name("keyPassword")
.description("sshConfigHost.identityPassphraseDescription")
@@ -69,7 +68,9 @@ public class InPlaceKeyStrategy implements SshIdentityStrategy {
.nonNull()
.bind(
() -> {
return new InPlaceKeyStrategy(key.get() != null ? InPlaceSecretValue.of(key.get()) : null, keyPasswordProperty.get());
return new InPlaceKeyStrategy(
key.get() != null ? InPlaceSecretValue.of(key.get()) : null,
keyPasswordProperty.get());
},
p);
}
@@ -9,7 +9,6 @@ import io.xpipe.app.process.ShellControl;
import io.xpipe.app.secret.SecretNoneStrategy;
import io.xpipe.app.secret.SecretRetrievalStrategy;
import io.xpipe.core.FilePath;
import io.xpipe.core.InPlaceSecretValue;
import io.xpipe.core.KeyValue;
import io.xpipe.core.OsType;