Various fixes

This commit is contained in:
crschnick
2026-09-24 15:47:59 +00:00
parent 2f0252234f
commit 222cb52d71
4 changed files with 12 additions and 16 deletions
@@ -23,8 +23,7 @@ public class TerminalLaunchExchange extends BeaconInterface<TerminalLaunchExchan
@Override
public Object handle(HttpExchange exchange, Request msg) throws BeaconClientException, BeaconServerException {
TerminalLauncherManager.verifyPid(msg.getRequest(), msg.getPid());
var r = TerminalLauncherManager.launchExchange(msg.getRequest());
var r = TerminalLauncherManager.launchExchange(msg.getRequest(), msg.getPid());
return Response.builder().targetFile(r).build();
}
@@ -22,7 +22,6 @@ public class TerminalPrepareExchange extends BeaconInterface<TerminalPrepareExch
@Override
public Object handle(HttpExchange exchange, Request msg) throws BeaconClientException {
TerminalLauncherManager.verifyPid(msg.getRequest(), msg.getPid());
var term = AppPrefs.get().terminalType().getValue();
var unicode = term.supportsUnicode();
var escapes = term.supportsEscapes();
@@ -49,26 +49,20 @@ public interface StoreEntryBadge {
static Action providerMenu(String... ids) {
return new Action() {
private ContextMenu contextMenu;
private void buildContextMenu(StoreEntryWrapper wrapper) {
if (contextMenu == null) {
contextMenu = new ContextMenu();
}
contextMenu.getItems().clear();
private ContextMenu buildContextMenu(StoreEntryWrapper wrapper) {
var contextMenu = new ContextMenu();
var provs = getProviders(wrapper);
for (var p : provs) {
var item = StoreEntryComp.buildMenuItemForAction(wrapper, p);
contextMenu.getItems().add(item);
}
return contextMenu;
}
@Override
public void run(StoreEntryWrapper wrapper, Button button) {
var cm = new ContextMenuWrapper(() -> {
buildContextMenu(wrapper);
return contextMenu;
return buildContextMenu(wrapper);
});
cm.show(button, Side.BOTTOM);
}
@@ -247,7 +241,7 @@ public interface StoreEntryBadge {
Platform.runLater(() -> {
var cm = new ContextMenuWrapper(() -> {
return buildContextMenu(addr);
return buildContextMenu(refreshed);
});
cm.show(b, Side.BOTTOM);
});
@@ -127,7 +127,7 @@ public class TerminalLauncherManager {
}
}
public static Path launchExchange(UUID request) throws BeaconClientException, BeaconServerException {
public static Path launchExchange(UUID request, Long pid) throws BeaconClientException, BeaconServerException {
synchronized (entries) {
var e = entries.values().stream()
.filter(entry -> entry.getRequest().equals(request))
@@ -158,6 +158,10 @@ public class TerminalLauncherManager {
}
}
if (pid != null) {
TerminalLauncherManager.verifyPid(request, pid);
}
if (!(e.getResult() instanceof TerminalLaunchResult.ResultSuccess)) {
throw new BeaconClientException("Invalid launch request state " + request);
}
@@ -190,7 +194,7 @@ public class TerminalLauncherManager {
var config = new TerminalInitScriptConfig(ref.get().getName(), false, TerminalInitFunction.none());
submitAsync(request, control, config, null);
waitExchange(request);
var script = launchExchange(request);
var script = launchExchange(request, null);
try (var sc = LocalShell.getShell().start()) {
var runCommand = ProcModuleProvider.get()
.getEffectiveLocalDialect()