Changed the fingerprinting code for Kavita+. Optimized System tab to be way faster. (#2140)
This commit is contained in:
parent
43cc771838
commit
5f505eaf6d
8 changed files with 84 additions and 34 deletions
|
|
@ -124,6 +124,17 @@ public class ServerController : BaseApiController
|
|||
return Ok(await _statsService.GetServerInfo());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns non-sensitive information about the current system
|
||||
/// </summary>
|
||||
/// <remarks>This is just for the UI and is extremly lightweight</remarks>
|
||||
/// <returns></returns>
|
||||
[HttpGet("server-info-slim")]
|
||||
public async Task<ActionResult<ServerInfoDto>> GetSlimVersion()
|
||||
{
|
||||
return Ok(await _statsService.GetServerInfoSlim());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Triggers the scheduling of the convert media job. This will convert all media to the target encoding (except for PNG). Only one job will run at a time.
|
||||
|
|
|
|||
21
API/DTOs/Stats/ServerInfoSlimDto.cs
Normal file
21
API/DTOs/Stats/ServerInfoSlimDto.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
namespace API.DTOs.Stats;
|
||||
|
||||
/// <summary>
|
||||
/// This is just for the Server tab on UI
|
||||
/// </summary>
|
||||
public class ServerInfoSlimDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique Id that represents a unique install
|
||||
/// </summary>
|
||||
public required string InstallId { get; set; }
|
||||
/// <summary>
|
||||
/// If the Kavita install is using Docker
|
||||
/// </summary>
|
||||
public bool IsDocker { get; set; }
|
||||
/// <summary>
|
||||
/// Version of Kavita
|
||||
/// </summary>
|
||||
public required string KavitaVersion { get; set; }
|
||||
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ public interface IStatsService
|
|||
{
|
||||
Task Send();
|
||||
Task<ServerInfoDto> GetServerInfo();
|
||||
Task<ServerInfoSlimDto> GetServerInfoSlim();
|
||||
Task SendCancellation();
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -171,6 +172,17 @@ public class StatsService : IStatsService
|
|||
return serverInfo;
|
||||
}
|
||||
|
||||
public async Task<ServerInfoSlimDto> GetServerInfoSlim()
|
||||
{
|
||||
var serverSettings = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
|
||||
return new ServerInfoSlimDto()
|
||||
{
|
||||
InstallId = serverSettings.InstallId,
|
||||
KavitaVersion = serverSettings.InstallVersion,
|
||||
IsDocker = OsInfo.IsDocker
|
||||
};
|
||||
}
|
||||
|
||||
public async Task SendCancellation()
|
||||
{
|
||||
_logger.LogInformation("Informing KavitaStats that this instance is no longer sending stats");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue