rdt-client/server/RdtClient.Service/Services/RemoteService.cs
2026-02-11 19:44:49 -07:00

27 lines
684 B
C#

using Microsoft.AspNetCore.SignalR;
namespace RdtClient.Service.Services;
public class RemoteService(IHubContext<RdtHub> hub, Torrents torrents)
{
public async Task Update()
{
var allTorrents = await torrents.Get();
// Prevent infinite recursion when serializing
foreach (var file in allTorrents.SelectMany(torrent => torrent.Downloads))
{
file.Torrent = null;
}
await hub.Clients.All.SendCoreAsync("update",
[
allTorrents
]);
}
public async Task UpdateDiskSpaceStatus(Object status)
{
await hub.Clients.All.SendCoreAsync("diskSpaceStatus", [status]);
}
}