Various fixes

This commit is contained in:
crschnick 2024-05-10 05:41:08 +00:00
parent 3363ad9f41
commit 7507f664df
5 changed files with 20 additions and 26 deletions

View file

@ -18,7 +18,8 @@ public class OpenFileSystemCache extends ShellControlCache {
ShellControl sc = model.getFileSystem().getShell().get();
ShellDialect d = sc.getShellDialect();
username = d.printUsernameCommand(sc).readStdoutOrThrow();
// If there is no id command, we should still be fine with just assuming root
username = d.printUsernameCommand(sc).readStdoutIfPossible().orElse("root");
}
public boolean isRoot() {

View file

@ -22,6 +22,6 @@ public class AppPreloader extends Preloader {
ModuleLayer.boot().findModule("javafx.graphics").orElseThrow(), "com.sun.glass.ui.Application");
var m = c.getDeclaredMethod("setName", String.class);
m.invoke(c.getMethod("GetApplication").invoke(null), "XPipe");
TrackEvent.info("Application preloaded launched");
TrackEvent.info("Application preloader run");
}
}

View file

@ -1,5 +1,6 @@
package io.xpipe.app.fxcomps.impl;
import atlantafx.base.theme.Styles;
import io.xpipe.app.browser.session.BrowserChooserComp;
import io.xpipe.app.comp.base.ButtonComp;
import io.xpipe.app.core.AppI18n;
@ -15,17 +16,13 @@ import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.core.store.FileNames;
import io.xpipe.core.store.FileSystemStore;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.Alert;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import atlantafx.base.theme.Styles;
import org.kordamp.ikonli.javafx.FontIcon;
import java.nio.file.Files;
@ -84,38 +81,26 @@ public class ContextualFileReferenceChoiceComp extends Comp<CompStructure<HBox>>
.styleClass(Styles.CENTER_PILL)
.grow(false, true);
var canGitShare = Bindings.createBooleanBinding(
() -> {
if (!AppPrefs.get().enableGitStorage().get()
|| filePath.getValue() == null
|| ContextualFileReference.of(filePath.getValue()).isInDataDirectory()) {
return false;
}
return true;
},
filePath,
AppPrefs.get().enableGitStorage());
var gitShareButton = new ButtonComp(null, new FontIcon("mdi2g-git"), () -> {
if (!AppPrefs.get().enableGitStorage().get()) {
AppLayoutModel.get().selectSettings();
AppPrefs.get().selectCategory("synchronization");
AppPrefs.get().selectCategory("sync");
return;
}
if (filePath.getValue() == null
|| ContextualFileReference.of(filePath.getValue()).isInDataDirectory()) {
var currentPath = filePath.getValue();
if (currentPath == null || currentPath.isBlank()) {
return;
}
if (filePath.getValue() == null || filePath.getValue().isBlank() || !canGitShare.get()) {
if (ContextualFileReference.of(currentPath).isInDataDirectory()) {
return;
}
try {
var data = DataStorage.get().getDataDir();
var f = data.resolve(FileNames.getFileName(filePath.getValue().trim()));
var source = Path.of(filePath.getValue().trim());
var f = data.resolve(FileNames.getFileName(currentPath.trim()));
var source = Path.of(currentPath.trim());
if (Files.exists(source)) {
var shouldCopy = AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("confirmGitShareTitle"));

View file

@ -1,5 +1,6 @@
package io.xpipe.app.util;
import com.fasterxml.jackson.core.JsonParseException;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.core.util.JacksonMapper;
@ -26,8 +27,10 @@ public class JsonConfigHelper {
var read = o.readTree(Files.readAllBytes(in));
return read;
}
} catch (JsonParseException e) {
ErrorEvent.fromThrowable("Unable to parse file " + in, e).expected().build().handle();
} catch (IOException e) {
ErrorEvent.fromThrowable(e).build().handle();
ErrorEvent.fromThrowable("Unable to parse file " + in, e).build().handle();
}
return JsonNodeFactory.instance.missingNode();
}
@ -57,7 +60,7 @@ public class JsonConfigHelper {
var newContent = writer.toString();
Files.writeString(out, newContent);
} catch (IOException e) {
ErrorEvent.fromThrowable(e).build().handle();
ErrorEvent.fromThrowable("Unable to write file " + out, e).build().handle();
}
}
}

View file

@ -33,3 +33,8 @@ The file browser has been reworked to support many new keyboard shortcuts and th
- Fix a corrupted PATH leading to cmd or powershell not being able to be started
- Fix headless system error message not being printed when application failed to start up
- Fix offline licenses not properly applying
- Fix WMClass not being properly set on Linux
- Fix file browser files being dragged into finder creating raw clipboard file
- Fix SSH gateway not updating when choosing key file on another host
- Fix file browser failing to connect if target system did not have id command available
- Fix git share file button not jumping to correct settings menu