From 210466e7d9fe589ddfaba6d8ac82948bbea500d5 Mon Sep 17 00:00:00 2001 From: AsamK Date: Fri, 30 Dec 2022 13:50:40 +0100 Subject: [PATCH] Allow JSON-RPC commands without account param if only one account exists --- .../asamk/signal/jsonrpc/SignalJsonRpcCommandHandler.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/asamk/signal/jsonrpc/SignalJsonRpcCommandHandler.java b/src/main/java/org/asamk/signal/jsonrpc/SignalJsonRpcCommandHandler.java index 2249fad6..720f22e6 100644 --- a/src/main/java/org/asamk/signal/jsonrpc/SignalJsonRpcCommandHandler.java +++ b/src/main/java/org/asamk/signal/jsonrpc/SignalJsonRpcCommandHandler.java @@ -87,7 +87,13 @@ public class SignalJsonRpcCommandHandler { return runCommand(objectMapper, params, new CommandRunnerImpl<>(m, jsonRpcCommand)); } - final var manager = getManagerFromParams(params); + var manager = getManagerFromParams(params); + if (manager == null) { + final var managers = c.getManagers(); + if (managers.size() == 1) { + manager = managers.get(0); + } + } if (manager != null) { return runCommand(objectMapper, params, new CommandRunnerImpl<>(manager, jsonRpcCommand)); } else {