This commit is contained in:
Joe Milazzo 2024-12-07 08:57:04 -06:00 committed by GitHub
parent bcfb4a6172
commit b24b8686f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 510 additions and 347 deletions

View file

@ -1,15 +0,0 @@
using API.Entities.Enums;
namespace API.DTOs.Stats;
public class FileFormatDto
{
/// <summary>
/// The extension with the ., in lowercase
/// </summary>
public required string Extension { get; set; }
/// <summary>
/// Format of extension
/// </summary>
public required MangaFormat Format { get; set; }
}

View file

@ -1,184 +0,0 @@
using System;
using System.Collections.Generic;
using API.Entities.Enums;
namespace API.DTOs.Stats;
#nullable enable
/// <summary>
/// Represents information about a Kavita Installation
/// </summary>
public class ServerInfoDto
{
/// <summary>
/// Unique Id that represents a unique install
/// </summary>
public required string InstallId { get; set; }
public required string Os { get; set; }
/// <summary>
/// If the Kavita install is using Docker
/// </summary>
public bool IsDocker { get; set; }
/// <summary>
/// Version of .NET instance is running
/// </summary>
public required string DotnetVersion { get; set; }
/// <summary>
/// Version of Kavita
/// </summary>
public required string KavitaVersion { get; set; }
/// <summary>
/// Number of Cores on the instance
/// </summary>
public int NumOfCores { get; set; }
/// <summary>
/// The number of libraries on the instance
/// </summary>
public int NumberOfLibraries { get; set; }
/// <summary>
/// Does any user have bookmarks
/// </summary>
public bool HasBookmarks { get; set; }
/// <summary>
/// The site theme the install is using
/// </summary>
/// <remarks>Introduced in v0.5.2</remarks>
public string? ActiveSiteTheme { get; set; }
/// <summary>
/// The reading mode the main user has as a preference
/// </summary>
/// <remarks>Introduced in v0.5.2</remarks>
public ReaderMode MangaReaderMode { get; set; }
/// <summary>
/// Number of users on the install
/// </summary>
/// <remarks>Introduced in v0.5.2</remarks>
public int NumberOfUsers { get; set; }
/// <summary>
/// Number of collections on the install
/// </summary>
/// <remarks>Introduced in v0.5.2</remarks>
public int NumberOfCollections { get; set; }
/// <summary>
/// Number of reading lists on the install (Sum of all users)
/// </summary>
/// <remarks>Introduced in v0.5.2</remarks>
public int NumberOfReadingLists { get; set; }
/// <summary>
/// Is OPDS enabled
/// </summary>
/// <remarks>Introduced in v0.5.2</remarks>
public bool OPDSEnabled { get; set; }
/// <summary>
/// Total number of files in the instance
/// </summary>
/// <remarks>Introduced in v0.5.2</remarks>
public int TotalFiles { get; set; }
/// <summary>
/// Total number of Genres in the instance
/// </summary>
/// <remarks>Introduced in v0.5.4</remarks>
public int TotalGenres { get; set; }
/// <summary>
/// Total number of People in the instance
/// </summary>
/// <remarks>Introduced in v0.5.4</remarks>
public int TotalPeople { get; set; }
/// <summary>
/// Number of users on this instance using Card Layout
/// </summary>
/// <remarks>Introduced in v0.5.4</remarks>
public int UsersOnCardLayout { get; set; }
/// <summary>
/// Number of users on this instance using List Layout
/// </summary>
/// <remarks>Introduced in v0.5.4</remarks>
public int UsersOnListLayout { get; set; }
/// <summary>
/// Max number of Series for any library on the instance
/// </summary>
/// <remarks>Introduced in v0.5.4</remarks>
public int MaxSeriesInALibrary { get; set; }
/// <summary>
/// Max number of Volumes for any library on the instance
/// </summary>
/// <remarks>Introduced in v0.5.4</remarks>
public int MaxVolumesInASeries { get; set; }
/// <summary>
/// Max number of Chapters for any library on the instance
/// </summary>
/// <remarks>Introduced in v0.5.4</remarks>
public int MaxChaptersInASeries { get; set; }
/// <summary>
/// Does this instance have relationships setup between series
/// </summary>
/// <remarks>Introduced in v0.5.4</remarks>
public bool UsingSeriesRelationships { get; set; }
/// <summary>
/// A list of background colors set on the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
public required IEnumerable<string> MangaReaderBackgroundColors { get; set; }
/// <summary>
/// A list of Page Split defaults being used on the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
public required IEnumerable<PageSplitOption> MangaReaderPageSplittingModes { get; set; }
/// <summary>
/// A list of Layout Mode defaults being used on the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
public required IEnumerable<LayoutMode> MangaReaderLayoutModes { get; set; }
/// <summary>
/// A list of file formats existing in the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
public required IEnumerable<FileFormatDto> FileFormats { get; set; }
/// <summary>
/// If there is at least one user that is using an age restricted profile on the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
public bool UsingRestrictedProfiles { get; set; }
/// <summary>
/// Number of users using the Emulate Comic Book setting
/// </summary>
/// <remarks>Introduced in v0.7.0</remarks>
public int UsersWithEmulateComicBook { get; set; }
/// <summary>
/// Percent (0.0-1.0) of libraries with folder watching enabled
/// </summary>
/// <remarks>Introduced in v0.7.0</remarks>
public float PercentOfLibrariesWithFolderWatchingEnabled { get; set; }
/// <summary>
/// Percent (0.0-1.0) of libraries included in Search
/// </summary>
/// <remarks>Introduced in v0.7.0</remarks>
public float PercentOfLibrariesIncludedInSearch { get; set; }
/// <summary>
/// Percent (0.0-1.0) of libraries included in Recommended
/// </summary>
/// <remarks>Introduced in v0.7.0</remarks>
public float PercentOfLibrariesIncludedInRecommended { get; set; }
/// <summary>
/// Percent (0.0-1.0) of libraries included in Dashboard
/// </summary>
/// <remarks>Introduced in v0.7.0</remarks>
public float PercentOfLibrariesIncludedInDashboard { get; set; }
/// <summary>
/// Total reading hours of all users
/// </summary>
/// <remarks>Introduced in v0.7.0</remarks>
public long TotalReadingHours { get; set; }
/// <summary>
/// The encoding the server is using to save media
/// </summary>
/// <remarks>Added in v0.7.3</remarks>
public EncodeFormat EncodeMediaAs { get; set; }
/// <summary>
/// The last user reading progress on the server (in UTC)
/// </summary>
/// <remarks>Added in v0.7.4</remarks>
public DateTime LastReadTime { get; set; }
}

View file

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using API.Entities.Enums;
namespace API.DTOs.Stats.V3;
public class LibraryStatV3
{
public bool IncludeInDashboard { get; set; }
public bool IncludeInSearch { get; set; }
public bool UsingFolderWatching { get; set; }
/// <summary>
/// Are any exclude patterns setup
/// </summary>
public bool UsingExcludePatterns { get; set; }
/// <summary>
/// Will this library create collections from ComicInfo
/// </summary>
public bool CreateCollectionsFromMetadata { get; set; }
/// <summary>
/// Will this library create reading lists from ComicInfo
/// </summary>
public bool CreateReadingListsFromMetadata { get; set; }
/// <summary>
/// Type of the Library
/// </summary>
public LibraryType LibraryType { get; set; }
public ICollection<FileTypeGroup> FileTypes { get; set; }
/// <summary>
/// Last time library was fully scanned
/// </summary>
public DateTime LastScanned { get; set; }
/// <summary>
/// Number of folders the library has
/// </summary>
public int NumberOfFolders { get; set; }
}

View file

@ -0,0 +1,12 @@
using API.Entities.Enums;
namespace API.DTOs.Stats.V3;
/// <summary>
/// KavitaStats - Information about Series Relationships
/// </summary>
public class RelationshipStatV3
{
public int Count { get; set; }
public RelationKind Relationship { get; set; }
}

View file

@ -0,0 +1,141 @@
using System;
using System.Collections.Generic;
using API.Entities.Enums;
namespace API.DTOs.Stats.V3;
/// <summary>
/// Represents information about a Kavita Installation for Kavita Stats v3 API
/// </summary>
public class ServerInfoV3Dto
{
/// <summary>
/// Unique Id that represents a unique install
/// </summary>
public required string InstallId { get; set; }
public required string Os { get; set; }
/// <summary>
/// If the Kavita install is using Docker
/// </summary>
public bool IsDocker { get; set; }
/// <summary>
/// Version of .NET instance is running
/// </summary>
public required string DotnetVersion { get; set; }
/// <summary>
/// Version of Kavita
/// </summary>
public required string KavitaVersion { get; set; }
/// <summary>
/// Version of Kavita on Installation
/// </summary>
public required string InitialKavitaVersion { get; set; }
/// <summary>
/// Date of first Installation
/// </summary>
public DateTime InitialInstallDate { get; set; }
/// <summary>
/// Number of Cores on the instance
/// </summary>
public int NumOfCores { get; set; }
/// <summary>
/// OS locale on the instance
/// </summary>
public string OsLocale { get; set; }
/// <summary>
/// Milliseconds to open a random archive (zip/cbz) for reading
/// </summary>
public long TimeToOpeCbzMs { get; set; }
/// <summary>
/// Number of pages for said archive (zip/cbz)
/// </summary>
public long TimeToOpenCbzPages { get; set; }
/// <summary>
/// Milliseconds to get a response from KavitaStats API
/// </summary>
/// <remarks>This pings a health check and does not capture any IP Information</remarks>
public long TimeToPingKavitaStatsApi { get; set; }
#region Media
/// <summary>
/// Number of collections on the install
/// </summary>
public int NumberOfCollections { get; set; }
/// <summary>
/// Number of reading lists on the install (Sum of all users)
/// </summary>
public int NumberOfReadingLists { get; set; }
/// <summary>
/// Total number of files in the instance
/// </summary>
public int TotalFiles { get; set; }
/// <summary>
/// Total number of Genres in the instance
/// </summary>
public int TotalGenres { get; set; }
/// <summary>
/// Total number of Series in the instance
/// </summary>
public int TotalSeries { get; set; }
/// <summary>
/// Total number of Libraries in the instance
/// </summary>
public int TotalLibraries { get; set; }
/// <summary>
/// Total number of People in the instance
/// </summary>
public int TotalPeople { get; set; }
/// <summary>
/// Max number of Series for any library on the instance
/// </summary>
public int MaxSeriesInALibrary { get; set; }
/// <summary>
/// Max number of Volumes for any library on the instance
/// </summary>
public int MaxVolumesInASeries { get; set; }
/// <summary>
/// Max number of Chapters for any library on the instance
/// </summary>
public int MaxChaptersInASeries { get; set; }
/// <summary>
/// Everything about the Libraries on the instance
/// </summary>
public IList<LibraryStatV3> Libraries { get; set; }
/// <summary>
/// Everything around Series Relationships between series
/// </summary>
public IList<RelationshipStatV3> Relationships { get; set; }
#endregion
#region Server
/// <summary>
/// Is OPDS enabled
/// </summary>
public bool OpdsEnabled { get; set; }
/// <summary>
/// The encoding the server is using to save media
/// </summary>
public EncodeFormat EncodeMediaAs { get; set; }
/// <summary>
/// The last user reading progress on the server (in UTC)
/// </summary>
public DateTime LastReadTime { get; set; }
/// <summary>
/// Is this server using Kavita+
/// </summary>
public bool ActiveKavitaPlusSubscription { get; set; }
#endregion
#region Users
/// <summary>
/// If there is at least one user that is using an age restricted profile on the instance
/// </summary>
/// <remarks>Introduced in v0.6.0</remarks>
public bool UsingRestrictedProfiles { get; set; }
public IList<UserStatV3> Users { get; set; }
#endregion
}

View file

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using API.Data.Misc;
using API.Entities.Enums.Device;
namespace API.DTOs.Stats.V3;
public class UserStatV3
{
public AgeRestriction AgeRestriction { get; set; }
/// <summary>
/// The last reading progress on the server (in UTC)
/// </summary>
public DateTime LastReadTime { get; set; }
/// <summary>
/// The last login on the server (in UTC)
/// </summary>
public DateTime LastLogin { get; set; }
/// <summary>
/// Has the user gone through email confirmation
/// </summary>
public bool IsEmailConfirmed { get; set; }
/// <summary>
/// Is the Email a valid address
/// </summary>
public bool HasValidEmail { get; set; }
/// <summary>
/// Float between 0-1 to showcase how much of the libraries a user has access to
/// </summary>
public float PercentageOfLibrariesHasAccess { get; set; }
/// <summary>
/// Number of reading lists this user created
/// </summary>
public int ReadingListsCreatedCount { get; set; }
/// <summary>
/// Number of collections this user created
/// </summary>
public int CollectionsCreatedCount { get; set; }
/// <summary>
/// Number of series in want to read for this user
/// </summary>
public int WantToReadSeriesCount { get; set; }
/// <summary>
/// Active locale for the user
/// </summary>
public string Locale { get; set; }
/// <summary>
/// Active Theme (name)
/// </summary>
public string ActiveTheme { get; set; }
/// <summary>
/// Number of series with Bookmarks created
/// </summary>
public int SeriesBookmarksCreatedCount { get; set; }
/// <summary>
/// Kavita+ only - Has an AniList Token set
/// </summary>
public bool HasAniListToken { get; set; }
/// <summary>
/// Kavita+ only - Has a MAL Token set
/// </summary>
public bool HasMALToken { get; set; }
/// <summary>
/// Number of Smart Filters a user has created
/// </summary>
public int SmartFilterCreatedCount { get; set; }
/// <summary>
/// Is the user sharing reviews
/// </summary>
public bool IsSharingReviews { get; set; }
/// <summary>
/// The number of devices setup and their platforms
/// </summary>
public ICollection<DevicePlatform> DevicePlatforms { get; set; }
/// <summary>
/// Roles for this user
/// </summary>
public ICollection<string> Roles { get; set; }
}