mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-23 16:10:24 +00:00
Various resilience fixes
This commit is contained in:
parent
e76371518f
commit
3df5a1f697
9 changed files with 17 additions and 34 deletions
|
@ -113,7 +113,8 @@ public final class BrowserFileSystemTabModel extends BrowserStoreSessionTab<File
|
|||
}
|
||||
|
||||
var current = getCurrentDirectory();
|
||||
if (DataStorage.get().getStoreEntries().contains(getEntry().get())
|
||||
// We might close this after storage shutdown
|
||||
if (DataStorage.get() != null && DataStorage.get().getStoreEntries().contains(getEntry().get())
|
||||
&& savedState != null
|
||||
&& current != null) {
|
||||
savedState.cd(current.getPath(), false);
|
||||
|
|
|
@ -390,11 +390,13 @@ public abstract class StoreEntryComp extends SimpleComp {
|
|||
.bind(Bindings.createBooleanBinding(
|
||||
() -> {
|
||||
return !getWrapper().getDeletable().get()
|
||||
&& AppPrefs.get().developerMode().getValue()
|
||||
&& !AppPrefs.get()
|
||||
.developerDisableGuiRestrictions()
|
||||
.get();
|
||||
},
|
||||
getWrapper().getDeletable(),
|
||||
AppPrefs.get().developerMode(),
|
||||
AppPrefs.get().developerDisableGuiRestrictions()));
|
||||
del.setOnAction(event -> getWrapper().delete());
|
||||
contextMenu.getItems().add(del);
|
||||
|
|
|
@ -157,7 +157,7 @@ public class StoreEntryWrapper {
|
|||
|
||||
busy.setValue(entry.getBusyCounter().get() != 0);
|
||||
deletable.setValue(entry.getConfiguration().isDeletable()
|
||||
|| AppPrefs.get().developerDisableGuiRestrictions().getValue());
|
||||
|| (AppPrefs.get().developerMode().getValue() && AppPrefs.get().developerDisableGuiRestrictions().getValue()));
|
||||
sessionActive.setValue(entry.getStore() instanceof SingletonSessionStore<?> ss
|
||||
&& entry.getStore() instanceof ShellStore
|
||||
&& ss.isSessionRunning());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.xpipe.app.core;
|
||||
|
||||
import io.xpipe.app.core.check.AppUserDirectoryCheck;
|
||||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
|
@ -121,6 +122,9 @@ public class AppProperties {
|
|||
autoAcceptEula = Optional.ofNullable(System.getProperty("io.xpipe.app.acceptEula"))
|
||||
.map(Boolean::parseBoolean)
|
||||
.orElse(false);
|
||||
|
||||
// We require the user dir from here
|
||||
AppUserDirectoryCheck.check(dataDir);
|
||||
AppCache.setBasePath(dataDir.resolve("cache"));
|
||||
UUID id = AppCache.getNonNull("uuid", UUID.class, null);
|
||||
if (id == null) {
|
||||
|
|
|
@ -7,12 +7,11 @@ import org.apache.commons.io.FileUtils;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class AppUserDirectoryCheck {
|
||||
|
||||
public static void check() {
|
||||
var dataDirectory = AppProperties.get().getDataDir();
|
||||
|
||||
public static void check(Path dataDirectory) {
|
||||
try {
|
||||
FileUtils.forceMkdir(dataDirectory.toFile());
|
||||
var testDirectory = dataDirectory.resolve("permissions_check");
|
||||
|
|
|
@ -115,7 +115,6 @@ public abstract class OperationMode {
|
|||
|
||||
TrackEvent.info("Initial setup");
|
||||
AppProperties.init();
|
||||
AppUserDirectoryCheck.check();
|
||||
AppTempCheck.check();
|
||||
AppLogs.init();
|
||||
AppDebugModeCheck.printIfNeeded();
|
||||
|
|
|
@ -133,12 +133,8 @@ public class AppPrefs {
|
|||
mapLocal(new SimpleBooleanProperty(false), "developerMode", Boolean.class, true);
|
||||
final BooleanProperty developerDisableUpdateVersionCheck =
|
||||
mapLocal(new SimpleBooleanProperty(false), "developerDisableUpdateVersionCheck", Boolean.class, false);
|
||||
private final ObservableBooleanValue developerDisableUpdateVersionCheckEffective =
|
||||
bindDeveloperTrue(developerDisableUpdateVersionCheck);
|
||||
final BooleanProperty developerDisableGuiRestrictions =
|
||||
mapLocal(new SimpleBooleanProperty(false), "developerDisableGuiRestrictions", Boolean.class, false);
|
||||
private final ObservableBooleanValue developerDisableGuiRestrictionsEffective =
|
||||
bindDeveloperTrue(developerDisableGuiRestrictions);
|
||||
final BooleanProperty developerForceSshTty =
|
||||
mapLocal(new SimpleBooleanProperty(false), "developerForceSshTty", Boolean.class, false);
|
||||
|
||||
|
@ -276,24 +272,6 @@ public class AppPrefs {
|
|||
return developerMode().getValue() && !ModuleHelper.isImage();
|
||||
}
|
||||
|
||||
private ObservableBooleanValue bindDeveloperTrue(ObservableBooleanValue o) {
|
||||
return Bindings.createBooleanBinding(
|
||||
() -> {
|
||||
return developerMode().getValue() && o.get();
|
||||
},
|
||||
o,
|
||||
developerMode());
|
||||
}
|
||||
|
||||
private ObservableBooleanValue bindDeveloperFalse(ObservableBooleanValue o) {
|
||||
return Bindings.createBooleanBinding(
|
||||
() -> {
|
||||
return !developerMode().getValue() && o.get();
|
||||
},
|
||||
o,
|
||||
developerMode());
|
||||
}
|
||||
|
||||
public ObservableValue<ExternalPasswordManager> externalPasswordManager() {
|
||||
return passwordManager;
|
||||
}
|
||||
|
@ -488,15 +466,15 @@ public class AppPrefs {
|
|||
}
|
||||
|
||||
public ObservableBooleanValue developerDisableUpdateVersionCheck() {
|
||||
return developerDisableUpdateVersionCheckEffective;
|
||||
return developerDisableUpdateVersionCheck;
|
||||
}
|
||||
|
||||
public ObservableBooleanValue developerDisableGuiRestrictions() {
|
||||
return developerDisableGuiRestrictionsEffective;
|
||||
return developerDisableGuiRestrictions;
|
||||
}
|
||||
|
||||
public ObservableBooleanValue developerForceSshTty() {
|
||||
return bindDeveloperTrue(developerForceSshTty);
|
||||
return developerForceSshTty;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -42,7 +42,7 @@ public interface NetworkTunnelStore extends DataStore {
|
|||
}
|
||||
}
|
||||
|
||||
default boolean isLocallyTunneable() {
|
||||
default boolean isLocallyTunnelable() {
|
||||
NetworkTunnelStore current = this;
|
||||
while (true) {
|
||||
if (current.getNetworkParent() == null) {
|
||||
|
@ -58,7 +58,7 @@ public interface NetworkTunnelStore extends DataStore {
|
|||
}
|
||||
|
||||
default NetworkTunnelSession sessionChain(int local, int remotePort, String address) throws Exception {
|
||||
if (!isLocallyTunneable()) {
|
||||
if (!isLocallyTunnelable()) {
|
||||
throw new IllegalStateException(
|
||||
"Unable to create tunnel chain as one intermediate system does not support tunneling");
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class CustomServiceStoreProvider extends AbstractServiceStoreProvider {
|
|||
StoreChoiceComp.other(
|
||||
host,
|
||||
NetworkTunnelStore.class,
|
||||
n -> n.getStore().isLocallyTunneable(),
|
||||
n -> n.getStore().isLocallyTunnelable(),
|
||||
StoreViewState.get().getAllConnectionsCategory()),
|
||||
host)
|
||||
.nonNull()
|
||||
|
|
Loading…
Reference in a new issue