Various fixes

This commit is contained in:
crschnick 2024-02-25 16:38:32 +00:00
parent 5a125bce9b
commit 322acbe39c
8 changed files with 26 additions and 25 deletions

View file

@ -86,6 +86,7 @@ run {
systemProperty 'io.xpipe.app.logLevel', "trace"
systemProperty 'io.xpipe.app.fullVersion', rootProject.fullVersion
systemProperty 'io.xpipe.app.showcase', 'true'
systemProperty 'io.xpipe.app.staging', isStage
// systemProperty "io.xpipe.beacon.port", "21724"
// systemProperty "io.xpipe.beacon.printMessages", "true"
// systemProperty 'io.xpipe.app.debugPlatform', "true"

View file

@ -42,6 +42,10 @@ public class BrowserTransferModel {
BooleanProperty allDownloaded = new SimpleBooleanProperty();
private void cleanDirectory() {
if (!Files.isDirectory(TEMP)) {
return;
}
try (var ls = Files.list(TEMP)) {
var list = ls.toList();
for (Path path : list) {

View file

@ -276,11 +276,13 @@ public class FileSystemHelper {
for (FileSystem.FileEntry fileEntry : list) {
flatFiles.put(fileEntry, FileNames.toUnix(FileNames.relativize(baseRelative, fileEntry.getPath())));
if (fileEntry.getKind() == FileKind.FILE) {
totalSize.addAndGet(fileEntry.getFileSystem().getFileSize(fileEntry.getPath()));
// This one is up-to-date and does not need to be recalculated
totalSize.addAndGet(fileEntry.getSize());
}
}
} else {
flatFiles.put(source, FileNames.getFileName(source.getPath()));
// Recalculate as it could have been changed meanwhile
totalSize.addAndGet(source.getFileSystem().getFileSize(source.getPath()));
}

View file

@ -32,13 +32,13 @@ public class AppPrefs {
private static final String DEVELOPER_MODE_PROP = "io.xpipe.app.developerMode";
private static AppPrefs INSTANCE;
private final List<Mapping<?>> mapping = new ArrayList<>();
final BooleanProperty dontAutomaticallyStartVmSshServer =
map(new SimpleBooleanProperty(false), "dontAutomaticallyStartVmSshServer", Boolean.class);
mapVaultSpecific(new SimpleBooleanProperty(false), "dontAutomaticallyStartVmSshServer", Boolean.class);
final BooleanProperty dontAcceptNewHostKeys =
map(new SimpleBooleanProperty(false), "dontAcceptNewHostKeys", Boolean.class);
mapVaultSpecific(new SimpleBooleanProperty(false), "dontAcceptNewHostKeys", Boolean.class);
final BooleanProperty performanceMode = map(new SimpleBooleanProperty(false), "performanceMode", Boolean.class);
final BooleanProperty useBundledTools = map(new SimpleBooleanProperty(false), "useBundledTools", Boolean.class);
public final ObjectProperty<AppTheme.Theme> theme =
map(new SimpleObjectProperty<>(), "theme", AppTheme.Theme.class);
final BooleanProperty useSystemFont = map(new SimpleBooleanProperty(true), "useSystemFont", Boolean.class);
@ -55,17 +55,17 @@ public class AppPrefs {
final BooleanProperty clearTerminalOnInit =
map(new SimpleBooleanProperty(true), "clearTerminalOnInit", Boolean.class);
public final BooleanProperty disableCertutilUse =
map(new SimpleBooleanProperty(false), "disableCertutilUse", Boolean.class);
mapVaultSpecific(new SimpleBooleanProperty(false), "disableCertutilUse", Boolean.class);
public final BooleanProperty useLocalFallbackShell =
map(new SimpleBooleanProperty(false), "useLocalFallbackShell", Boolean.class);
public final BooleanProperty disableTerminalRemotePasswordPreparation =
map(new SimpleBooleanProperty(false), "disableTerminalRemotePasswordPreparation", Boolean.class);
mapVaultSpecific(new SimpleBooleanProperty(false), "disableTerminalRemotePasswordPreparation", Boolean.class);
public final Property<Boolean> alwaysConfirmElevation =
map(new SimpleObjectProperty<>(false), "alwaysConfirmElevation", Boolean.class);
mapVaultSpecific(new SimpleObjectProperty<>(false), "alwaysConfirmElevation", Boolean.class);
public final BooleanProperty dontCachePasswords =
map(new SimpleBooleanProperty(false), "dontCachePasswords", Boolean.class);
mapVaultSpecific(new SimpleBooleanProperty(false), "dontCachePasswords", Boolean.class);
public final BooleanProperty denyTempScriptCreation =
map(new SimpleBooleanProperty(false), "denyTempScriptCreation", Boolean.class);
mapVaultSpecific(new SimpleBooleanProperty(false), "denyTempScriptCreation", Boolean.class);
final StringProperty passwordManagerCommand =
map(new SimpleStringProperty(""), "passwordManagerCommand", String.class);
final ObjectProperty<StartupBehaviour> startupBehaviour =

View file

@ -143,7 +143,7 @@ public class StandardStorage extends DataStorage {
// Show one exception
if (exception.get() != null) {
ErrorEvent.fromThrowable(exception.get()).handle();
ErrorEvent.fromThrowable(exception.get()).expected().handle();
}
storeEntriesSet.forEach(dataStoreCategory -> {
@ -169,7 +169,7 @@ public class StandardStorage extends DataStorage {
local.deleteFromDisk();
hasFixedLocal = false;
} catch (IOException ex) {
ErrorEvent.fromThrowable(ex).terminal(true).build().handle();
ErrorEvent.fromThrowable(ex).terminal(true).expected().build().handle();
}
}
}
@ -275,7 +275,7 @@ public class StandardStorage extends DataStorage {
// Show one exception
if (exception.get() != null) {
ErrorEvent.fromThrowable(exception.get()).handle();
ErrorEvent.fromThrowable(exception.get()).expected().handle();
}
deleteLeftovers();

View file

@ -111,19 +111,18 @@ public class AppDownloads {
}
}
public static Optional<GHRelease> getLatestIncludingPreRelease() throws IOException {
public static Optional<GHRelease> getTopReleaseIncludingPreRelease() throws IOException {
var repo = getRepository();
return Optional.ofNullable(repo.listReleases().iterator().next());
}
public static Optional<GHRelease> getLatestRelease() throws IOException {
public static Optional<GHRelease> getMarkedLatestRelease() throws IOException {
var repo = getRepository();
return Optional.ofNullable(repo.getLatestRelease());
}
public static Optional<GHRelease> getLatestSuitableRelease() throws IOException {
var preIncluding = getLatestIncludingPreRelease();
var preIncluding = getTopReleaseIncludingPreRelease();
// If we are currently running a prerelease, always return this as the suitable release!
if (preIncluding.isPresent()
&& preIncluding.get().isPrerelease()
@ -131,12 +130,7 @@ public class AppDownloads {
return preIncluding;
}
// If this release is not a prerelease, just return it to prevent querying another release
if (preIncluding.isPresent() && !preIncluding.get().isPrerelease()) {
return preIncluding;
}
return getLatestRelease();
return getMarkedLatestRelease();
}
public static Optional<GHRelease> getRelease(String version, boolean omitErrors) {

View file

@ -74,11 +74,11 @@ public class AppInstaller {
String.format(
"""
cd /D "%%HOMEDRIVE%%%%HOMEPATH%%"
start "" /wait msiexec /i "%s" /lv "%s" /qb
start "" /wait msiexec /i "%s" /lv "%s" /qr
start "" "%s"
""",
file, logFile, exec));
shellProcessControl.executeSimpleCommand("start \"\" /min cmd /c \"" + script + "\"");
shellProcessControl.executeSimpleCommand("start \"XPipe Updater\" /min cmd /c \"" + script + "\"");
}
@Override

View file

@ -231,7 +231,7 @@ public abstract class UpdateHandler {
// In case we perform any operations such as opening a terminal
// give it some time to open while this process is still alive
// Otherwise it might quit because the parent process is dead already
ThreadHelper.sleep(2000);
ThreadHelper.sleep(100);
} catch (Throwable ex) {
ex.printStackTrace();
}