checkpoint
This commit is contained in:
parent
28bc6d6a28
commit
7a89d08fc3
|
|
@ -19,6 +19,8 @@ namespace Jellyfin.Plugin.Webdav
|
|||
/// <inheritdoc/>
|
||||
public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost)
|
||||
{
|
||||
// Register plugin configuration instance
|
||||
serviceCollection.AddSingleton<Configuration.PluginConfiguration>(_ => WebdavPlugin.Instance.Configuration);
|
||||
serviceCollection.AddSingleton<WebDavClientService>();
|
||||
serviceCollection.AddHostedService<WebDavSyncService>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Jellyfin.Plugin.Webdav
|
|||
/// </summary>
|
||||
/// <param name="path">Remote path.</param>
|
||||
/// <returns>A collection of WebDAV resources.</returns>
|
||||
public async Task<IEnumerable<WebDavResource>> ListAsync(string path)
|
||||
public async Task<IEnumerable<dynamic>> ListAsync(string path)
|
||||
{
|
||||
var response = await _client.Propfind(path).ConfigureAwait(false);
|
||||
return response.Resources;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
/*
|
||||
* Jellyfin.Plugin.Webdav
|
||||
* Copyright (C) 2025 Jellyfin contributors
|
||||
* Licensed under GPLv3
|
||||
*/
|
||||
namespace Jellyfin.Plugin.Webdav
|
||||
{
|
||||
using System.IO;
|
||||
using MediaBrowser.Controller;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Plugin.Webdav.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -46,7 +43,11 @@ namespace Jellyfin.Plugin.Webdav
|
|||
/// <inheritdoc/>
|
||||
public async Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var localRoot = config.CacheDirectory;
|
||||
// Determine cache root: either configured directory or default user views path
|
||||
var baseCache = string.IsNullOrWhiteSpace(config.CacheDirectory)
|
||||
? appPaths.DefaultUserViewsPath
|
||||
: config.CacheDirectory;
|
||||
var localRoot = Path.Combine(baseCache, "WebDAV");
|
||||
if (!Directory.Exists(localRoot))
|
||||
{
|
||||
Directory.CreateDirectory(localRoot);
|
||||
|
|
@ -57,7 +58,7 @@ namespace Jellyfin.Plugin.Webdav
|
|||
|
||||
var options = new LibraryOptions();
|
||||
await libraryManager
|
||||
.AddVirtualFolder("WebDAV", null, options, true)
|
||||
.AddVirtualFolder("WebDAV", new[] { localRoot }, options, true)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue