mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-03 19:30:31 +00:00
Reformat
This commit is contained in:
@@ -2,8 +2,6 @@ package io.xpipe.app.action;
|
||||
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.SimpleComp;
|
||||
import io.xpipe.app.core.AppFont;
|
||||
import io.xpipe.app.core.AppFontSizes;
|
||||
import io.xpipe.app.hub.action.BatchStoreAction;
|
||||
import io.xpipe.app.hub.action.MultiStoreAction;
|
||||
import io.xpipe.app.hub.action.StoreAction;
|
||||
@@ -18,11 +16,8 @@ import javafx.collections.FXCollections;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.ColumnConstraints;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
import atlantafx.base.theme.Styles;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package io.xpipe.app.action;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import io.xpipe.app.hub.action.BatchStoreAction;
|
||||
import io.xpipe.app.hub.action.MultiStoreAction;
|
||||
import io.xpipe.app.hub.action.StoreAction;
|
||||
@@ -9,6 +7,7 @@ import io.xpipe.core.store.DataStore;
|
||||
import io.xpipe.core.util.JacksonMapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
@@ -10,7 +10,6 @@ import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.update.AppDistributionType;
|
||||
import io.xpipe.app.util.*;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.scene.layout.Region;
|
||||
@@ -33,7 +32,8 @@ public class ActionShortcutComp extends SimpleComp {
|
||||
protected Region createSimple() {
|
||||
var options = new OptionsBuilder();
|
||||
options.nameAndDescription("actionDesktopShortcut").addComp(createDesktopComp());
|
||||
options.nameAndDescription(AppDistributionType.get().isSupportsUrls() ? "actionUrlShortcut" : "actionUrlShortcutDisabled")
|
||||
options.nameAndDescription(
|
||||
AppDistributionType.get().isSupportsUrls() ? "actionUrlShortcut" : "actionUrlShortcutDisabled")
|
||||
.addComp(createUrlComp())
|
||||
.disable(!AppDistributionType.get().isSupportsUrls());
|
||||
options.nameAndDescription("actionApiCall").addComp(createApiComp());
|
||||
@@ -93,10 +93,10 @@ public class ActionShortcutComp extends SimpleComp {
|
||||
prop.bind(text);
|
||||
|
||||
var copyButton = new ButtonComp(null, new FontIcon("mdi2c-clipboard-multiple-outline"), () -> {
|
||||
if (action.getValue() instanceof SerializableAction sa) {
|
||||
ClipboardHelper.copyUrl(sa.toNode().toPrettyString());
|
||||
}
|
||||
})
|
||||
if (action.getValue() instanceof SerializableAction sa) {
|
||||
ClipboardHelper.copyUrl(sa.toNode().toPrettyString());
|
||||
}
|
||||
})
|
||||
.grow(false, true)
|
||||
.tooltipKey("copyBody");
|
||||
var field = new TextFieldComp(prop, true);
|
||||
|
||||
@@ -25,7 +25,6 @@ public class ActionExchangeImpl extends ActionExchange {
|
||||
return Response.builder().build();
|
||||
}
|
||||
|
||||
|
||||
private boolean checkPermission() {
|
||||
var cache = AppCache.getBoolean("externalActionPermitted", false);
|
||||
if (cache) {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package io.xpipe.app.beacon.impl;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.beacon.BeaconClientException;
|
||||
import io.xpipe.beacon.api.CategoryInfoExchange;
|
||||
import io.xpipe.core.util.JacksonMapper;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package io.xpipe.app.beacon.impl;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStorageQuery;
|
||||
import io.xpipe.beacon.api.CategoryQueryExchange;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
public class CategoryQueryExchangeImpl extends CategoryQueryExchange {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package io.xpipe.app.beacon.impl;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreCategory;
|
||||
import io.xpipe.beacon.BeaconClientException;
|
||||
import io.xpipe.beacon.api.CategoryRemoveExchange;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ public class ConnectionQueryExchangeImpl extends ConnectionQueryExchange {
|
||||
|
||||
@Override
|
||||
public Object handle(HttpExchange exchange, Request msg) {
|
||||
var found = DataStorageQuery.queryEntry(msg.getCategoryFilter(), msg.getConnectionFilter(), msg.getTypeFilter());
|
||||
var found =
|
||||
DataStorageQuery.queryEntry(msg.getCategoryFilter(), msg.getConnectionFilter(), msg.getTypeFilter());
|
||||
return Response.builder()
|
||||
.found(found.stream().map(entry -> entry.getUuid()).toList())
|
||||
.build();
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package io.xpipe.app.beacon.impl;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import io.xpipe.app.storage.DataStorageSecret;
|
||||
import io.xpipe.beacon.BeaconClientException;
|
||||
import io.xpipe.beacon.api.SecretDecryptExchange;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SecretDecryptExchangeImpl extends SecretDecryptExchange {
|
||||
@@ -16,8 +17,6 @@ public class SecretDecryptExchangeImpl extends SecretDecryptExchange {
|
||||
throw new BeaconClientException("Unable to parse secret");
|
||||
}
|
||||
|
||||
return Response.builder()
|
||||
.decrypted(new String(secret.getSecret()))
|
||||
.build();
|
||||
return Response.builder().decrypted(new String(secret.getSecret())).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package io.xpipe.app.beacon.impl;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import io.xpipe.app.storage.DataStorageSecret;
|
||||
import io.xpipe.beacon.api.SecretEncryptExchange;
|
||||
import io.xpipe.core.util.InPlaceSecretValue;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
|
||||
public class SecretEncryptExchangeImpl extends SecretEncryptExchange {
|
||||
|
||||
@Override
|
||||
public Object handle(HttpExchange exchange, Request msg) {
|
||||
var secret = DataStorageSecret.ofCurrentSecret(InPlaceSecretValue.of(msg.getValue()));
|
||||
return Response.builder()
|
||||
.encrypted(secret.serialize(true))
|
||||
.build();
|
||||
return Response.builder().encrypted(secret.serialize(true)).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppLayoutModel;
|
||||
import io.xpipe.app.hub.action.StoreAction;
|
||||
import io.xpipe.core.store.FileEntry;
|
||||
import io.xpipe.core.store.FilePath;
|
||||
import io.xpipe.core.store.FileSystemStore;
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@ public class BrowserBreadcrumbBar extends SimpleComp {
|
||||
@Override
|
||||
protected Region createSimple() {
|
||||
Callback<Breadcrumbs.BreadCrumbItem<String>, ButtonBase> crumbFactory = crumb -> {
|
||||
var name = crumb.getValue().equals("/") ? "/" : FilePath.of(crumb.getValue()).getFileName();
|
||||
var name = crumb.getValue().equals("/")
|
||||
? "/"
|
||||
: FilePath.of(crumb.getValue()).getFileName();
|
||||
var btn = new Button(name, null);
|
||||
btn.setMnemonicParsing(false);
|
||||
btn.setFocusTraversable(false);
|
||||
|
||||
@@ -26,9 +26,7 @@ public interface BrowserFileOutput {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
|
||||
}
|
||||
public void onFinish() {}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,8 @@ public final class BrowserFileSystemTabModel extends BrowserStoreSessionTab<File
|
||||
}
|
||||
|
||||
public void refreshBrowserEntriesSync(List<BrowserEntry> entries) throws Exception {
|
||||
refreshFileEntriesSync(entries.stream().map(BrowserEntry::getRawFileEntry).collect(Collectors.toList()));
|
||||
refreshFileEntriesSync(
|
||||
entries.stream().map(BrowserEntry::getRawFileEntry).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public void refreshFileEntriesSync(List<FileEntry> entries) throws Exception {
|
||||
|
||||
@@ -69,8 +69,10 @@ public class BrowserTransferComp extends SimpleComp {
|
||||
return entry.getFileName();
|
||||
}
|
||||
|
||||
var hideProgress =
|
||||
sourceItem.get().getDownloadFinished().get();
|
||||
var hideProgress = sourceItem
|
||||
.get()
|
||||
.getDownloadFinished()
|
||||
.get();
|
||||
var share = p.getTransferred() * 100 / p.getTotal();
|
||||
var progressSuffix = hideProgress ? "" : " " + share + "%";
|
||||
return entry.getFileName() + progressSuffix;
|
||||
|
||||
@@ -86,8 +86,9 @@ public class BrowserTransferModel {
|
||||
public void clear(boolean delete) {
|
||||
List<Item> toClear;
|
||||
synchronized (items) {
|
||||
toClear =
|
||||
items.stream().filter(item -> item.getDownloadFinished().get()).toList();
|
||||
toClear = items.stream()
|
||||
.filter(item -> item.getDownloadFinished().get())
|
||||
.toList();
|
||||
if (toClear.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -172,8 +173,9 @@ public class BrowserTransferModel {
|
||||
public void transferToDownloads() throws Exception {
|
||||
List<Item> toMove;
|
||||
synchronized (items) {
|
||||
toMove =
|
||||
items.stream().filter(item -> item.getDownloadFinished().get()).toList();
|
||||
toMove = items.stream()
|
||||
.filter(item -> item.getDownloadFinished().get())
|
||||
.toList();
|
||||
if (toMove.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ public abstract class MultiExecuteMenuProvider implements BrowserMenuBranchProvi
|
||||
model.openTerminalSync(
|
||||
entry.getRawFileEntry().getName(),
|
||||
model.getCurrentDirectory() != null
|
||||
? model.getCurrentDirectory()
|
||||
.getPath()
|
||||
? model.getCurrentDirectory().getPath()
|
||||
: null,
|
||||
cmd,
|
||||
entries.size() == 1);
|
||||
@@ -93,8 +92,8 @@ public abstract class MultiExecuteMenuProvider implements BrowserMenuBranchProvi
|
||||
}
|
||||
|
||||
sc.command(cmd)
|
||||
.withWorkingDirectory(model.getCurrentDirectory()
|
||||
.getPath())
|
||||
.withWorkingDirectory(
|
||||
model.getCurrentDirectory().getPath())
|
||||
.execute();
|
||||
}
|
||||
model.refreshBrowserEntriesSync(entries);
|
||||
|
||||
@@ -67,8 +67,16 @@ public class NewItemMenuProvider implements BrowserMenuBranchProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
var fixedFiles = entries.stream().map(browserEntry -> browserEntry.getRawFileEntry().getKind() == FileKind.DIRECTORY ?
|
||||
browserEntry.getRawFileEntry().getPath() : browserEntry.getRawFileEntry().getPath().getParent())
|
||||
var fixedFiles = entries.stream()
|
||||
.map(browserEntry ->
|
||||
browserEntry.getRawFileEntry().getKind() == FileKind.DIRECTORY
|
||||
? browserEntry
|
||||
.getRawFileEntry()
|
||||
.getPath()
|
||||
: browserEntry
|
||||
.getRawFileEntry()
|
||||
.getPath()
|
||||
.getParent())
|
||||
.toList();
|
||||
var builder = NewFileActionProvider.Action.builder();
|
||||
builder.initFiles(model, fixedFiles);
|
||||
@@ -106,8 +114,16 @@ public class NewItemMenuProvider implements BrowserMenuBranchProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
var fixedFiles = entries.stream().map(browserEntry -> browserEntry.getRawFileEntry().getKind() == FileKind.DIRECTORY ?
|
||||
browserEntry.getRawFileEntry().getPath() : browserEntry.getRawFileEntry().getPath().getParent())
|
||||
var fixedFiles = entries.stream()
|
||||
.map(browserEntry ->
|
||||
browserEntry.getRawFileEntry().getKind() == FileKind.DIRECTORY
|
||||
? browserEntry
|
||||
.getRawFileEntry()
|
||||
.getPath()
|
||||
: browserEntry
|
||||
.getRawFileEntry()
|
||||
.getPath()
|
||||
.getParent())
|
||||
.toList();
|
||||
var builder = NewDirectoryActionProvider.Action.builder();
|
||||
builder.initFiles(model, fixedFiles);
|
||||
@@ -150,8 +166,16 @@ public class NewItemMenuProvider implements BrowserMenuBranchProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
var fixedFiles = entries.stream().map(browserEntry -> browserEntry.getRawFileEntry().getKind() == FileKind.DIRECTORY ?
|
||||
browserEntry.getRawFileEntry().getPath() : browserEntry.getRawFileEntry().getPath().getParent())
|
||||
var fixedFiles = entries.stream()
|
||||
.map(browserEntry ->
|
||||
browserEntry.getRawFileEntry().getKind() == FileKind.DIRECTORY
|
||||
? browserEntry
|
||||
.getRawFileEntry()
|
||||
.getPath()
|
||||
: browserEntry
|
||||
.getRawFileEntry()
|
||||
.getPath()
|
||||
.getParent())
|
||||
.toList();
|
||||
var builder = NewLinkActionProvider.Action.builder();
|
||||
builder.initFiles(model, fixedFiles);
|
||||
|
||||
@@ -35,10 +35,15 @@ public class ZipActionProvider implements BrowserActionProvider {
|
||||
var sc = model.getFileSystem().getShell().orElseThrow();
|
||||
if (sc.getOsType() == OsType.WINDOWS) {
|
||||
var base = model.getCurrentDirectory().getPath();
|
||||
var command = CommandBuilder.of().add("Compress-Archive", "-Force", "-DestinationPath").addFile(target).add("-Path");
|
||||
var command = CommandBuilder.of()
|
||||
.add("Compress-Archive", "-Force", "-DestinationPath")
|
||||
.addFile(target)
|
||||
.add("-Path");
|
||||
for (int i = 0; i < getEntries().size(); i++) {
|
||||
var rel = getEntries().get(i).getRawFileEntry().getPath().relativize(base);
|
||||
if (getEntries().get(i).getRawFileEntry().getKind() == FileKind.DIRECTORY && directoryContentOnly) {
|
||||
var rel =
|
||||
getEntries().get(i).getRawFileEntry().getPath().relativize(base);
|
||||
if (getEntries().get(i).getRawFileEntry().getKind() == FileKind.DIRECTORY
|
||||
&& directoryContentOnly) {
|
||||
command.addQuoted(rel.toDirectory().toWindows() + "*");
|
||||
} else {
|
||||
command.addFile(rel.toWindows());
|
||||
@@ -59,7 +64,10 @@ public class ZipActionProvider implements BrowserActionProvider {
|
||||
var command = CommandBuilder.of().add("zip", "-q", "-y", "-r", "-");
|
||||
for (BrowserEntry entry : getEntries()) {
|
||||
var base = target.getParent();
|
||||
var rel = entry.getRawFileEntry().getPath().relativize(base).toUnix();
|
||||
var rel = entry.getRawFileEntry()
|
||||
.getPath()
|
||||
.relativize(base)
|
||||
.toUnix();
|
||||
if (entry.getRawFileEntry().getKind() == FileKind.DIRECTORY && directoryContentOnly) {
|
||||
command.add(".");
|
||||
} else {
|
||||
@@ -69,7 +77,12 @@ public class ZipActionProvider implements BrowserActionProvider {
|
||||
command.add(">").addFile(target);
|
||||
|
||||
if (directoryContentOnly) {
|
||||
sc.command(command).withWorkingDirectory(getEntries().getFirst().getRawFileEntry().getPath()).execute();
|
||||
sc.command(command)
|
||||
.withWorkingDirectory(getEntries()
|
||||
.getFirst()
|
||||
.getRawFileEntry()
|
||||
.getPath())
|
||||
.execute();
|
||||
} else {
|
||||
sc.command(command).execute();
|
||||
}
|
||||
|
||||
@@ -5,10 +5,9 @@ import io.xpipe.app.comp.CompStructure;
|
||||
import io.xpipe.app.comp.SimpleCompStructure;
|
||||
import io.xpipe.app.core.AppFontSizes;
|
||||
import io.xpipe.app.util.BindingsHelper;
|
||||
import io.xpipe.app.util.Check;
|
||||
import io.xpipe.app.util.Hyperlinks;
|
||||
|
||||
import io.xpipe.app.util.Validator;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.binding.Bindings;
|
||||
|
||||
@@ -11,8 +11,8 @@ import io.xpipe.app.update.AppDistributionType;
|
||||
import io.xpipe.app.update.UpdateAvailableDialog;
|
||||
import io.xpipe.app.util.Hyperlinks;
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.Property;
|
||||
|
||||
@@ -42,9 +42,9 @@ public class AppGnomeScaleDialog {
|
||||
return;
|
||||
}
|
||||
|
||||
var content = AppDialog.dialogText("You are running XPipe with a high display scaling on a Wayland system." +
|
||||
" Due to xwayland limitations, this might result in a blurry window." +
|
||||
" See below for a possible fix.");
|
||||
var content = AppDialog.dialogText("You are running XPipe with a high display scaling on a Wayland system."
|
||||
+ " Due to xwayland limitations, this might result in a blurry window."
|
||||
+ " See below for a possible fix.");
|
||||
var modal = ModalOverlay.of("waylandScalingTitle", content);
|
||||
modal.addButton(ModalButton.ok(() -> {
|
||||
AppCache.update("gnomeScaleNoticeShown", true);
|
||||
|
||||
@@ -27,7 +27,8 @@ public class ShellSession extends Session {
|
||||
try {
|
||||
shellControl.start();
|
||||
|
||||
var supportsAliveCheck = shellControl.getShellDialect().getDumbMode().supportsAnyPossibleInteraction();
|
||||
var supportsAliveCheck =
|
||||
shellControl.getShellDialect().getDumbMode().supportsAnyPossibleInteraction();
|
||||
if (supportsAliveCheck) {
|
||||
startAliveListener();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,10 @@ public interface SingletonSessionStoreProvider extends DataStoreProvider {
|
||||
var t = new StoreToggleComp(null, g, sec, enabled, newState -> {
|
||||
SingletonSessionStore<?> s = sec.getWrapper().getEntry().getStore().asNeeded();
|
||||
if (s.isSessionEnabled() != newState) {
|
||||
var action = ToggleActionProvider.Action.builder().ref(sec.getWrapper().getEntry().ref()).enabled(newState).build();
|
||||
var action = ToggleActionProvider.Action.builder()
|
||||
.ref(sec.getWrapper().getEntry().ref())
|
||||
.enabled(newState)
|
||||
.build();
|
||||
action.executeAsync();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,8 +24,12 @@ public final class BatchStoreAction<T extends DataStore> extends SerializableAct
|
||||
|
||||
@Override
|
||||
public String getShortcutName() {
|
||||
var names = actions.size() > 3 ? actions.size() + "..." : actions.stream().map(a -> DataStorage.get().getStoreEntryDisplayName(a.getRef().get())).collect(
|
||||
Collectors.joining(", "));
|
||||
var names = actions.size() > 3
|
||||
? actions.size() + "..."
|
||||
: actions.stream()
|
||||
.map(a -> DataStorage.get()
|
||||
.getStoreEntryDisplayName(a.getRef().get()))
|
||||
.collect(Collectors.joining(", "));
|
||||
return names + " (" + getDisplayName() + ")";
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,11 @@ public abstract class MultiStoreAction<T extends DataStore> extends Serializable
|
||||
|
||||
@Override
|
||||
public String getShortcutName() {
|
||||
var names = refs.size() > 3 ? refs.size() + "..." : refs.stream().map(ref -> DataStorage.get().getStoreEntryDisplayName(ref.get())).collect(
|
||||
Collectors.joining(", "));
|
||||
var names = refs.size() > 3
|
||||
? refs.size() + "..."
|
||||
: refs.stream()
|
||||
.map(ref -> DataStorage.get().getStoreEntryDisplayName(ref.get()))
|
||||
.collect(Collectors.joining(", "));
|
||||
return names + " (" + getDisplayName() + ")";
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.xpipe.app.hub.action.impl;
|
||||
import io.xpipe.app.action.ActionProvider;
|
||||
import io.xpipe.app.ext.SingletonSessionStore;
|
||||
import io.xpipe.app.hub.action.StoreAction;
|
||||
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
|
||||
|
||||
@@ -35,17 +35,22 @@ public class StoreCreationComp extends ModalOverlayContentComp {
|
||||
|
||||
private Region createStoreProperties(Comp<?> providerComp, Validator providerVal, Validator propVal) {
|
||||
var nameKey = model.storeTypeNameKey();
|
||||
var built = new OptionsBuilder(propVal).addComp(providerComp, model.getStore()).name(nameKey + "Name").description(
|
||||
nameKey + "NameDescription").addString(model.getName(), false).nonNull().check(
|
||||
val -> Validator.create(val, AppI18n.observable("readOnlyStoreError"), model.getName(), s -> {
|
||||
var same = s != null && model.getExistingEntry() != null && DataStorage.get().getEffectiveReadOnlyState(
|
||||
model.getExistingEntry()) && s.equals(model.getExistingEntry().getName());
|
||||
var built = new OptionsBuilder(propVal)
|
||||
.addComp(providerComp, model.getStore())
|
||||
.name(nameKey + "Name")
|
||||
.description(nameKey + "NameDescription")
|
||||
.addString(model.getName(), false)
|
||||
.nonNull()
|
||||
.check(val -> Validator.create(val, AppI18n.observable("readOnlyStoreError"), model.getName(), s -> {
|
||||
var same = s != null
|
||||
&& model.getExistingEntry() != null
|
||||
&& DataStorage.get().getEffectiveReadOnlyState(model.getExistingEntry())
|
||||
&& s.equals(model.getExistingEntry().getName());
|
||||
return !same;
|
||||
})).buildComp();
|
||||
}))
|
||||
.buildComp();
|
||||
var comp = new OptionsComp(built.getEntries(), new ChainedValidator(List.of(providerVal, propVal)));
|
||||
return comp
|
||||
.styleClass("store-creator-options")
|
||||
.createRegion();
|
||||
return comp.styleClass("store-creator-options").createRegion();
|
||||
}
|
||||
|
||||
private Region createLayout() {
|
||||
|
||||
@@ -372,7 +372,8 @@ public abstract class StoreEntryComp extends SimpleComp {
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
if (cat == StoreActionCategory.CONFIGURATION && getWrapper().getEntry().getValidity() != DataStoreEntry.Validity.LOAD_FAILED) {
|
||||
if (cat == StoreActionCategory.CONFIGURATION
|
||||
&& getWrapper().getEntry().getValidity() != DataStoreEntry.Validity.LOAD_FAILED) {
|
||||
var rename = new MenuItem(AppI18n.get("rename"), new FontIcon("mdal-edit"));
|
||||
rename.setOnAction(event -> {
|
||||
name.requestFocus();
|
||||
|
||||
@@ -318,7 +318,8 @@ public class StoreViewState {
|
||||
// Some entries might already be removed again
|
||||
var wrappers = Arrays.stream(entry)
|
||||
.map(StoreEntryWrapper::new)
|
||||
.filter(storeEntryWrapper -> DataStorage.get().getStoreEntries().contains(storeEntryWrapper.getEntry()))
|
||||
.filter(storeEntryWrapper ->
|
||||
DataStorage.get().getStoreEntries().contains(storeEntryWrapper.getEntry()))
|
||||
.toList();
|
||||
wrappers.forEach(StoreEntryWrapper::update);
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.util.Hyperlinks;
|
||||
import io.xpipe.core.util.FailableSupplier;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public interface ErrorAction {
|
||||
|
||||
static ErrorAction openDocumentation(String link) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import io.xpipe.app.core.AppLayoutModel;
|
||||
import io.xpipe.app.util.LabelGraphic;
|
||||
import io.xpipe.app.util.LicenseProvider;
|
||||
import io.xpipe.app.util.LicenseRequiredException;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.stream.Stream;
|
||||
@@ -29,11 +28,16 @@ public class GuiErrorHandler extends GuiErrorHandlerBase implements ErrorHandler
|
||||
if (event.isOmitted()) {
|
||||
ErrorAction.ignore().handle(event);
|
||||
if (AppLayoutModel.get() != null) {
|
||||
AppLayoutModel.get().showQueueEntry(
|
||||
new AppLayoutModel.QueueEntry(AppI18n.observable("errorOccurred"), new LabelGraphic.IconGraphic("mdoal-error_outline"),
|
||||
() -> {
|
||||
handleGui(event);
|
||||
}), Duration.ofSeconds(10), true);
|
||||
AppLayoutModel.get()
|
||||
.showQueueEntry(
|
||||
new AppLayoutModel.QueueEntry(
|
||||
AppI18n.observable("errorOccurred"),
|
||||
new LabelGraphic.IconGraphic("mdoal-error_outline"),
|
||||
() -> {
|
||||
handleGui(event);
|
||||
}),
|
||||
Duration.ofSeconds(10),
|
||||
true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ public class DataStorageQuery {
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
public static List<DataStoreCategory> queryCategory(String categoryFilter) {
|
||||
if (DataStorage.get() == null) {
|
||||
return List.of();
|
||||
|
||||
@@ -312,10 +312,12 @@ public class StandardStorage extends DataStorage {
|
||||
filterPerUserEntries(storeEntries.keySet());
|
||||
|
||||
// Only add new stores if really necessary
|
||||
laterAddedEntries.stream().filter(dataStoreEntry -> storeEntries.containsKey(dataStoreEntry)).forEach(e -> {
|
||||
storeEntries.remove(e);
|
||||
addStoreEntryIfNotPresent(e);
|
||||
});
|
||||
laterAddedEntries.stream()
|
||||
.filter(dataStoreEntry -> storeEntries.containsKey(dataStoreEntry))
|
||||
.forEach(e -> {
|
||||
storeEntries.remove(e);
|
||||
addStoreEntryIfNotPresent(e);
|
||||
});
|
||||
|
||||
deleteLeftovers();
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.xpipe.app.util;
|
||||
|
||||
import io.xpipe.app.ext.LocalStore;
|
||||
import io.xpipe.app.pwman.PasswordManager;
|
||||
import io.xpipe.app.storage.*;
|
||||
import io.xpipe.app.terminal.ExternalTerminalType;
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.synedra.validatorfx.ValidationResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class ExclusiveValidator<T> implements Validator {
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.synedra.validatorfx.ValidationResult;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SimpleValidator implements Validator {
|
||||
|
||||
@@ -139,7 +139,8 @@ open module io.xpipe.app {
|
||||
OpenFileWithMenuProvider,
|
||||
OpenDirectoryMenuProvider,
|
||||
OpenDirectoryInNewTabMenuProvider,
|
||||
ScanHubLeafProvider, RefreshActionProvider,
|
||||
ScanHubLeafProvider,
|
||||
RefreshActionProvider,
|
||||
ToggleActionProvider,
|
||||
OpenTerminalMenuProvider,
|
||||
OpenNativeFileDetailsMenuProvider,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.beacon.api;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.xpipe.beacon.BeaconInterface;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package io.xpipe.beacon.api;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.xpipe.beacon.BeaconInterface;
|
||||
import io.xpipe.core.store.StorePath;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.xpipe.beacon.api;
|
||||
|
||||
import io.xpipe.beacon.BeaconInterface;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.xpipe.beacon.api;
|
||||
|
||||
import io.xpipe.beacon.BeaconInterface;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package io.xpipe.beacon.api;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.xpipe.beacon.BeaconInterface;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package io.xpipe.beacon.api;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.xpipe.beacon.BeaconInterface;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.Builder;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
|
||||
@@ -179,7 +179,8 @@ public interface ShellControl extends ProcessControl {
|
||||
|
||||
ShellSecurityPolicy getEffectiveSecurityPolicy();
|
||||
|
||||
String buildElevatedCommand(CommandConfiguration input, String prefix, UUID requestId, CountDown countDown, String user)
|
||||
String buildElevatedCommand(
|
||||
CommandConfiguration input, String prefix, UUID requestId, CountDown countDown, String user)
|
||||
throws Exception;
|
||||
|
||||
void restart() throws Exception;
|
||||
|
||||
@@ -323,7 +323,8 @@ public class WrapperShellControl implements ShellControl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String buildElevatedCommand(CommandConfiguration input, String prefix, UUID requestId, CountDown countDown, String user)
|
||||
public String buildElevatedCommand(
|
||||
CommandConfiguration input, String prefix, UUID requestId, CountDown countDown, String user)
|
||||
throws Exception {
|
||||
return parent.buildElevatedCommand(input, prefix, requestId, countDown, user);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@ public class FileNames {
|
||||
return file.substring(0, file.length() - getFileName(file).length() - 1);
|
||||
}
|
||||
|
||||
|
||||
public static String normalize(String file) {
|
||||
var backslash = file.contains("\\");
|
||||
return backslash ? toWindows(file) : toUnix(file);
|
||||
|
||||
@@ -48,7 +48,8 @@ public final class FilePath {
|
||||
return false;
|
||||
}
|
||||
FilePath filePath = (FilePath) o;
|
||||
return Objects.equals(normalize().removeTrailingSlash().value, filePath.normalize().removeTrailingSlash().value);
|
||||
return Objects.equals(
|
||||
normalize().removeTrailingSlash().value, filePath.normalize().removeTrailingSlash().value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,8 @@ import java.time.Instant;
|
||||
@Value
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PasswordManagerIdentityStore extends IdentityStore implements InternalCacheDataStore, ValidatableStore, UserScopeStore {
|
||||
public class PasswordManagerIdentityStore extends IdentityStore
|
||||
implements InternalCacheDataStore, ValidatableStore, UserScopeStore {
|
||||
|
||||
String key;
|
||||
boolean perUser;
|
||||
|
||||
-2
@@ -4,7 +4,6 @@ import io.xpipe.app.ext.DataStoreCreationCategory;
|
||||
import io.xpipe.app.ext.GuiDialog;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.prefs.PasswordManagerTestComp;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStorageUserHandler;
|
||||
import io.xpipe.app.storage.DataStoreCategory;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
@@ -16,7 +15,6 @@ import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PasswordManagerIdentityStoreProvider extends IdentityStoreProvider {
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.identity;
|
||||
|
||||
import io.xpipe.core.util.FailableSupplier;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -65,7 +65,7 @@ public interface UsernameStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
final class Dynamic implements UsernameStrategy {
|
||||
final class Dynamic implements UsernameStrategy {
|
||||
|
||||
private final FailableSupplier<String> username;
|
||||
|
||||
@@ -73,22 +73,22 @@ public interface UsernameStrategy {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getClass().hashCode();
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getClass().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Dynamic;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Dynamic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "<dynamic>";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "<dynamic>";
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean hasUser() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -30,16 +30,20 @@ open module io.xpipe.ext.base {
|
||||
requires org.kordamp.ikonli.javafx;
|
||||
requires atlantafx.base;
|
||||
|
||||
provides ActionProvider with LocalIdentityConvertHubLeafProvider,
|
||||
provides ActionProvider with
|
||||
LocalIdentityConvertHubLeafProvider,
|
||||
RunBackgroundScriptActionProvider,
|
||||
RunHubBatchScriptActionProvider,
|
||||
RunHubScriptActionProvider,
|
||||
RunTerminalScriptActionProvider, SimpleScriptQuickEditHubLeafProvider,
|
||||
RunTerminalScriptActionProvider,
|
||||
SimpleScriptQuickEditHubLeafProvider,
|
||||
StoreStartActionProvider,
|
||||
StoreStopActionProvider,
|
||||
StorePauseActionProvider,
|
||||
StoreRestartActionProvider, ServiceCopyAddressHubLeafProvider,
|
||||
RunScriptActionProviderMenu, ServiceRefreshHubProvider,
|
||||
StoreRestartActionProvider,
|
||||
ServiceCopyAddressHubLeafProvider,
|
||||
RunScriptActionProviderMenu,
|
||||
ServiceRefreshHubProvider,
|
||||
RunFileScriptMenuProvider;
|
||||
provides DataStoreProvider with
|
||||
FixedServiceGroupStoreProvider,
|
||||
|
||||
Reference in New Issue
Block a user