| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Truly disable IPC when disable-ipc is set to true in aerc.conf. Don't
run commands over IPC and don't start an IPC server.
Being able to disable IPC in the config is useful because it allows
making aerc open mailto links in a new instance without modifying the
aerc.desktop file. There are of course potential security benefits as
well.
Changelog-changed: The `disable-ipc` option in `aerc.conf` completely
disables IPC.
Signed-off-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
| |
If IPC fails the first time we try it, we know that no other aerc
instance is running. When we retry, run the command directly instead of
going through the current instance's own IPC server.
Signed-off-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Detect error responses in addition to errors connecting, sending the
request, and receiving the response.
If an error occurs when retrying the IPC call, keep the new aerc
instance running and simply show the error. We already know (due to the
initial failed IPC call) that no other aerc instance is running. Keeping
the new instance open also improves the visibility of the error in some
cases, such as when clicking on a malformed mailto link causes a new
aerc instance to open.
Signed-off-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When aerc receives a command over IPC, it quotes the arguments before
passing them on to the internal command parser. In many cases, the
parser interprets the quotes, and the command runs with the arguments
exactly as they were specified in the shell. In some cases, though, the
quotes are not interpreted and the additional quotes can cause the
command to fail. Simply eliminating the addition of quotes is not
possible because some commands need them.
Allow a command and its arguments to be specified as a single argument
in the shell. In that case, pass that argument verbatim to the internal
command parser so that it is interpreted exactly as if it had been typed
directly in aerc's command line.
Link: https://lists.sr.ht/~rjarry/aerc-devel/%3C20240203085541.27416-2-contact%40willowbarraco.fr%3E
Changelog-added: Execute IPC commands verbatim by providing the
command and its args as a single argument in the shell.
Cc: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Jason Cox <me@jasoncarloscox.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
| |
This has nothing to do at the root of the source tree.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pass a cancellable context to the IPC server and defer accepting
connections until the first worker message has been received by the main
thread.
This is not a real fix for the :split command not working at startup.
:split requires a mail store to be present on the currently selected
account tab+folder. I could have waited for a types.DirectoryContents
message but it seems silly and bug prone since such a message may never
arrive and we don't want to pool IPC messages forever.
Also, a types.DirectoryContents message may arrive for one account but
:split is only effective *per account* and the default selected account
tab is the first one.
In any case, this band aid prevents aerc from crashing or breaking down
the terminal when running IPC commands in the aerc-startup hook.
Fixes: https://lists.sr.ht/~rjarry/aerc-devel/%3CCYPN7AVYQ69S.WV0T67VM6WX3%40wegtam.com%3E
Fixes: https://todo.sr.ht/~rjarry/aerc/173
Reported-by: Jens Grassel <jens@wegtam.com>
Reported-by: Justine Smithies <justine@smithies.me.uk>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Thomas Böhler <witcher@wiredspace.de>
Reviewed-by: Thomas Böhler <witcher@wiredspace.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some commands need to invoke others and/or run shell commands. For this,
we need the raw command line as entered by the user. Pass it down the
call chain just before it is split to invoke the command Execute method.
Remove unit tests for the template expand() test which does have any
added value now that it is performed on a single string without any
quote juggling.
Update all code to handle a single string instead of a list of
arguments.
Introduce a new dependency on git.sr.ht/~rjarry/go-opt to deal with
shell splitting. This is in preparation for using opt.ArgsToStruct to
parse arguments for all aerc commands.
There should be no functional change after this patch.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
Tested-by: Inwit <inwit@sindominio.net>
|
|
|
|
|
|
|
|
|
|
|
| |
github.com/mitchellh/go-homedir has not received any update since 2019.
The last release of github.com/kyoh86/xdg was in 2020 and it has been
marked as deprecated by its author.
Replace these with internal functions.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to make automation easier, it's useful to be able to send
commands to aerc via IPC. This can be done by calling the aerc binary
followed by a colon and the command to run. For example:
aerc :read && aerc :remark && aerc :archive month
Security to ensure no malicious commands are run is deferred to the
user. By default the socket is only writable by the user. This is
considered sufficient as the potential harm an attacker gaining
write-access to a user's session can cause is significantly greater than
"can delete some emails".
To ensure users with an according threat model, it is possible to
disable command IPC. mailto-handling is unaffected even though it works
over IPC as it is absolutely non-destructive.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
| |
Currently, every function has to be mapped to the according handler with
our god-object. To make adding new handlers require less changes, change
this mapping into an interface that is satisfied by *widgets.Aerc
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In overhauling the IPC, it has become necessary to switch to a more
extendable message format, to ensure more complex commands can be sent.
Messages have the following basic structure and must not contain
linebreaks, as these are used to delimit separate messages from one
another.
{"arguments": ["mailto:moritz@poldrack.dev"]}
The responses have the following structure:
{"error": "epic fail"}
If the IPC request was successful, "error" will be empty.
{"error": ""}
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
There are several //TODO comments in the socket package, these should be
fixed before expanding it.
Put send logic into it's own file and rename receiver code.
Fix the rather inelegant error handling when shutting down the server.
Make sure to close sockets.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Signed-off-by: Robin Jarry <robin@jarry.cc>
|