Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to dotnet 8.0 #15083

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Developer note: The software implements the [Torznab](https://torznab.github.io/
A third-party Golang SDK for Jackett is available from [webtor-io/go-jackett](https://github.com/webtor-io/go-jackett)

#### Supported Systems
* Windows 7 SP1 or greater
* Linux [supported operating systems here](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md#linux)
* macOS 10.15+ or greater
* Windows 10 Version 1607+ or greater [supported operating systems here](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md#windows)
* Linux [supported operating systems here](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md#linux)
* macOS 12.0+ (Monterey) or greater [supported operating systems here](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md#macos)

<details> <summary> <b> Supported Public Trackers </b> </summary>

Expand Down Expand Up @@ -725,7 +725,7 @@ We recommend you install Jackett as a Windows service using the supplied install

To get started with using the installer for Jackett, follow the steps below:

1. Check if you need any .NET prerequisites installed, see https://docs.microsoft.com/en-us/dotnet/core/install/windows?tabs=net60#dependencies
1. Check if you need any .NET prerequisites installed, see https://docs.microsoft.com/en-us/dotnet/core/install/windows?tabs=net80#dependencies
2. Download the latest version of the Windows installer, "Jackett.Installer.Windows.exe" from the [releases](https://github.com/Jackett/Jackett/releases/latest) page.
3. When prompted if you would like this app to make changes to your computer, select "yes".
4. If you would like to install Jackett as a Windows Service, make sure the "Install as Windows Service" checkbox is filled.
Expand Down Expand Up @@ -802,7 +802,7 @@ On an Ubuntu 16 system: [chrisjohnson00.jackett](https://galaxy.ansible.com/chri
## Installation on macOS

### Prerequisites
macOS 10.15+ or greater
macOS 12.0+ (Monterey) or greater

### Install as service
1. Download and extract the latest `Jackett.Binaries.macOS.tar.gz` or `Jackett.Binaries.macOSARM64.tar.gz` release from the [releases](https://github.com/Jackett/Jackett/releases/latest) page.
Expand Down Expand Up @@ -948,8 +948,8 @@ git clone https://github.com/Jackett/Jackett.git
cd Jackett/src

# dotnet core version
dotnet publish Jackett.Server -f net6.0 --self-contained -r osx-x64 -c Debug # takes care of everything
./Jackett.Server/bin/Debug/net6.0/osx-x64/jackett # run jackett
dotnet publish Jackett.Server -f net8.0 --self-contained -r osx-x64 -c Debug # takes care of everything
./Jackett.Server/bin/Debug/net8.0/osx-x64/jackett # run jackett
```

### Linux
Expand All @@ -961,8 +961,8 @@ git clone https://github.com/Jackett/Jackett.git
cd Jackett/src

# dotnet core version
dotnet publish Jackett.Server -f net6.0 --self-contained -r linux-x64 -c Debug # takes care of everything
./Jackett.Server/bin/Debug/net6.0/linux-x64/jackett # run jackett
dotnet publish Jackett.Server -f net8.0 --self-contained -r linux-x64 -c Debug # takes care of everything
./Jackett.Server/bin/Debug/net8.0/linux-x64/jackett # run jackett
```

## Screenshots
Expand Down
10 changes: 5 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
name: $(majorVersion).$(minorVersion).$(patchVersion)
variables:
majorVersion: 0
minorVersion: 21
minorVersion: 22
patchVersion: $[counter(variables['minorVersion'], 1)] # this will reset when we bump minor
jackettVersion: $(majorVersion).$(minorVersion).$(patchVersion)
buildConfiguration: Release
netCoreFramework: net6.0
netCoreSdkVersion: 6.0.x
netCoreFramework: net8.0
netCoreSdkVersion: 8.0.x
# system.debug: true

trigger:
Expand Down Expand Up @@ -129,7 +129,7 @@ stages:
displayName: Build DateTimeRoutines
# this task is not mandatory since DateTimeRoutines is build in the next task, but the purpose is to fix:
# error MSB4018: System.IO.IOException: The process cannot access the file
# '/home/vsts/work/1/net6.0-linux-musl-arm/src/DateTimeRoutines/bin/Release/netstandard2.0/DateTimeRoutines.deps.json'
# '/home/vsts/work/1/src/DateTimeRoutines/bin/Release/netstandard2.0/DateTimeRoutines.deps.json'
# because it is being used by another process.
inputs:
command: build
Expand Down Expand Up @@ -500,7 +500,7 @@ stages:
- task: PublishPipelineArtifact@1
condition: and(succeeded(), startsWith(variables['runtime'], 'win'))
inputs:
targetPath: $(Build.SourcesDirectory)/coverlet/reports/coverage.cobertura.Windows.net6.0.xml
targetPath: $(Build.SourcesDirectory)/coverlet/reports/coverage.cobertura.Windows.net8.0.xml

- stage: IntegrationTestJackett
displayName: Integration Tests
Expand Down
9 changes: 6 additions & 3 deletions src/Jackett.Common/Indexers/BaseIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ protected async Task FollowIfRedirect(WebResult response, string referrer = null
break;
}

await DoFollowIfRedirect(response, referrer, overrideRedirectUrl, overrideCookies, accumulateCookies);
response = await DoFollowIfRedirect(response, referrer, overrideRedirectUrl, overrideCookies, accumulateCookies);

if (accumulateCookies)
{
Expand Down Expand Up @@ -701,7 +701,7 @@ protected virtual void UpdateCookieHeader(string newCookies, string cookieOverri
}
}

private async Task DoFollowIfRedirect(WebResult incomingResponse, string referrer = null, string overrideRedirectUrl = null, string overrideCookies = null, bool accumulateCookies = false)
private async Task<WebResult> DoFollowIfRedirect(WebResult incomingResponse, string referrer = null, string overrideRedirectUrl = null, string overrideCookies = null, bool accumulateCookies = false)
{
if (incomingResponse.IsRedirect)
{
Expand All @@ -722,8 +722,11 @@ private async Task DoFollowIfRedirect(WebResult incomingResponse, string referre
Cookies = redirRequestCookies,
Encoding = Encoding
});
MapperUtil.Mapper.Map(redirectedResponse, incomingResponse);

return redirectedResponse;
}

return incomingResponse;
}

protected List<string> GetAllTrackerCategories() =>
Expand Down
9 changes: 4 additions & 5 deletions src/Jackett.Common/Jackett.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<PackageReference Include="AngleSharp" Version="1.1.2" />
<PackageReference Include="AngleSharp.Xml" Version="1.0.0" />
<PackageReference Include="Autofac" Version="6.5.0" />
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="BencodeNET" Version="4.0.0" />
<PackageReference Include="FlareSolverrSharp" Version="3.0.7" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
Expand All @@ -27,10 +26,10 @@
<PackageReference Include="Polly" Version="8.4.0" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.9" />
<PackageReference Include="YamlDotNet" Version="13.1.1" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="YamlDotNet" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Jackett.Common/Models/Config/RuntimeSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public string DataFolder
return CustomDataFolder;
}

if (System.Environment.OSVersion.Platform == PlatformID.Unix)
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create), "Jackett");
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.DoNotVerify), "Jackett");
}
else
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Jackett");
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData, Environment.SpecialFolderOption.DoNotVerify), "Jackett");
}
}
}
Expand Down
45 changes: 45 additions & 0 deletions src/Jackett.Common/Models/TrackerCacheResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;

namespace Jackett.Common.Models
{
Expand All @@ -10,5 +11,49 @@ public class TrackerCacheResult : ReleaseInfo
public string TrackerType { get; set; }
public string CategoryDesc { get; set; }
public Uri BlackholeLink { get; set; }

public TrackerCacheResult(ReleaseInfo releaseInfo)
{
Title = releaseInfo.Title;
Guid = releaseInfo.Guid;
Link = releaseInfo.Link;
Details = releaseInfo.Details;
PublishDate = releaseInfo.PublishDate;
Category = releaseInfo.Category;
Size = releaseInfo.Size;
Files = releaseInfo.Files;
Grabs = releaseInfo.Grabs;
Description = releaseInfo.Description;
RageID = releaseInfo.RageID;
TVDBId = releaseInfo.TVDBId;
Imdb = releaseInfo.Imdb;
TMDb = releaseInfo.TMDb;
TVMazeId = releaseInfo.TVMazeId;
TraktId = releaseInfo.TraktId;
DoubanId = releaseInfo.DoubanId;
Genres = releaseInfo.Genres;
Year = releaseInfo.Year;
Author = releaseInfo.Author;
BookTitle = releaseInfo.BookTitle;
Publisher = releaseInfo.Publisher;
Artist = releaseInfo.Artist;
Album = releaseInfo.Album;
Label = releaseInfo.Label;
Track = releaseInfo.Track;
Seeders = releaseInfo.Seeders;
Peers = releaseInfo.Peers;
Poster = releaseInfo.Poster;
InfoHash = releaseInfo.InfoHash;
MagnetUri = releaseInfo.MagnetUri;
MinimumRatio = releaseInfo.MinimumRatio;
MinimumSeedTime = releaseInfo.MinimumSeedTime;
DownloadVolumeFactor = releaseInfo.DownloadVolumeFactor;
UploadVolumeFactor = releaseInfo.UploadVolumeFactor;

CategoryDesc = Category != null ? string.Join(", ", Category.Select(TorznabCatType.GetCatDesc).Where(x => !string.IsNullOrEmpty(x))) : string.Empty;

// Use peers as leechers
Peers -= Seeders;
}
}
}
40 changes: 18 additions & 22 deletions src/Jackett.Common/Services/CacheService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void CacheResults(IIndexer indexer, TorznabQuery query, List<ReleaseInfo>
var trackerCacheQuery = new TrackerCacheQuery
{
Created = DateTime.Now,
Results = releases
Results = releases.Select(r => (ReleaseInfo)r.Clone()).ToList()
};

var trackerCache = _cache[indexer.Id];
Expand Down Expand Up @@ -123,27 +123,23 @@ public IReadOnlyList<TrackerCacheResult> GetCachedResults()

PruneCacheByTtl(); // remove expired results

var results = new List<TrackerCacheResult>();
foreach (var trackerCache in _cache.Values)
{
var trackerResults = new List<TrackerCacheResult>();
foreach (var query in trackerCache.Queries.Values.OrderByDescending(q => q.Created)) // newest first
{
foreach (var release in query.Results)
{
var item = MapperUtil.Mapper.Map<TrackerCacheResult>(release);
item.FirstSeen = query.Created;
item.Tracker = trackerCache.TrackerName;
item.TrackerId = trackerCache.TrackerId;
item.TrackerType = trackerCache.TrackerType;
item.Peers -= item.Seeders; // Use peers as leechers
trackerResults.Add(item);
}
}
trackerResults = trackerResults.GroupBy(r => r.Guid).Select(y => y.First()).Take(300).ToList();
results.AddRange(trackerResults);
}
var result = results.OrderByDescending(i => i.PublishDate).Take(3000).ToList();
var result = _cache.Values.SelectMany(
trackerCache => trackerCache.Queries.Values
.OrderByDescending(q => q.Created)
.SelectMany(
query => query.Results.Select(release =>
new TrackerCacheResult(release)
{
FirstSeen = query.Created,
Tracker = trackerCache.TrackerName,
TrackerId = trackerCache.TrackerId,
TrackerType = trackerCache.TrackerType
}))
.GroupBy(r => r.Guid)
.Select(y => y.First())
.Take(300))
.OrderByDescending(i => i.PublishDate)
.Take(3000).ToList();

_logger.Debug($"CACHE GetCachedResults / Results: {result.Count} (cache may contain more results)");
PrintCacheStatus();
Expand Down
24 changes: 19 additions & 5 deletions src/Jackett.Common/Services/ConfigurationService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Security.Principal;
using Jackett.Common.Models.Config;
Expand All @@ -11,7 +13,6 @@

namespace Jackett.Common.Services
{

public class ConfigurationService : IConfigurationService
{
private readonly ISerializeService serializeService;
Expand All @@ -34,10 +35,23 @@ public void CreateOrMigrateSettings()
{
try
{
// Migrate app data to 'Library/Application Support' on .NET 8 for OSX
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
var userAppDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile, Environment.SpecialFolderOption.DoNotVerify), ".config", "Jackett");
var appDataFolder = GetAppDataFolder();

// Check for existing json configuration files due to LogManager creating log.txt early in Program.cs
if (Directory.Exists(userAppDataFolder) && (!Directory.Exists(appDataFolder) || !Directory.EnumerateFiles(appDataFolder, "*.json", SearchOption.AllDirectories).Any()))
{
PerformMigration(userAppDataFolder);
}
}

if (!Directory.Exists(GetAppDataFolder()))
{
var dir = Directory.CreateDirectory(GetAppDataFolder());
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
if (Environment.OSVersion.Platform != PlatformID.Unix)
{
var access = dir.GetAccessControl();
var directorySecurity = new DirectorySecurity(GetAppDataFolder(), AccessControlSections.All);
Expand Down Expand Up @@ -112,7 +126,7 @@ public void PerformMigration(string oldDirectory)
if (!Directory.Exists(destFolder))
{
var dir = Directory.CreateDirectory(destFolder);
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
if (Environment.OSVersion.Platform != PlatformID.Unix)
{
var directorySecurity = new DirectorySecurity(destFolder, AccessControlSections.All);
directorySecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow));
Expand All @@ -123,7 +137,7 @@ public void PerformMigration(string oldDirectory)
{
File.Copy(file, destPath);
// The old files were created when running as admin so make sure they are editable by normal users / services.
if (System.Environment.OSVersion.Platform != PlatformID.Unix)
if (Environment.OSVersion.Platform != PlatformID.Unix)
{
var fileInfo = new FileInfo(destFolder);
var fileSecurity = new FileSecurity(destPath, AccessControlSections.All);
Expand Down Expand Up @@ -200,7 +214,7 @@ public List<string> GetCardigannDefinitionsFolders()
{
var dirs = new List<string>();

if (System.Environment.OSVersion.Platform == PlatformID.Unix)
if (Environment.OSVersion.Platform == PlatformID.Unix)
{
dirs.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "cardigann/definitions/"));
dirs.Add("/etc/xdg/cardigan/definitions/");
Expand Down
26 changes: 0 additions & 26 deletions src/Jackett.Common/Utils/MapperUtil.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
Expand Down