This commit is contained in:
crschnick 2023-02-09 21:30:07 +00:00
parent 7be8087b19
commit 131dec75ec
228 changed files with 800 additions and 942 deletions

View file

@ -100,6 +100,7 @@ The license model is chosen in such a way that you are
able to use and integrate X-Pipe within your application through the MIT-licensed API. able to use and integrate X-Pipe within your application through the MIT-licensed API.
In any other case where you plan to contribute to the X-Pipe platform itself, which is GPL licensed, In any other case where you plan to contribute to the X-Pipe platform itself, which is GPL licensed,
I would still have to figure out how to exactly handle these kinds of contributions. I would still have to figure out how to exactly handle these kinds of contributions.
It is also planned to move many components to a more permissive license in the future.
## Development ## Development

View file

@ -13,8 +13,7 @@ import java.util.Optional;
public final class XPipeApiConnection extends BeaconConnection { public final class XPipeApiConnection extends BeaconConnection {
private XPipeApiConnection() { private XPipeApiConnection() {}
}
public static XPipeApiConnection open() { public static XPipeApiConnection open() {
var con = new XPipeApiConnection(); var con = new XPipeApiConnection();

View file

@ -10,10 +10,7 @@ import java.io.InputStream;
public class DataRawImpl extends DataSourceImpl implements DataRaw { public class DataRawImpl extends DataSourceImpl implements DataRaw {
public DataRawImpl( public DataRawImpl(
DataSourceId sourceId, DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
DataSourceConfig sourceConfig,
io.xpipe.core.source.DataSource<?> internalSource
) {
super(sourceId, sourceConfig, internalSource); super(sourceId, sourceConfig, internalSource);
} }

View file

@ -18,8 +18,7 @@ public abstract class DataSourceImpl implements DataSource {
private final io.xpipe.core.source.DataSource<?> internalSource; private final io.xpipe.core.source.DataSource<?> internalSource;
public DataSourceImpl( public DataSourceImpl(
DataSourceId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource<?> internalSource DataSourceId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource<?> internalSource) {
) {
this.sourceId = sourceId; this.sourceId = sourceId;
this.config = config; this.config = config;
this.internalSource = internalSource; this.internalSource = internalSource;

View file

@ -9,10 +9,7 @@ import io.xpipe.core.source.DataSourceType;
public class DataStructureImpl extends DataSourceImpl implements DataStructure { public class DataStructureImpl extends DataSourceImpl implements DataStructure {
DataStructureImpl( DataStructureImpl(
DataSourceId sourceId, DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
DataSourceConfig sourceConfig,
io.xpipe.core.source.DataSource<?> internalSource
) {
super(sourceId, sourceConfig, internalSource); super(sourceId, sourceConfig, internalSource);
} }

View file

@ -37,11 +37,16 @@ public class DataTableAccumulatorImpl implements DataTableAccumulator {
connection = XPipeApiConnection.open(); connection = XPipeApiConnection.open();
store = new InternalStreamStore(); store = new InternalStreamStore();
var addReq = StoreAddExchange.Request.builder().storeInput(store).name(store.getUuid().toString()).build(); var addReq = StoreAddExchange.Request.builder()
.storeInput(store)
.name(store.getUuid().toString())
.build();
StoreAddExchange.Response addRes = connection.performSimpleExchange(addReq); StoreAddExchange.Response addRes = connection.performSimpleExchange(addReq);
QuietDialogHandler.handle(addRes.getConfig(), connection); QuietDialogHandler.handle(addRes.getConfig(), connection);
connection.sendRequest(WriteStreamExchange.Request.builder().name(store.getUuid().toString()).build()); connection.sendRequest(WriteStreamExchange.Request.builder()
.name(store.getUuid().toString())
.build());
bodyOutput = connection.sendBody(); bodyOutput = connection.sendBody();
} }

View file

@ -24,11 +24,7 @@ import java.util.stream.StreamSupport;
public class DataTableImpl extends DataSourceImpl implements DataTable { public class DataTableImpl extends DataSourceImpl implements DataTable {
DataTableImpl( DataTableImpl(DataSourceId id, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
DataSourceId id,
DataSourceConfig sourceConfig,
io.xpipe.core.source.DataSource<?> internalSource
) {
super(id, sourceConfig, internalSource); super(id, sourceConfig, internalSource);
} }
@ -74,7 +70,6 @@ public class DataTableImpl extends DataSourceImpl implements DataTable {
public Iterator<TupleNode> iterator() { public Iterator<TupleNode> iterator() {
return new TableIterator(); return new TableIterator();
} }
; ;
private class TableIterator implements Iterator<TupleNode> { private class TableIterator implements Iterator<TupleNode> {

View file

@ -25,10 +25,7 @@ import java.util.stream.StreamSupport;
public class DataTextImpl extends DataSourceImpl implements DataText { public class DataTextImpl extends DataSourceImpl implements DataText {
DataTextImpl( DataTextImpl(
DataSourceId sourceId, DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource<?> internalSource) {
DataSourceConfig sourceConfig,
io.xpipe.core.source.DataSource<?> internalSource
) {
super(sourceId, sourceConfig, internalSource); super(sourceId, sourceConfig, internalSource);
} }

View file

@ -42,8 +42,7 @@ public class AppLayoutComp extends Comp<CompStructure<BorderPane>> {
private List<SideMenuBarComp.Entry> createEntryList() { private List<SideMenuBarComp.Entry> createEntryList() {
var l = new ArrayList<>(List.of( var l = new ArrayList<>(List.of(
new SideMenuBarComp.Entry( new SideMenuBarComp.Entry(I18n.observable("connections"), "mdi2c-connection", new StoreLayoutComp()),
I18n.observable("connections"), "mdi2c-connection", new StoreLayoutComp()),
new SideMenuBarComp.Entry(I18n.observable("data"), "mdsal-dvr", new SourceCollectionLayoutComp()), new SideMenuBarComp.Entry(I18n.observable("data"), "mdsal-dvr", new SourceCollectionLayoutComp()),
new SideMenuBarComp.Entry( new SideMenuBarComp.Entry(
I18n.observable("settings"), "mdsmz-miscellaneous_services", new PrefsComp(this)), I18n.observable("settings"), "mdsmz-miscellaneous_services", new PrefsComp(this)),
@ -52,7 +51,8 @@ public class AppLayoutComp extends Comp<CompStructure<BorderPane>> {
// new SideMenuBarComp.Entry(I18n.observable("account"), "mdi2a-account", new StorageLayoutComp()), // new SideMenuBarComp.Entry(I18n.observable("account"), "mdi2a-account", new StorageLayoutComp()),
new SideMenuBarComp.Entry(I18n.observable("about"), "mdi2p-package-variant", new AboutTabComp()))); new SideMenuBarComp.Entry(I18n.observable("about"), "mdi2p-package-variant", new AboutTabComp())));
if (AppProperties.get().isDeveloperMode()) { if (AppProperties.get().isDeveloperMode()) {
// l.add(new SideMenuBarComp.Entry(I18n.observable("developer"), "mdi2b-book-open-variant", new DeveloperTabComp())); // l.add(new SideMenuBarComp.Entry(I18n.observable("developer"), "mdi2b-book-open-variant", new
// DeveloperTabComp()));
} }
// l.add(new SideMenuBarComp.Entry(I18n.observable("abc"), "mdi2b-book-open-variant", Comp.of(() -> { // l.add(new SideMenuBarComp.Entry(I18n.observable("abc"), "mdi2b-book-open-variant", Comp.of(() -> {
// var fi = new FontIcon("mdsal-dvr"); // var fi = new FontIcon("mdsal-dvr");

View file

@ -2,14 +2,14 @@ package io.xpipe.app.comp.about;
import io.xpipe.app.comp.base.ButtonComp; import io.xpipe.app.comp.base.ButtonComp;
import io.xpipe.app.core.AppLogs; import io.xpipe.app.core.AppLogs;
import io.xpipe.app.util.ExternalEditor;
import io.xpipe.app.issue.UserReportComp; import io.xpipe.app.issue.UserReportComp;
import io.xpipe.app.util.ExternalEditor;
import io.xpipe.core.util.XPipeInstallation; import io.xpipe.core.util.XPipeInstallation;
import io.xpipe.extension.I18n; import io.xpipe.extension.I18n;
import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.event.ErrorEvent;
import io.xpipe.extension.fxcomps.SimpleComp; import io.xpipe.extension.fxcomps.SimpleComp;
import io.xpipe.extension.util.DynamicOptionsBuilder;
import io.xpipe.extension.util.DesktopHelper; import io.xpipe.extension.util.DesktopHelper;
import io.xpipe.extension.util.DynamicOptionsBuilder;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
public class BrowseDirectoryComp extends SimpleComp { public class BrowseDirectoryComp extends SimpleComp {
@ -30,7 +30,11 @@ public class BrowseDirectoryComp extends SimpleComp {
.addComp( .addComp(
"logFile", "logFile",
new ButtonComp(I18n.observable("openCurrentLogFile"), () -> { new ButtonComp(I18n.observable("openCurrentLogFile"), () -> {
ExternalEditor.get().openInEditor(AppLogs.get().getSessionLogsDirectory().resolve("xpipe.log").toString()); ExternalEditor.get()
.openInEditor(AppLogs.get()
.getSessionLogsDirectory()
.resolve("xpipe.log")
.toString());
}), }),
null) null)
.addComp( .addComp(

View file

@ -22,8 +22,7 @@ public record ThirdPartyDependency(String name, String version, String licenseNa
} }
try (var list = Files.list(path)) { try (var list = Files.list(path)) {
for (var p : list for (var p : list.filter(p -> p.getFileName().toString().endsWith(".properties"))
.filter(p -> p.getFileName().toString().endsWith(".properties"))
.sorted(Comparator.comparing(path1 -> path1.toString())) .sorted(Comparator.comparing(path1 -> path1.toString()))
.toList()) { .toList()) {
var props = new Properties(); var props = new Properties();

View file

@ -1,12 +1,12 @@
package io.xpipe.app.comp.about; package io.xpipe.app.comp.about;
import io.xpipe.extension.util.XPipeDistributionType;
import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppI18n;
import io.xpipe.app.update.AppUpdater; import io.xpipe.app.update.AppUpdater;
import io.xpipe.app.util.Hyperlinks; import io.xpipe.app.util.Hyperlinks;
import io.xpipe.extension.I18n; import io.xpipe.extension.I18n;
import io.xpipe.extension.fxcomps.SimpleComp; import io.xpipe.extension.fxcomps.SimpleComp;
import io.xpipe.extension.fxcomps.util.PlatformThread; import io.xpipe.extension.fxcomps.util.PlatformThread;
import io.xpipe.extension.util.XPipeDistributionType;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableBooleanValue; import javafx.beans.value.ObservableBooleanValue;

View file

@ -29,7 +29,8 @@ public class IntegratedTextAreaComp extends SimpleComp {
@Override @Override
protected Region createSimple() { protected Region createSimple() {
var fileDrop = new FileDropOverlayComp<>(Comp.of(() -> { var fileDrop = new FileDropOverlayComp<>(
Comp.of(() -> {
var textArea = new TextAreaComp(value, lazy).createRegion(); var textArea = new TextAreaComp(value, lazy).createRegion();
var copyButton = createOpenButton(textArea); var copyButton = createOpenButton(textArea);
var pane = new AnchorPane(copyButton); var pane = new AnchorPane(copyButton);
@ -40,7 +41,8 @@ public class IntegratedTextAreaComp extends SimpleComp {
var c = new StackPane(); var c = new StackPane();
c.getChildren().addAll(textArea, pane); c.getChildren().addAll(textArea, pane);
return c; return c;
}), paths -> value.setValue(Files.readString(paths.get(0)))); }),
paths -> value.setValue(Files.readString(paths.get(0))));
return fileDrop.createRegion(); return fileDrop.createRegion();
} }
@ -48,7 +50,8 @@ public class IntegratedTextAreaComp extends SimpleComp {
var button = new IconButtonComp("mdal-edit", () -> ExternalEditor.get() var button = new IconButtonComp("mdal-edit", () -> ExternalEditor.get()
.startEditing(identifier, fileType, this, value.getValue(), (s) -> { .startEditing(identifier, fileType, this, value.getValue(), (s) -> {
Platform.runLater(() -> value.setValue(s)); Platform.runLater(() -> value.setValue(s));
})).createRegion(); }))
.createRegion();
return button; return button;
} }
} }

View file

@ -22,8 +22,7 @@ public class ListBoxViewComp<T> extends Comp<CompStructure<VBox>> {
private final ObservableList<T> all; private final ObservableList<T> all;
private final Function<T, Comp<?>> compFunction; private final Function<T, Comp<?>> compFunction;
public ListBoxViewComp( public ListBoxViewComp(ObservableList<T> shown, ObservableList<T> all, Function<T, Comp<?>> compFunction) {
ObservableList<T> shown, ObservableList<T> all, Function<T, Comp<?>> compFunction) {
this.shown = PlatformThread.sync(shown); this.shown = PlatformThread.sync(shown);
this.all = PlatformThread.sync(all); this.all = PlatformThread.sync(all);
this.compFunction = compFunction; this.compFunction = compFunction;

View file

@ -23,28 +23,23 @@ public class DataSourceTargetChoiceComp extends Comp<CompStructure<ComboBox<Node
private final Property<DataSourceTarget> selectedApplication; private final Property<DataSourceTarget> selectedApplication;
private final List<DataSourceTarget> all; private final List<DataSourceTarget> all;
private DataSourceTargetChoiceComp( private DataSourceTargetChoiceComp(Property<DataSourceTarget> selectedApplication, List<DataSourceTarget> all) {
Property<DataSourceTarget> selectedApplication, List<DataSourceTarget> all) {
this.selectedApplication = selectedApplication; this.selectedApplication = selectedApplication;
this.all = all; this.all = all;
} }
public static DataSourceTargetChoiceComp create( public static DataSourceTargetChoiceComp create(
Property<DataSourceTarget> selectedApplication, Property<DataSourceTarget> selectedApplication, Predicate<DataSourceTarget> filter) {
Predicate<DataSourceTarget> filter) {
selectedApplication.addListener((observable, oldValue, val) -> { selectedApplication.addListener((observable, oldValue, val) -> {
AppCache.update("application-last-used", val != null ? val.getId() : null); AppCache.update("application-last-used", val != null ? val.getId() : null);
}); });
var all = DataSourceTarget.getAll().stream() var all =
.filter((p) -> filter.test(p)) DataSourceTarget.getAll().stream().filter((p) -> filter.test(p)).toList();
.toList();
if (selectedApplication.getValue() == null) { if (selectedApplication.getValue() == null) {
String selectedId = AppCache.get("application-last-used", String.class, () -> null); String selectedId = AppCache.get("application-last-used", String.class, () -> null);
var selectedProvider = selectedId != null var selectedProvider = selectedId != null
? DataSourceTarget.byId(selectedId) ? DataSourceTarget.byId(selectedId).filter(filter).orElse(null)
.filter(filter)
.orElse(null)
: null; : null;
selectedApplication.setValue(selectedProvider); selectedApplication.setValue(selectedProvider);
} }

View file

@ -8,8 +8,8 @@ import io.xpipe.app.storage.DataSourceEntry;
import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.util.Hyperlinks; import io.xpipe.app.util.Hyperlinks;
import io.xpipe.core.source.DataSourceId; import io.xpipe.core.source.DataSourceId;
import io.xpipe.extension.I18n;
import io.xpipe.extension.DataSourceTarget; import io.xpipe.extension.DataSourceTarget;
import io.xpipe.extension.I18n;
import io.xpipe.extension.fxcomps.Comp; import io.xpipe.extension.fxcomps.Comp;
import io.xpipe.extension.fxcomps.CompStructure; import io.xpipe.extension.fxcomps.CompStructure;
import io.xpipe.extension.fxcomps.SimpleComp; import io.xpipe.extension.fxcomps.SimpleComp;
@ -65,7 +65,9 @@ public class DsDataTransferComp extends SimpleComp {
AppWindowHelper.sideWindow( AppWindowHelper.sideWindow(
I18n.get("pipeDataSource"), I18n.get("pipeDataSource"),
window -> { window -> {
var ms = new DsDataTransferComp(new SimpleObjectProperty<>(e)).exclude(DataSourceTarget.byId("base.saveSource").orElseThrow()); var ms = new DsDataTransferComp(new SimpleObjectProperty<>(e))
.exclude(DataSourceTarget.byId("base.saveSource")
.orElseThrow());
var multi = new MultiStepComp() { var multi = new MultiStepComp() {
@Override @Override
protected List<Entry> setup() { protected List<Entry> setup() {
@ -111,9 +113,7 @@ public class DsDataTransferComp extends SimpleComp {
}; };
return multi.apply(s -> { return multi.apply(s -> {
SimpleChangeListener.apply(ms.getSelectedTarget(), (c) -> { SimpleChangeListener.apply(ms.getSelectedTarget(), (c) -> {
if (c != null if (c != null && c.getAccessType() == DataSourceTarget.AccessType.PASSIVE) {
&& c.getAccessType()
== DataSourceTarget.AccessType.PASSIVE) {
((Region) s.get().getChildren().get(2)).setMaxHeight(0); ((Region) s.get().getChildren().get(2)).setMaxHeight(0);
((Region) s.get().getChildren().get(2)).setMinHeight(0); ((Region) s.get().getChildren().get(2)).setMinHeight(0);
((Region) s.get().getChildren().get(2)).setVisible(false); ((Region) s.get().getChildren().get(2)).setVisible(false);
@ -149,8 +149,9 @@ public class DsDataTransferComp extends SimpleComp {
var chooser = DataSourceTargetChoiceComp.create( var chooser = DataSourceTargetChoiceComp.create(
selectedTarget, selectedTarget,
a -> !excludedTargets.contains(a) && a.isApplicable(dataSourceEntry.getValue().getSource()) && a -> !excludedTargets.contains(a)
a.createRetrievalInstructions( && a.isApplicable(dataSourceEntry.getValue().getSource())
&& a.createRetrievalInstructions(
dataSourceEntry.getValue().getSource(), id) dataSourceEntry.getValue().getSource(), id)
!= null); != null);
@ -165,11 +166,9 @@ public class DsDataTransferComp extends SimpleComp {
return selectedTarget.getValue() != null return selectedTarget.getValue() != null
&& selectedTarget.getValue().getSetupGuideURL() != null; && selectedTarget.getValue().getSetupGuideURL() != null;
}, },
selectedTarget selectedTarget)));
)));
var top = new HorizontalComp(List.<Comp<?>>of( var top = new HorizontalComp(List.<Comp<?>>of(
chooser.apply(struc -> HBox.setHgrow(struc.get(), Priority.ALWAYS)), chooser.apply(struc -> HBox.setHgrow(struc.get(), Priority.ALWAYS)), setupGuideButton))
setupGuideButton))
.apply(struc -> { .apply(struc -> {
struc.get().setAlignment(Pos.CENTER); struc.get().setAlignment(Pos.CENTER);
struc.get().setSpacing(12); struc.get().setSpacing(12);
@ -179,9 +178,7 @@ public class DsDataTransferComp extends SimpleComp {
// setupGuideButton.prefHeightProperty().bind(chooserR.heightProperty()); // setupGuideButton.prefHeightProperty().bind(chooserR.heightProperty());
var content = new VBox( var content = new VBox(
new DynamicOptionsComp( new DynamicOptionsComp(List.of(new DynamicOptionsComp.Entry(null, null, top)), false).createRegion(),
List.of(new DynamicOptionsComp.Entry(null, null, top)), false)
.createRegion(),
new Region()); new Region());
SimpleChangeListener.apply(selectedTarget, c -> { SimpleChangeListener.apply(selectedTarget, c -> {
if (selectedTarget.getValue() == null) { if (selectedTarget.getValue() == null) {
@ -192,8 +189,7 @@ public class DsDataTransferComp extends SimpleComp {
var instructions = selectedTarget var instructions = selectedTarget
.getValue() .getValue()
.createRetrievalInstructions( .createRetrievalInstructions(dataSourceEntry.getValue().getSource(), id);
dataSourceEntry.getValue().getSource(), id);
content.getChildren().set(1, instructions.getRegion()); content.getChildren().set(1, instructions.getRegion());
VBox.setVgrow(instructions.getRegion(), Priority.ALWAYS); VBox.setVgrow(instructions.getRegion(), Priority.ALWAYS);
selectedDisplay.setValue(instructions); selectedDisplay.setValue(instructions);

View file

@ -40,7 +40,8 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
private GuiDsCreatorMultiStep( private GuiDsCreatorMultiStep(
Stage window, Stage window,
DataSourceEntry editing, DataSourceCollection targetGroup, DataSourceEntry editing,
DataSourceCollection targetGroup,
DataSourceProvider.Category category, DataSourceProvider.Category category,
DataSourceProvider<?> provider, DataSourceProvider<?> provider,
DI store, DI store,
@ -72,13 +73,7 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
I18n.get("newDataSource"), I18n.get("newDataSource"),
window -> { window -> {
var ms = new GuiDsCreatorMultiStep<>( var ms = new GuiDsCreatorMultiStep<>(
window, window, null, sourceCollection, category, null, null, null, State.CREATE);
null, sourceCollection,
category,
null,
null,
null,
State.CREATE);
loading.bind(ms.loading); loading.bind(ms.loading);
window.setOnCloseRequest(e -> { window.setOnCloseRequest(e -> {
if (ms.state == State.CREATE && ms.source.getValue() != null) { if (ms.state == State.CREATE && ms.source.getValue() != null) {
@ -102,7 +97,8 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
window -> { window -> {
var ms = new GuiDsCreatorMultiStep<>( var ms = new GuiDsCreatorMultiStep<>(
window, window,
entry, DataStorage.get() entry,
DataStorage.get()
.getCollectionForSourceEntry(entry) .getCollectionForSourceEntry(entry)
.orElse(null), .orElse(null),
entry.getProvider().getCategory(), entry.getProvider().getCategory(),
@ -130,7 +126,8 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
window -> { window -> {
var gui = new GuiDsCreatorMultiStep<>( var gui = new GuiDsCreatorMultiStep<>(
window, window,
null, sourceCollection, null,
sourceCollection,
category, category,
provider.orElse(null), provider.orElse(null),
store, store,
@ -266,7 +263,8 @@ public class GuiDsCreatorMultiStep<DI extends DataStore, DS extends DataSource<D
switch (state) { switch (state) {
case EDIT -> {} case EDIT -> {}
case CREATE -> { case CREATE -> {
list.add(new Entry(I18n.observable("target"), new GuiDsCreatorTransferStep(targetGroup, store, source))); list.add(
new Entry(I18n.observable("target"), new GuiDsCreatorTransferStep(targetGroup, store, source)));
} }
} }
return list; return list;

View file

@ -45,7 +45,8 @@ public class GuiDsCreatorTransferStep extends MultiStepComp.Step<CompStructure<?
return null; return null;
} }
var name = DataStorage.get().createUniqueSourceEntryName(DataStorage.get().getInternalCollection(), source.get()); var name = DataStorage.get()
.createUniqueSourceEntryName(DataStorage.get().getInternalCollection(), source.get());
var entry = DataSourceEntry.createNew(UUID.randomUUID(), name, this.source.get()); var entry = DataSourceEntry.createNew(UUID.randomUUID(), name, this.source.get());
return entry; return entry;
}, },

View file

@ -66,7 +66,8 @@ public class GuiDsStoreSelectStep extends MultiStepComp.Step<CompStructure<? ext
private Region createCategoryChooserComp() { private Region createCategoryChooserComp() {
if (category == DataSourceProvider.Category.STREAM) { if (category == DataSourceProvider.Category.STREAM) {
return new DsStreamStoreChoiceComp(input, provider, true, true, DsStreamStoreChoiceComp.Mode.OPEN).createRegion(); return new DsStreamStoreChoiceComp(input, provider, true, true, DsStreamStoreChoiceComp.Mode.OPEN)
.createRegion();
} }
if (category == DataSourceProvider.Category.DATABASE) { if (category == DataSourceProvider.Category.DATABASE) {

View file

@ -56,8 +56,8 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
Property<DataStore> selected, Property<DataStore> selected,
Property<DataSourceProvider<?>> provider, Property<DataSourceProvider<?>> provider,
boolean showAnonymous, boolean showAnonymous,
boolean showSaved, Mode mode boolean showSaved,
) { Mode mode) {
this.selected = selected; this.selected = selected;
this.provider = provider; this.provider = provider;
this.showAnonymous = showAnonymous; this.showAnonymous = showAnonymous;
@ -69,9 +69,12 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
@Override @Override
protected Region createSimple() { protected Region createSimple() {
var isNamedStore = XPipeDaemon.getInstance().getStoreName(selected.getValue()).isPresent(); var isNamedStore =
XPipeDaemon.getInstance().getStoreName(selected.getValue()).isPresent();
var localStore = new SimpleObjectProperty<DataStore>( var localStore = new SimpleObjectProperty<DataStore>(
!isNamedStore && selected.getValue() instanceof FileStore fileStore && fileStore.getFileSystem() instanceof LocalStore !isNamedStore
&& selected.getValue() instanceof FileStore fileStore
&& fileStore.getFileSystem() instanceof LocalStore
? selected.getValue() ? selected.getValue()
: null); : null);
var browseComp = new DsLocalFileBrowseComp(provider, localStore, mode).apply(GrowAugment.create(true, false)); var browseComp = new DsLocalFileBrowseComp(provider, localStore, mode).apply(GrowAugment.create(true, false));
@ -99,7 +102,9 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
provider != null ? provider : new SimpleObjectProperty<>()); provider != null ? provider : new SimpleObjectProperty<>());
var remoteStore = new SimpleObjectProperty<DataStore>( var remoteStore = new SimpleObjectProperty<DataStore>(
isNamedStore && selected.getValue() instanceof FileStore fileStore && !(fileStore.getFileSystem() instanceof LocalStore) isNamedStore
&& selected.getValue() instanceof FileStore fileStore
&& !(fileStore.getFileSystem() instanceof LocalStore)
? selected.getValue() ? selected.getValue()
: null); : null);
var remote = new TabPaneComp.Entry( var remote = new TabPaneComp.Entry(
@ -111,7 +116,8 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
"mdrmz-storage", "mdrmz-storage",
NamedStoreChoiceComp.create(filter, namedStore, DataStoreProvider.Category.STREAM)); NamedStoreChoiceComp.create(filter, namedStore, DataStoreProvider.Category.STREAM));
var otherStore = new SimpleObjectProperty<DataStore>(localStore.get() == null && remoteStore.get() == null && !isNamedStore ? selected.getValue() : null); var otherStore = new SimpleObjectProperty<DataStore>(
localStore.get() == null && remoteStore.get() == null && !isNamedStore ? selected.getValue() : null);
var other = new TabPaneComp.Entry( var other = new TabPaneComp.Entry(
I18n.observable("other"), I18n.observable("other"),
"mdrmz-web_asset", "mdrmz-web_asset",
@ -132,7 +138,8 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable {
selected.addListener((observable, oldValue, newValue) -> { selected.addListener((observable, oldValue, newValue) -> {
if (provider != null && provider.getValue() == null) { if (provider != null && provider.getValue() == null) {
provider.setValue(DataSourceProviders.byPreferredStore(newValue, null).orElse(null)); provider.setValue(
DataSourceProviders.byPreferredStore(newValue, null).orElse(null));
} }
}); });

View file

@ -158,7 +158,8 @@ public class SourceCollectionViewState {
private ObservableList<SourceCollectionWrapper> filter(ObservableList<SourceCollectionWrapper> list) { private ObservableList<SourceCollectionWrapper> filter(ObservableList<SourceCollectionWrapper> list) {
return list.filtered(storeEntryWrapper -> { return list.filtered(storeEntryWrapper -> {
if (AppPrefs.get().developerMode().getValue() && AppPrefs.get().developerShowHiddenEntries().get()) { if (AppPrefs.get().developerMode().getValue()
&& AppPrefs.get().developerShowHiddenEntries().get()) {
return true; return true;
} else { } else {
return !storeEntryWrapper.isInternal(); return !storeEntryWrapper.isInternal();

View file

@ -17,12 +17,10 @@ public class StoreEntryListComp extends SimpleComp {
var topLevel = StoreEntrySection.createTopLevels(); var topLevel = StoreEntrySection.createTopLevels();
var filtered = BindingsHelper.filteredContentBinding( var filtered = BindingsHelper.filteredContentBinding(
topLevel, topLevel,
StoreViewState.get().getFilterString().map(s -> (storeEntrySection -> storeEntrySection.shouldShow(s)))); StoreViewState.get()
var content = new ListViewComp<>( .getFilterString()
filtered, .map(s -> (storeEntrySection -> storeEntrySection.shouldShow(s))));
topLevel, var content = new ListViewComp<>(filtered, topLevel, null, (StoreEntrySection e) -> {
null,
(StoreEntrySection e) -> {
return e.comp(true); return e.comp(true);
}); });
return content.styleClass("store-list-comp"); return content.styleClass("store-list-comp");

View file

@ -43,7 +43,9 @@ public class StoreEntryWrapper implements StorageFilter.Filterable {
ActionProvider.ALL.stream() ActionProvider.ALL.stream()
.filter(dataStoreActionProvider -> { .filter(dataStoreActionProvider -> {
return !entry.isDisabled() return !entry.isDisabled()
&& dataStoreActionProvider.getDataStoreCallSite() != null && dataStoreActionProvider.getDataStoreCallSite() && dataStoreActionProvider.getDataStoreCallSite() != null
&& dataStoreActionProvider
.getDataStoreCallSite()
.getApplicableClass() .getApplicableClass()
.isAssignableFrom(entry.getStore().getClass()); .isAssignableFrom(entry.getStore().getClass());
}) })
@ -54,8 +56,9 @@ public class StoreEntryWrapper implements StorageFilter.Filterable {
return false; return false;
} }
return dataStoreActionProvider.getDataStoreCallSite().isApplicable( return dataStoreActionProvider
entry.getStore().asNeeded()); .getDataStoreCallSite()
.isApplicable(entry.getStore().asNeeded());
}, },
disabledProperty(), disabledProperty(),
state, state,

View file

@ -30,8 +30,7 @@ public class StoreViewState {
private final ObservableList<StoreEntryWrapper> shownEntries = private final ObservableList<StoreEntryWrapper> shownEntries =
FXCollections.observableList(new CopyOnWriteArrayList<>()); FXCollections.observableList(new CopyOnWriteArrayList<>());
private final ObservableBooleanValue empty = private final ObservableBooleanValue empty = BindingsHelper.persist(Bindings.equal(Bindings.size(allEntries), 1));
BindingsHelper.persist(Bindings.equal(Bindings.size(allEntries), 1));
private StoreViewState() { private StoreViewState() {
try { try {

View file

@ -69,7 +69,8 @@ public class App extends Application {
AppActionLinkDetector.detectOnFocus(); AppActionLinkDetector.detectOnFocus();
}); });
}); });
var title = String.format("X-Pipe Desktop (Alpha %s)", AppProperties.get().getVersion()); var title =
String.format("X-Pipe Desktop (Alpha %s)", AppProperties.get().getVersion());
var appWindow = new AppMainWindow(stage); var appWindow = new AppMainWindow(stage);
appWindow.initialize(); appWindow.initialize();
appWindow.setContent(title, content); appWindow.setContent(title, content);

View file

@ -65,8 +65,11 @@ public class AppActionLinkDetector {
alert.setAlertType(Alert.AlertType.CONFIRMATION); alert.setAlertType(Alert.AlertType.CONFIRMATION);
alert.setTitle(I18n.get("clipboardActionDetectedTitle")); alert.setTitle(I18n.get("clipboardActionDetectedTitle"));
alert.setHeaderText(I18n.get("clipboardActionDetectedHeader")); alert.setHeaderText(I18n.get("clipboardActionDetectedHeader"));
alert.getDialogPane().setContent(AppWindowHelper.alertContentText(I18n.get("clipboardActionDetectedContent"))); alert.getDialogPane()
}).map(buttonType -> buttonType.getButtonData().isDefaultButton()).orElse(false); .setContent(AppWindowHelper.alertContentText(I18n.get("clipboardActionDetectedContent")));
})
.map(buttonType -> buttonType.getButtonData().isDefaultButton())
.orElse(false);
return paste; return paste;
} }
} }

View file

@ -21,7 +21,9 @@ public class AppChecks {
new IOException( new IOException(
"Unable to access directory " + dataDirectory "Unable to access directory " + dataDirectory
+ ". Please make sure that you have the appropriate permissions and no Antivirus program is blocking the access. " + ". Please make sure that you have the appropriate permissions and no Antivirus program is blocking the access. "
+ "In case you use cloud storage, verify that your cloud storage is working and you are logged in.")).term().handle(); + "In case you use cloud storage, verify that your cloud storage is working and you are logged in."))
.term()
.handle();
} }
} }
} }

View file

@ -51,8 +51,7 @@ public class AppFont {
public static void setSize(Node node, int off) { public static void setSize(Node node, int off) {
var baseSize = AppPrefs.get() != null ? AppPrefs.get().fontSize.getValue() : 12; var baseSize = AppPrefs.get() != null ? AppPrefs.get().fontSize.getValue() : 12;
node.setStyle( node.setStyle(node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;");
node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;");
} }
public static void loadFonts() { public static void loadFonts() {

View file

@ -158,7 +158,9 @@ public class AppI18n implements I18n {
} }
private boolean matchesLocale(Path f) { private boolean matchesLocale(Path f) {
var l = AppPrefs.get() != null ? AppPrefs.get().language.getValue().getLocale() : SupportedLocale.ENGLISH.getLocale(); var l = AppPrefs.get() != null
? AppPrefs.get().language.getValue().getLocale()
: SupportedLocale.ENGLISH.getLocale();
var name = FilenameUtils.getBaseName(f.getFileName().toString()); var name = FilenameUtils.getBaseName(f.getFileName().toString());
var ending = "_" + l.toLanguageTag(); var ending = "_" + l.toLanguageTag();
return name.endsWith(ending); return name.endsWith(ending);
@ -208,6 +210,9 @@ public class AppI18n implements I18n {
.handle(); .handle();
}); });
} }
this.prettyTime = new PrettyTime(AppPrefs.get() != null ? AppPrefs.get().language.getValue().getLocale() : SupportedLocale.ENGLISH.getLocale()); this.prettyTime = new PrettyTime(
AppPrefs.get() != null
? AppPrefs.get().language.getValue().getLocale()
: SupportedLocale.ENGLISH.getLocale());
} }
} }

View file

@ -42,8 +42,10 @@ public class AppLogs {
private final PrintStream originalSysErr; private final PrintStream originalSysErr;
private final Path logDir; private final Path logDir;
private final boolean writeToSysout; private final boolean writeToSysout;
@Getter @Getter
private final boolean writeToFile; private final boolean writeToFile;
private final PrintStream outStream; private final PrintStream outStream;
private final Map<String, PrintStream> categoryWriters; private final Map<String, PrintStream> categoryWriters;

View file

@ -44,7 +44,9 @@ public class AppProperties {
version = Optional.ofNullable(props.getProperty("version")).orElse("dev"); version = Optional.ofNullable(props.getProperty("version")).orElse("dev");
build = Optional.ofNullable(props.getProperty("build")).orElse("unknown"); build = Optional.ofNullable(props.getProperty("build")).orElse("unknown");
buildUuid = Optional.ofNullable(System.getProperty("io.xpipe.app.buildId")).map(UUID::fromString).orElse(UUID.randomUUID()); buildUuid = Optional.ofNullable(System.getProperty("io.xpipe.app.buildId"))
.map(UUID::fromString)
.orElse(UUID.randomUUID());
sentryUrl = System.getProperty("io.xpipe.app.sentryUrl"); sentryUrl = System.getProperty("io.xpipe.app.sentryUrl");
extensionPaths = parseExtensionPaths(); extensionPaths = parseExtensionPaths();

View file

@ -219,7 +219,9 @@ public class AppWindowHelper {
} else { } else {
var url = AppResources.getResourceURL(AppResources.XPIPE_MODULE, "img/logo.png"); var url = AppResources.getResourceURL(AppResources.XPIPE_MODULE, "img/logo.png");
if (url.isPresent()) { if (url.isPresent()) {
((Stage) a.getDialogPane().getScene().getWindow()).getIcons().add(new Image(url.get().toString())); ((Stage) a.getDialogPane().getScene().getWindow())
.getIcons()
.add(new Image(url.get().toString()));
} }
} }
} }

View file

@ -3,12 +3,12 @@ package io.xpipe.app.core.mode;
import io.xpipe.app.comp.storage.collection.SourceCollectionViewState; import io.xpipe.app.comp.storage.collection.SourceCollectionViewState;
import io.xpipe.app.comp.storage.store.StoreViewState; import io.xpipe.app.comp.storage.store.StoreViewState;
import io.xpipe.app.core.*; import io.xpipe.app.core.*;
import io.xpipe.app.util.ExternalEditor;
import io.xpipe.app.update.AppUpdater;
import io.xpipe.app.issue.BasicErrorHandler; import io.xpipe.app.issue.BasicErrorHandler;
import io.xpipe.app.issue.ErrorHandler; import io.xpipe.app.issue.ErrorHandler;
import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.update.AppUpdater;
import io.xpipe.app.util.ExternalEditor;
import io.xpipe.core.util.JacksonMapper; import io.xpipe.core.util.JacksonMapper;
import io.xpipe.extension.event.TrackEvent; import io.xpipe.extension.event.TrackEvent;

View file

@ -1,10 +1,10 @@
package io.xpipe.app.core.mode; package io.xpipe.app.core.mode;
import io.xpipe.app.update.UpdateChangelogAlert;
import io.xpipe.app.core.App; import io.xpipe.app.core.App;
import io.xpipe.app.core.AppGreetings; import io.xpipe.app.core.AppGreetings;
import io.xpipe.app.issue.ErrorHandler; import io.xpipe.app.issue.ErrorHandler;
import io.xpipe.app.issue.ErrorHandlerComp; import io.xpipe.app.issue.ErrorHandlerComp;
import io.xpipe.app.update.UpdateChangelogAlert;
import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.event.ErrorEvent;
import io.xpipe.extension.event.TrackEvent; import io.xpipe.extension.event.TrackEvent;
import javafx.application.Platform; import javafx.application.Platform;

View file

@ -25,7 +25,8 @@ public abstract class PlatformMode extends OperationMode {
} }
try { try {
GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); GraphicsDevice[] screenDevices =
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
HAS_GRAPHICS = screenDevices != null && screenDevices.length > 0; HAS_GRAPHICS = screenDevices != null && screenDevices.length > 0;
} catch (HeadlessException e) { } catch (HeadlessException e) {
TrackEvent.warn(e.getMessage()); TrackEvent.warn(e.getMessage());

View file

@ -20,12 +20,15 @@ public class ModeExchangeImpl extends ModeExchange
throw new ClientException("Unsupported mode: " + msg.getMode().getDisplayName() + ". Supported: " throw new ClientException("Unsupported mode: " + msg.getMode().getDisplayName() + ". Supported: "
+ String.join( + String.join(
", ", ", ",
OperationMode.getAll().stream().filter(OperationMode::isSupported) OperationMode.getAll().stream()
.filter(OperationMode::isSupported)
.map(OperationMode::getId) .map(OperationMode::getId)
.toList())); .toList()));
} }
OperationMode.switchTo(mode); OperationMode.switchTo(mode);
return ModeExchange.Response.builder().usedMode(OperationMode.map(OperationMode.get())).build(); return ModeExchange.Response.builder()
.usedMode(OperationMode.map(OperationMode.get()))
.build();
} }
} }

View file

@ -22,10 +22,12 @@ public class AttachmentHelper {
if (file.isDirectory()) { if (file.isDirectory()) {
compressDirectoryToZipfile(rootDir, sourceDir.resolve(file.getName()), out); compressDirectoryToZipfile(rootDir, sourceDir.resolve(file.getName()), out);
} else { } else {
ZipEntry entry = new ZipEntry(rootDir.relativize(sourceDir).resolve(file.getName()).toString()); ZipEntry entry = new ZipEntry(
rootDir.relativize(sourceDir).resolve(file.getName()).toString());
out.putNextEntry(entry); out.putNextEntry(entry);
FileInputStream in = new FileInputStream(sourceDir.resolve(file.getName()).toString()); FileInputStream in =
new FileInputStream(sourceDir.resolve(file.getName()).toString());
IOUtils.copy(in, out); IOUtils.copy(in, out);
IOUtils.closeQuietly(in); IOUtils.closeQuietly(in);
} }

View file

@ -4,10 +4,10 @@ import io.sentry.*;
import io.sentry.protocol.SentryId; import io.sentry.protocol.SentryId;
import io.sentry.protocol.User; import io.sentry.protocol.User;
import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppCache;
import io.xpipe.extension.util.XPipeDistributionType;
import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppProperties;
import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.event.ErrorEvent;
import io.xpipe.extension.event.TrackEvent; import io.xpipe.extension.event.TrackEvent;
import io.xpipe.extension.util.XPipeDistributionType;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import java.nio.file.Files; import java.nio.file.Files;

View file

@ -50,9 +50,11 @@ public class UserReportComp extends SimpleComp {
} }
return file.getFileName().toString(); return file.getFileName().toString();
}).styleClass("attachment-list"); })
.styleClass("attachment-list");
var tp = new TitledPaneComp(I18n.observable("additionalErrorAttachments"), list, 100) var tp = new TitledPaneComp(I18n.observable("additionalErrorAttachments"), list, 100)
.apply(s -> AppFont.medium(s.get())).styleClass("attachments"); .apply(s -> AppFont.medium(s.get()))
.styleClass("attachments");
return tp; return tp;
// //
// var list = FXCollections.observableList(event.getSensitiveDiagnostics()); // var list = FXCollections.observableList(event.getSensitiveDiagnostics());

View file

@ -71,7 +71,8 @@ public class LauncherCommand implements Callable<Integer> {
if (BeaconServer.isRunning()) { if (BeaconServer.isRunning()) {
try (var con = new LauncherConnection()) { try (var con = new LauncherConnection()) {
con.constructSocket(); con.constructSocket();
con.performSimpleExchange(FocusExchange.Request.builder().mode(getEffectiveMode()).build()); con.performSimpleExchange(
FocusExchange.Request.builder().mode(getEffectiveMode()).build());
if (inputs.size() > 0) { if (inputs.size() > 0) {
con.performSimpleExchange( con.performSimpleExchange(
OpenExchange.Request.builder().arguments(inputs).build()); OpenExchange.Request.builder().arguments(inputs).build());
@ -79,8 +80,9 @@ public class LauncherCommand implements Callable<Integer> {
if (OsType.getLocal().equals(OsType.MACOS)) { if (OsType.getLocal().equals(OsType.MACOS)) {
Desktop.getDesktop().setOpenURIHandler(e -> { Desktop.getDesktop().setOpenURIHandler(e -> {
con.performSimpleExchange( con.performSimpleExchange(OpenExchange.Request.builder()
OpenExchange.Request.builder().arguments(List.of(e.getURI().toString())).build()); .arguments(List.of(e.getURI().toString()))
.build());
}); });
ThreadHelper.sleep(1000); ThreadHelper.sleep(1000);
} }

View file

@ -21,7 +21,9 @@ import java.util.List;
public abstract class LauncherInput { public abstract class LauncherInput {
public static void handle(List<String> arguments) { public static void handle(List<String> arguments) {
TrackEvent.withDebug("launcher", "Handling arguments").elements(arguments).handle(); TrackEvent.withDebug("launcher", "Handling arguments")
.elements(arguments)
.handle();
var all = new ArrayList<ActionProvider.Action>(); var all = new ArrayList<ActionProvider.Action>();
arguments.forEach(s -> { arguments.forEach(s -> {

View file

@ -405,8 +405,7 @@ public class AppPrefs {
Setting.of( Setting.of(
"externalStartupBehaviour", "externalStartupBehaviour",
externalStartupBehaviourControl, externalStartupBehaviourControl,
externalStartupBehaviour externalStartupBehaviour),
),
Setting.of("closeBehaviour", closeBehaviourControl, closeBehaviour), Setting.of("closeBehaviour", closeBehaviourControl, closeBehaviour),
Setting.of("automaticallyUpdate", automaticallyUpdateField, automaticallyUpdate) Setting.of("automaticallyUpdate", automaticallyUpdateField, automaticallyUpdate)
.applyVisibility(VisibilityProperty.of(new SimpleBooleanProperty( .applyVisibility(VisibilityProperty.of(new SimpleBooleanProperty(
@ -416,9 +415,7 @@ public class AppPrefs {
XPipeDistributionType.get().supportsUpdate()))), XPipeDistributionType.get().supportsUpdate()))),
Setting.of("storageDirectory", storageDirectoryControl, internalStorageDirectory), Setting.of("storageDirectory", storageDirectoryControl, internalStorageDirectory),
Setting.of("logLevel", logLevelField, internalLogLevel), Setting.of("logLevel", logLevelField, internalLogLevel),
Setting.of("developerMode", developerModeField, internalDeveloperMode) Setting.of("developerMode", developerModeField, internalDeveloperMode))),
)
),
Category.of( Category.of(
"appearance", "appearance",
Group.of( Group.of(
@ -427,10 +424,8 @@ public class AppPrefs {
Setting.of("theme", themeControl, themeInternal), Setting.of("theme", themeControl, themeInternal),
Setting.of("useSystemFont", useSystemFontInternal), Setting.of("useSystemFont", useSystemFontInternal),
Setting.of("tooltipDelay", tooltipDelayInternal, tooltipDelayMin, tooltipDelayMax), Setting.of("tooltipDelay", tooltipDelayInternal, tooltipDelayMin, tooltipDelayMax),
Setting.of("fontSize", fontSizeInternal, fontSizeMin, fontSizeMax) Setting.of("fontSize", fontSizeInternal, fontSizeMin, fontSizeMax)),
), Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal))),
Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal))
),
Category.of( Category.of(
"integrations", "integrations",
Group.of( Group.of(
@ -443,39 +438,29 @@ public class AppPrefs {
"editorReloadTimeout", "editorReloadTimeout",
editorReloadTimeout, editorReloadTimeout,
editorReloadTimeoutMin, editorReloadTimeoutMin,
editorReloadTimeoutMax editorReloadTimeoutMax))),
)
)
),
Category.of( Category.of(
"developer", "developer",
Setting.of( Setting.of(
"developerDisableUpdateVersionCheck", "developerDisableUpdateVersionCheck",
developerDisableUpdateVersionCheckField, developerDisableUpdateVersionCheckField,
developerDisableUpdateVersionCheck developerDisableUpdateVersionCheck),
),
Setting.of( Setting.of(
"developerDisableGuiRestrictions", "developerDisableGuiRestrictions",
developerDisableGuiRestrictionsField, developerDisableGuiRestrictionsField,
developerDisableGuiRestrictions developerDisableGuiRestrictions),
),
Setting.of( Setting.of(
"developerDisableConnectorInstallationVersionCheck", "developerDisableConnectorInstallationVersionCheck",
developerDisableConnectorInstallationVersionCheckField, developerDisableConnectorInstallationVersionCheckField,
developerDisableConnectorInstallationVersionCheck developerDisableConnectorInstallationVersionCheck),
),
Setting.of( Setting.of(
"developerShowHiddenEntries", "developerShowHiddenEntries",
developerShowHiddenEntriesField, developerShowHiddenEntriesField,
developerShowHiddenEntries developerShowHiddenEntries),
),
Setting.of( Setting.of(
"developerShowHiddenProviders", "developerShowHiddenProviders",
developerShowHiddenProvidersField, developerShowHiddenProvidersField,
developerShowHiddenProviders developerShowHiddenProviders))));
)
)
));
categories.get(categories.size() - 1).setVisibilityProperty(VisibilityProperty.of(developerMode())); categories.get(categories.size() - 1).setVisibilityProperty(VisibilityProperty.of(developerMode()));

View file

@ -6,21 +6,15 @@ import lombok.Getter;
@Getter @Getter
public enum CloseBehaviour implements PrefsChoiceValue { public enum CloseBehaviour implements PrefsChoiceValue {
QUIT( QUIT("app.quit", () -> {
"app.quit",
() -> {
OperationMode.shutdown(false, false); OperationMode.shutdown(false, false);
}), }),
CONTINUE_IN_BACKGROUND( CONTINUE_IN_BACKGROUND("app.continueInBackground", () -> {
"app.continueInBackground",
() -> {
OperationMode.switchToAsync(OperationMode.BACKGROUND); OperationMode.switchToAsync(OperationMode.BACKGROUND);
}), }),
MINIMIZE_TO_TRAY( MINIMIZE_TO_TRAY("app.minimizeToTray", () -> {
"app.minimizeToTray",
() -> {
OperationMode.switchToAsync(OperationMode.TRAY); OperationMode.switchToAsync(OperationMode.TRAY);
}); });

View file

@ -39,8 +39,8 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
protected Optional<Path> getApplicationPath() { protected Optional<Path> getApplicationPath() {
try (ShellProcessControl pc = ShellStore.local().create().start()) { try (ShellProcessControl pc = ShellStore.local().create().start()) {
try (var c = pc.command(String.format( try (var c = pc.command(String.format(
"/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister " + "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister "
"-dump | grep -o \"/.*%s.app\" | grep -v -E \"Caches|TimeMachine|Temporary|/Volumes/%s\" | uniq", + "-dump | grep -o \"/.*%s.app\" | grep -v -E \"Caches|TimeMachine|Temporary|/Volumes/%s\" | uniq",
applicationName, applicationName)) applicationName, applicationName))
.start()) { .start()) {
var path = c.readOnlyStdout(); var path = c.readOnlyStdout();
@ -66,7 +66,7 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
} }
} }
public static abstract class PathApplication extends ExternalApplicationType { public abstract static class PathApplication extends ExternalApplicationType {
protected final String executable; protected final String executable;

View file

@ -29,9 +29,8 @@ public class PrefFields {
return Path.of(value); return Path.of(value);
} }
}); });
return StringField.ofStringType( return StringField.ofStringType(stringProperty)
stringProperty).render( .render(() -> new SimpleChooserControl(
() -> new SimpleChooserControl(
I18n.get("browse"), fileProperty.getValue().toFile(), true)); I18n.get("browse"), fileProperty.getValue().toFile(), true));
} }
} }

View file

@ -30,10 +30,13 @@ public class DataSourceEntry extends StorageElement {
@NonFinal @NonFinal
State state; State state;
@NonFinal @NonFinal
String information; String information;
@NonFinal @NonFinal
JsonNode sourceNode; JsonNode sourceNode;
@NonFinal @NonFinal
DataSource<?> dataSource; DataSource<?> dataSource;
@ -70,10 +73,17 @@ public class DataSourceEntry extends StorageElement {
} }
public static DataSourceEntry createNew( public static DataSourceEntry createNew(
@NonNull UUID uuid, @NonNull String name, @NonNull DataSource<?> dataSource @NonNull UUID uuid, @NonNull String name, @NonNull DataSource<?> dataSource) {
) {
var entry = new DataSourceEntry( var entry = new DataSourceEntry(
null, uuid, name, Instant.now(), Instant.now(), true, DataStorageWriter.sourceToNode(dataSource), null, State.INCOMPLETE); null,
uuid,
name,
Instant.now(),
Instant.now(),
true,
DataStorageWriter.sourceToNode(dataSource),
null,
State.INCOMPLETE);
entry.simpleRefresh(); entry.simpleRefresh();
return entry; return entry;
} }

View file

@ -78,7 +78,9 @@ public abstract class DataStorage {
} }
public DataSourceCollection getInternalCollection() { public DataSourceCollection getInternalCollection() {
var found = sourceCollections.stream().filter(o -> o.getName() != null && o.getName().equals("Internal")).findAny(); var found = sourceCollections.stream()
.filter(o -> o.getName() != null && o.getName().equals("Internal"))
.findAny();
if (found.isPresent()) { if (found.isPresent()) {
return found.get(); return found.get();
} }

View file

@ -46,7 +46,8 @@ public class DataStorageWriter {
} }
return Optional.empty(); return Optional.empty();
}, },
"storeId", isRoot); "storeId",
isRoot);
node = replaceReferencesWithIds( node = replaceReferencesWithIds(
node, node,
@ -61,7 +62,8 @@ public class DataStorageWriter {
} }
return Optional.empty(); return Optional.empty();
}, },
"sourceId", isRoot); "sourceId",
isRoot);
return node; return node;
} }

View file

@ -37,7 +37,8 @@ public class AppInstaller {
if (s.isLocal()) { if (s.isLocal()) {
targetFile = localFile.toString(); targetFile = localFile.toString();
} else { } else {
targetFile = FileNames.join(s.getTemporaryDirectory(), localFile.getFileName().toString()); targetFile = FileNames.join(
s.getTemporaryDirectory(), localFile.getFileName().toString());
try (CommandProcessControl c = s.command(s.getShellType().getStreamFileWriteCommand(targetFile)) try (CommandProcessControl c = s.command(s.getShellType().getStreamFileWriteCommand(targetFile))
.start()) { .start()) {
c.discardOut(); c.discardOut();
@ -60,7 +61,9 @@ public class AppInstaller {
} }
if (OsType.getLocal().equals(OsType.LINUX)) { if (OsType.getLocal().equals(OsType.LINUX)) {
return Files.exists(Path.of("/etc/debian_version")) ? new InstallerAssetType.Debian() : new InstallerAssetType.Rpm(); return Files.exists(Path.of("/etc/debian_version"))
? new InstallerAssetType.Debian()
: new InstallerAssetType.Rpm();
} }
if (OsType.getLocal().equals(OsType.MACOS)) { if (OsType.getLocal().equals(OsType.MACOS)) {
@ -236,7 +239,8 @@ public class AppInstaller {
@Override @Override
public void installRemote(ShellProcessControl shellProcessControl, String file) throws Exception { public void installRemote(ShellProcessControl shellProcessControl, String file) throws Exception {
try (var pc = shellProcessControl.subShell(ShellTypes.BASH).start()) { try (var pc = shellProcessControl.subShell(ShellTypes.BASH).start()) {
try (CommandProcessControl c = pc.command("installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /") try (CommandProcessControl c = pc.command(
"installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /")
.elevated() .elevated()
.start()) { .start()) {
c.discardOrThrow(); c.discardOrThrow();
@ -247,7 +251,8 @@ public class AppInstaller {
@Override @Override
public void installLocal(String file) throws Exception { public void installLocal(String file) throws Exception {
var command = "set -x\n" + "sudo installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /\n" + "xpipe daemon start"; var command = "set -x\n" + "sudo installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /\n"
+ "xpipe daemon start";
TerminalProvider.open("X-Pipe Updater", command); TerminalProvider.open("X-Pipe Updater", command);
} }
} }

View file

@ -1,7 +1,6 @@
package io.xpipe.app.update; package io.xpipe.app.update;
import io.xpipe.app.core.AppCache; import io.xpipe.app.core.AppCache;
import io.xpipe.extension.util.XPipeDistributionType;
import io.xpipe.app.core.AppExtensionManager; import io.xpipe.app.core.AppExtensionManager;
import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppProperties;
import io.xpipe.app.core.mode.OperationMode; import io.xpipe.app.core.mode.OperationMode;
@ -12,6 +11,7 @@ import io.xpipe.extension.event.ErrorEvent;
import io.xpipe.extension.event.TrackEvent; import io.xpipe.extension.event.TrackEvent;
import io.xpipe.extension.util.BusyProperty; import io.xpipe.extension.util.BusyProperty;
import io.xpipe.extension.util.ThreadHelper; import io.xpipe.extension.util.ThreadHelper;
import io.xpipe.extension.util.XPipeDistributionType;
import javafx.beans.property.BooleanProperty; import javafx.beans.property.BooleanProperty;
import javafx.beans.property.Property; import javafx.beans.property.Property;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;

View file

@ -12,13 +12,14 @@ public class UpdateAvailableAlert {
return; return;
} }
var update = AppWindowHelper.showBlockingAlert( var update = AppWindowHelper.showBlockingAlert(alert -> {
alert -> {
alert.setTitle(I18n.get("updateReadyTitle")); alert.setTitle(I18n.get("updateReadyTitle"));
alert.setHeaderText(I18n.get("updateReadyHeader")); alert.setHeaderText(I18n.get("updateReadyHeader"));
alert.setContentText(I18n.get("updateReadyContent")); alert.setContentText(I18n.get("updateReadyContent"));
alert.setAlertType(Alert.AlertType.INFORMATION); alert.setAlertType(Alert.AlertType.INFORMATION);
}).map(buttonType -> buttonType.getButtonData().isDefaultButton()).orElse(false); })
.map(buttonType -> buttonType.getButtonData().isDefaultButton())
.orElse(false);
if (update) { if (update) {
AppUpdater.get().executeUpdateAndClose(); AppUpdater.get().executeUpdateAndClose();
} }

View file

@ -122,18 +122,18 @@ public class ExternalEditor {
return Optional.empty(); return Optional.empty();
} }
public void startEditing( public void startEditing(String keyName, String fileType, Object key, String input, Consumer<String> output) {
String keyName,
String fileType,
Object key,
String input,
Consumer<String> output) {
if (input == null) { if (input == null) {
input = ""; input = "";
} }
String s = input; String s = input;
startEditing(keyName, fileType, key, () -> new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)), () -> new ByteArrayOutputStream(s.length()) { startEditing(
keyName,
fileType,
key,
() -> new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)),
() -> new ByteArrayOutputStream(s.length()) {
@Override @Override
public void close() throws IOException { public void close() throws IOException {
super.close(); super.close();
@ -154,7 +154,8 @@ public class ExternalEditor {
return; return;
} }
var name = keyName + " - " + UUID.randomUUID().toString().substring(0, 6) + "." + (fileType != null ? fileType : "txt"); var name = keyName + " - " + UUID.randomUUID().toString().substring(0, 6) + "."
+ (fileType != null ? fileType : "txt");
Path file = TEMP.resolve(name); Path file = TEMP.resolve(name);
try { try {
FileUtils.forceMkdirParent(file.toFile()); FileUtils.forceMkdirParent(file.toFile());

View file

@ -22,7 +22,8 @@ public class ProxyManagerProviderImpl extends ProxyManagerProvider {
alert.setAlertType(Alert.AlertType.CONFIRMATION); alert.setAlertType(Alert.AlertType.CONFIRMATION);
alert.setTitle(I18n.get("connectorInstallationTitle")); alert.setTitle(I18n.get("connectorInstallationTitle"));
alert.setHeaderText(I18n.get("connectorInstallationHeader")); alert.setHeaderText(I18n.get("connectorInstallationHeader"));
alert.getDialogPane().setContent(AppWindowHelper.alertContentText(I18n.get("connectorInstallationContent"))); alert.getDialogPane()
.setContent(AppWindowHelper.alertContentText(I18n.get("connectorInstallationContent")));
}) })
.filter(buttonType -> buttonType.getButtonData().isDefaultButton()) .filter(buttonType -> buttonType.getButtonData().isDefaultButton())
.isPresent(); .isPresent();

View file

@ -13,7 +13,9 @@ public abstract class TerminalProvider {
@Override @Override
public void init(ModuleLayer layer) { public void init(ModuleLayer layer) {
INSTANCE = ServiceLoader.load(layer, TerminalProvider.class).findFirst().orElseThrow(); INSTANCE = ServiceLoader.load(layer, TerminalProvider.class)
.findFirst()
.orElseThrow();
} }
@Override @Override

View file

@ -7,9 +7,9 @@ import io.xpipe.app.comp.source.store.NamedStoreChoiceComp;
import io.xpipe.app.core.AppImages; import io.xpipe.app.core.AppImages;
import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppProperties;
import io.xpipe.app.core.AppResources; import io.xpipe.app.core.AppResources;
import io.xpipe.app.update.AppDownloads;
import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.update.AppDownloads;
import io.xpipe.core.charsetter.Charsetter; import io.xpipe.core.charsetter.Charsetter;
import io.xpipe.core.source.DataSource; import io.xpipe.core.source.DataSource;
import io.xpipe.core.source.DataSourceId; import io.xpipe.core.source.DataSourceId;
@ -71,7 +71,8 @@ public class XPipeDaemonProvider implements XPipeDaemon {
Property<DataSourceProvider<?>> provider, Property<DataSourceProvider<?>> provider,
boolean showAnonymous, boolean showAnonymous,
boolean showSaved) { boolean showSaved) {
return (T) new DsStreamStoreChoiceComp(storeProperty, provider, showAnonymous, showSaved, DsStreamStoreChoiceComp.Mode.WRITE); return (T) new DsStreamStoreChoiceComp(
storeProperty, provider, showAnonymous, showSaved, DsStreamStoreChoiceComp.Mode.WRITE);
} }
@Override @Override

View file

@ -101,7 +101,8 @@ open module io.xpipe.app {
uses MessageExchangeImpl; uses MessageExchangeImpl;
uses io.xpipe.app.util.TerminalProvider; uses io.xpipe.app.util.TerminalProvider;
provides ModuleLayerLoader with TerminalProvider.Loader; provides ModuleLayerLoader with
TerminalProvider.Loader;
provides DataStateProvider with provides DataStateProvider with
DataStateProviderImpl; DataStateProviderImpl;
provides ProxyManagerProvider with provides ProxyManagerProvider with

View file

@ -35,6 +35,7 @@ public class BeaconClient implements AutoCloseable {
@Getter @Getter
private final Closeable base; private final Closeable base;
private final InputStream in; private final InputStream in;
private final OutputStream out; private final OutputStream out;
@ -296,10 +297,7 @@ public class BeaconClient implements AutoCloseable {
void run() throws E; void run() throws E;
} }
@JsonTypeInfo( @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
use = JsonTypeInfo.Id.NAME,
property = "type"
)
public abstract static class ClientInformation { public abstract static class ClientInformation {
public final CliClientInformation cli() { public final CliClientInformation cli() {

View file

@ -78,8 +78,7 @@ public abstract class BeaconConnection implements AutoCloseable {
} }
public <REQ extends RequestMessage, RES extends ResponseMessage> void performInputExchange( public <REQ extends RequestMessage, RES extends ResponseMessage> void performInputExchange(
REQ req, BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer REQ req, BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer) {
) {
checkClosed(); checkClosed();
performInputOutputExchange(req, null, responseConsumer); performInputOutputExchange(req, null, responseConsumer);
@ -88,8 +87,7 @@ public abstract class BeaconConnection implements AutoCloseable {
public <REQ extends RequestMessage, RES extends ResponseMessage> void performInputOutputExchange( public <REQ extends RequestMessage, RES extends ResponseMessage> void performInputOutputExchange(
REQ req, REQ req,
BeaconClient.FailableConsumer<OutputStream, IOException> reqWriter, BeaconClient.FailableConsumer<OutputStream, IOException> reqWriter,
BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer BeaconClient.FailableBiConsumer<RES, InputStream, Exception> responseConsumer) {
) {
checkClosed(); checkClosed();
try { try {
@ -151,8 +149,7 @@ public abstract class BeaconConnection implements AutoCloseable {
} }
public <REQ extends RequestMessage, RES extends ResponseMessage> RES performOutputExchange( public <REQ extends RequestMessage, RES extends ResponseMessage> RES performOutputExchange(
REQ req, BeaconClient.FailableConsumer<OutputStream, Exception> reqWriter REQ req, BeaconClient.FailableConsumer<OutputStream, Exception> reqWriter) {
) {
checkClosed(); checkClosed();
try { try {
@ -183,7 +180,10 @@ public abstract class BeaconConnection implements AutoCloseable {
public InternalStreamStore createInternalStreamStore(String name) { public InternalStreamStore createInternalStreamStore(String name) {
var store = new InternalStreamStore(); var store = new InternalStreamStore();
var addReq = StoreAddExchange.Request.builder().storeInput(store).name(name != null ? name : store.getUuid().toString()).build(); var addReq = StoreAddExchange.Request.builder()
.storeInput(store)
.name(name != null ? name : store.getUuid().toString())
.build();
StoreAddExchange.Response addRes = performSimpleExchange(addReq); StoreAddExchange.Response addRes = performSimpleExchange(addReq);
QuietDialogHandler.handle(addRes.getConfig(), this); QuietDialogHandler.handle(addRes.getConfig(), this);
return store; return store;
@ -194,8 +194,7 @@ public abstract class BeaconConnection implements AutoCloseable {
} }
public void writeStream(String name, InputStream in) { public void writeStream(String name, InputStream in) {
performOutputExchange( performOutputExchange(WriteStreamExchange.Request.builder().name(name).build(), in::transferTo);
WriteStreamExchange.Request.builder().name(name).build(), in::transferTo);
} }
private BeaconException unwrapException(Exception exception) { private BeaconException unwrapException(Exception exception) {

View file

@ -39,7 +39,10 @@ public class BeaconDaemonController {
return; return;
} }
var client = BeaconClient.connect(BeaconClient.ApiClientInformation.builder().version("?").language("Java API Test").build()); var client = BeaconClient.connect(BeaconClient.ApiClientInformation.builder()
.version("?")
.language("Java API Test")
.build());
if (!BeaconServer.tryStop(client)) { if (!BeaconServer.tryStop(client)) {
throw new AssertionError(); throw new AssertionError();
} }

View file

@ -5,8 +5,7 @@ package io.xpipe.beacon;
*/ */
public class BeaconException extends RuntimeException { public class BeaconException extends RuntimeException {
public BeaconException() { public BeaconException() {}
}
public BeaconException(String message) { public BeaconException(String message) {
super(message); super(message);

View file

@ -11,7 +11,6 @@ public class BeaconJacksonModule extends SimpleModule {
new NamedType(BeaconClient.ApiClientInformation.class), new NamedType(BeaconClient.ApiClientInformation.class),
new NamedType(BeaconClient.CliClientInformation.class), new NamedType(BeaconClient.CliClientInformation.class),
new NamedType(BeaconClient.DaemonInformation.class), new NamedType(BeaconClient.DaemonInformation.class),
new NamedType(BeaconClient.ReachableCheckInformation.class) new NamedType(BeaconClient.ReachableCheckInformation.class));
);
} }
} }

View file

@ -74,7 +74,8 @@ public class BeaconProxyImpl extends ProxyProvider {
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends DataSourceReadConnection> T createRemoteReadConnection(DataSource<?> source, ShellStore proxy) throws Exception { public <T extends DataSourceReadConnection> T createRemoteReadConnection(DataSource<?> source, ShellStore proxy)
throws Exception {
var downstream = downstreamTransform(source, proxy); var downstream = downstreamTransform(source, proxy);
BeaconClient client = null; BeaconClient client = null;
@ -105,7 +106,8 @@ public class BeaconProxyImpl extends ProxyProvider {
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends DataSourceConnection> T createRemoteWriteConnection(DataSource<?> source, WriteMode mode, ShellStore proxy) throws Exception { public <T extends DataSourceConnection> T createRemoteWriteConnection(
DataSource<?> source, WriteMode mode, ShellStore proxy) throws Exception {
var downstream = downstreamTransform(source, proxy); var downstream = downstreamTransform(source, proxy);
BeaconClient client = null; BeaconClient client = null;
@ -124,7 +126,8 @@ public class BeaconProxyImpl extends ProxyProvider {
finalClient.close(); finalClient.close();
} }
}; };
var outputSource = DataSource.createInternalDataSource(source.getType(), new OutputStreamStore(outputStream)); var outputSource =
DataSource.createInternalDataSource(source.getType(), new OutputStreamStore(outputStream));
return (T) outputSource.openWriteConnection(mode); return (T) outputSource.openWriteConnection(mode);
} catch (Exception ex) { } catch (Exception ex) {
if (client != null) { if (client != null) {

View file

@ -43,7 +43,8 @@ public class BeaconServer {
public static Process start(String installationBase, XPipeDaemonMode mode) throws Exception { public static Process start(String installationBase, XPipeDaemonMode mode) throws Exception {
String command; String command;
if (!BeaconConfig.launchDaemonInDebugMode()) { if (!BeaconConfig.launchDaemonInDebugMode()) {
command = XPipeInstallation.createExternalAsyncLaunchCommand(installationBase, mode, BeaconConfig.getDaemonArguments()); command = XPipeInstallation.createExternalAsyncLaunchCommand(
installationBase, mode, BeaconConfig.getDaemonArguments());
} else { } else {
command = XPipeInstallation.createExternalLaunchCommand( command = XPipeInstallation.createExternalLaunchCommand(
getDaemonDebugExecutable(installationBase), BeaconConfig.getDaemonArguments(), mode); getDaemonDebugExecutable(installationBase), BeaconConfig.getDaemonArguments(), mode);
@ -77,8 +78,7 @@ public class BeaconServer {
ioe.printStackTrace(); ioe.printStackTrace();
} }
}, },
"daemon sysout" "daemon sysout");
);
out.setDaemon(true); out.setDaemon(true);
out.start(); out.start();
@ -98,8 +98,7 @@ public class BeaconServer {
ioe.printStackTrace(); ioe.printStackTrace();
} }
}, },
"daemon syserr" "daemon syserr");
);
err.setDaemon(true); err.setDaemon(true);
err.start(); err.start();
} }
@ -117,8 +116,7 @@ public class BeaconServer {
throw new IllegalStateException(); throw new IllegalStateException();
} else { } else {
if (BeaconConfig.attachDebuggerToDaemon()) { if (BeaconConfig.attachDebuggerToDaemon()) {
return FileNames.join( return FileNames.join(installationBase, XPipeInstallation.getDaemonDebugAttachScriptPath(osType));
installationBase, XPipeInstallation.getDaemonDebugAttachScriptPath(osType));
} else { } else {
return FileNames.join(installationBase, XPipeInstallation.getDaemonDebugScriptPath(osType)); return FileNames.join(installationBase, XPipeInstallation.getDaemonDebugScriptPath(osType));
} }

View file

@ -5,8 +5,7 @@ package io.xpipe.beacon;
*/ */
public class ClientException extends Exception { public class ClientException extends Exception {
public ClientException() { public ClientException() {}
}
public ClientException(String message) { public ClientException(String message) {
super(message); super(message);

View file

@ -5,8 +5,7 @@ package io.xpipe.beacon;
*/ */
public class ConnectorException extends Exception { public class ConnectorException extends Exception {
public ConnectorException() { public ConnectorException() {}
}
public ConnectorException(String message) { public ConnectorException(String message) {
super(message); super(message);

View file

@ -1,4 +1,3 @@
package io.xpipe.beacon; package io.xpipe.beacon;
public interface RequestMessage { public interface RequestMessage {}
}

View file

@ -1,4 +1,3 @@
package io.xpipe.beacon; package io.xpipe.beacon;
public interface ResponseMessage { public interface ResponseMessage {}
}

View file

@ -31,7 +31,6 @@ public class SecretProviderImpl extends SecretProvider {
return nonce; return nonce;
} }
private static SecretKey getAESKey(int keysize) throws NoSuchAlgorithmException, InvalidKeySpecException { private static SecretKey getAESKey(int keysize) throws NoSuchAlgorithmException, InvalidKeySpecException {
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
var salt = new byte[16]; var salt = new byte[16];

View file

@ -5,8 +5,7 @@ package io.xpipe.beacon;
*/ */
public class ServerException extends Exception { public class ServerException extends Exception {
public ServerException() { public ServerException() {}
}
public ServerException(String message) { public ServerException(String message) {
super(message); super(message);

View file

@ -26,6 +26,5 @@ public class FocusExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -31,6 +31,5 @@ public class ForwardExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -20,12 +20,12 @@ public class OpenExchange implements MessageExchange {
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {
@NonNull List<String> arguments; @NonNull
List<String> arguments;
} }
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -21,14 +21,8 @@ public class ProxyFunctionExchange implements MessageExchange {
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {
@JsonSerialize( @JsonSerialize(using = ProxyFunction.Serializer.class, as = ProxyFunction.class)
using = ProxyFunction.Serializer.class, @JsonDeserialize(using = ProxyFunction.Deserializer.class, as = ProxyFunction.class)
as = ProxyFunction.class
)
@JsonDeserialize(
using = ProxyFunction.Deserializer.class,
as = ProxyFunction.class
)
ProxyFunction function; ProxyFunction function;
} }
@ -37,14 +31,8 @@ public class ProxyFunctionExchange implements MessageExchange {
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {
@JsonSerialize( @JsonSerialize(using = ProxyFunction.Serializer.class, as = ProxyFunction.class)
using = ProxyFunction.Serializer.class, @JsonDeserialize(using = ProxyFunction.Deserializer.class, as = ProxyFunction.class)
as = ProxyFunction.class
)
@JsonDeserialize(
using = ProxyFunction.Deserializer.class,
as = ProxyFunction.class
)
ProxyFunction function; ProxyFunction function;
} }
} }

View file

@ -19,12 +19,12 @@ public class ProxyReadConnectionExchange implements MessageExchange {
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {
@NonNull DataSource<?> source; @NonNull
DataSource<?> source;
} }
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -20,13 +20,15 @@ public class ProxyWriteConnectionExchange implements MessageExchange {
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {
@NonNull DataSource<?> source; @NonNull
@NonNull WriteMode mode; DataSource<?> source;
@NonNull
WriteMode mode;
} }
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -43,7 +43,8 @@ public class QueryDataSourceExchange implements MessageExchange {
@NonNull @NonNull
String provider; String provider;
@NonNull DataSourceType type; @NonNull
DataSourceType type;
@NonNull @NonNull
LinkedHashMap<String, String> config; LinkedHashMap<String, String> config;

View file

@ -21,12 +21,12 @@ public class ReadStreamExchange implements MessageExchange {
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {
@NonNull String name; @NonNull
String name;
} }
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -19,8 +19,7 @@ public class StopExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {}
}
@Jacksonized @Jacksonized
@Builder @Builder

View file

@ -21,12 +21,12 @@ public class WriteStreamExchange implements MessageExchange {
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {
@NonNull String name; @NonNull
String name;
} }
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -29,6 +29,5 @@ public class QueryRawDataExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -34,6 +34,7 @@ public class QueryTableDataExchange implements MessageExchange {
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {
@NonNull TupleType dataType; @NonNull
TupleType dataType;
} }
} }

View file

@ -30,6 +30,5 @@ public class QueryTextDataExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -19,8 +19,7 @@ public class InstanceExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {}
}
@Jacksonized @Jacksonized
@Builder @Builder

View file

@ -20,8 +20,7 @@ public class ListCollectionsExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {}
}
@Jacksonized @Jacksonized
@Builder @Builder

View file

@ -20,8 +20,7 @@ public class ListStoresExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {}
}
@Jacksonized @Jacksonized
@Builder @Builder

View file

@ -30,6 +30,5 @@ public class ReadDrainExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -26,6 +26,5 @@ public class RemoveCollectionExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -26,6 +26,5 @@ public class RemoveStoreExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -29,6 +29,5 @@ public class RenameCollectionExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -31,6 +31,5 @@ public class RenameEntryExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -29,6 +29,5 @@ public class RenameStoreExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -27,6 +27,5 @@ public class SelectExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Response implements ResponseMessage { public static class Response implements ResponseMessage {}
}
} }

View file

@ -23,8 +23,7 @@ public class SourceProviderListExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {}
}
@Jacksonized @Jacksonized
@Builder @Builder

View file

@ -17,8 +17,7 @@ public class StatusExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {}
}
@Jacksonized @Jacksonized
@Builder @Builder

View file

@ -22,8 +22,7 @@ public class StoreProviderListExchange implements MessageExchange {
@Jacksonized @Jacksonized
@Builder @Builder
@Value @Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {}
}
@Jacksonized @Jacksonized
@Builder @Builder

View file

@ -17,8 +17,7 @@ public class VersionExchange implements MessageExchange {
@lombok.extern.jackson.Jacksonized @lombok.extern.jackson.Jacksonized
@lombok.Builder @lombok.Builder
@lombok.Value @lombok.Value
public static class Request implements RequestMessage { public static class Request implements RequestMessage {}
}
@Jacksonized @Jacksonized
@Builder @Builder

View file

@ -17,6 +17,7 @@ public class QuietDialogHandler {
private final BeaconConnection connection; private final BeaconConnection connection;
private final Map<String, String> overrides; private final Map<String, String> overrides;
private DialogElement element; private DialogElement element;
public QuietDialogHandler(DialogReference ref, BeaconConnection connection, Map<String, String> overrides) { public QuietDialogHandler(DialogReference ref, BeaconConnection connection, Map<String, String> overrides) {
this.dialogKey = ref.getDialogId(); this.dialogKey = ref.getDialogId();
this.element = ref.getStart(); this.element = ref.getStart();

View file

@ -23,7 +23,9 @@ module io.xpipe.beacon {
opens io.xpipe.beacon.exchange.api; opens io.xpipe.beacon.exchange.api;
opens io.xpipe.beacon.exchange.data; opens io.xpipe.beacon.exchange.data;
opens io.xpipe.beacon.exchange.cli; opens io.xpipe.beacon.exchange.cli;
exports io.xpipe.beacon.util; exports io.xpipe.beacon.util;
opens io.xpipe.beacon.util; opens io.xpipe.beacon.util;
requires static com.fasterxml.jackson.core; requires static com.fasterxml.jackson.core;
@ -34,9 +36,12 @@ module io.xpipe.beacon {
uses MessageExchange; uses MessageExchange;
uses ProxyFunction; uses ProxyFunction;
provides ProxyProvider with BeaconProxyImpl; provides ProxyProvider with
provides SecretProvider with SecretProviderImpl; BeaconProxyImpl;
provides Module with BeaconJacksonModule; provides SecretProvider with
SecretProviderImpl;
provides Module with
BeaconJacksonModule;
provides io.xpipe.beacon.exchange.MessageExchange with provides io.xpipe.beacon.exchange.MessageExchange with
ForwardExchange, ForwardExchange,
InstanceExchange, InstanceExchange,

View file

@ -23,8 +23,7 @@ public abstract class Charsetter {
public static Charsetter INSTANCE; public static Charsetter INSTANCE;
private static CharsetterUniverse universe; private static CharsetterUniverse universe;
protected Charsetter() { protected Charsetter() {}
}
protected static void checkInit() { protected static void checkInit() {
if (universe == null) { if (universe == null) {
@ -78,8 +77,7 @@ public abstract class Charsetter {
} }
public abstract Result read( public abstract Result read(
FailableSupplier<InputStream, Exception> in, FailableConsumer<InputStreamReader, Exception> con FailableSupplier<InputStream, Exception> in, FailableConsumer<InputStreamReader, Exception> con)
)
throws Exception; throws Exception;
public Result detect(StreamDataStore store) throws Exception { public Result detect(StreamDataStore store) throws Exception {
@ -112,7 +110,9 @@ public abstract class Charsetter {
if (store instanceof FileStore fileStore && fileStore.getFileSystem() instanceof MachineStore m) { if (store instanceof FileStore fileStore && fileStore.getFileSystem() instanceof MachineStore m) {
if (result.getNewLine() == null) { if (result.getNewLine() == null) {
result = new Result(result.getCharset(), m.getShellType() != null ? m.getShellType().getNewLine() : null); result = new Result(
result.getCharset(),
m.getShellType() != null ? m.getShellType().getNewLine() : null);
} }
} }

View file

@ -19,13 +19,8 @@ public class StreamCharset {
public static final StreamCharset UTF8_BOM = new StreamCharset( public static final StreamCharset UTF8_BOM = new StreamCharset(
StandardCharsets.UTF_8, StandardCharsets.UTF_8,
new byte[]{ new byte[] {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF},
(byte) 0xEF, Identifiers.get("utf", "8", "bom"));
(byte) 0xBB,
(byte) 0xBF
},
Identifiers.get("utf", "8", "bom")
);
// ====== // ======
// UTF-16 // UTF-16
@ -36,24 +31,16 @@ public class StreamCharset {
public static final StreamCharset UTF16_BE_BOM = new StreamCharset( public static final StreamCharset UTF16_BE_BOM = new StreamCharset(
StandardCharsets.UTF_16BE, StandardCharsets.UTF_16BE,
new byte[]{ new byte[] {(byte) 0xFE, (byte) 0xFF},
(byte) 0xFE, Identifiers.get("utf", "16", "be", "bom"));
(byte) 0xFF
},
Identifiers.get("utf", "16", "be", "bom")
);
public static final StreamCharset UTF16_LE = public static final StreamCharset UTF16_LE =
new StreamCharset(StandardCharsets.UTF_16LE, null, Identifiers.get("utf", "16", "le")); new StreamCharset(StandardCharsets.UTF_16LE, null, Identifiers.get("utf", "16", "le"));
public static final StreamCharset UTF16_LE_BOM = new StreamCharset( public static final StreamCharset UTF16_LE_BOM = new StreamCharset(
StandardCharsets.UTF_16LE, StandardCharsets.UTF_16LE,
new byte[]{ new byte[] {(byte) 0xFF, (byte) 0xFE},
(byte) 0xFF, Identifiers.get("utf", "16", "le", "bom"));
(byte) 0xFE
},
Identifiers.get("utf", "16", "le", "bom")
);
public static final StreamCharset UTF16 = UTF16_LE; public static final StreamCharset UTF16 = UTF16_LE;
@ -67,8 +54,7 @@ public class StreamCharset {
new StreamCharset( new StreamCharset(
StandardCharsets.US_ASCII, StandardCharsets.US_ASCII,
null, null,
Identifiers.join(Identifiers.get("ascii"), Identifiers.get("us", "ascii")) Identifiers.join(Identifiers.get("ascii"), Identifiers.get("us", "ascii"))),
),
new StreamCharset( new StreamCharset(
StandardCharsets.ISO_8859_1, StandardCharsets.ISO_8859_1,
null, null,
@ -76,20 +62,15 @@ public class StreamCharset {
Identifiers.get("iso", "8859"), Identifiers.get("iso", "8859"),
Identifiers.get("iso", "8859", "1"), Identifiers.get("iso", "8859", "1"),
Identifiers.get("8859"), Identifiers.get("8859"),
Identifiers.get("8859", "1") Identifiers.get("8859", "1"))),
)
),
new StreamCharset( new StreamCharset(
Charset.forName("Windows-1251"), Charset.forName("Windows-1251"),
null, null,
Identifiers.join(Identifiers.get("windows", "1251"), Identifiers.get("1251")) Identifiers.join(Identifiers.get("windows", "1251"), Identifiers.get("1251"))),
),
new StreamCharset( new StreamCharset(
Charset.forName("Windows-1252"), Charset.forName("Windows-1252"),
null, null,
Identifiers.join(Identifiers.get("windows", "1252"), Identifiers.get("1252")) Identifiers.join(Identifiers.get("windows", "1252"), Identifiers.get("1252"))));
)
);
// ====== // ======
// UTF-32 // UTF-32
@ -98,26 +79,16 @@ public class StreamCharset {
new StreamCharset(Charset.forName("utf-32le"), null, Identifiers.get("utf", "32", "le")); new StreamCharset(Charset.forName("utf-32le"), null, Identifiers.get("utf", "32", "le"));
public static final StreamCharset UTF32_LE_BOM = new StreamCharset( public static final StreamCharset UTF32_LE_BOM = new StreamCharset(
Charset.forName("utf-32le"), Charset.forName("utf-32le"),
new byte[]{ new byte[] {0x00, 0x00, (byte) 0xFE, (byte) 0xFF},
0x00, Identifiers.get("utf", "32", "le", "bom"));
0x00,
(byte) 0xFE,
(byte) 0xFF
},
Identifiers.get("utf", "32", "le", "bom")
);
public static final StreamCharset UTF32_BE = public static final StreamCharset UTF32_BE =
new StreamCharset(Charset.forName("utf-32be"), null, Identifiers.get("utf", "32", "be")); new StreamCharset(Charset.forName("utf-32be"), null, Identifiers.get("utf", "32", "be"));
public static final StreamCharset UTF32_BE_BOM = new StreamCharset( public static final StreamCharset UTF32_BE_BOM = new StreamCharset(
Charset.forName("utf-32be"), Charset.forName("utf-32be"),
new byte[] { new byte[] {
(byte) 0xFF, (byte) 0xFF, (byte) 0xFE, 0x00, 0x00,
(byte) 0xFE,
0x00,
0x00,
}, },
Identifiers.get("utf", "32", "be", "bom") Identifiers.get("utf", "32", "be", "bom"));
);
private static final List<StreamCharset> RARE_NAMED = private static final List<StreamCharset> RARE_NAMED =
List.of(UTF16_LE, UTF16_LE_BOM, UTF16_BE, UTF16_BE_BOM, UTF32_LE, UTF32_LE_BOM, UTF32_BE, UTF32_BE_BOM); List.of(UTF16_LE, UTF16_LE_BOM, UTF16_BE, UTF16_BE_BOM, UTF32_LE, UTF32_LE_BOM, UTF32_BE, UTF32_BE_BOM);
@ -136,13 +107,11 @@ public class StreamCharset {
.map(charset -> new StreamCharset( .map(charset -> new StreamCharset(
charset, charset,
null, null,
Identifiers.get(charset.name().split("-")) Identifiers.get(charset.name().split("-")))))
))
)
.toList(); .toList();
public static final List<StreamCharset> ALL = Stream.concat(COMMON.stream(), RARE.stream()).toList(); public static final List<StreamCharset> ALL =
Stream.concat(COMMON.stream(), RARE.stream()).toList();
Charset charset; Charset charset;
byte[] byteOrderMark; byte[] byteOrderMark;
@ -157,7 +126,9 @@ public class StreamCharset {
} }
public static StreamCharset get(String s) { public static StreamCharset get(String s) {
var found = ALL.stream().filter(streamCharset -> streamCharset.getNames().contains(s.toLowerCase(Locale.ROOT))).findFirst(); var found = ALL.stream()
.filter(streamCharset -> streamCharset.getNames().contains(s.toLowerCase(Locale.ROOT)))
.findFirst();
if (found.isEmpty()) { if (found.isEmpty()) {
throw new IllegalArgumentException("Unknown charset name: " + s); throw new IllegalArgumentException("Unknown charset name: " + s);
} }

Some files were not shown because too many files have changed in this diff Show more