mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
Update man page
This commit is contained in:
parent
1ad0e94b64
commit
c628e27d2e
5 changed files with 59 additions and 49 deletions
|
@ -5,6 +5,7 @@ vim:set ts=4 sw=4 tw=82 noet:
|
|||
:quotes.~:
|
||||
|
||||
= signal-cli-dbus (5)
|
||||
:doctype: manpage
|
||||
|
||||
== Name
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ vim:set ts=4 sw=4 tw=82 noet:
|
|||
:quotes.~:
|
||||
|
||||
= signal-cli-jsonrpc (5)
|
||||
:doctype: manpage
|
||||
|
||||
== Name
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ vim:set ts=4 sw=4 tw=82 noet:
|
|||
:quotes.~:
|
||||
|
||||
= signal-cli (1)
|
||||
:doctype: manpage
|
||||
|
||||
== Name
|
||||
|
||||
|
@ -601,7 +602,7 @@ The primary device will respond with synchronization messages with full contact
|
|||
|
||||
=== uploadStickerPack
|
||||
|
||||
Upload a new sticker pack, consisting of a manifest file and the sticker images.
|
||||
Upload a new sticker pack, consisting of a manifest file and the sticker images. +
|
||||
Images must conform to the following specification: (see https://support.signal.org/hc/en-us/articles/360031836512-Stickers#sticker_reqs )
|
||||
|
||||
- Static stickers in PNG or WebP format
|
||||
|
@ -657,20 +658,25 @@ signal-cli can run in daemon mode and provides an experimental dbus or JSON-RPC
|
|||
If no `-a` account is given, all local accounts will be exported as separate dbus objects under the same bus name.
|
||||
|
||||
*--dbus*::
|
||||
Export DBus interface on user bus.
|
||||
See signal-cli-dbus (5) for info on the dbus interface.
|
||||
Export DBus interface on user bus. +
|
||||
See **signal-cli-dbus**(5) for info on the dbus interface.
|
||||
|
||||
*--dbus-system*::
|
||||
Export DBus interface on system bus.
|
||||
See signal-cli-dbus (5) for info on the dbus interface.
|
||||
Export DBus interface on system bus. +
|
||||
See **signal-cli-dbus**(5) for info on the dbus interface.
|
||||
|
||||
*--socket [SOCKET]*::
|
||||
Export a JSON-RPC interface on a UNIX socket (default $XDG_RUNTIME_DIR/signal-cli/socket).
|
||||
See signal-cli-jsonrpc (5) for info on the JSON-RPC interface.
|
||||
Export a JSON-RPC interface on a UNIX socket (default $XDG_RUNTIME_DIR/signal-cli/socket). +
|
||||
See **signal-cli-jsonrpc**(5) for info on the JSON-RPC interface.
|
||||
|
||||
*--tcp [HOST:PORT]*::
|
||||
Export a JSON-RPC interface on a TCP socket (default localhost:7583).
|
||||
See signal-cli-jsonrpc (5) for info on the JSON-RPC interface.
|
||||
Export a JSON-RPC interface on a TCP socket (default localhost:7583). +
|
||||
See **signal-cli-jsonrpc**(5) for info on the JSON-RPC interface.
|
||||
|
||||
*--http [HOST:PORT]*::
|
||||
Expose a JSON-RPC interface as http endpoint (default localhost:8080).
|
||||
The JSON-RPC endpoint is `/api/v1/rpc`. +
|
||||
See **signal-cli-jsonrpc**(5) for info on the JSON-RPC interface.
|
||||
|
||||
*--ignore-attachments*::
|
||||
Don’t download attachments of received messages.
|
||||
|
|
|
@ -73,7 +73,7 @@ public class DaemonCommand implements MultiLocalCommand, LocalCommand {
|
|||
subparser.addArgument("--http")
|
||||
.nargs("?")
|
||||
.setConst("localhost:8080")
|
||||
.help("Expose a JSON-RPC interface as http endpoint.");
|
||||
.help("Expose a JSON-RPC interface as http endpoint (default localhost:8080).");
|
||||
subparser.addArgument("--no-receive-stdout")
|
||||
.help("Don’t print received messages to stdout.")
|
||||
.action(Arguments.storeTrue());
|
||||
|
|
|
@ -41,54 +41,56 @@ public class HttpServerHandler {
|
|||
|
||||
public void init() throws IOException {
|
||||
|
||||
logger.info("Starting server on " + address.toString());
|
||||
logger.info("Starting server on " + address.toString());
|
||||
|
||||
final var server = HttpServer.create(address, 0);
|
||||
server.setExecutor(Executors.newFixedThreadPool(10));
|
||||
final var server = HttpServer.create(address, 0);
|
||||
server.setExecutor(Executors.newFixedThreadPool(10));
|
||||
|
||||
server.createContext("/api/v1/rpc", httpExchange -> {
|
||||
server.createContext("/api/v1/rpc", httpExchange -> {
|
||||
|
||||
if (!"POST".equals(httpExchange.getRequestMethod())) {
|
||||
sendResponse(405, null, httpExchange);
|
||||
return;
|
||||
}
|
||||
if (!"POST".equals(httpExchange.getRequestMethod())) {
|
||||
sendResponse(405, null, httpExchange);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!"application/json".equals(httpExchange.getRequestHeaders().getFirst("Content-Type"))) {
|
||||
sendResponse(415, null, httpExchange);
|
||||
return;
|
||||
}
|
||||
if (!"application/json".equals(httpExchange.getRequestHeaders().getFirst("Content-Type"))) {
|
||||
sendResponse(415, null, httpExchange);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
|
||||
final Object[] result = {null};
|
||||
final var jsonRpcSender = new JsonRpcSender(s -> {
|
||||
if (result[0] != null) {
|
||||
throw new AssertionError("There should only be a single JSON-RPC response");
|
||||
}
|
||||
|
||||
result[0] = s;
|
||||
});
|
||||
|
||||
final var jsonRpcReader = new JsonRpcReader(jsonRpcSender, httpExchange.getRequestBody());
|
||||
jsonRpcReader.readMessages((method, params) -> commandHandler.handleRequest(objectMapper, method, params),
|
||||
response -> logger.debug("Received unexpected response for id {}", response.getId()));
|
||||
|
||||
if (result[0] !=null) {
|
||||
sendResponse(200, result[0], httpExchange);
|
||||
} else {
|
||||
sendResponse(201, null, httpExchange);
|
||||
final Object[] result = {null};
|
||||
final var jsonRpcSender = new JsonRpcSender(s -> {
|
||||
if (result[0] != null) {
|
||||
throw new AssertionError("There should only be a single JSON-RPC response");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Throwable aEx) {
|
||||
logger.error("Failed to process request.", aEx);
|
||||
sendResponse(200, JsonRpcResponse.forError(
|
||||
new JsonRpcResponse.Error(JsonRpcResponse.Error.INTERNAL_ERROR,
|
||||
"An internal server error has occurred.", null), null), httpExchange);
|
||||
}
|
||||
});
|
||||
result[0] = s;
|
||||
});
|
||||
|
||||
server.start();
|
||||
final var jsonRpcReader = new JsonRpcReader(jsonRpcSender, httpExchange.getRequestBody());
|
||||
jsonRpcReader.readMessages((method, params) -> commandHandler.handleRequest(objectMapper,
|
||||
method,
|
||||
params), response -> logger.debug("Received unexpected response for id {}", response.getId()));
|
||||
|
||||
if (result[0] != null) {
|
||||
sendResponse(200, result[0], httpExchange);
|
||||
} else {
|
||||
sendResponse(201, null, httpExchange);
|
||||
}
|
||||
|
||||
} catch (Throwable aEx) {
|
||||
logger.error("Failed to process request.", aEx);
|
||||
sendResponse(200,
|
||||
JsonRpcResponse.forError(new JsonRpcResponse.Error(JsonRpcResponse.Error.INTERNAL_ERROR,
|
||||
"An internal server error has occurred.",
|
||||
null), null),
|
||||
httpExchange);
|
||||
}
|
||||
});
|
||||
|
||||
server.start();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue