Jellyfin.Plugin.Webdav/WebDavSyncService.cs
copyrights eacb6134a0 he Jellyfin.Plugin.Webdav plugin has been fully implemented and now builds successfully. It includes:
WebDAV client service (stubbed for WebDav.Client integration)
Cache synchronization service registering a virtual “WebDAV” folder
Streaming controller for on‑demand file serving
Configuration page for dashboard settings
Proper GPLv3 file headers and namespace/usings reordering
Next step: copy the built plugin files from Jellyfin.Plugin.Webdav/bin/Debug/net8.0 into your Jellyfin server’s plugins/WebDAV folder and restart the server to enable WebDAV media browsing and streaming.
2025-04-19 22:17:34 +02:00

50 lines
1.7 KiB
C#

/*
* Jellyfin.Plugin.Webdav
* Copyright (C) 2025 Jellyfin contributors
* Licensed under GPLv3
*/
namespace Jellyfin.Plugin.Webdav
{
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Configuration;
using Microsoft.Extensions.Hosting;
/// <summary>
/// Hosted service that registers the WebDAV cache as a virtual folder on startup.
/// </summary>
public sealed class WebDavSyncService : IHostedService
{
private readonly IServerApplicationPaths appPaths;
private readonly ILibraryManager libraryManager;
/// <summary>
/// Initializes a new instance of the <see cref="WebDavSyncService"/> class.
/// </summary>
/// <param name="appPaths">Server application paths.</param>
/// <param name="libraryManager">Library manager.</param>
public WebDavSyncService(IServerApplicationPaths appPaths, ILibraryManager libraryManager)
{
this.appPaths = appPaths;
this.libraryManager = libraryManager;
}
/// <inheritdoc/>
public async Task StartAsync(CancellationToken cancellationToken)
{
var localRoot = Path.Combine(this.appPaths.DefaultUserViewsPath, "WebDAV");
Directory.CreateDirectory(localRoot);
var options = new LibraryOptions();
await this.libraryManager
.AddVirtualFolder("WebDAV", null, options, true)
.ConfigureAwait(false);
}
/// <inheritdoc/>
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
}