diff --git a/WebDavClientService.cs b/WebDavClientService.cs
index fb3a6af..2b0276b 100644
--- a/WebDavClientService.cs
+++ b/WebDavClientService.cs
@@ -8,31 +8,55 @@ namespace Jellyfin.Plugin.Webdav
using System;
using System.Collections.Generic;
using System.IO;
+ using System.Net;
using System.Threading.Tasks;
using Jellyfin.Plugin.Webdav.Configuration;
+ using WebDav.Client;
///
/// Service for interacting with WebDAV endpoints.
///
public sealed class WebDavClientService
{
- private readonly PluginConfiguration _configuration;
+ private readonly PluginConfiguration _config;
+ private readonly WebDavClient _client;
- public WebDavClientService(PluginConfiguration configuration)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Plugin configuration.
+ public WebDavClientService(PluginConfiguration config)
{
- _configuration = configuration;
+ _config = config;
+ var parameters = new WebDavClientParams
+ {
+ BaseAddress = new Uri(_config.BaseUrl.TrimEnd('/')),
+ Credentials = new NetworkCredential(_config.Username, _config.Password),
+ PreAuthenticate = true
+ };
+ _client = new WebDavClient(parameters);
}
- /// List resources at the specified WebDAV path.
- public Task> ListAsync(string path)
+ ///
+ /// Lists resources at the specified WebDAV path.
+ ///
+ /// Remote path.
+ /// A collection of WebDAV resources.
+ public async Task> ListAsync(string path)
{
- return Task.FromResult>(Array.Empty