Rework git storage functionality

This commit is contained in:
crschnick 2023-11-27 13:29:17 +00:00
parent 37366ff1a8
commit 08c1586240
13 changed files with 54 additions and 17 deletions

View file

@ -19,6 +19,7 @@ import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.util.*;
import io.xpipe.core.store.DataStore;
import io.xpipe.core.util.ValidationException;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
@ -370,6 +371,9 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
}
messageProp.setValue(newMessage);
changedSinceError.setValue(false);
if (ex instanceof ValidationException) {
ErrorEvent.unreportable(ex);
}
ErrorEvent.fromThrowable(ex).omit().handle();
}
});

View file

@ -50,10 +50,10 @@ public class BaseMode extends OperationMode {
AppPrefs.init();
AppCharsets.init();
AppCharsetter.init();
AppSocketServer.init();
DataStorage.init();
AppFileWatcher.init();
FileBridge.init();
AppSocketServer.init();
TrackEvent.info("mode", "Finished base components initialization");
initialized = true;
}

View file

@ -1,6 +1,7 @@
package io.xpipe.app.exchange;
import io.xpipe.app.core.mode.OperationMode;
import io.xpipe.app.core.AppStyle;
import io.xpipe.app.core.AppTheme;
import io.xpipe.app.util.AskpassAlert;
import io.xpipe.beacon.BeaconHandler;
import io.xpipe.beacon.exchange.AskpassExchange;
@ -10,10 +11,8 @@ public class AskpassExchangeImpl extends AskpassExchange
@Override
public Response handleRequest(BeaconHandler handler, Request msg) {
if (OperationMode.get().equals(OperationMode.BACKGROUND)) {
OperationMode.switchTo(OperationMode.TRAY);
}
AppStyle.init();
AppTheme.init();
var r = AskpassAlert.query(msg.getPrompt(), msg.getRequest(), msg.getStoreId(), msg.getSubId());
return Response.builder().value(r != null ? r.inPlace() : null).build();
}

View file

@ -24,7 +24,8 @@ import java.util.concurrent.Callable;
@CommandLine.Command(
header = "Launches the XPipe daemon.",
sortOptions = false,
showEndOfOptionsDelimiterInUsageHelp = true)
showEndOfOptionsDelimiterInUsageHelp = true,
subcommands = {LauncherHelpCommand.class})
public class LauncherCommand implements Callable<Integer> {
@CommandLine.Option(

View file

@ -0,0 +1,23 @@
package io.xpipe.app.launcher;
import picocli.CommandLine;
import java.util.concurrent.Callable;
@CommandLine.Command(
name = "--help",
header = "Displays help information",
helpCommand = true
)
public class LauncherHelpCommand implements Callable<Integer> {
@Override
public Integer call() {
System.out.println("""
HELP
COMMAND!
""");
return 0;
}
}

View file

@ -88,6 +88,7 @@ public class CustomFormRenderer extends PreferencesFxFormRenderer {
c.getNode().disabledProperty().not());
var descriptionLabel = new Label();
descriptionLabel.setMaxWidth(600);
AppFont.medium(descriptionLabel);
descriptionLabel.setWrapText(true);
descriptionLabel
@ -142,6 +143,9 @@ public class CustomFormRenderer extends PreferencesFxFormRenderer {
if (element instanceof LazyNodeElement<?> nodeElement) {
var node = nodeElement.getNode();
if (node instanceof Region r) {
r.setMaxWidth(600);
}
grid.add(node, 0, i + rowAmount);
GridPane.setMargin(node, new Insets(SPACING, 0, 0, offset));
}

View file

@ -1,13 +1,13 @@
package io.xpipe.app.storage;
import io.xpipe.app.util.LicenseProvider;
import io.xpipe.core.process.ProcessControlProvider;
import java.nio.file.Path;
public interface GitStorageHandler {
static GitStorageHandler getInstance() {
return LicenseProvider.get().createStorageHandler();
return (GitStorageHandler) ProcessControlProvider.get().createStorageHandler();
}
boolean supportsShare();

View file

@ -4,7 +4,6 @@ import io.xpipe.app.comp.store.StoreSortMode;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.issue.TrackEvent;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.util.LicenseProvider;
import io.xpipe.app.util.XPipeSession;
import io.xpipe.core.store.LocalStore;
import lombok.Getter;
@ -29,7 +28,7 @@ public class StandardStorage extends DataStorage {
private boolean loaded;
StandardStorage() {
this.gitStorageHandler = LicenseProvider.get().createStorageHandler();
this.gitStorageHandler = GitStorageHandler.getInstance();
this.gitStorageHandler.init(dir);
}

View file

@ -2,7 +2,6 @@ package io.xpipe.app.util;
import io.xpipe.app.ext.ExtensionException;
import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.storage.GitStorageHandler;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.util.ModuleLayerLoader;
@ -47,6 +46,4 @@ public abstract class LicenseProvider {
public abstract void init();
public abstract Comp<?> overviewPage();
public abstract GitStorageHandler createStorageHandler();
}

View file

@ -30,7 +30,7 @@ enableGitStorageDescription=When enabled, XPipe will initialize a git repository
storageGitRemote=Git remote URL
storageGitRemoteDescription=When set, XPipe will automatically pull any changes when loading and push any changes to the remote repository when saving.\n\nThis allows you to share your configuration data through git. Note that this might slow down loading and saving operations.\n\nRequires a restart to apply.
vault=Vault
workspaceLockDescription=Sets a custom password to encrypt your stored information in XPipe.\n\nThis results in increased security as it provides an additional layer of encryption for your stored sensitive information. You will then be prompted to enter the password when XPipe starts.
workspaceLockDescription=Sets a custom password to encrypt any sensitive information stored in XPipe.\n\nThis results in increased security as it provides an additional layer of encryption for your stored sensitive information. You will then be prompted to enter the password when XPipe starts.
useSystemFontDescription=Controls whether to use your system font or the default font used by XPipe (Roboto).
tooltipDelay=Tooltip delay
tooltipDelayDescription=The amount of milliseconds to wait until a tooltip is displayed.

View file

@ -32,4 +32,5 @@ public abstract class ProcessControlProvider {
public abstract ShellControl createLocalProcessControl(boolean stoppable);
public abstract Object createStorageHandler();
}

9
dist/changelogs/1.7.9.md vendored Normal file
View file

@ -0,0 +1,9 @@
## Changes in 1.7.9
- Fix some windows being shown outside of screen bounds when display scaling values were set very high
- Fix macOS .pkg installers requiring Rosetta to be installed on ARM even though it wasn't needed
- Fix powerlevel10k breaking terminal integrations on macOS
- Fix some NullPointerExceptions
- Fix file browser execute action not launching scripts
- Fix some license related errors
- Show more information when SSH connection fails

View file

@ -70,8 +70,8 @@ public abstract class ScriptStore extends JacksonizedValue implements DataStore,
}
var refs = applicable.stream().map(scriptStore -> {
return DataStorage.get().getStoreEntries().stream().filter(dataStoreEntry -> dataStoreEntry.getStore() == scriptStore).findFirst().orElseThrow().<SimpleScriptStore>ref();
}).toList();
return DataStorage.get().getStoreEntries().stream().filter(dataStoreEntry -> dataStoreEntry.getStore() == scriptStore).findFirst().map(entry -> entry.<SimpleScriptStore>ref());
}).flatMap(Optional::stream).toList();
var hash = refs.stream().mapToInt(value -> value.get().getName().hashCode() + value.getStore().hashCode()).sum();
var xpipeHome = XPipeInstallation.getDataDir(proc);
var targetDir = FileNames.join(xpipeHome, "scripts", proc.getShellDialect().getId());