Compare commits

..

11 Commits

Author SHA1 Message Date
bakerboy448
ab4d80faa6 align mock with upstream 2025-10-30 12:06:17 -05:00
bakerboy448
a2afcff6df Fallback to host sqlite3 on FreeBSD and Linux
also align with upstream
2025-10-30 11:13:40 -05:00
bakerboy448
e4fb36e08f Bump to 2.3.0 2025-10-30 05:51:48 -05:00
Mark McDowall
ff22fdf7d3 Set known networks to RFC 1918 ranges during startup
(cherry picked from commit d10107739b9ed6a50165e5dd1dfae15c7e8aea56)
2025-10-29 23:42:00 +00:00
Polgonite
b3d46465ae Fixed: qBittorrent /login API success check 2025-10-29 17:59:58 -05:00
bakerboy448
eb57d20545 Bump to 2.2.0 2025-10-25 14:42:07 -05:00
bakerboy448
775b716c0f Fixed:(RuTracker) fix for Anime S01nd Episode N of N or N+N of N+N
Based on Jackett 5b712189fc55470dc94b56ea0d764e123e2dc432
2025-10-20 18:19:42 -05:00
bakerboy448
f7f3648dac Bump to 2.1.5 2025-10-13 19:42:22 -05:00
Bogdan
c669048767 Bump System.Data.SQLite, MailKit, Microsoft.Data.SqlClient, Newtonsoft.Json and Polly
(cherry picked from commit 86282d621b3edcbf3582d6321de8be4172d37ed2)
2025-10-05 12:18:14 -05:00
Bogdan
c282e4bef8 Pin System.Private.Uri to 4.3.2
(cherry picked from commit e0180e397d90db01e8cee0ee38419eb0b6bce989)
2025-10-05 12:18:14 -05:00
bakerboy448
574721bfb5 Bump to 2.1.4 2025-10-05 12:18:07 -05:00
8 changed files with 62 additions and 32 deletions

View File

@@ -9,7 +9,7 @@ variables:
testsFolder: './_tests'
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
majorVersion: '2.1.3'
majorVersion: '2.3.0'
minorVersion: $[counter('minorVersion', 1)]
prowlarrVersion: '$(majorVersion).$(minorVersion)'
buildName: '$(Build.SourceBranchName).$(prowlarrVersion)'

View File

@@ -14,7 +14,6 @@ namespace NzbDrone.Common.Composition
static AssemblyLoader()
{
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ContainerResolveEventHandler);
RegisterSQLiteResolver();
}
public static IList<Assembly> Load(IList<string> assemblyNames)
@@ -23,6 +22,10 @@ namespace NzbDrone.Common.Composition
toLoad.Add("Prowlarr.Common");
toLoad.Add(OsInfo.IsWindows ? "Prowlarr.Windows" : "Prowlarr.Mono");
var toRegisterResolver = new List<string> { "System.Data.SQLite" };
toRegisterResolver.AddRange(assemblyNames.Intersect(new[] { "Prowlarr.Core" }));
RegisterNativeResolver(toRegisterResolver);
var startupPath = AppDomain.CurrentDomain.BaseDirectory;
return toLoad
@@ -43,27 +46,46 @@ namespace NzbDrone.Common.Composition
return AssemblyLoadContext.Default.LoadFromAssemblyPath(assemblyPath);
}
public static void RegisterSQLiteResolver()
public static void RegisterNativeResolver(IEnumerable<string> assemblyNames)
{
// This ensures we look for sqlite3 using libsqlite3.so.0 on Linux and not libsqlite3.so which
// is less likely to exist.
var sqliteAssembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "System.Data.SQLite.dll"));
foreach (var name in assemblyNames)
{
// This ensures we look for sqlite3 using libsqlite3.so.0 on Linux and not libsqlite3.so which
// is less likely to exist.
var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{name}.dll"));
try
{
NativeLibrary.SetDllImportResolver(sqliteAssembly, LoadSqliteNativeLib);
}
catch (InvalidOperationException)
{
// This can only be set once per assembly
// Catch required for NzbDrone.Host tests
try
{
NativeLibrary.SetDllImportResolver(assembly, LoadNativeLib);
}
catch (InvalidOperationException)
{
// This can only be set once per assembly
// Catch required for NzbDrone.Host tests
}
}
}
private static IntPtr LoadSqliteNativeLib(string libraryName, Assembly assembly, DllImportSearchPath? dllImportSearchPath)
private static IntPtr LoadNativeLib(string libraryName, Assembly assembly, DllImportSearchPath? dllImportSearchPath)
{
var mappedName = OsInfo.IsLinux && libraryName == "sqlite3" ? "libsqlite3.so.0" : libraryName;
ArgumentException.ThrowIfNullOrWhiteSpace(libraryName);
var mappedName = libraryName;
if (libraryName is "sqlite3" or "e_sqlite3")
{
if (OsInfo.IsLinux)
{
if (NativeLibrary.TryLoad(libraryName, assembly, dllImportSearchPath, out var libHandle))
{
return libHandle;
}
mappedName = "libsqlite3.so.0";
}
}
return NativeLibrary.Load(mappedName, assembly, dllImportSearchPath);
}
}

View File

@@ -8,7 +8,7 @@
<PackageReference Include="IPAddressRange" Version="6.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="NLog.Layouts.ClefJsonLayout" Version="1.0.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.4.0" />
@@ -17,7 +17,8 @@
<PackageReference Include="NLog.Targets.Syslog" Version="7.0.0" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
<PackageReference Include="System.Data.SQLite" Version="2.0.1" />
<PackageReference Include="System.Data.SQLite" Version="2.0.2" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Text.Json" Version="8.0.6" />
<PackageReference Include="System.ValueTuple" Version="4.6.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />

View File

@@ -424,8 +424,8 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
}
catch (HttpException ex)
{
_logger.Debug("qbitTorrent authentication failed.");
if (ex.Response.StatusCode == HttpStatusCode.Forbidden)
_logger.Debug(ex, "qbitTorrent authentication failed.");
if (ex.Response.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
{
throw new DownloadClientAuthenticationException("Failed to authenticate with qBittorrent.", ex);
}
@@ -437,9 +437,9 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
throw new DownloadClientUnavailableException("Failed to connect to qBittorrent, please check your settings.", ex);
}
if (response.Content != "Ok.")
// returns "Fails." on bad login
if (response.Content.IsNotNullOrWhiteSpace() && response.Content != "Ok.")
{
// returns "Fails." on bad login
_logger.Debug("qbitTorrent authentication failed.");
throw new DownloadClientAuthenticationException("Failed to authenticate with qBittorrent.");
}

View File

@@ -1541,7 +1541,7 @@ namespace NzbDrone.Core.Indexers.Definitions
if (season != 0)
{
searchString += " Сезон: " + season;
searchString += " ТВ | Сезон: " + season;
}
parameters.Set("nm", searchString);
@@ -1712,6 +1712,8 @@ namespace NzbDrone.Core.Indexers.Definitions
private readonly Regex _tvTitleRusSeasonRegex = new(@"Сезон\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusEpisodeOfRegex = new(@"(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)\s*из\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusEpisodeRegex = new(@"(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusSeasonAnimeRegex = new(@"ТВ[-]*(?:(\d+))", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusEpisodeAnimeOfRegex = new(@"\[(\d+(\+\d+)?)\s+из\s+(\d+(\+\d+)?)\]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public string Parse(string title,
ICollection<IndexerCategory> categories,
@@ -1736,6 +1738,8 @@ namespace NzbDrone.Core.Indexers.Definitions
title = _tvTitleRusSeasonRegex.Replace(title, "S$1");
title = _tvTitleRusEpisodeOfRegex.Replace(title, "E$1 of $2");
title = _tvTitleRusEpisodeRegex.Replace(title, "E$1");
title = _tvTitleRusSeasonAnimeRegex.Replace(title, "S$1");
title = _tvTitleRusEpisodeAnimeOfRegex.Replace(title, "E$1 of $3");
}
else if (IsAnyMovieCategory(categories))
{

View File

@@ -6,13 +6,13 @@
<PackageReference Include="AngleSharp.Xml" Version="1.0.0" />
<PackageReference Include="Dapper" Version="2.1.66" />
<PackageReference Include="Diacritical.Net" Version="1.0.4" />
<PackageReference Include="MailKit" Version="4.13.0" />
<PackageReference Include="MailKit" Version="4.14.0" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="8.0.16" />
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="8.0.16" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.2" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.1" />
<PackageReference Include="NLog.Targets.Syslog" Version="7.0.0" />
<PackageReference Include="Npgsql" Version="9.0.3" />
<PackageReference Include="Polly" Version="8.6.3" />
<PackageReference Include="Polly" Version="8.6.4" />
<PackageReference Include="Servarr.FluentMigrator.Runner" Version="3.3.2.9" />
<PackageReference Include="Servarr.FluentMigrator.Runner.Postgres" Version="3.3.2.9" />
<PackageReference Include="Servarr.FluentMigrator.Runner.SQLite" Version="3.3.2.9" />
@@ -20,7 +20,7 @@
<PackageReference Include="System.Memory" Version="4.6.3" />
<PackageReference Include="System.ServiceModel.Syndication" Version="8.0.0" />
<PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="System.Text.Json" Version="8.0.6" />
<PackageReference Include="MonoTorrent" Version="2.0.7" />

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using DryIoc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
@@ -31,6 +32,7 @@ using Prowlarr.Http.ClientSchema;
using Prowlarr.Http.ErrorManagement;
using Prowlarr.Http.Frontend;
using Prowlarr.Http.Middleware;
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
namespace NzbDrone.Host
@@ -59,8 +61,9 @@ namespace NzbDrone.Host
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedHost;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("10.0.0.0"), 8));
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("172.16.0.0"), 12));
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("192.168.0.0"), 16));
});
services.AddRouting(options => options.LowercaseUrls = true);

View File

@@ -51,7 +51,7 @@ namespace NzbDrone.Test.Common.AutoMoq
if (behavior != MockBehavior.Default && mock.Behavior == MockBehavior.Default)
{
throw new InvalidOperationException("Unable to change be behaviour of a an existing mock.");
throw new InvalidOperationException("Unable to change be behaviour of an existing mock.");
}
return mock;
@@ -139,7 +139,7 @@ namespace NzbDrone.Test.Common.AutoMoq
LoadPlatformLibrary();
AssemblyLoader.RegisterSQLiteResolver();
AssemblyLoader.RegisterNativeResolver(new[] { "System.Data.SQLite", "Prowlarr.Core" });
}
private Mock<T> TheRegisteredMockForThisType<T>(Type type)