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