mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Update SixLabors.ImageSharp, MailKit, DryIoc libraries
Closes #8282 Co-Authored-By: Stepan Goremykin <25577658+goremykin@users.noreply.github.com>
This commit is contained in:
parent
cc285fab45
commit
a7ba1a6454
@ -4,7 +4,7 @@
|
||||
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64' or '$(RuntimeIdentifier)' == 'linux-musl-arm64'">ISMUSL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DryIoc.dll" Version="5.3.0" />
|
||||
<PackageReference Include="DryIoc.dll" Version="5.3.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
|
@ -42,11 +42,9 @@ public void Resize(string source, string destination, int height)
|
||||
|
||||
try
|
||||
{
|
||||
using (var image = Image.Load(source))
|
||||
{
|
||||
image.Mutate(x => x.Resize(0, height));
|
||||
image.Save(destination);
|
||||
}
|
||||
using var image = Image.Load(source);
|
||||
image.Mutate(x => x.Resize(0, height));
|
||||
image.Save(destination);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -83,23 +83,6 @@ public override ValidationResult Test()
|
||||
return new ValidationResult(failures);
|
||||
}
|
||||
|
||||
public ValidationFailure Test(EmailSettings settings)
|
||||
{
|
||||
const string body = "Success! You have properly configured your email notification settings";
|
||||
|
||||
try
|
||||
{
|
||||
SendEmail(settings, "Radarr - Test Notification", body);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Unable to send test email");
|
||||
return new ValidationFailure("Server", "Unable to send test email");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void SendEmail(EmailSettings settings, string subject, string body, bool htmlBody = false)
|
||||
{
|
||||
var email = new MimeMessage();
|
||||
@ -129,52 +112,67 @@ private void SendEmail(EmailSettings settings, string subject, string body, bool
|
||||
throw;
|
||||
}
|
||||
|
||||
_logger.Debug("Finished sending email. Subject: {0}", email.Subject);
|
||||
_logger.Debug("Finished sending email. Subject: {0}", subject);
|
||||
}
|
||||
|
||||
private void Send(MimeMessage email, EmailSettings settings)
|
||||
{
|
||||
using (var client = new SmtpClient())
|
||||
using var client = new SmtpClient();
|
||||
client.Timeout = 10000;
|
||||
|
||||
var serverOption = SecureSocketOptions.Auto;
|
||||
|
||||
if (settings.RequireEncryption)
|
||||
{
|
||||
client.Timeout = 10000;
|
||||
|
||||
var serverOption = SecureSocketOptions.Auto;
|
||||
|
||||
if (settings.RequireEncryption)
|
||||
if (settings.Port == 465)
|
||||
{
|
||||
if (settings.Port == 465)
|
||||
{
|
||||
serverOption = SecureSocketOptions.SslOnConnect;
|
||||
}
|
||||
else
|
||||
{
|
||||
serverOption = SecureSocketOptions.StartTls;
|
||||
}
|
||||
serverOption = SecureSocketOptions.SslOnConnect;
|
||||
}
|
||||
|
||||
client.ServerCertificateValidationCallback = _certificateValidationService.ShouldByPassValidationError;
|
||||
|
||||
_logger.Debug("Connecting to mail server");
|
||||
|
||||
client.Connect(settings.Server, settings.Port, serverOption);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(settings.Username))
|
||||
else
|
||||
{
|
||||
_logger.Debug("Authenticating to mail server");
|
||||
|
||||
client.Authenticate(settings.Username, settings.Password);
|
||||
serverOption = SecureSocketOptions.StartTls;
|
||||
}
|
||||
|
||||
_logger.Debug("Sending to mail server");
|
||||
|
||||
client.Send(email);
|
||||
|
||||
_logger.Debug("Sent to mail server, disconnecting");
|
||||
|
||||
client.Disconnect(true);
|
||||
|
||||
_logger.Debug("Disconnecting from mail server");
|
||||
}
|
||||
|
||||
client.ServerCertificateValidationCallback = _certificateValidationService.ShouldByPassValidationError;
|
||||
|
||||
_logger.Debug("Connecting to mail server");
|
||||
|
||||
client.Connect(settings.Server, settings.Port, serverOption);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(settings.Username))
|
||||
{
|
||||
_logger.Debug("Authenticating to mail server");
|
||||
|
||||
client.Authenticate(settings.Username, settings.Password);
|
||||
}
|
||||
|
||||
_logger.Debug("Sending to mail server");
|
||||
|
||||
client.Send(email);
|
||||
|
||||
_logger.Debug("Sent to mail server, disconnecting");
|
||||
|
||||
client.Disconnect(true);
|
||||
|
||||
_logger.Debug("Disconnecting from mail server");
|
||||
}
|
||||
|
||||
public ValidationFailure Test(EmailSettings settings)
|
||||
{
|
||||
const string body = "Success! You have properly configured your email notification settings";
|
||||
|
||||
try
|
||||
{
|
||||
SendEmail(settings, "Radarr - Test Notification", body);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Unable to send test email");
|
||||
return new ValidationFailure("Server", "Unable to send test email");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private MailboxAddress ParseAddress(string type, string address)
|
||||
|
@ -32,7 +32,8 @@ public class EmailSettings : IProviderConfig
|
||||
|
||||
public EmailSettings()
|
||||
{
|
||||
Port = 567;
|
||||
Port = 587;
|
||||
|
||||
To = Array.Empty<string>();
|
||||
Cc = Array.Empty<string>();
|
||||
Bcc = Array.Empty<string>();
|
||||
|
@ -5,7 +5,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||
<PackageReference Include="Equ" Version="2.3.0" />
|
||||
<PackageReference Include="MailKit" Version="2.15.0" />
|
||||
<PackageReference Include="MailKit" Version="3.6.0" />
|
||||
<PackageReference Include="Npgsql" Version="6.0.3" />
|
||||
<PackageReference Include="Servarr.FFMpegCore" Version="4.7.0-26" />
|
||||
<PackageReference Include="Servarr.FFprobe" Version="5.1.2.106" />
|
||||
@ -17,7 +17,7 @@
|
||||
<PackageReference Include="Servarr.FluentMigrator.Runner.SQLite" Version="3.3.2.9" />
|
||||
<PackageReference Include="Servarr.FluentMigrator.Runner.Postgres" Version="3.3.2.9" />
|
||||
<PackageReference Include="FluentValidation" Version="8.6.2" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="NLog" Version="5.0.1" />
|
||||
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
|
||||
|
@ -7,8 +7,8 @@
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.3.0" />
|
||||
<PackageReference Include="DryIoc.dll" Version="5.3.0" />
|
||||
<PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="6.1.0" />
|
||||
<PackageReference Include="DryIoc.dll" Version="5.3.4" />
|
||||
<PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="6.1.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NzbDrone.Common\Radarr.Common.csproj" />
|
||||
|
@ -4,8 +4,8 @@
|
||||
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DryIoc.dll" Version="5.3.0" />
|
||||
<PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="6.1.0" />
|
||||
<PackageReference Include="DryIoc.dll" Version="5.3.4" />
|
||||
<PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="6.1.1" />
|
||||
<PackageReference Include="NLog" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user