mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
parent
8519b64947
commit
ae88645180
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System;
|
||||
using FluentValidation.Results;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using RestSharp;
|
||||
using NzbDrone.Core.Rest;
|
||||
using NzbDrone.Common.Serializer;
|
||||
@ -75,7 +76,11 @@ private void SendNotification(string title, string message, RestRequest request,
|
||||
|
||||
var client = RestClientFactory.BuildClient(URL);
|
||||
|
||||
if (!string.IsNullOrEmpty(settings.DeviceIds))
|
||||
if (settings.DeviceNames.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
request.AddParameter("deviceNames", settings.DeviceNames);
|
||||
}
|
||||
else if (settings.DeviceIds.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
request.AddParameter("deviceIds", settings.DeviceIds);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using FluentValidation;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
@ -10,7 +10,7 @@ public class JoinSettingsValidator : AbstractValidator<JoinSettings>
|
||||
public JoinSettingsValidator()
|
||||
{
|
||||
RuleFor(s => s.ApiKey).NotEmpty();
|
||||
RuleFor(s => s.DeviceIds).Matches(@"\A\S+\z").When(s => !string.IsNullOrEmpty(s.DeviceIds));
|
||||
RuleFor(s => s.DeviceIds).Empty().WithMessage("Use Device Names instead");
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,9 +21,12 @@ public class JoinSettings : IProviderConfig
|
||||
[FieldDefinition(0, Label = "API Key", HelpText = "The API Key from your Join account settings (click Join API button).", HelpLink = "https://joinjoaomgcd.appspot.com/")]
|
||||
public string ApiKey { get; set; }
|
||||
|
||||
[FieldDefinition(1, Label = "Device IDs", HelpText = "Comma separated list of Device IDs you'd like to send notifications to. If unset, all devices will receive notifications.", HelpLink = "https://joinjoaomgcd.appspot.com/")]
|
||||
[FieldDefinition(1, Label = "Device IDs", HelpText = "Deprecated, use Device Names instead. Comma separated list of Device IDs you'd like to send notifications to. If unset, all devices will receive notifications.")]
|
||||
public string DeviceIds { get; set; }
|
||||
|
||||
[FieldDefinition(2, Label = "Device Names", HelpText = "Comma separated list of full or partial device names you'd like to send notifications to. If unset, all devices will receive notifications.", HelpLink = "https://joaoapps.com/join/api/")]
|
||||
public string DeviceNames { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
|
Loading…
Reference in New Issue
Block a user