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