From 2068c5393e130d51d7bf2ae948b1fcb254c7106f Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 3 Mar 2024 13:44:47 +0200 Subject: [PATCH] Fixed: URL Base setting for Kodi connections --- src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs | 2 +- src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs b/src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs index 028a64a18..7f5ddb780 100644 --- a/src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs @@ -75,7 +75,7 @@ namespace NzbDrone.Core.Notifications.Xbmc private string ProcessRequest(XbmcSettings settings, string method, params object[] parameters) { - var url = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, "jsonrpc"); + var url = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, settings.UrlBase); var requestBuilder = new JsonRpcRequestBuilder(url, method, parameters); requestBuilder.LogResponseContent = true; diff --git a/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs index 2d54157f2..97331f333 100644 --- a/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs @@ -14,16 +14,18 @@ namespace NzbDrone.Core.Notifications.Xbmc { RuleFor(c => c.Host).ValidHost(); RuleFor(c => c.DisplayTime).GreaterThanOrEqualTo(2); + RuleFor(c => c.UrlBase).ValidUrlBase(); } } public class XbmcSettings : IProviderConfig { - private static readonly XbmcSettingsValidator Validator = new XbmcSettingsValidator(); + private static readonly XbmcSettingsValidator Validator = new (); public XbmcSettings() { Port = 8080; + UrlBase = "/jsonrpc"; DisplayTime = 5; } @@ -65,7 +67,7 @@ namespace NzbDrone.Core.Notifications.Xbmc public bool AlwaysUpdate { get; set; } [JsonIgnore] - public string Address => $"{Host.ToUrlHost()}:{Port}"; + public string Address => $"{Host.ToUrlHost()}:{Port}{UrlBase}"; public NzbDroneValidationResult Validate() {