feat(daemon): route commands and the TUI through a running daemon
Session::open attaches to a daemon when one is reachable and logs in otherwise, so every existing command works unchanged against either. A local socket is found automatically, which is what makes an agent's invocation need no flags at all; --no-daemon opts out. Commands now read identity, shares, server, and download directory from the session rather than from this run's config: routed to a daemon those differ, and the session is the one actually on the network. Without that, whoami named the wrong server and shares reindex would have imposed the client machine's folders on the daemon.
This commit is contained in:
@@ -24,7 +24,10 @@ pub fn whoami(ctx: &Ctx) -> CliResult {
|
||||
// reachable needs what is true, not what was asked for.
|
||||
let bound = session.client.listen_port();
|
||||
ctx.out.emit(&WhoamiRecord {
|
||||
user: ctx.settings.username.clone(),
|
||||
// The session's own name, not this run's configuration: routed to a
|
||||
// daemon they are different, and the session is the one that is
|
||||
// actually on the network.
|
||||
user: session.client.username(),
|
||||
server: ctx.settings.server_address.to_string(),
|
||||
listening: bound.is_some(),
|
||||
listen_port: bound.unwrap_or(0),
|
||||
|
||||
Reference in New Issue
Block a user