From 36f47c24af477b7af51e1d3dc620dbd8fa5dec3e Mon Sep 17 00:00:00 2001 From: crschnick Date: Mon, 16 Sep 2024 07:40:37 +0000 Subject: [PATCH] Detect webtop --- .../main/java/io/xpipe/app/update/PortableUpdater.java | 4 ++-- .../java/io/xpipe/app/update/XPipeDistributionType.java | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/update/PortableUpdater.java b/app/src/main/java/io/xpipe/app/update/PortableUpdater.java index 8aafadc40..13313b668 100644 --- a/app/src/main/java/io/xpipe/app/update/PortableUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/PortableUpdater.java @@ -13,8 +13,8 @@ import java.time.Instant; public class PortableUpdater extends UpdateHandler { - public PortableUpdater() { - super(true); + public PortableUpdater(boolean thread) { + super(thread); } @Override diff --git a/app/src/main/java/io/xpipe/app/update/XPipeDistributionType.java b/app/src/main/java/io/xpipe/app/update/XPipeDistributionType.java index 0d6c8d6e3..c8a609a68 100644 --- a/app/src/main/java/io/xpipe/app/update/XPipeDistributionType.java +++ b/app/src/main/java/io/xpipe/app/update/XPipeDistributionType.java @@ -12,15 +12,18 @@ import io.xpipe.core.util.XPipeInstallation; import lombok.Getter; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Arrays; import java.util.function.Supplier; public enum XPipeDistributionType { UNKNOWN("unknown", false, () -> new GitHubUpdater(false)), DEVELOPMENT("development", true, () -> new GitHubUpdater(false)), - PORTABLE("portable", false, () -> new PortableUpdater()), + PORTABLE("portable", false, () -> new PortableUpdater(true)), NATIVE_INSTALLATION("install", true, () -> new GitHubUpdater(true)), HOMEBREW("homebrew", true, () -> new HomebrewUpdater()), + WEBTOP("webtop", true, () -> new PortableUpdater(false)), CHOCO("choco", true, () -> new ChocoUpdater()); private static XPipeDistributionType type; @@ -95,6 +98,10 @@ public enum XPipeDistributionType { return UNKNOWN; } + if (OsType.getLocal() == OsType.LINUX && "/config".equals(System.getProperty("user.home")) && Files.isDirectory(Path.of("/kclient"))) { + return WEBTOP; + } + try (var sc = LocalShell.getShell()) { // In theory, we can also add && !AppProperties.get().isStaging() here, but we want to replicate the // production behavior