mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
* When account updates occur for a user, send an event to them to tell them to refresh their account information (if they are on the site at the time). This way if we revoke permissions, the site will reactively adapt. * Some cleanup on the user preferences to remove some calls we don't need anymore. * Removed old bulk cleanup bookmark code as it's no longer needed. * Tweaked the messaging for stat collection to reflect what we collect now versus when this was initially implemented. * Implemented the ability for users to configure their servers to save bookmarks as webP. Reorganized the tabs for Admin dashboard to account for upcoming features. * Implemented the ability to bulk convert bookmarks (as many times as the user wants). Added a display of Reoccurring Jobs to the Tasks admin tab. Currently it's just placeholder, but will be enhanced further later in the release. * Tweaked the wording around the convert switch. * Moved System actions to the task tab * Added a controller just for Tachiyomi so we can have dedicated APIs for that client. Deprecated an existing API on the Reader route. * Fixed the unit tests
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using API.Data;
|
|
using API.Extensions;
|
|
using API.SignalR.Presence;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
namespace API.SignalR
|
|
{
|
|
/// <summary>
|
|
/// Generic hub for sending messages to UI
|
|
/// </summary>
|
|
[Authorize]
|
|
public class MessageHub : Hub
|
|
{
|
|
private readonly IPresenceTracker _tracker;
|
|
|
|
public MessageHub(IPresenceTracker tracker)
|
|
{
|
|
_tracker = tracker;
|
|
}
|
|
|
|
public override async Task OnConnectedAsync()
|
|
{
|
|
await _tracker.UserConnected(Context.User.GetUsername(), Context.ConnectionId);
|
|
|
|
var currentUsers = await PresenceTracker.GetOnlineUsers();
|
|
await Clients.All.SendAsync(MessageFactory.OnlineUsers, currentUsers);
|
|
|
|
|
|
await base.OnConnectedAsync();
|
|
}
|
|
|
|
public override async Task OnDisconnectedAsync(Exception exception)
|
|
{
|
|
await _tracker.UserDisconnected(Context.User.GetUsername(), Context.ConnectionId);
|
|
|
|
var currentUsers = await PresenceTracker.GetOnlineUsers();
|
|
await Clients.All.SendAsync(MessageFactory.OnlineUsers, currentUsers);
|
|
|
|
|
|
await base.OnDisconnectedAsync(exception);
|
|
}
|
|
}
|
|
}
|