feat: update shared directories at runtime

Client::set_shared_directories rescans the given roots into a fresh
in-memory index, swaps it for peers, and re-announces the folder/file
counts to the server. The current directory list moves into the client
context so the running set is queryable. e2e-verified: a browser sees a
directory that was added after login.
This commit is contained in:
michel
2026-07-20 20:49:01 +02:00
parent a605431a10
commit be8197fd31
6 changed files with 115 additions and 11 deletions
+2 -1
View File
@@ -2,7 +2,7 @@ use super::{
Arc, Client, ClientContext, ClientOperation, ConnectionType, DownloadPeer,
DownloadStatus, Listen, Peer, PeerRegistry, Receiver, Result, RwLock,
RwLockExt, Sender, ServerActor, ServerMessage, Shares, SoulseekRs,
TcpStream, debug, error, info, mpsc, thread, trace, warn,
TcpStream, debug, error, info, mpsc, thread, trace,
};
impl Client {
@@ -46,6 +46,7 @@ impl Client {
let shared_folder_count = shares.folder_count();
let shared_file_count = shares.file_count();
ctx.shares = shares;
ctx.shared_directories = self.shared_directories.clone();
let server_actor = ServerActor::new(
self.address.clone(),