diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-06-02 08:38:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-02 08:38:47 -0500 |
| commit | 2bd24b38f046d9e7b37825db6af2756e43ba0dfc (patch) | |
| tree | fd1f5b246cdc8597e4bc9176fd70bb6067bebfe9 /src/slskd/State.cs | |
| parent | 1a6075b612dd5067eb4e8376ac9034050ad74477 (diff) | |
| parent | 9e0013c0317adbaa007fce8dbea06928b1d159ef (diff) | |
| download | slskd-2bd24b38f046d9e7b37825db6af2756e43ba0dfc.tar.gz | |
Merge pull request #493 from slskd/shares
Add a 'Shares' tab to the 'System' page, along with a button to rescan shares
Diffstat (limited to 'src/slskd/State.cs')
| -rw-r--r-- | src/slskd/State.cs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/slskd/State.cs b/src/slskd/State.cs index 0daa5d76..10ed80f6 100644 --- a/src/slskd/State.cs +++ b/src/slskd/State.cs @@ -21,6 +21,7 @@ namespace slskd using System.Collections.Generic; using System.Net; using System.Text.Json.Serialization; + using slskd.Shares; using slskd.Users; using Soulseek; @@ -32,10 +33,9 @@ namespace slskd public VersionState Version { get; init; } = new VersionState(); public bool PendingReconnect { get; init; } public bool PendingRestart { get; init; } - public bool PendingShareRescan { get; init; } public ServerState Server { get; init; } = new ServerState(); public DistributedNetworkState DistributedNetwork { get; init; } = new DistributedNetworkState(); - public SharedFileCacheState SharedFileCache { get; init; } = new SharedFileCacheState(); + public ShareState Shares { get; init; } = new ShareState(); public string[] Rooms { get; init; } = Array.Empty<string>(); public User[] Users { get; init; } = Array.Empty<User>(); } @@ -69,15 +69,25 @@ namespace slskd public string BranchRoot { get; init; } public bool CanAcceptChildren { get; init; } public int ChildLimit { get; init; } - public IReadOnlyCollection<string> Children { get; init; } + public IReadOnlyCollection<string> Children { get; init; } = new List<string>().AsReadOnly(); public bool HasParent { get; init; } public bool IsBranchRoot { get; init; } public string Parent { get; init; } } /// <summary> - /// Share cache state. + /// Share state. /// </summary> + public record ShareState + { + public bool ScanPending { get; init; } + public bool Scanning { get; init; } + public bool Faulted { get; init; } + public double ScanProgress { get; init; } + public int Directories { get; init; } + public int Files { get; init; } + } + public record SharedFileCacheState { /// <summary> @@ -114,5 +124,10 @@ namespace slskd /// Gets the number of directories excluded by filters. /// </summary> public int ExcludedDirectories { get; init; } + + /// <summary> + /// Gets the list of shares stored in the cache. + /// </summary> + public IReadOnlyCollection<Share> Shares { get; init; } = new List<Share>().AsReadOnly(); } }
\ No newline at end of file |
