From 7c5fc1e4b017129668bf8777de67cb0a9d85fad7 Mon Sep 17 00:00:00 2001 From: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com> Date: Sat, 24 Apr 2021 18:43:26 +0100 Subject: [PATCH] New: Adds SSL option to Kodi connections (#6219) --- .../Notifications/Xbmc/XbmcJsonApiProxy.cs | 2 +- .../Notifications/Xbmc/XbmcSettings.cs | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs b/src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs index 153cad05d..3e69370be 100644 --- a/src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/XbmcJsonApiProxy.cs @@ -75,7 +75,7 @@ public List GetMovies(XbmcSettings settings) private string ProcessRequest(XbmcSettings settings, string method, params object[] parameters) { - var url = string.Format(@"http://{0}/jsonrpc", settings.Address); + var url = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, "jsonrpc"); 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 0898a1ecd..0355b84b1 100644 --- a/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs @@ -32,26 +32,29 @@ public XbmcSettings() [FieldDefinition(1, Label = "Port")] public int Port { get; set; } - [FieldDefinition(2, Label = "Username", Privacy = PrivacyLevel.UserName)] + [FieldDefinition(2, Label = "Use SSL", Type = FieldType.Checkbox, HelpText = "Connect to Kodi over HTTPS instead of HTTP")] + public bool UseSsl { get; set; } + + [FieldDefinition(3, Label = "Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(3, Label = "Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(4, Label = "Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] public string Password { get; set; } [DefaultValue(5)] - [FieldDefinition(4, Label = "Display Time", HelpText = "How long the notification will be displayed for (In seconds)")] + [FieldDefinition(5, Label = "Display Time", HelpText = "How long the notification will be displayed for (In seconds)")] public int DisplayTime { get; set; } - [FieldDefinition(5, Label = "GUI Notification", Type = FieldType.Checkbox)] + [FieldDefinition(6, Label = "GUI Notification", Type = FieldType.Checkbox)] public bool Notify { get; set; } - [FieldDefinition(6, Label = "Update Library", HelpText = "Update Library on Import & Rename?", Type = FieldType.Checkbox)] + [FieldDefinition(7, Label = "Update Library", HelpText = "Update Library on Import & Rename?", Type = FieldType.Checkbox)] public bool UpdateLibrary { get; set; } - [FieldDefinition(7, Label = "Clean Library", HelpText = "Clean Library after update?", Type = FieldType.Checkbox)] + [FieldDefinition(8, Label = "Clean Library", HelpText = "Clean Library after update?", Type = FieldType.Checkbox)] public bool CleanLibrary { get; set; } - [FieldDefinition(8, Label = "Always Update", HelpText = "Update Library even when a video is playing?", Type = FieldType.Checkbox)] + [FieldDefinition(9, Label = "Always Update", HelpText = "Update Library even when a video is playing?", Type = FieldType.Checkbox)] public bool AlwaysUpdate { get; set; } [JsonIgnore]