Skip to content

Commit

Permalink
Squash merge xpipe 13 feature branches into master
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Nov 16, 2024
1 parent 6dabe53 commit 5868fcf
Show file tree
Hide file tree
Showing 482 changed files with 7,421 additions and 5,705 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You should therefore always check out the matching version tag for your local re
You can find the available version tags at https://github.com/xpipe-io/xpipe/tags.
So for example if you currently have XPipe `11.3` installed, you should run `git reset --hard 11.3` first to properly compile against it.

You need to have JDK for Java 21 installed to compile the project.
You need to have JDK for Java 22 installed to compile the project.
If you are on Linux or macOS, you can easily accomplish that by running
```bash
curl -s "https://get.sdkman.io" | bash
Expand Down Expand Up @@ -57,15 +57,15 @@ to connect to that debugger through [AttachMe](https://plugins.jetbrains.com/plu

## Modularity and IDEs

All XPipe components target [Java 21](https://openjdk.java.net/projects/jdk/21/) and make full use of the Java Module System (JPMS).
All XPipe components target [Java 22](https://openjdk.java.net/projects/jdk/22/) and make full use of the Java Module System (JPMS).
All components are modularized, including all their dependencies.
In case a dependency is (sadly) not modularized yet, module information is manually added using [extra-java-module-info](https://github.com/gradlex-org/extra-java-module-info).
Further, note that as this is a pretty complicated Java project that fully utilizes modularity,
many IDEs still have problems building this project properly.

For example, you can't build this project in eclipse or vscode as it will complain about missing modules.
The tested and recommended IDE is IntelliJ.
When setting up the project in IntelliJ, make sure that the correct JDK (Java 21)
When setting up the project in IntelliJ, make sure that the correct JDK (Java 22)
is selected both for the project and for gradle itself.

## Contributing guide
Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ dependencies {
api project(':beacon')

compileOnly 'org.hamcrest:hamcrest:3.0'
compileOnly 'org.junit.jupiter:junit-jupiter-api:5.11.0'
compileOnly 'org.junit.jupiter:junit-jupiter-params:5.11.0'
compileOnly 'org.junit.jupiter:junit-jupiter-api:5.11.3'
compileOnly 'org.junit.jupiter:junit-jupiter-params:5.11.3'

api 'com.vladsch.flexmark:flexmark:0.64.8'
api 'com.vladsch.flexmark:flexmark-util:0.64.8'
Expand Down Expand Up @@ -58,8 +58,8 @@ dependencies {
api 'org.apache.commons:commons-lang3:3.17.0'
api 'io.sentry:sentry:7.14.0'
api 'commons-io:commons-io:2.16.1'
api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "2.17.2"
api group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: "2.17.2"
api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "2.18.1"
api group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: "2.18.1"
api group: 'org.kordamp.ikonli', name: 'ikonli-material2-pack', version: "12.2.0"
api group: 'org.kordamp.ikonli', name: 'ikonli-materialdesign2-pack', version: "12.2.0"
api group: 'org.kordamp.ikonli', name: 'ikonli-javafx', version: "12.2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.xpipe.app.beacon.impl;

import io.xpipe.app.terminal.TerminalView;
import io.xpipe.app.util.AskpassAlert;
import io.xpipe.app.util.SecretManager;
import io.xpipe.app.util.SecretQueryState;
Expand Down Expand Up @@ -34,9 +35,30 @@ public Object handle(HttpExchange exchange, Request msg) throws BeaconClientExce
if (p.getState() != SecretQueryState.NORMAL) {
throw new BeaconClientException(SecretQueryState.toErrorMessage(p.getState()));
}
focusTerminalIfNeeded(msg.getPid());
return Response.builder().value(secret.inPlace()).build();
}

private void focusTerminalIfNeeded(long pid) {
var found = TerminalView.get().findSession(pid);
if (found.isEmpty()) {
return;
}

var term = TerminalView.get().getTerminalInstances().stream()
.filter(instance ->
instance.getTerminalProcess().equals(found.get().getTerminal()))
.findFirst();
if (term.isEmpty()) {
return;
}

var control = term.get().controllable();
control.ifPresent(controllableTerminalSession -> {
controllableTerminalSession.focus();
});
}

@Override
public boolean requiresEnabledApi() {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.xpipe.app.beacon.impl;

import io.xpipe.app.browser.session.BrowserSessionModel;
import io.xpipe.app.browser.BrowserFullSessionModel;
import io.xpipe.app.core.AppLayoutModel;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.beacon.BeaconClientException;
Expand All @@ -19,8 +19,8 @@ public Object handle(HttpExchange exchange, Request msg) throws Exception {
if (!(e.getStore() instanceof FileSystemStore)) {
throw new BeaconClientException("Not a file system connection");
}
BrowserSessionModel.DEFAULT.openFileSystemSync(
e.ref(), msg.getDirectory() != null ? ignored -> msg.getDirectory() : null, null);
BrowserFullSessionModel.DEFAULT.openFileSystemSync(
e.ref(), msg.getDirectory() != null ? ignored -> msg.getDirectory() : null, null, true);
AppLayoutModel.get().selectBrowser();
return Response.builder().build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public Object handle(HttpExchange exchange, Request msg) throws Throwable {
.getStoreEntryIfPresent(msg.getConnection())
.orElseThrow(() -> new BeaconClientException("Unknown connection: " + msg.getConnection()));
if (e.getStore() instanceof FixedHierarchyStore) {
DataStorage.get().refreshChildren(e, null, true);
DataStorage.get().refreshChildren(e, true);
} else {
e.validateOrThrowAndClose(null);
e.validateOrThrow();
}
return Response.builder().build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.xpipe.app.beacon.impl;

import io.xpipe.app.ext.ShellStore;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.app.util.TerminalLauncher;
import io.xpipe.app.terminal.TerminalLauncher;
import io.xpipe.beacon.BeaconClientException;
import io.xpipe.beacon.api.ConnectionTerminalExchange;
import io.xpipe.core.store.ShellStore;

import com.sun.net.httpserver.HttpExchange;

Expand All @@ -18,9 +18,8 @@ public Object handle(HttpExchange exchange, Request msg) throws Exception {
if (!(e.getStore() instanceof ShellStore shellStore)) {
throw new BeaconClientException("Not a shell connection");
}
try (var sc = shellStore.control().start()) {
TerminalLauncher.open(e, e.getName(), msg.getDirectory(), sc);
}
var sc = shellStore.getOrStartSession();
TerminalLauncher.open(e, e.getName(), msg.getDirectory(), sc);
return Response.builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.xpipe.app.beacon.impl;

import io.xpipe.app.core.launcher.LauncherInput;
import io.xpipe.app.core.mode.OperationMode;
import io.xpipe.app.launcher.LauncherInput;
import io.xpipe.app.util.PlatformState;
import io.xpipe.beacon.BeaconServerException;
import io.xpipe.beacon.api.DaemonOpenExchange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import io.xpipe.app.beacon.AppBeaconServer;
import io.xpipe.app.beacon.BeaconShellSession;
import io.xpipe.app.ext.ShellStore;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.beacon.BeaconClientException;
import io.xpipe.beacon.api.ShellStartExchange;
import io.xpipe.core.store.ShellStore;

import com.sun.net.httpserver.HttpExchange;
import lombok.SneakyThrows;
Expand All @@ -25,7 +25,9 @@ public Object handle(HttpExchange exchange, Request msg) {
var existing = AppBeaconServer.get().getCache().getShellSessions().stream()
.filter(beaconShellSession -> beaconShellSession.getEntry().equals(e))
.findFirst();
var control = (existing.isPresent() ? existing.get().getControl() : s.control());
var control = (existing.isPresent()
? existing.get().getControl()
: s.standaloneControl().start());
control.setNonInteractive();
control.start();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.xpipe.app.beacon.impl;

import io.xpipe.app.ext.ProcessControlProvider;
import io.xpipe.app.util.TerminalLauncherManager;
import io.xpipe.app.terminal.TerminalLauncherManager;
import io.xpipe.beacon.api.SshLaunchExchange;
import io.xpipe.core.process.ShellDialects;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.xpipe.app.beacon.impl;

import io.xpipe.app.util.TerminalLauncherManager;
import io.xpipe.app.terminal.TerminalLauncherManager;
import io.xpipe.beacon.BeaconClientException;
import io.xpipe.beacon.api.TerminalLaunchExchange;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.xpipe.app.beacon.impl;

import io.xpipe.app.util.TerminalLauncherManager;
import io.xpipe.app.terminal.TerminalLauncherManager;
import io.xpipe.app.terminal.TerminalView;
import io.xpipe.beacon.BeaconClientException;
import io.xpipe.beacon.BeaconServerException;
import io.xpipe.beacon.api.TerminalWaitExchange;
Expand All @@ -10,7 +11,8 @@
public class TerminalWaitExchangeImpl extends TerminalWaitExchange {
@Override
public Object handle(HttpExchange exchange, Request msg) throws BeaconClientException, BeaconServerException {
TerminalLauncherManager.waitExchange(msg.getRequest());
TerminalView.get().open(msg.getRequest(), msg.getPid());
TerminalLauncherManager.waitExchange(msg.getRequest(), msg.getPid());
return Response.builder().build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.xpipe.app.browser.session;
package io.xpipe.app.browser;

import io.xpipe.app.util.BooleanScope;
import io.xpipe.app.util.ThreadHelper;
Expand All @@ -13,13 +13,13 @@
import lombok.Getter;

@Getter
public class BrowserAbstractSessionModel<T extends BrowserSessionTab<?>> {
public class BrowserAbstractSessionModel<T extends BrowserSessionTab> {

protected final ObservableList<T> sessionEntries = FXCollections.observableArrayList();
protected final Property<T> selectedEntry = new SimpleObjectProperty<>();
protected final BooleanProperty busy = new SimpleBooleanProperty();

public void closeAsync(BrowserSessionTab<?> e) {
public void closeAsync(BrowserSessionTab e) {
ThreadHelper.runAsync(() -> {
closeSync(e);
});
Expand All @@ -37,7 +37,7 @@ public void openSync(T e, BooleanProperty externalBusy) throws Exception {
}
}

public void closeSync(BrowserSessionTab<?> e) {
public void closeSync(BrowserSessionTab e) {
e.close();
synchronized (BrowserAbstractSessionModel.this) {
this.sessionEntries.remove(e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
package io.xpipe.app.browser.session;
package io.xpipe.app.browser;

import io.xpipe.app.browser.BrowserBookmarkComp;
import io.xpipe.app.browser.BrowserBookmarkHeaderComp;
import io.xpipe.app.browser.file.BrowserConnectionListComp;
import io.xpipe.app.browser.file.BrowserConnectionListFilterComp;
import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.fs.OpenFileSystemComp;
import io.xpipe.app.browser.fs.OpenFileSystemModel;
import io.xpipe.app.browser.file.BrowserFileSystemTabComp;
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
import io.xpipe.app.comp.Comp;
import io.xpipe.app.comp.base.DialogComp;
import io.xpipe.app.comp.base.SideSplitPaneComp;
import io.xpipe.app.comp.base.LeftSplitPaneComp;
import io.xpipe.app.comp.base.StackComp;
import io.xpipe.app.comp.base.VerticalComp;
import io.xpipe.app.comp.store.StoreEntryWrapper;
import io.xpipe.app.core.AppFont;
import io.xpipe.app.core.AppLayoutModel;
import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.impl.StackComp;
import io.xpipe.app.fxcomps.impl.VerticalComp;
import io.xpipe.app.fxcomps.util.BindingsHelper;
import io.xpipe.app.fxcomps.util.PlatformThread;
import io.xpipe.app.ext.ShellStore;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.BindingsHelper;
import io.xpipe.app.util.FileReference;
import io.xpipe.app.util.PlatformThread;
import io.xpipe.app.util.ThreadHelper;
import io.xpipe.core.store.FileSystemStore;
import io.xpipe.core.store.ShellStore;

import javafx.beans.property.BooleanProperty;
import javafx.collections.ListChangeListener;
Expand All @@ -37,22 +37,22 @@
import java.util.function.Predicate;
import java.util.function.Supplier;

public class BrowserChooserComp extends DialogComp {
public class BrowserFileChooserSessionComp extends DialogComp {

private final Stage stage;
private final BrowserFileChooserModel model;
private final BrowserFileChooserSessionModel model;

public BrowserChooserComp(Stage stage, BrowserFileChooserModel model) {
public BrowserFileChooserSessionComp(Stage stage, BrowserFileChooserSessionModel model) {
this.stage = stage;
this.model = model;
}

public static void openSingleFile(
Supplier<DataStoreEntryRef<? extends FileSystemStore>> store, Consumer<FileReference> file, boolean save) {
PlatformThread.runLaterIfNeeded(() -> {
var model = new BrowserFileChooserModel(OpenFileSystemModel.SelectionMode.SINGLE_FILE);
var model = new BrowserFileChooserSessionModel(BrowserFileSystemTabModel.SelectionMode.SINGLE_FILE);
DialogComp.showWindow(save ? "saveFileTitle" : "openFileTitle", stage -> {
var comp = new BrowserChooserComp(stage, model);
var comp = new BrowserFileChooserSessionComp(stage, model);
comp.apply(struc -> struc.get().setPrefSize(1200, 700))
.apply(struc -> AppFont.normal(struc.get()))
.styleClass("browser")
Expand Down Expand Up @@ -114,8 +114,8 @@ public Comp<?> content() {
});
};

var bookmarkTopBar = new BrowserBookmarkHeaderComp();
var bookmarksList = new BrowserBookmarkComp(
var bookmarkTopBar = new BrowserConnectionListFilterComp();
var bookmarksList = new BrowserConnectionListComp(
BindingsHelper.map(model.getSelectedEntry(), v -> v.getEntry().get()),
applicable,
action,
Expand All @@ -138,7 +138,7 @@ public Comp<?> content() {
model.getSelectedEntry().subscribe(selected -> {
PlatformThread.runLaterIfNeeded(() -> {
if (selected != null) {
s.getChildren().setAll(new OpenFileSystemComp(selected, false).createRegion());
s.getChildren().setAll(new BrowserFileSystemTabComp(selected, false).createRegion());
} else {
s.getChildren().clear();
}
Expand All @@ -148,7 +148,7 @@ public Comp<?> content() {
});

var vertical = new VerticalComp(List.of(bookmarkTopBar, bookmarksContainer)).styleClass("left");
var splitPane = new SideSplitPaneComp(vertical, stack)
var splitPane = new LeftSplitPaneComp(vertical, stack)
.withInitialWidth(AppLayoutModel.get().getSavedState().getBrowserConnectionsWidth())
.withOnDividerChange(AppLayoutModel.get().getSavedState()::setBrowserConnectionsWidth)
.styleClass("background")
Expand Down
Loading

0 comments on commit 5868fcf

Please sign in to comment.