aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Startup.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-08-05 09:46:33 -0500
committerGitHub <noreply@github.com>2021-08-05 09:46:33 -0500
commitadca7674d78c73ef2f2bd505bd4652460794826c (patch)
treee1a8812a3797b36846b5e00c53e478b938989dc2 /src/slskd/Startup.cs
parentfdded3572f465c2ddc3110c0927711537215fd58 (diff)
parentd33a280c2307925aa68102beaa2e61a38f8e7e6c (diff)
downloadslskd-adca7674d78c73ef2f2bd505bd4652460794826c.tar.gz
Merge pull request #140 from slskd/share-hash
Make shared file cache fill asynchronous, enable re-scanning shares at runtime via API
Diffstat (limited to 'src/slskd/Startup.cs')
-rw-r--r--src/slskd/Startup.cs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs
index dcbf0a16..ef955df9 100644
--- a/src/slskd/Startup.cs
+++ b/src/slskd/Startup.cs
@@ -104,9 +104,10 @@ namespace slskd
return true;
});
- // add IStateMonitor to DI, to track application state in an observable way. similar to IOptionsMonitor,
- // but state is managed by the application itself. Usage is roughly the same.
- services.AddSingleton<IStateMonitor, StateMonitor>();
+ // add IStateMonitor instance to DI, to track application state in an observable way.
+ // similar to IOptionsMonitor, but state is managed by the application itself.
+ // Usage is roughly the same.
+ services.AddSingleton<IStateMonitor<ApplicationState>, StateMonitor<ApplicationState>>();
services.AddCors(options => options.AddPolicy("AllowAll", builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()));
@@ -205,8 +206,8 @@ namespace slskd
services.AddSingleton<IBrowseTracker, BrowseTracker>();
services.AddSingleton<IConversationTracker, ConversationTracker>();
services.AddSingleton<IRoomTracker, RoomTracker>(_ => new RoomTracker(messageLimit: 250));
- services.AddSingleton<ISharedFileCache>(_ =>
- new SharedFileCache(OptionsAtStartup.Directories.Shared, 3600000));
+
+ services.AddSingleton<ISharedFileCache, SharedFileCache>();
services.AddSingleton<ISearchService, SearchService>();
services.AddSingleton<IPeerService, PeerService>();
@@ -217,8 +218,8 @@ namespace slskd
services.AddSingleton<IPushbulletService, PushbulletService>();
- services.AddHostedService<Service>();
- services.AddSingleton(_ => Service.SoulseekClient);
+ services.AddHostedService<Application>();
+ services.AddSingleton(_ => Application.SoulseekClient);
}
/// <summary>