mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Final updater fixes
This commit is contained in:
parent
8c549b8050
commit
8ebef850b7
7 changed files with 21 additions and 47 deletions
|
@ -68,7 +68,7 @@ public class ErrorDetailsComp extends SimpleComp {
|
|||
// AppI18n.observable("events"), "mdi2c-clipboard-list-outline", createTrackEventHistory()));
|
||||
// }
|
||||
|
||||
var tb = new TabPaneComp(new SimpleObjectProperty<>(items.get(0)), items);
|
||||
var tb = new TabPaneComp(new SimpleObjectProperty<>(items.size() > 0 ? items.get(0) : null), items);
|
||||
tb.apply(r -> AppFont.small(r.get()));
|
||||
return tb.createRegion();
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class SentryErrorHandler {
|
|||
options.setEnableUncaughtExceptionHandler(false);
|
||||
options.setAttachServerName(false);
|
||||
// options.setDebug(true);
|
||||
options.setDist(XPipeDistributionType.get().getName());
|
||||
options.setDist(XPipeDistributionType.get().getId());
|
||||
options.setRelease(AppProperties.get().getVersion());
|
||||
options.setEnableShutdownHook(false);
|
||||
options.setProguardUuid(AppProperties.get().getBuildUuid().toString());
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ChocoUpdater extends UpdateHandler {
|
|||
.space()
|
||||
.string("xpipe")
|
||||
.space()
|
||||
.keyword("--version=" + getLastUpdateCheckResult().getValue().getVersion())
|
||||
.keyword("--version=" + getPreparedUpdate().getValue().getVersion())
|
||||
.build();
|
||||
return new CodeSnippetComp(false, new SimpleObjectProperty<>(snippet)).createRegion();
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public class ChocoUpdater extends UpdateHandler {
|
|||
var isUpdate = isUpdate(latest);
|
||||
var rel = new AvailableRelease(
|
||||
AppProperties.get().getVersion(),
|
||||
XPipeDistributionType.get().getId(),
|
||||
latest,
|
||||
"https://community.chocolatey.org/packages/xpipe/" + latest,
|
||||
null,
|
||||
|
|
|
@ -32,6 +32,7 @@ public class GitHubUpdater extends UpdateHandler {
|
|||
var changelog = changelogString.orElse(null);
|
||||
var rel = new PreparedUpdate(
|
||||
AppProperties.get().getVersion(),
|
||||
XPipeDistributionType.get().getId(),
|
||||
lastUpdateCheckResult.getValue().getVersion(),
|
||||
lastUpdateCheckResult.getValue().getReleaseUrl(),
|
||||
downloadFile.get(),
|
||||
|
@ -71,6 +72,7 @@ public class GitHubUpdater extends UpdateHandler {
|
|||
event("Selected asset " + ghAsset.get().getName());
|
||||
lastUpdateCheckResult.setValue(new AvailableRelease(
|
||||
AppProperties.get().getVersion(),
|
||||
XPipeDistributionType.get().getId(),
|
||||
rel.get().getTagName(),
|
||||
rel.get().getHtmlUrl().toString(),
|
||||
ghAsset.get().getBrowserDownloadUrl(),
|
||||
|
|
|
@ -43,6 +43,7 @@ public class PortableUpdater extends UpdateHandler {
|
|||
var isUpdate = isUpdate(rel.get().getTagName());
|
||||
lastUpdateCheckResult.setValue(new AvailableRelease(
|
||||
AppProperties.get().getVersion(),
|
||||
XPipeDistributionType.get().getId(),
|
||||
rel.get().getTagName(),
|
||||
rel.get().getHtmlUrl().toString(),
|
||||
null,
|
||||
|
|
|
@ -40,7 +40,6 @@ public abstract class UpdateHandler {
|
|||
if (hasUpdated) {
|
||||
AppCache.clear("performedUpdate");
|
||||
updateSucceeded = AppProperties.get().getVersion().equals(performedUpdate.getNewVersion());
|
||||
AppCache.clear("lastUpdateCheckResult");
|
||||
AppCache.clear("preparedUpdate");
|
||||
event("Found information about recent update");
|
||||
} else {
|
||||
|
@ -51,10 +50,13 @@ public abstract class UpdateHandler {
|
|||
|
||||
// Check if the original version this was downloaded from is still the same
|
||||
if (preparedUpdate.getValue() != null
|
||||
&& !preparedUpdate
|
||||
&& (!preparedUpdate
|
||||
.getValue()
|
||||
.getSourceVersion()
|
||||
.equals(AppProperties.get().getVersion())) {
|
||||
.equals(AppProperties.get().getVersion())
|
||||
|| !XPipeDistributionType.get()
|
||||
.getId()
|
||||
.equals(preparedUpdate.getValue().getSourceDist()))) {
|
||||
preparedUpdate.setValue(null);
|
||||
}
|
||||
|
||||
|
@ -168,6 +170,7 @@ public abstract class UpdateHandler {
|
|||
|
||||
var rel = new PreparedUpdate(
|
||||
AppProperties.get().getVersion(),
|
||||
XPipeDistributionType.get().getId(),
|
||||
lastUpdateCheckResult.getValue().getVersion(),
|
||||
lastUpdateCheckResult.getValue().getReleaseUrl(),
|
||||
null,
|
||||
|
@ -237,6 +240,7 @@ public abstract class UpdateHandler {
|
|||
@With
|
||||
public static class AvailableRelease {
|
||||
String sourceVersion;
|
||||
String sourceDist;
|
||||
String version;
|
||||
String releaseUrl;
|
||||
String downloadUrl;
|
||||
|
@ -250,6 +254,7 @@ public abstract class UpdateHandler {
|
|||
@Jacksonized
|
||||
public static class PreparedUpdate {
|
||||
String sourceVersion;
|
||||
String sourceDist;
|
||||
String version;
|
||||
String releaseUrl;
|
||||
Path file;
|
||||
|
|
|
@ -4,42 +4,16 @@ import io.xpipe.app.core.AppCache;
|
|||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.util.XPipeSession;
|
||||
import io.xpipe.core.impl.LocalStore;
|
||||
import io.xpipe.core.util.ModuleHelper;
|
||||
import io.xpipe.core.util.XPipeInstallation;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public enum XPipeDistributionType {
|
||||
DEVELOPMENT("development", () -> new GitHubUpdater(false)) {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "development";
|
||||
}
|
||||
},
|
||||
PORTABLE("portable", () -> new PortableUpdater()) {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "portable";
|
||||
}
|
||||
},
|
||||
INSTALLATION("install", () -> new GitHubUpdater(true)) {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "install";
|
||||
}
|
||||
},
|
||||
CHOCO("choco", () -> new ChocoUpdater()) {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "choco";
|
||||
}
|
||||
};
|
||||
DEVELOPMENT("development", () -> new GitHubUpdater(false)),
|
||||
PORTABLE("portable", () -> new PortableUpdater()),
|
||||
INSTALLATION("install", () -> new GitHubUpdater(true)),
|
||||
CHOCO("choco", () -> new ChocoUpdater());
|
||||
|
||||
private static XPipeDistributionType type;
|
||||
|
||||
|
@ -53,9 +27,6 @@ public enum XPipeDistributionType {
|
|||
return type;
|
||||
}
|
||||
|
||||
if (!ModuleHelper.isImage()) {
|
||||
return (type = DEVELOPMENT);
|
||||
}
|
||||
|
||||
if (!XPipeSession.get().isNewBuildSession()) {
|
||||
var cached = AppCache.get("dist", String.class, () -> null);
|
||||
|
@ -75,10 +46,6 @@ public enum XPipeDistributionType {
|
|||
}
|
||||
|
||||
public static XPipeDistributionType determine() {
|
||||
if (!XPipeInstallation.isInstallationDistribution()) {
|
||||
return (type = PORTABLE);
|
||||
}
|
||||
|
||||
try (var sc = LocalStore.getShell()) {
|
||||
try (var chocoOut = sc.command("choco search --local-only -r xpipe").start()) {
|
||||
var out = chocoOut.readStdoutDiscardErr();
|
||||
|
@ -107,6 +74,4 @@ public enum XPipeDistributionType {
|
|||
}
|
||||
return updateHandler;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue