Add support for message formatting in process control

This commit is contained in:
crschnick 2023-04-20 14:17:39 +00:00
parent fe6d56d71e
commit 8da34c670a
4 changed files with 19 additions and 1 deletions

View file

@ -1,5 +1,9 @@
# Security
Due to its nature, X-Pipe has to handle a lot of sensitive information.
This can range from passwords for all kinds of servers, to SSH keys, and more.
Therefore, you should definitely be interested in the security model of X-Pipe.
This document summarizes the approach of X-Pipe when it comes to the security of your sensitive information.
If any of your questions are left unanswered by this document, feel free to file an
issue report so your question can be answered individually and can also potentially be included in this document.

View file

@ -7,10 +7,14 @@ import io.xpipe.app.fxcomps.impl.LabelComp;
import io.xpipe.app.fxcomps.impl.SecretFieldComp;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.core.util.SecretValue;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.layout.VBox;
import java.util.Objects;
public class LockChangeAlert {
public static void show() {
@ -42,8 +46,13 @@ public class LockChangeAlert {
var content = new VBox(label1, p1, new Spacer(15), label2, p2);
content.setSpacing(5);
alert.getDialogPane().setContent(content);
var button = alert.getDialogPane().lookupButton(ButtonType.OK);
button.disableProperty().bind(Bindings.createBooleanBinding(() -> {
return !Objects.equals(prop1.getValue(), prop2.getValue());
}, prop1, prop2));
})
.filter(b -> b.getButtonData().isDefaultButton() && ((prop1.getValue() != null && prop2.getValue() != null && prop1.getValue().equals(prop2.getValue())) || (prop1.getValue() == null && prop2.getValue() == null)))
.filter(b -> b.getButtonData().isDefaultButton())
.ifPresent(t -> {
AppPrefs.get().changeLock(prop1.getValue());
});

View file

@ -8,6 +8,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.function.Consumer;
import java.util.function.Function;
public interface CommandControl extends ProcessControl {
@ -20,6 +21,8 @@ public interface CommandControl extends ProcessControl {
CLOSE
}
CommandControl withMessageFormatter(Function<String, String> formatter);
CommandControl terminalExitMode(TerminalExitMode mode);
public CommandControl doesNotObeyReturnValueConvention();

View file

@ -19,6 +19,8 @@ public interface ShellControl extends ProcessControl {
ShellControl onExit(Consumer<ShellControl> pc);
ShellControl withMessageFormatter(Function<String, String> formatter);
String prepareTerminalOpen() throws Exception;
String prepareIntermediateTerminalOpen(String content) throws Exception;