1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01: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:
Qstick 2023-04-22 20:18:22 -05:00
parent cc285fab45
commit a7ba1a6454
7 changed files with 63 additions and 66 deletions

View File

@ -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" />

View File

@ -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
{

View File

@ -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)

View File

@ -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>();

View File

@ -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" />

View File

@ -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" />

View File

@ -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>