This commit is contained in:
crschnick
2025-08-21 12:49:37 +00:00
parent 4330102ffa
commit b024e99fd7
34 changed files with 78 additions and 172 deletions
@@ -106,6 +106,7 @@ public class ActionShortcutComp extends SimpleComp {
return group;
}
@SuppressWarnings("unused")
private Comp<?> createMacroComp() {
var button = new ButtonComp(
AppI18n.observable("createMacro"), new FontIcon("mdi2c-clipboard-multiple-outline"), onCreateMacro);
@@ -60,10 +60,6 @@ public class ModalOverlay {
return this;
}
public ModalOverlay withDefaultButtons() {
return withDefaultButtons(() -> {});
}
public ModalButton addButton(ModalButton button) {
buttons.add(button);
return button;
@@ -36,19 +36,6 @@ public class AppActionLinkDetector {
AppOpenArguments.handle(List.of(content));
}
public static void detectOnFocus() {
var content = getClipboardAction();
if (content == null) {
lastDetectedAction = null;
return;
}
if (content.equals(lastDetectedAction)) {
return;
}
lastDetectedAction = content;
handle(content, true);
}
public static void detectOnPaste() {
var content = getClipboardAction();
if (content == null) {
@@ -22,10 +22,6 @@ public abstract class AppNames {
return ofCurrent().getGroupName() + ".app" + (name != null ? "." + name : "");
}
public static String appModuleName(String name) {
return ofCurrent().getGroupName() + name;
}
public static String extModuleName(String name) {
return ofCurrent().getGroupName() + ".ext." + name;
}
@@ -16,9 +16,9 @@ public abstract class AppSystemInfo {
public static AppSystemInfo ofCurrent() {
return switch (OsType.getLocal()) {
case OsType.Linux linux -> ofLinux();
case OsType.MacOs macOs -> ofMacOs();
case OsType.Windows windows -> ofWindows();
case OsType.Linux ignored -> ofLinux();
case OsType.MacOs ignored -> ofMacOs();
case OsType.Windows ignored -> ofWindows();
};
}
@@ -426,6 +426,7 @@ public class AppTheme {
91);
// Adjust this to create your own theme
@SuppressWarnings("unused")
public static final Theme CUSTOM = new DerivedTheme(
"custom",
"primer",
@@ -39,9 +39,11 @@ public class AppWindowsShutdown {
public interface WinHookProc extends WinUser.HOOKPROC {
@SuppressWarnings("unused")
WinDef.LRESULT callback(int nCode, WinDef.WPARAM wParam, CWPSSTRUCT hookProcStruct);
}
@SuppressWarnings("unused")
public static class CWPSSTRUCT extends Structure {
public WinDef.LPARAM lParam;
public WinDef.WPARAM wParam;
@@ -8,6 +8,7 @@ import io.xpipe.core.OsType;
import java.util.concurrent.TimeUnit;
@SuppressWarnings("unused")
public class AppCertutilCheck {
private static boolean getResult() {
@@ -7,22 +7,10 @@ public class ExtensionException extends RuntimeException {
public ExtensionException() {}
private ExtensionException(String message) {
super(message);
}
private ExtensionException(String message, Throwable cause) {
super(message, cause);
}
public ExtensionException(Throwable cause) {
super(cause);
}
public ExtensionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public static ExtensionException corrupt(String message, Throwable cause) {
try {
var loc = AppInstallation.ofCurrent().getBaseInstallationPath();
@@ -93,19 +93,6 @@ public class StoreCategoryWrapper {
return cachedParent;
}
public boolean contains(StoreEntryWrapper entry) {
if (entry.getCategory().getValue() == this) {
return true;
}
for (var c : children.getList()) {
if (c.contains(entry)) {
return true;
}
}
return false;
}
public void select() {
PlatformThread.runLaterIfNeeded(() -> {
StoreViewState.get().getActiveCategory().setValue(this);
@@ -57,11 +57,6 @@ public class StoreChoiceComp<T extends DataStore> extends SimpleComp {
return new StoreChoiceComp<>(Mode.OTHER, null, selected, clazz, filter, initialCategory);
}
public static StoreChoiceComp<ShellStore> proxy(
Property<DataStoreEntryRef<ShellStore>> selected, StoreCategoryWrapper initialCategory) {
return new StoreChoiceComp<>(Mode.PROXY, null, selected, ShellStore.class, null, initialCategory);
}
public static StoreChoiceComp<ShellStore> host(
Property<DataStoreEntryRef<ShellStore>> selected, StoreCategoryWrapper initialCategory) {
return new StoreChoiceComp<>(Mode.HOST, null, selected, ShellStore.class, null, initialCategory);
@@ -107,19 +107,33 @@ public class StoreCreationMenu {
private static Menu categoryMenu(
String name, String graphic, DataStoreCreationCategory category, String defaultProvider) {
var sub = DataStoreProviders.getAll().stream()
var providers = DataStoreProviders.getAll().stream()
.filter(dataStoreProvider -> category.equals(dataStoreProvider.getCreationCategory()))
.sorted(Comparator.comparingInt(dataStoreProvider -> dataStoreProvider.getOrderPriority()))
.toList();
var menu = new Menu();
menu.setGraphic(new FontIcon(graphic));
menu.textProperty().bind(AppI18n.observable(name));
if (providers.isEmpty()) {
return menu;
}
menu.setOnAction(event -> {
if (event.getTarget() != menu) {
return;
}
Platform.runLater(() -> {
if (defaultProvider != null) {
providers.stream().filter(dataStoreProvider -> dataStoreProvider.getId().equals(defaultProvider)).findFirst().ifPresent(dataStoreProvider -> {
var index = providers.indexOf(dataStoreProvider);
menu.getItems().get(index).fire();
});
return;
}
var onlyItem = menu.getItems().getFirst();
onlyItem.fire();
});
@@ -128,13 +142,6 @@ public class StoreCreationMenu {
menu.getParentPopup().hide();
});
var providers = sub.stream()
.sorted(Comparator.comparingInt(dataStoreProvider -> dataStoreProvider.getOrderPriority()))
.toList();
if (providers.isEmpty()) {
return menu;
}
int lastOrder = providers.getFirst().getOrderPriority();
for (io.xpipe.app.ext.DataStoreProvider dataStoreProvider : providers) {
if (dataStoreProvider.getOrderPriority() != lastOrder) {
@@ -82,8 +82,13 @@ public final class AppPrefs {
.requiresRestart(false)
.documentationLink(DocumentationLink.API)
.build());
final BooleanProperty enableMcpServer =
mapLocal(new GlobalBooleanProperty(false), "enableMcpServer", Boolean.class, false);
final BooleanProperty enableMcpServer = map(Mapping.builder()
.property(new GlobalBooleanProperty(false))
.key("enableMcpServer")
.valueClass(Boolean.class)
.requiresRestart(false)
.documentationLink(DocumentationLink.MCP)
.build());
final BooleanProperty enableMcpMutationTools =
mapLocal(new GlobalBooleanProperty(false), "enableMcpMutationTools", Boolean.class, false);
final BooleanProperty dontAutomaticallyStartVmSshServer =
@@ -517,10 +522,6 @@ public final class AppPrefs {
return disableCertutilUse;
}
public ObservableBooleanValue useLocalFallbackShell() {
return useLocalFallbackShell;
}
public ObservableValue<ShellDialect> localShellDialect() {
return localShellDialect;
}
@@ -219,6 +219,7 @@ public interface ExternalEditorType extends PrefsChoiceValue {
};
// Cli is broken, keep inactive
@SuppressWarnings("unused")
WindowsType THEIAIDE_WINDOWS = new WindowsType() {
@Override
@@ -529,7 +530,7 @@ public interface ExternalEditorType extends PrefsChoiceValue {
TEXT_EDIT);
List<ExternalEditorType> CROSS_PLATFORM_EDITORS = List.of(FLEET, INTELLIJ, PYCHARM, WEBSTORM, CLION);
@SuppressWarnings("TrivialFunctionalExpressionUsage")
@SuppressWarnings({"unused", "TrivialFunctionalExpressionUsage"})
List<ExternalEditorType> ALL = ((Supplier<List<ExternalEditorType>>) () -> {
var all = new ArrayList<ExternalEditorType>();
if (OsType.getLocal() == OsType.WINDOWS) {
@@ -5,7 +5,7 @@ import java.util.UUID;
public interface ShellDialectAskpass {
String prepareStderrPassthroughContent(ShellControl sc, UUID requestId, String prefix);
String prepareStderrPassthroughContent(UUID requestId, String prefix);
String prepareFixedContent(ShellControl sc, String fileName, List<String> s) throws Exception;
@@ -14,7 +14,7 @@ public interface ShellDumbMode {
return null;
}
default CommandBuilder prepareInlineDumbCommand(ShellControl self, ShellControl parent, ShellOpenFunction function)
default CommandBuilder prepareInlineDumbCommand(ShellControl self, ShellOpenFunction function)
throws Exception {
return function.prepareWithoutInitCommand();
}
@@ -48,6 +48,7 @@ public class EnpassPasswordManager implements PasswordManager {
return SHELL;
}
@SuppressWarnings("unused")
public static OptionsBuilder createOptions(Property<EnpassPasswordManager> p) {
var prop = new SimpleObjectProperty<>(p.getValue().getVaultPath());
var comp = new ContextualFileReferenceChoiceComp(
@@ -33,6 +33,7 @@ public class PasswordManagerCommand implements PasswordManager {
private static ShellControl SHELL;
ShellScript script;
@SuppressWarnings("unused")
static OptionsBuilder createOptions(Property<PasswordManagerCommand> property) {
var template = new SimpleObjectProperty<PasswordManagerCommandTemplate>();
var script = new SimpleObjectProperty<>(
@@ -33,28 +33,26 @@ public class MobaXTermTerminalType implements ExternalApplicationType.WindowsTyp
@Override
public void launch(TerminalLaunchConfiguration configuration) throws Exception {
try (var sc = LocalShell.getShell()) {
SshLocalBridge.init();
var b = SshLocalBridge.get();
var abs = b.getIdentityKey().toAbsolutePath();
var drivePath =
"/drives/" + abs.getRoot().toString().substring(0, 1).toLowerCase() + "/"
+ abs.getRoot().relativize(abs).toString().replaceAll("\\\\", "/");
var winPath = b.getIdentityKey().toString().replaceAll("\\\\", "\\\\\\\\");
var command = CommandBuilder.of()
.add("ssh")
.addQuoted(b.getUser() + "@localhost")
.add("-i")
.add("\"$(cygpath -u \"" + winPath + "\" || echo \"" + drivePath + "\")\"")
.add("-p")
.add("" + b.getPort());
// Don't use local shell to build as it uses cygwin
var rawCommand = command.buildSimple();
var script = ShellTemp.getLocalTempDataDirectory("mobaxpipe.sh");
Files.writeString(Path.of(script.toString()), "#!/usr/bin/env bash\n" + rawCommand);
var fixedFile = script.toString().replaceAll("\\\\", "/").replaceAll("\\s", "\\$0");
launch(CommandBuilder.of().add("-newtab").add(fixedFile));
}
SshLocalBridge.init();
var b = SshLocalBridge.get();
var abs = b.getIdentityKey().toAbsolutePath();
var drivePath =
"/drives/" + abs.getRoot().toString().substring(0, 1).toLowerCase() + "/"
+ abs.getRoot().relativize(abs).toString().replaceAll("\\\\", "/");
var winPath = b.getIdentityKey().toString().replaceAll("\\\\", "\\\\\\\\");
var command = CommandBuilder.of()
.add("ssh")
.addQuoted(b.getUser() + "@localhost")
.add("-i")
.add("\"$(cygpath -u \"" + winPath + "\" || echo \"" + drivePath + "\")\"")
.add("-p")
.add("" + b.getPort());
// Don't use local shell to build as it uses cygwin
var rawCommand = command.buildSimple();
var script = ShellTemp.getLocalTempDataDirectory("mobaxpipe.sh");
Files.writeString(Path.of(script.toString()), "#!/usr/bin/env bash\n" + rawCommand);
var fixedFile = script.toString().replaceAll("\\\\", "/").replaceAll("\\s", "\\$0");
launch(CommandBuilder.of().add("-newtab").add(fixedFile));
}
@Override
@@ -25,11 +25,13 @@ import java.util.List;
@JsonTypeName("ohmyposh")
public class OhMyPoshTerminalPrompt extends ConfigFileTerminalPrompt {
@SuppressWarnings("unused")
public static OptionsBuilder createOptions(Property<OhMyPoshTerminalPrompt> p) {
return createOptions(
p, s -> OhMyPoshTerminalPrompt.builder().configuration(s).build());
}
@SuppressWarnings("unused")
public static OhMyPoshTerminalPrompt createDefault() {
return OhMyPoshTerminalPrompt.builder()
.configuration(
@@ -25,11 +25,13 @@ import java.util.List;
@JsonTypeName("ohmyzsh")
public class OhMyZshTerminalPrompt extends ConfigFileTerminalPrompt {
@SuppressWarnings("unused")
public static OptionsBuilder createOptions(Property<OhMyZshTerminalPrompt> p) {
return createOptions(
p, s -> OhMyZshTerminalPrompt.builder().configuration(s).build());
}
@SuppressWarnings("unused")
public static OhMyZshTerminalPrompt createDefault() {
return OhMyZshTerminalPrompt.builder()
.configuration(
@@ -26,11 +26,13 @@ import java.util.List;
@JsonTypeName("starship")
public class StarshipTerminalPrompt extends ConfigFileTerminalPrompt {
@SuppressWarnings("unused")
public static OptionsBuilder createOptions(Property<StarshipTerminalPrompt> p) {
return createOptions(
p, s -> StarshipTerminalPrompt.builder().configuration(s).build());
}
@SuppressWarnings("unused")
public static StarshipTerminalPrompt createDefault() {
return StarshipTerminalPrompt.builder()
.configuration(
@@ -60,23 +60,17 @@ public class TermiusTerminalType implements ExternalTerminalType {
@Override
public boolean isAvailable() {
try (var sc = LocalShell.getShell()) {
return switch (OsType.getLocal()) {
case OsType.Linux ignored -> {
yield Files.exists(Path.of("/opt/Termius"));
}
case OsType.MacOs ignored -> {
yield Files.exists(Path.of("/Applications/Termius.app"));
}
case OsType.Windows ignored -> {
var r = WindowsRegistry.local()
.readStringValueIfPresent(WindowsRegistry.HKEY_CURRENT_USER, "SOFTWARE\\Classes\\termius");
yield r.isPresent();
}
};
} catch (Exception e) {
ErrorEventFactory.fromThrowable(e).omit().handle();
return false;
return switch (OsType.getLocal()) {
case OsType.Linux ignored -> {
yield Files.exists(Path.of("/opt/Termius"));
}
case OsType.MacOs ignored -> {
yield Files.exists(Path.of("/Applications/Termius.app"));
}
case OsType.Windows ignored -> {
var r = WindowsRegistry.local().readStringValueIfPresent(WindowsRegistry.HKEY_CURRENT_USER, "SOFTWARE\\Classes\\termius");
yield r.isPresent();
}
}
}
@@ -1,9 +1,6 @@
package io.xpipe.app.update;
import io.xpipe.app.core.AppInstallation;
import io.xpipe.app.core.AppLogs;
import io.xpipe.app.core.AppNames;
import io.xpipe.app.core.AppRestart;
import io.xpipe.app.core.*;
import io.xpipe.app.core.mode.OperationMode;
import io.xpipe.app.process.ShellDialects;
import io.xpipe.app.process.ShellScript;
@@ -29,7 +26,7 @@ public class AppInstaller {
}
if (OsType.getLocal() == OsType.LINUX) {
return Files.exists(Path.of("/etc/debian_version"))
return AppSystemInfo.ofLinux().isDebianBased()
? new InstallerAssetType.Debian()
: new InstallerAssetType.Rpm();
}
@@ -42,7 +42,6 @@ public enum DocumentationLink {
SSH("guide/ssh"),
SSH_HOST_KEYS("troubleshoot/ssh#no-matching-host-key-type-found"),
SSH_KEX("troubleshoot/ssh#no-matching-key-exchange-method"),
SSH_PERMISSION_DENIED("troubleshoot/ssh#permission-denied"),
SSH_IPV6("troubleshoot/ssh#ipv6-issues"),
SSH_CONNECTION_CLOSED("troubleshoot/ssh#connection-closed-by-remote-host"),
SSH_KEY_PERMISSIONS("troubleshoot/ssh#key-permissions-too-open"),
@@ -20,8 +20,6 @@ public abstract class LicenseProvider {
public abstract String formatExceptionMessage(String name, boolean plural, LicensedFeature licensedFeature);
public abstract boolean hasLicense();
public abstract String getLicenseId();
public abstract ObservableValue<String> licenseTitle();
@@ -69,12 +69,6 @@ public class NativeWinWindowControl {
return refs;
}
public void removeBorders() {
var style = User32.INSTANCE.GetWindowLong(windowHandle, User32.GWL_STYLE);
var mod = style & ~(User32.WS_CAPTION | User32.WS_THICKFRAME | User32.WS_MAXIMIZEBOX);
User32.INSTANCE.SetWindowLong(windowHandle, User32.GWL_STYLE, mod);
}
public boolean isIconified() {
return (User32.INSTANCE.GetWindowLong(windowHandle, User32.GWL_STYLE) & User32.WS_MINIMIZE) != 0;
}
@@ -154,6 +148,7 @@ public class NativeWinWindowControl {
}
}
@SuppressWarnings("unused")
public enum DwmSystemBackDropType {
// DWMSBT_NONE
NONE(1),
@@ -23,6 +23,7 @@ public class CustomVncClient implements ExternalVncClient {
String command;
@SuppressWarnings("unused")
static OptionsBuilder createOptions(Property<CustomVncClient> property) {
var command = new SimpleObjectProperty<>(property.getValue().getCommand());
return new OptionsBuilder()
@@ -8,17 +8,4 @@ public class BeaconClientException extends Exception {
public BeaconClientException(String message) {
super(message);
}
public BeaconClientException(String message, Throwable cause) {
super(message, cause);
}
public BeaconClientException(Throwable cause) {
super(cause);
}
public BeaconClientException(
String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
@@ -14,13 +14,4 @@ public class BeaconConnectorException extends Exception {
public BeaconConnectorException(String message, Throwable cause) {
super(message, cause);
}
public BeaconConnectorException(Throwable cause) {
super(cause);
}
public BeaconConnectorException(
String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
@@ -16,9 +16,4 @@ public class BeaconServerException extends Exception {
public BeaconServerException(Throwable cause) {
super(cause);
}
public BeaconServerException(
String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
@@ -114,6 +114,7 @@ public class CoreJacksonModule extends SimpleModule {
@JsonSerialize(as = Throwable.class)
public abstract static class ThrowableTypeMixIn {
@SuppressWarnings("unused")
@JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class, property = "$id")
private Throwable cause;
}
@@ -12,13 +12,4 @@ public class UuidHelper {
return Optional.empty();
}
}
public static Optional<UUID> parse(FailableSupplier<String> supplier) {
try {
var s = supplier.get();
return Optional.of(UUID.fromString(s));
} catch (Exception ex) {
return Optional.empty();
}
}
}
@@ -25,18 +25,6 @@ import java.util.List;
@AllArgsConstructor
public class YubikeyPivStrategy implements SshIdentityStrategy {
public static String getDefaultSharedLibrary() {
var file = switch (OsType.getLocal()) {
case OsType.Linux ignored -> "/usr/local/lib/libykcs11.so";
case OsType.MacOs ignored -> "/usr/local/lib/libykcs11.dylib";
case OsType.Windows ignored -> {
var x64 = "C:\\Program Files\\Yubico\\Yubico PIV Tool\\bin\\libykcs11.dll";
yield x64;
}
};
return file;
}
private String getFile() {
var file = switch (OsType.getLocal()) {
case OsType.Linux ignored -> "/usr/local/lib/libykcs11.so";