Compare commits

..

No commits in common. "develop" and "v2.14.4.4809" have entirely different histories.

116 changed files with 1123 additions and 1520 deletions

View file

@ -2,7 +2,7 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "Lidarr",
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0",
"image": "mcr.microsoft.com/devcontainers/dotnet:1-6.0",
"features": {
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,

2
.vscode/launch.json vendored
View file

@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build dotnet",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/_output/net8.0/Lidarr",
"program": "${workspaceFolder}/_output/net6.0/Lidarr",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console

View file

@ -9,13 +9,13 @@ Setup guides, [FAQ](/lidarr/faq), the more information we have on the [wiki](htt
# Development
Lidarr is written in C# (backend) and JS (frontend). The backend is built on the .NET 8 framework, while the frontend utilizes Reactjs.
Lidarr is written in C# (backend) and JS (frontend). The backend is built on the .NET6 (and _soon_ .NET8) framework, while the frontend utilizes Reactjs.
## Tools required
- Visual Studio 2022 or higher is recommended (<https://www.visualstudio.com/vs/>). The community version is free and works (<https://www.visualstudio.com/downloads/>).
> VS 2022 V17.0 or higher is recommended as it includes the .NET 8 SDK
> VS 2022 V17.0 or higher is recommended as it includes the .NET6 SDK
{.is-info}
- HTML/Javascript editor of choice (VS Code/Sublime Text/Webstorm/Atom/etc)
@ -24,7 +24,7 @@ Lidarr is written in C# (backend) and JS (frontend). The backend is built on the
- **20** (any minor or patch version within this)
{.grid-list}
> The Application will **NOT** run on older versions such as `18.x`, `16.x` or any version below 20.0! Due to a dependency issue, it will also not run on `21.x` and is untested on other versions.
> The Application will **NOT** run on older versions such as `18.x`, `16.x` or any version below 20.0! Due to a dependency issue, it will also not run on `21.x` and is untested on other verisons.
{.is-warning}
- [Yarn](https://yarnpkg.com/getting-started/install) is required to build the frontend
@ -60,7 +60,7 @@ The backend solution is most easily built and ran in Visual Studio or Rider, how
#### Visual Studio
> Ensure startup project is set to `Lidarr.Console` and framework to `net8.0`
> Ensure startup project is set to `Lidarr.Console` and framework to `net6.0`
{.is-info}
1. First `Build` the solution in Visual Studio, this will ensure all projects are correctly built and dependencies restored

View file

@ -9,18 +9,18 @@ variables:
testsFolder: './_tests'
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
majorVersion: '3.1.1'
majorVersion: '2.14.4'
minorVersion: $[counter('minorVersion', 1076)]
lidarrVersion: '$(majorVersion).$(minorVersion)'
buildName: '$(Build.SourceBranchName).$(lidarrVersion)'
sentryOrg: 'servarr'
sentryUrl: 'https://sentry.servarr.com'
dotnetVersion: '8.0.405'
dotnetVersion: '6.0.427'
nodeVersion: '20.X'
innoVersion: '6.2.0'
windowsImage: 'windows-2025'
linuxImage: 'ubuntu-24.04'
macImage: 'macOS-15'
windowsImage: 'windows-2022'
linuxImage: 'ubuntu-22.04'
macImage: 'macOS-13'
trigger:
branches:
@ -106,7 +106,7 @@ stages:
echo "Extra platforms already enabled"
else
echo "Enabling extra platform support"
sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64/' "$BUNDLEDVERSIONS"
sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64;linux-x86/' $BUNDLEDVERSIONS
fi
displayName: Enable Extra Platform Support
- bash: ./build.sh --backend --enable-extra-platforms
@ -122,23 +122,27 @@ stages:
artifact: '$(osName)Backend'
displayName: Publish Backend
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: '$(testsFolder)/net8.0/win-x64/publish'
- publish: '$(testsFolder)/net6.0/win-x64/publish'
artifact: win-x64-tests
displayName: Publish win-x64 Test Package
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: '$(testsFolder)/net8.0/linux-x64/publish'
- publish: '$(testsFolder)/net6.0/linux-x64/publish'
artifact: linux-x64-tests
displayName: Publish linux-x64 Test Package
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: '$(testsFolder)/net8.0/linux-musl-x64/publish'
- publish: '$(testsFolder)/net6.0/linux-x86/publish'
artifact: linux-x86-tests
displayName: Publish linux-x86 Test Package
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: '$(testsFolder)/net6.0/linux-musl-x64/publish'
artifact: linux-musl-x64-tests
displayName: Publish linux-musl-x64 Test Package
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: '$(testsFolder)/net8.0/freebsd-x64/publish'
- publish: '$(testsFolder)/net6.0/freebsd-x64/publish'
artifact: freebsd-x64-tests
displayName: Publish freebsd-x64 Test Package
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
- publish: '$(testsFolder)/net8.0/osx-x64/publish'
- publish: '$(testsFolder)/net6.0/osx-x64/publish'
artifact: osx-x64-tests
displayName: Publish osx-x64 Test Package
condition: and(succeeded(), eq(variables['osName'], 'Windows'))
@ -256,21 +260,21 @@ stages:
archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).windows-core-x64.zip'
archiveType: 'zip'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/win-x64/net8.0
rootFolderOrFile: $(artifactsFolder)/win-x64/net6.0
- task: ArchiveFiles@2
displayName: Create win-x86 zip
inputs:
archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).windows-core-x86.zip'
archiveType: 'zip'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/win-x86/net8.0
rootFolderOrFile: $(artifactsFolder)/win-x86/net6.0
- task: ArchiveFiles@2
displayName: Create osx-x64 app
inputs:
archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).osx-app-core-x64.zip'
archiveType: 'zip'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/osx-x64-app/net8.0
rootFolderOrFile: $(artifactsFolder)/osx-x64-app/net6.0
- task: ArchiveFiles@2
displayName: Create osx-x64 tar
inputs:
@ -278,14 +282,14 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/osx-x64/net8.0
rootFolderOrFile: $(artifactsFolder)/osx-x64/net6.0
- task: ArchiveFiles@2
displayName: Create osx-arm64 app
inputs:
archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).osx-app-core-arm64.zip'
archiveType: 'zip'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/osx-arm64-app/net8.0
rootFolderOrFile: $(artifactsFolder)/osx-arm64-app/net6.0
- task: ArchiveFiles@2
displayName: Create osx-arm64 tar
inputs:
@ -293,7 +297,7 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/osx-arm64/net8.0
rootFolderOrFile: $(artifactsFolder)/osx-arm64/net6.0
- task: ArchiveFiles@2
displayName: Create linux-x64 tar
inputs:
@ -301,7 +305,7 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/linux-x64/net8.0
rootFolderOrFile: $(artifactsFolder)/linux-x64/net6.0
- task: ArchiveFiles@2
displayName: Create linux-musl-x64 tar
inputs:
@ -309,7 +313,15 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/linux-musl-x64/net8.0
rootFolderOrFile: $(artifactsFolder)/linux-musl-x64/net6.0
- task: ArchiveFiles@2
displayName: Create linux-x86 tar
inputs:
archiveFile: '$(Build.ArtifactStagingDirectory)/Lidarr.$(buildName).linux-core-x86.tar.gz'
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/linux-x86/net6.0
- task: ArchiveFiles@2
displayName: Create linux-arm tar
inputs:
@ -317,7 +329,7 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/linux-arm/net8.0
rootFolderOrFile: $(artifactsFolder)/linux-arm/net6.0
- task: ArchiveFiles@2
displayName: Create linux-musl-arm tar
inputs:
@ -325,7 +337,7 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/linux-musl-arm/net8.0
rootFolderOrFile: $(artifactsFolder)/linux-musl-arm/net6.0
- task: ArchiveFiles@2
displayName: Create linux-arm64 tar
inputs:
@ -333,7 +345,7 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/linux-arm64/net8.0
rootFolderOrFile: $(artifactsFolder)/linux-arm64/net6.0
- task: ArchiveFiles@2
displayName: Create linux-musl-arm64 tar
inputs:
@ -341,7 +353,7 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/linux-musl-arm64/net8.0
rootFolderOrFile: $(artifactsFolder)/linux-musl-arm64/net6.0
- task: ArchiveFiles@2
displayName: Create freebsd-x64 tar
inputs:
@ -349,7 +361,7 @@ stages:
archiveType: 'tar'
tarCompression: 'gz'
includeRootFolder: false
rootFolderOrFile: $(artifactsFolder)/freebsd-x64/net8.0
rootFolderOrFile: $(artifactsFolder)/freebsd-x64/net6.0
- publish: $(Build.ArtifactStagingDirectory)
artifact: 'Packages'
displayName: Publish Packages
@ -481,6 +493,10 @@ stages:
testName: 'Musl Net Core'
artifactName: linux-musl-x64-tests
containerImage: ghcr.io/servarr/testimages:alpine
linux-x86:
testName: 'linux-x86'
artifactName: linux-x86-tests
containerImage: ghcr.io/servarr/testimages:linux-x86
pool:
vmImage: ${{ variables.linuxImage }}
@ -494,6 +510,12 @@ stages:
displayName: 'Install .NET'
inputs:
version: $(dotnetVersion)
condition: and(succeeded(), ne(variables['testName'], 'linux-x86'))
- bash: |
SDKURL=$(curl -s https://api.github.com/repos/Servarr/dotnet-linux-x86/releases | jq -rc '.[].assets[].browser_download_url' | grep sdk-${DOTNETVERSION}.*gz$)
curl -fsSL $SDKURL | tar xzf - -C /opt/dotnet
displayName: 'Install .NET'
condition: and(succeeded(), eq(variables['testName'], 'linux-x86'))
- checkout: none
- task: DownloadPipelineArtifact@2
displayName: Download Test Artifact
@ -900,6 +922,11 @@ stages:
artifactName: linux-musl-x64-tests
containerImage: ghcr.io/servarr/testimages:alpine
pattern: 'Lidarr.*.linux-musl-core-x64.tar.gz'
linux-x86:
testName: 'linux-x86'
artifactName: linux-x86-tests
containerImage: ghcr.io/servarr/testimages:linux-x86
pattern: 'Lidarr.*.linux-core-x86.tar.gz'
pool:
vmImage: ${{ variables.linuxImage }}
@ -912,6 +939,12 @@ stages:
displayName: 'Install .NET'
inputs:
version: $(dotnetVersion)
condition: and(succeeded(), ne(variables['testName'], 'linux-x86'))
- bash: |
SDKURL=$(curl -s https://api.github.com/repos/Servarr/dotnet-linux-x86/releases | jq -rc '.[].assets[].browser_download_url' | grep sdk-${DOTNETVERSION}.*gz$)
curl -fsSL $SDKURL | tar xzf - -C /opt/dotnet
displayName: 'Install .NET'
condition: and(succeeded(), eq(variables['testName'], 'linux-x86'))
- checkout: none
- task: DownloadPipelineArtifact@2
displayName: Download Test Artifact
@ -1187,23 +1220,22 @@ stages:
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll,**/NzbDrone.Core.Test/Files/**/*,./frontend/**,**/ExternalModules/**,./src/Libraries/**
sonar.coverage.exclusions=**/Lidarr.Api.V1/**/*
sonar.cs.cobertura.reportsPaths=$(Build.SourcesDirectory)/CoverageResults/**/coverage.cobertura.xml
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/CoverageResults/**/coverage.opencover.xml
sonar.cs.nunit.reportsPaths=$(Build.SourcesDirectory)/TestResult.xml
- bash: |
./build.sh --backend -f net8.0 -r win-x64
TEST_DIR=_tests/net8.0/win-x64/publish/ ./test.sh Windows Unit Coverage
./build.sh --backend -f net6.0 -r win-x64
TEST_DIR=_tests/net6.0/win-x64/publish/ ./test.sh Windows Unit Coverage
displayName: Coverage Unit Tests
- task: SonarCloudAnalyze@3
condition: eq(variables['System.PullRequest.IsFork'], 'False')
displayName: Publish SonarCloud Results
- task: reportgenerator@5
- task: reportgenerator@5.3.11
displayName: Generate Coverage Report
inputs:
reports: '$(Build.SourcesDirectory)/CoverageResults/**/coverage.cobertura.xml'
reports: '$(Build.SourcesDirectory)/CoverageResults/**/coverage.opencover.xml'
targetdir: '$(Build.SourcesDirectory)/CoverageResults/combined'
reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges'
publishCodeCoverageResults: true
sourcedirs: src
- stage: Report_Out
dependsOn:
@ -1234,3 +1266,4 @@ stages:
DISCORDCHANNELID: $(discordChannelId)
DISCORDWEBHOOKKEY: $(discordWebhookKey)
DISCORDTHREADID: $(discordThreadId)

View file

@ -33,14 +33,14 @@ EnableExtraPlatformsInSDK()
echo "Extra platforms already enabled"
else
echo "Enabling extra platform support"
sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64/' "$BUNDLEDVERSIONS"
sed -i.ORI 's/osx-x64/osx-x64;freebsd-x64;linux-x86/' $BUNDLEDVERSIONS
fi
}
EnableExtraPlatforms()
{
if grep -qv freebsd-x64 src/Directory.Build.props; then
sed -i'' -e "s^<RuntimeIdentifiers>\(.*\)</RuntimeIdentifiers>^<RuntimeIdentifiers>\1;freebsd-x64</RuntimeIdentifiers>^g" src/Directory.Build.props
sed -i'' -e "s^<RuntimeIdentifiers>\(.*\)</RuntimeIdentifiers>^<RuntimeIdentifiers>\1;freebsd-x64;linux-x86</RuntimeIdentifiers>^g" src/Directory.Build.props
fi
}
@ -79,9 +79,9 @@ Build()
if [[ -z "$RID" || -z "$FRAMEWORK" ]];
then
dotnet msbuild -restore $slnFile -p:SelfContained=true -p:Configuration=Release -p:Platform=$platform -t:PublishAllRids
dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform=$platform -t:PublishAllRids
else
dotnet msbuild -restore $slnFile -p:SelfContained=true -p:Configuration=Release -p:Platform=$platform -p:RuntimeIdentifiers=$RID -t:PublishAllRids
dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform=$platform -p:RuntimeIdentifiers=$RID -t:PublishAllRids
fi
ProgressEnd 'Build'
@ -137,7 +137,7 @@ PackageLinux()
echo "Adding Lidarr.Mono to UpdatePackage"
cp $folder/Lidarr.Mono.* $folder/Lidarr.Update
if [ "$framework" = "net8.0" ]; then
if [ "$framework" = "net6.0" ]; then
cp $folder/Mono.Posix.NETStandard.* $folder/Lidarr.Update
cp $folder/libMonoPosixHelper.* $folder/Lidarr.Update
fi
@ -165,7 +165,7 @@ PackageMacOS()
echo "Adding Lidarr.Mono to UpdatePackage"
cp $folder/Lidarr.Mono.* $folder/Lidarr.Update
if [ "$framework" = "net8.0" ]; then
if [ "$framework" = "net6.0" ]; then
cp $folder/Mono.Posix.NETStandard.* $folder/Lidarr.Update
cp $folder/libMonoPosixHelper.* $folder/Lidarr.Update
fi
@ -377,14 +377,15 @@ then
Build
if [[ -z "$RID" || -z "$FRAMEWORK" ]];
then
PackageTests "net8.0" "win-x64"
PackageTests "net8.0" "win-x86"
PackageTests "net8.0" "linux-x64"
PackageTests "net8.0" "linux-musl-x64"
PackageTests "net8.0" "osx-x64"
PackageTests "net6.0" "win-x64"
PackageTests "net6.0" "win-x86"
PackageTests "net6.0" "linux-x64"
PackageTests "net6.0" "linux-musl-x64"
PackageTests "net6.0" "osx-x64"
if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ];
then
PackageTests "net8.0" "freebsd-x64"
PackageTests "net6.0" "freebsd-x64"
PackageTests "net6.0" "linux-x86"
fi
else
PackageTests "$FRAMEWORK" "$RID"
@ -412,19 +413,20 @@ then
if [[ -z "$RID" || -z "$FRAMEWORK" ]];
then
Package "net8.0" "win-x64"
Package "net8.0" "win-x86"
Package "net8.0" "linux-x64"
Package "net8.0" "linux-musl-x64"
Package "net8.0" "linux-arm64"
Package "net8.0" "linux-musl-arm64"
Package "net8.0" "linux-arm"
Package "net8.0" "linux-musl-arm"
Package "net8.0" "osx-x64"
Package "net8.0" "osx-arm64"
Package "net6.0" "win-x64"
Package "net6.0" "win-x86"
Package "net6.0" "linux-x64"
Package "net6.0" "linux-musl-x64"
Package "net6.0" "linux-arm64"
Package "net6.0" "linux-musl-arm64"
Package "net6.0" "linux-arm"
Package "net6.0" "linux-musl-arm"
Package "net6.0" "osx-x64"
Package "net6.0" "osx-arm64"
if [ "$ENABLE_EXTRA_PLATFORMS" = "YES" ];
then
Package "net8.0" "freebsd-x64"
Package "net6.0" "freebsd-x64"
Package "net6.0" "linux-x86"
fi
else
Package "$FRAMEWORK" "$RID"
@ -434,7 +436,7 @@ fi
if [ "$INSTALLER" = "YES" ];
then
InstallInno
BuildInstaller "net8.0" "win-x64"
BuildInstaller "net8.0" "win-x86"
BuildInstaller "net6.0" "win-x64"
BuildInstaller "net6.0" "win-x86"
RemoveInno
fi

View file

@ -1,7 +1,7 @@
#!/bin/bash
set -e
FRAMEWORK="net8.0"
FRAMEWORK="net6.0"
PLATFORM=$1
ARCHITECTURE="${2:-x64}"
@ -38,7 +38,7 @@ dotnet clean $slnFile -c Release
dotnet msbuild -restore $slnFile -p:Configuration=Debug -p:Platform=$platform -p:RuntimeIdentifiers=$RUNTIME -t:PublishAllRids
dotnet new tool-manifest
dotnet tool install --version 9.0.6 Swashbuckle.AspNetCore.Cli
dotnet tool install --version 6.6.2 Swashbuckle.AspNetCore.Cli
dotnet tool run swagger tofile --output ./src/Lidarr.Api.V1/openapi.json "$outputFolder/$FRAMEWORK/$RUNTIME/$application" v1 &

View file

@ -30,6 +30,5 @@
.label {
composes: label from '~Components/Label.css';
display: flex;
max-width: 100%;
}

View file

@ -19,7 +19,6 @@
.modal {
position: relative;
display: flex;
max-width: 90%;
max-height: 90%;
border-radius: 6px;
opacity: 1;

View file

@ -1,56 +0,0 @@
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';
import themes from 'Styles/Themes';
function createThemeSelector() {
return createSelector(
(state: AppState) => state.settings.ui.item.theme || window.Lidarr.theme,
(theme) => theme
);
}
const useTheme = () => {
const selectedTheme = useSelector(createThemeSelector());
const [resolvedTheme, setResolvedTheme] = useState(selectedTheme);
useEffect(() => {
if (selectedTheme !== 'auto') {
setResolvedTheme(selectedTheme);
return;
}
const applySystemTheme = () => {
setResolvedTheme(
window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light'
);
};
applySystemTheme();
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', applySystemTheme);
return () => {
window
.matchMedia('(prefers-color-scheme: dark)')
.removeEventListener('change', applySystemTheme);
};
}, [selectedTheme]);
return resolvedTheme;
};
export default useTheme;
export const useThemeColor = (color: string) => {
const theme = useTheme();
const themeVariables = themes[theme];
// @ts-expect-error - themeVariables is a string indexable type
return themeVariables[color];
};

View file

@ -30,9 +30,7 @@ export const authenticationMethodOptions = [
key: 'basic',
get value() {
return translate('AuthBasic');
},
isDisabled: true,
isHidden: true
}
},
{
key: 'forms',

View file

@ -142,8 +142,7 @@ const mediaInfoTokens = [
const otherTokens = [
{ token: '{Release Group}', example: 'Rls Grp' },
{ token: '{Custom Formats}', example: 'iNTERNAL' },
{ token: '{Custom Format:FormatName}', example: 'AMZN' }
{ token: '{Custom Formats}', example: 'iNTERNAL' }
];
const originalTokens = [

View file

@ -1,5 +0,0 @@
{
"sdk": {
"version": "8.0.405"
}
}

View file

@ -31,7 +31,7 @@
"@fortawesome/free-solid-svg-icons": "6.7.1",
"@fortawesome/react-fontawesome": "0.2.2",
"@juggle/resize-observer": "3.4.0",
"@microsoft/signalr": "8.0.17",
"@microsoft/signalr": "6.0.25",
"@sentry/browser": "7.119.1",
"@sentry/integrations": "7.119.1",
"@types/node": "20.16.11",
@ -126,7 +126,7 @@
"html-webpack-plugin": "5.6.0",
"loader-utils": "^3.2.1",
"mini-css-extract-plugin": "2.9.1",
"postcss": "8.5.6",
"postcss": "8.4.47",
"postcss-color-function": "4.1.0",
"postcss-loader": "7.3.0",
"postcss-mixins": "9.0.4",

View file

@ -84,7 +84,7 @@
<Deterministic Condition="$(AssemblyVersion.EndsWith('*'))">False</Deterministic>
<PathMap>$(MSBuildThisFileDirectory)=./</PathMap>
<PathMap>$(MSBuildProjectDirectory)=./$(MSBuildProjectName)/</PathMap>
</PropertyGroup>
<!-- Set the AssemblyConfiguration attribute for projects -->
@ -99,6 +99,13 @@
<RootNamespace Condition="'$(LidarrProject)'=='true'">$(MSBuildProjectName.Replace('Lidarr','NzbDrone'))</RootNamespace>
</PropertyGroup>
<ItemGroup Condition="'$(TestProject)'!='true'">
<!-- Annotates .NET assemblies with repository information including SHA -->
<!-- Sentry uses this to link directly to GitHub at the exact version/file/line -->
<!-- This is built-in on .NET 8 and can be removed once the project is updated -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
<!-- Sentry specific configuration: Only in Release mode -->
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<!-- https://docs.sentry.io/platforms/dotnet/configuration/msbuild/ -->
@ -123,11 +130,14 @@
<!-- Standard testing packages -->
<ItemGroup Condition="'$(TestProject)'=='true'">
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
<PackageReference Include="NunitXml.TestLogger" Version="3.1.20" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NunitXml.TestLogger" Version="3.0.131" />
</ItemGroup>
<ItemGroup Condition="'$(TestProject)'=='true' and '$(TargetFramework)'=='net6.0'">
<PackageReference Include="coverlet.collector" Version="3.0.4-preview.27.ge7cb7c3b40" />
</ItemGroup>
<PropertyGroup Condition="'$(LidarrProject)'=='true' and '$(EnableAnalyzers)'=='false'">

View file

@ -142,7 +142,7 @@ public List<AlbumResource> GetAlbums([FromQuery]int? artistId,
}
[RestPostById]
public ActionResult<AlbumResource> AddAlbum([FromBody] AlbumResource albumResource)
public ActionResult<AlbumResource> AddAlbum(AlbumResource albumResource)
{
var album = _addAlbumService.AddAlbum(albumResource.ToModel());
@ -150,7 +150,7 @@ public ActionResult<AlbumResource> AddAlbum([FromBody] AlbumResource albumResour
}
[RestPutById]
public ActionResult<AlbumResource> UpdateAlbum([FromBody] AlbumResource albumResource)
public ActionResult<AlbumResource> UpdateAlbum(AlbumResource albumResource)
{
var album = _albumService.GetAlbum(albumResource.Id);
@ -171,7 +171,7 @@ public void DeleteAlbum(int id, bool deleteFiles = false, bool addImportListExcl
}
[HttpPut("monitor")]
public IActionResult SetAlbumsMonitored([FromBody] AlbumsMonitoredResource resource)
public IActionResult SetAlbumsMonitored([FromBody]AlbumsMonitoredResource resource)
{
_albumService.SetMonitored(resource.AlbumIds, resource.Monitored);

View file

@ -157,7 +157,7 @@ public List<ArtistResource> AllArtists(Guid? mbId)
[RestPostById]
[Consumes("application/json")]
[Produces("application/json")]
public ActionResult<ArtistResource> AddArtist([FromBody] ArtistResource artistResource)
public ActionResult<ArtistResource> AddArtist(ArtistResource artistResource)
{
var artist = _addArtistService.AddArtist(artistResource.ToModel());
@ -167,7 +167,7 @@ public ActionResult<ArtistResource> AddArtist([FromBody] ArtistResource artistRe
[RestPutById]
[Consumes("application/json")]
[Produces("application/json")]
public ActionResult<ArtistResource> UpdateArtist([FromBody] ArtistResource artistResource, bool moveFiles = false)
public ActionResult<ArtistResource> UpdateArtist(ArtistResource artistResource, bool moveFiles = false)
{
var artist = _artistService.GetArtist(artistResource.Id);

View file

@ -51,7 +51,7 @@ public override AutoTaggingResource GetResourceById(int id)
[RestPostById]
[Consumes("application/json")]
public ActionResult<AutoTaggingResource> Create([FromBody] AutoTaggingResource autoTagResource)
public ActionResult<AutoTaggingResource> Create(AutoTaggingResource autoTagResource)
{
var model = autoTagResource.ToModel(_specifications);
@ -62,7 +62,7 @@ public ActionResult<AutoTaggingResource> Create([FromBody] AutoTaggingResource a
[RestPutById]
[Consumes("application/json")]
public ActionResult<AutoTaggingResource> Update([FromBody] AutoTaggingResource resource)
public ActionResult<AutoTaggingResource> Update(AutoTaggingResource resource)
{
var model = resource.ToModel(_specifications);

View file

@ -51,7 +51,7 @@ public override CommandResource GetResourceById(int id)
[RestPostById]
[Consumes("application/json")]
[Produces("application/json")]
public ActionResult<CommandResource> StartCommand([FromBody] CommandResource commandResource)
public ActionResult<CommandResource> StartCommand(CommandResource commandResource)
{
var commandType =
_knownTypes.GetImplementations(typeof(Command))

View file

@ -34,7 +34,7 @@ public TResource GetConfig()
[RestPutById]
[Consumes("application/json")]
public virtual ActionResult<TResource> SaveConfig([FromBody] TResource resource)
public virtual ActionResult<TResource> SaveConfig(TResource resource)
{
var dictionary = resource.GetType()
.GetProperties(BindingFlags.Instance | BindingFlags.Public)

View file

@ -40,14 +40,10 @@ public HostConfigController(IConfigFileProvider configFileProvider,
SharedValidator.RuleFor(c => c.UrlBase).ValidUrlBase();
SharedValidator.RuleFor(c => c.InstanceName).ContainsLidarr().When(c => c.InstanceName.IsNotNullOrWhiteSpace());
SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => c.AuthenticationMethod == AuthenticationType.Forms);
SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => c.AuthenticationMethod == AuthenticationType.Forms);
SharedValidator.RuleFor(c => c.AuthenticationMethod)
#pragma warning disable CS0618 // Type or member is obsolete
.NotEqual(AuthenticationType.Basic)
#pragma warning restore CS0618 // Type or member is obsolete
.WithMessage("'Basic' is no longer supported, switch to 'Forms' instead.");
SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => c.AuthenticationMethod == AuthenticationType.Basic ||
c.AuthenticationMethod == AuthenticationType.Forms);
SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => c.AuthenticationMethod == AuthenticationType.Basic ||
c.AuthenticationMethod == AuthenticationType.Forms);
SharedValidator.RuleFor(c => c.PasswordConfirmation)
.Must((resource, p) => IsMatchingPassword(resource)).WithMessage("Must match Password");
@ -111,7 +107,7 @@ public HostConfigResource GetHostConfig()
}
[RestPutById]
public ActionResult<HostConfigResource> SaveHostConfig([FromBody] HostConfigResource resource)
public ActionResult<HostConfigResource> SaveHostConfig(HostConfigResource resource)
{
var dictionary = resource.GetType()
.GetProperties(BindingFlags.Instance | BindingFlags.Public)

View file

@ -61,7 +61,7 @@ public NamingConfigResource GetNamingConfig()
}
[RestPutById]
public ActionResult<NamingConfigResource> UpdateNamingConfig([FromBody] NamingConfigResource resource)
public ActionResult<NamingConfigResource> UpdateNamingConfig(NamingConfigResource resource)
{
var nameSpec = resource.ToModel();
ValidateFormatResult(nameSpec);

View file

@ -32,7 +32,7 @@ public UiConfigController(IConfigFileProvider configFileProvider, IConfigService
}
[RestPutById]
public override ActionResult<UiConfigResource> SaveConfig([FromBody] UiConfigResource resource)
public override ActionResult<UiConfigResource> SaveConfig(UiConfigResource resource)
{
var dictionary = resource.GetType()
.GetProperties(BindingFlags.Instance | BindingFlags.Public)

View file

@ -31,7 +31,7 @@ public List<CustomFilterResource> GetCustomFilters()
[RestPostById]
[Consumes("application/json")]
public ActionResult<CustomFilterResource> AddCustomFilter([FromBody] CustomFilterResource resource)
public ActionResult<CustomFilterResource> AddCustomFilter(CustomFilterResource resource)
{
var customFilter = _customFilterService.Add(resource.ToModel());
@ -40,7 +40,7 @@ public ActionResult<CustomFilterResource> AddCustomFilter([FromBody] CustomFilte
[RestPutById]
[Consumes("application/json")]
public ActionResult<CustomFilterResource> UpdateCustomFilter([FromBody] CustomFilterResource resource)
public ActionResult<CustomFilterResource> UpdateCustomFilter(CustomFilterResource resource)
{
_customFilterService.Update(resource.ToModel());
return Accepted(resource.Id);

View file

@ -56,7 +56,7 @@ public List<CustomFormatResource> GetAll()
[RestPostById]
[Consumes("application/json")]
public ActionResult<CustomFormatResource> Create([FromBody] CustomFormatResource customFormatResource)
public ActionResult<CustomFormatResource> Create(CustomFormatResource customFormatResource)
{
var model = customFormatResource.ToModel(_specifications);
@ -67,7 +67,7 @@ public ActionResult<CustomFormatResource> Create([FromBody] CustomFormatResource
[RestPutById]
[Consumes("application/json")]
public ActionResult<CustomFormatResource> Update([FromBody] CustomFormatResource resource)
public ActionResult<CustomFormatResource> Update(CustomFormatResource resource)
{
var model = resource.ToModel(_specifications);

View file

@ -40,7 +40,7 @@ public List<ImportListExclusionResource> GetImportListExclusions()
}
[RestPostById]
public ActionResult<ImportListExclusionResource> AddImportListExclusion([FromBody] ImportListExclusionResource resource)
public ActionResult<ImportListExclusionResource> AddImportListExclusion(ImportListExclusionResource resource)
{
var customFilter = _importListExclusionService.Add(resource.ToModel());
@ -48,7 +48,7 @@ public ActionResult<ImportListExclusionResource> AddImportListExclusion([FromBod
}
[RestPutById]
public ActionResult<ImportListExclusionResource> UpdateImportListExclusion([FromBody] ImportListExclusionResource resource)
public ActionResult<ImportListExclusionResource> UpdateImportListExclusion(ImportListExclusionResource resource)
{
_importListExclusionService.Update(resource.ToModel());
return Accepted(resource.Id);

View file

@ -66,7 +66,7 @@ public ReleaseController(IAlbumService albumService,
}
[HttpPost]
public async Task<ActionResult<ReleaseResource>> DownloadRelease([FromBody] ReleaseResource release)
public async Task<ActionResult<ReleaseResource>> DownloadRelease(ReleaseResource release)
{
ValidateResource(release);

View file

@ -49,7 +49,7 @@ public ReleasePushController(IMakeDownloadDecision downloadDecisionMaker,
[HttpPost]
[Consumes("application/json")]
public ActionResult<ReleaseResource> Create([FromBody] ReleaseResource release)
public ActionResult<ReleaseResource> Create(ReleaseResource release)
{
_logger.Info("Release pushed: {0} - {1}", release.Title, release.DownloadUrl ?? release.MagnetUrl);

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Lidarr.Http\Lidarr.Http.csproj" />
@ -9,7 +9,7 @@
<ProjectReference Include="..\NzbDrone.SignalR\Lidarr.SignalR.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="9.0.6" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.6.2" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
<PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="Ical.Net" Version="4.3.1" />

View file

@ -33,7 +33,7 @@ public ManualImportController(IManualImportService manualImportService,
}
[HttpPost]
public IActionResult UpdateItems([FromBody] List<ManualImportUpdateResource> resource)
public IActionResult UpdateItems(List<ManualImportUpdateResource> resource)
{
return Accepted(UpdateImportItems(resource));
}

View file

@ -34,7 +34,7 @@ public DelayProfileController(IDelayProfileService delayProfileService, DelayPro
}
[RestPostById]
public ActionResult<DelayProfileResource> Create([FromBody] DelayProfileResource resource)
public ActionResult<DelayProfileResource> Create(DelayProfileResource resource)
{
var model = resource.ToModel();
model = _delayProfileService.Add(model);
@ -54,7 +54,7 @@ public void DeleteProfile(int id)
}
[RestPutById]
public ActionResult<DelayProfileResource> Update([FromBody] DelayProfileResource resource)
public ActionResult<DelayProfileResource> Update(DelayProfileResource resource)
{
var model = resource.ToModel();
_delayProfileService.Update(model);

View file

@ -24,7 +24,7 @@ public MetadataProfileController(IMetadataProfileService profileService)
}
[RestPostById]
public ActionResult<MetadataProfileResource> Create([FromBody] MetadataProfileResource resource)
public ActionResult<MetadataProfileResource> Create(MetadataProfileResource resource)
{
var model = resource.ToModel();
model = _profileService.Add(model);
@ -38,7 +38,7 @@ public void DeleteProfile(int id)
}
[RestPutById]
public ActionResult<MetadataProfileResource> Update([FromBody] MetadataProfileResource resource)
public ActionResult<MetadataProfileResource> Update(MetadataProfileResource resource)
{
var model = resource.ToModel();

View file

@ -44,7 +44,7 @@ public QualityProfileController(IQualityProfileService qualityProfileService, IC
}
[RestPostById]
public ActionResult<QualityProfileResource> Create([FromBody] QualityProfileResource resource)
public ActionResult<QualityProfileResource> Create(QualityProfileResource resource)
{
var model = resource.ToModel();
model = _qualityProfileService.Add(model);
@ -58,7 +58,7 @@ public void DeleteProfile(int id)
}
[RestPutById]
public ActionResult<QualityProfileResource> Update([FromBody] QualityProfileResource resource)
public ActionResult<QualityProfileResource> Update(QualityProfileResource resource)
{
var model = resource.ToModel();

View file

@ -47,13 +47,13 @@ public List<ReleaseProfileResource> GetAll()
}
[RestPostById]
public ActionResult<ReleaseProfileResource> Create([FromBody] ReleaseProfileResource resource)
public ActionResult<ReleaseProfileResource> Create(ReleaseProfileResource resource)
{
return Created(_releaseProfileService.Add(resource.ToModel()).Id);
}
[RestPutById]
public ActionResult<ReleaseProfileResource> Update([FromBody] ReleaseProfileResource resource)
public ActionResult<ReleaseProfileResource> Update(ReleaseProfileResource resource)
{
_releaseProfileService.Update(resource.ToModel());
return Accepted(resource.Id);

View file

@ -23,7 +23,7 @@ public QualityDefinitionController(IQualityDefinitionService qualityDefinitionSe
}
[RestPutById]
public ActionResult<QualityDefinitionResource> Update([FromBody] QualityDefinitionResource resource)
public ActionResult<QualityDefinitionResource> Update(QualityDefinitionResource resource)
{
var model = resource.ToModel();
_qualityDefinitionService.Update(model);

View file

@ -147,8 +147,8 @@ public PagingResource<QueueResource> GetQueue([FromQuery] PagingRequestResource
var filteredQueue = includeUnknownArtistItems ? queue : queue.Where(q => q.Artist != null);
var pending = _pendingReleaseService.GetPendingQueue();
var hasArtistIdFilter = artistIds is { Count: > 0 };
var hasQualityFilter = quality is { Count: > 0 };
var hasArtistIdFilter = artistIds.Any();
var hasQualityFilter = quality.Any();
var fullQueue = filteredQueue.Concat(pending).Where(q =>
{

View file

@ -66,7 +66,7 @@ public override RootFolderResource GetResourceById(int id)
[RestPostById]
[Consumes("application/json")]
public ActionResult<RootFolderResource> CreateRootFolder([FromBody] RootFolderResource rootFolderResource)
public ActionResult<RootFolderResource> CreateRootFolder(RootFolderResource rootFolderResource)
{
var model = rootFolderResource.ToModel();
@ -74,7 +74,7 @@ public ActionResult<RootFolderResource> CreateRootFolder([FromBody] RootFolderRe
}
[RestPutById]
public ActionResult<RootFolderResource> UpdateRootFolder([FromBody] RootFolderResource rootFolderResource)
public ActionResult<RootFolderResource> UpdateRootFolder(RootFolderResource rootFolderResource)
{
var model = rootFolderResource.ToModel();

View file

@ -42,14 +42,14 @@ public List<TagResource> GetAll()
[RestPostById]
[Consumes("application/json")]
public ActionResult<TagResource> Create([FromBody] TagResource resource)
public ActionResult<TagResource> Create(TagResource resource)
{
return Created(_tagService.Add(resource.ToModel()).Id);
}
[RestPutById]
[Consumes("application/json")]
public ActionResult<TagResource> Update([FromBody] TagResource resource)
public ActionResult<TagResource> Update(TagResource resource)
{
_tagService.Update(resource.ToModel());
return Accepted(resource.Id);

View file

@ -1,5 +1,5 @@
{
"openapi": "3.0.4",
"openapi": "3.0.1",
"info": {
"title": "Lidarr",
"description": "Lidarr API docs",

View file

@ -27,8 +27,9 @@ public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthentic
public ApiKeyAuthenticationHandler(IOptionsMonitor<ApiKeyAuthenticationOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock,
IConfigFileProvider config)
: base(options, logger, encoder)
: base(options, logger, encoder, clock)
{
_apiKey = config.ApiKey;
}

View file

@ -18,6 +18,11 @@ public static AuthenticationBuilder AddApiKey(this AuthenticationBuilder authent
return authenticationBuilder.AddScheme<ApiKeyAuthenticationOptions, ApiKeyAuthenticationHandler>(name, options);
}
public static AuthenticationBuilder AddBasic(this AuthenticationBuilder authenticationBuilder, string name)
{
return authenticationBuilder.AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>(name, options => { });
}
public static AuthenticationBuilder AddNone(this AuthenticationBuilder authenticationBuilder, string name)
{
return authenticationBuilder.AddScheme<AuthenticationSchemeOptions, NoAuthenticationHandler>(name, options => { });
@ -30,7 +35,7 @@ public static AuthenticationBuilder AddExternal(this AuthenticationBuilder authe
public static AuthenticationBuilder AddAppAuthentication(this IServiceCollection services)
{
services.AddOptions<CookieAuthenticationOptions>(nameof(AuthenticationType.Forms))
services.AddOptions<CookieAuthenticationOptions>(AuthenticationType.Forms.ToString())
.Configure<IConfigFileProvider>((options, configFileProvider) =>
{
// Replace diacritics and replace non-word characters to ensure cookie name doesn't contain any valid URL characters not allowed in cookie names
@ -47,9 +52,10 @@ public static AuthenticationBuilder AddAppAuthentication(this IServiceCollection
});
return services.AddAuthentication()
.AddNone(nameof(AuthenticationType.None))
.AddExternal(nameof(AuthenticationType.External))
.AddCookie(nameof(AuthenticationType.Forms))
.AddNone(AuthenticationType.None.ToString())
.AddExternal(AuthenticationType.External.ToString())
.AddBasic(AuthenticationType.Basic.ToString())
.AddCookie(AuthenticationType.Forms.ToString())
.AddApiKey("API", options =>
{
options.HeaderName = "X-Api-Key";

View file

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Authentication;
namespace Lidarr.Http.Authentication
{
public class BasicAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>
{
private readonly IAuthenticationService _authService;
public BasicAuthenticationHandler(IAuthenticationService authService,
IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock)
: base(options, logger, encoder, clock)
{
_authService = authService;
}
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
{
if (!Request.Headers.ContainsKey("Authorization"))
{
return Task.FromResult(AuthenticateResult.Fail("Authorization header missing."));
}
// Get authorization key
var authorizationHeader = Request.Headers["Authorization"].ToString();
var authHeaderRegex = new Regex(@"Basic (.*)");
if (!authHeaderRegex.IsMatch(authorizationHeader))
{
return Task.FromResult(AuthenticateResult.Fail("Authorization code not formatted properly."));
}
var authBase64 = Encoding.UTF8.GetString(Convert.FromBase64String(authHeaderRegex.Replace(authorizationHeader, "$1")));
var authSplit = authBase64.Split(':', 2);
var authUsername = authSplit[0];
var authPassword = authSplit.Length > 1 ? authSplit[1] : throw new Exception("Unable to get password");
var user = _authService.Login(Request, authUsername, authPassword);
if (user == null)
{
return Task.FromResult(AuthenticateResult.Fail("The username or password is not correct."));
}
var claims = new List<Claim>
{
new Claim("user", user.Username),
new Claim("identifier", user.Identifier.ToString()),
new Claim("AuthType", AuthenticationType.Basic.ToString())
};
var identity = new ClaimsIdentity(claims, "Basic", "user", "identifier");
var principal = new ClaimsPrincipal(identity);
var ticket = new AuthenticationTicket(principal, "Basic");
return Task.FromResult(AuthenticateResult.Success(ticket));
}
protected override Task HandleChallengeAsync(AuthenticationProperties properties)
{
Response.Headers.Add("WWW-Authenticate", $"Basic realm=\"{BuildInfo.AppName}\"");
Response.StatusCode = 401;
return Task.CompletedTask;
}
protected override Task HandleForbiddenAsync(AuthenticationProperties properties)
{
Response.StatusCode = 403;
return Task.CompletedTask;
}
}
}

View file

@ -13,8 +13,9 @@ public class NoAuthenticationHandler : AuthenticationHandler<AuthenticationSchem
{
public NoAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger,
UrlEncoder encoder)
: base(options, logger, encoder)
UrlEncoder encoder,
ISystemClock clock)
: base(options, logger, encoder, clock)
{
}

View file

@ -8,7 +8,7 @@ namespace NzbDrone.Http.Authentication
{
public class UiAuthorizationPolicyProvider : IAuthorizationPolicyProvider
{
private const string PolicyName = "UI";
private const string POLICY_NAME = "UI";
private readonly IConfigFileProvider _config;
public DefaultAuthorizationPolicyProvider FallbackPolicyProvider { get; }
@ -26,7 +26,7 @@ public UiAuthorizationPolicyProvider(IOptions<AuthorizationOptions> options,
public Task<AuthorizationPolicy> GetPolicyAsync(string policyName)
{
if (policyName.Equals(PolicyName, StringComparison.OrdinalIgnoreCase))
if (policyName.Equals(POLICY_NAME, StringComparison.OrdinalIgnoreCase))
{
var policy = new AuthorizationPolicyBuilder(_config.AuthenticationMethod.ToString())
.AddRequirements(new BypassableDenyAnonymousAuthorizationRequirement());

View file

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="9.5.4" />
<PackageReference Include="ImpromptuInterface" Version="8.0.6" />
<PackageReference Include="ImpromptuInterface" Version="7.0.1" />
<PackageReference Include="NLog" Version="5.4.0" />
</ItemGroup>
<ItemGroup>

View file

@ -22,7 +22,7 @@ public async Task InvokeAsync(HttpContext context)
{
if (context.Request.IsApiRequest() && !context.Response.Headers.ContainsKey(VERSIONHEADER))
{
context.Response.Headers[VERSIONHEADER] = _version;
context.Response.Headers.Add(VERSIONHEADER, _version);
}
await _next(context);

View file

@ -6,5 +6,8 @@
<add key="Taglib" value="https://pkgs.dev.azure.com/Lidarr/Lidarr/_packaging/Taglib/nuget/v3/index.json" />
<add key="dotnet-bsd-crossbuild" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/dotnet-bsd-crossbuild/nuget/v3/index.json" />
<add key="Mono.Posix.NETStandard" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/Mono.Posix.NETStandard/nuget/v3/index.json" />
<add key="SQLite" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/SQLite/nuget/v3/index.json" />
<add key="coverlet-nightly" value="https://pkgs.dev.azure.com/Servarr/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json" />
<add key="FluentMigrator" value="https://pkgs.dev.azure.com/Servarr/Servarr/_packaging/FluentMigrator/nuget/v3/index.json" />
</packageSources>
</configuration>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NBuilder" Version="6.1.0" />

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Selenium.Support" Version="3.141.0" />

View file

@ -10,7 +10,7 @@ public class BuildInfoFixture
[Test]
public void should_return_version()
{
BuildInfo.Version.Major.Should().BeOneOf(3, 10);
BuildInfo.Version.Major.Should().BeOneOf(2, 10);
}
[Test]

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Host\Lidarr.Host.csproj" />

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Runtime.Serialization;
namespace NzbDrone.Common.Disk
{
@ -23,5 +24,10 @@ public DestinationAlreadyExistsException(string message, Exception innerExceptio
: base(message, innerException)
{
}
protected DestinationAlreadyExistsException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}

View file

@ -18,7 +18,6 @@ public class AppFolderFactory : IAppFolderFactory
{
private readonly IAppFolderInfo _appFolderInfo;
private readonly IDiskProvider _diskProvider;
private readonly IDiskTransferService _diskTransferService;
private readonly Logger _logger;
public AppFolderFactory(IAppFolderInfo appFolderInfo,
@ -28,7 +27,6 @@ public AppFolderFactory(IAppFolderInfo appFolderInfo,
{
_appFolderInfo = appFolderInfo;
_diskProvider = diskProvider;
_diskTransferService = diskTransferService;
_logger = NzbDroneLogger.GetLogger(this);
}
@ -36,7 +34,6 @@ public void Register()
{
try
{
MigrateAppDataFolder();
_diskProvider.EnsureFolder(_appFolderInfo.AppDataFolder);
}
catch (UnauthorizedAccessException)
@ -69,28 +66,6 @@ public void SetPermissions()
}
}
private void MigrateAppDataFolder()
{
try
{
if (OsInfo.IsOsx)
{
var userAppDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile, Environment.SpecialFolderOption.DoNotVerify), ".config", "Lidarr");
if (_diskProvider.FolderExists(userAppDataFolder) && !_diskProvider.FileExists(_appFolderInfo.GetConfigPath()))
{
_diskTransferService.MirrorFolder(userAppDataFolder, _appFolderInfo.AppDataFolder);
_diskProvider.DeleteFolder(userAppDataFolder, true);
}
}
}
catch (Exception ex)
{
_logger.Debug(ex, ex.Message);
throw new LidarrStartupException(ex, "Unable to migrate configuration folder to {0}. Migrate manually", _appFolderInfo.AppDataFolder);
}
}
private void InitializeMonoApplicationData()
{
if (OsInfo.IsWindows)

View file

@ -26,9 +26,9 @@ public AppFolderInfo(IStartupContext startupContext)
_dataSpecialFolder = Environment.SpecialFolder.ApplicationData;
}
if (startupContext.Args.TryGetValue(StartupContext.APPDATA, out var argsAppDataFolder))
if (startupContext.Args.ContainsKey(StartupContext.APPDATA))
{
AppDataFolder = argsAppDataFolder;
AppDataFolder = startupContext.Args[StartupContext.APPDATA];
Logger.Info("Data directory is being overridden to [{0}]", AppDataFolder);
}
else

View file

@ -21,7 +21,7 @@ public RuntimeInfo(Logger logger, IHostLifetime hostLifetime = null)
IsWindowsService = hostLifetime is WindowsServiceLifetime;
IsStarting = true;
// net8.0 will return Lidarr.dll for entry assembly, we need the actual
// net6.0 will return Lidarr.dll for entry assembly, we need the actual
// executable name (Lidarr on linux). On mono this will return the location of
// the mono executable itself, which is not what we want.
var entry = Process.GetCurrentProcess().MainModule;

View file

@ -1,28 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<NeutralLanguage>en</NeutralLanguage>
<DefineConstants Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64' or '$(RuntimeIdentifier)' == 'linux-musl-arm64'">ISMUSL</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DryIoc.dll" Version="5.4.3" />
<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="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="NLog.Layouts.ClefJsonLayout" Version="1.0.4" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.2" />
<PackageReference Include="NLog.Layouts.ClefJsonLayout" Version="1.0.3" />
<PackageReference Include="Sentry" Version="4.0.2" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
<PackageReference Include="System.Data.SQLite" Version="2.0.2" />
<PackageReference Include="System.IO.Abstractions" Version="17.0.24" />
<PackageReference Include="System.Text.Json" Version="8.0.6" />
<PackageReference Include="System.Text.Json" Version="6.0.10" />
<PackageReference Include="System.ValueTuple" Version="4.6.1" />
<PackageReference Include="System.Data.SQLite.Core.Servarr" Version="1.0.115.5-18" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="EnsureThat\Resources\ExceptionMessages.Designer.cs">

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<ApplicationIcon>..\NzbDrone.Host\NzbDrone.ico</ApplicationIcon>
</PropertyGroup>

View file

@ -8,7 +8,6 @@
namespace NzbDrone.Core.Test.Http
{
[TestFixture]
[Platform(Exclude = "MacOsX")]
public class HttpProxySettingsProviderFixture : TestBase<HttpProxySettingsProvider>
{
private HttpProxySettings GetProxySettings()
@ -16,24 +15,24 @@ private HttpProxySettings GetProxySettings()
return new HttpProxySettings(ProxyType.Socks5, "localhost", 8080, "*.httpbin.org,google.com,172.16.0.0/12", true, null, null);
}
[TestCase("http://eu.httpbin.org/get")]
[TestCase("http://google.com/get")]
[TestCase("http://localhost:8654/get")]
[TestCase("http://172.21.0.1:8989/api/v3/indexer/schema")]
public void should_bypass_proxy(string url)
[Test]
public void should_bypass_proxy()
{
var settings = GetProxySettings();
Subject.ShouldProxyBeBypassed(settings, new HttpUri(url)).Should().BeTrue();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://eu.httpbin.org/get")).Should().BeTrue();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://google.com/get")).Should().BeTrue();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://localhost:8654/get")).Should().BeTrue();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://172.21.0.1:8989/api/v3/indexer/schema")).Should().BeTrue();
}
[TestCase("http://bing.com/get")]
[TestCase("http://172.3.0.1:8989/api/v3/indexer/schema")]
public void should_not_bypass_proxy(string url)
[Test]
public void should_not_bypass_proxy()
{
var settings = GetProxySettings();
Subject.ShouldProxyBeBypassed(settings, new HttpUri(url)).Should().BeFalse();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://bing.com/get")).Should().BeFalse();
Subject.ShouldProxyBeBypassed(settings, new HttpUri("http://172.3.0.1:8989/api/v3/indexer/schema")).Should().BeFalse();
}
}
}

View file

@ -80,7 +80,7 @@ public void map_artist_should_not_update_id_if_http_throws()
}
[Test]
[Ignore("Pending mapping fixes", Until = "2025-12-31 00:00:00Z")]
[Ignore("Pending mapping fixes", Until = "2025-10-20 00:00:00Z")]
public void map_artist_should_work()
{
UseRealHttp();
@ -159,7 +159,7 @@ public void map_album_should_not_update_id_if_http_throws()
}
[Test]
[Ignore("Pending mapping fixes", Until = "2025-12-31 00:00:00Z")]
[Ignore("Pending mapping fixes", Until = "2025-10-20 00:00:00Z")]
public void map_album_should_work()
{
UseRealHttp();

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NBuilder" Version="6.1.0" />

View file

@ -14,7 +14,7 @@
namespace NzbDrone.Core.Test.MetadataSource.SkyHook
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class SkyHookProxyFixture : CoreTest<SkyHookProxy>
{
private MetadataProfile _metadataProfile;

View file

@ -12,7 +12,7 @@
namespace NzbDrone.Core.Test.MetadataSource.SkyHook
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class SkyHookProxySearchFixture : CoreTest<SkyHookProxy>
{
[SetUp]

View file

@ -1,132 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Music;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
{
[TestFixture]
public class CustomFormatsFixture : CoreTest<FileNameBuilder>
{
private Artist _artist;
private Album _album;
private AlbumRelease _release;
private Track _track;
private TrackFile _trackFile;
private NamingConfig _namingConfig;
private List<CustomFormat> _customFormats;
[SetUp]
public void Setup()
{
_artist = Builder<Artist>
.CreateNew()
.With(s => s.Name = "Alien Ant Farm")
.Build();
_album = Builder<Album>
.CreateNew()
.With(s => s.Title = "Anthology")
.Build();
_release = Builder<AlbumRelease>
.CreateNew()
.With(s => s.Media = new List<Medium> { new Medium { Number = 1 } })
.Build();
_track = Builder<Track>.CreateNew()
.With(e => e.Title = "City Sushi")
.With(e => e.AbsoluteTrackNumber = 6)
.With(e => e.AlbumRelease = _release)
.Build();
_trackFile = new TrackFile { Quality = new QualityModel(Quality.MP3_320), ReleaseGroup = "LidarrTest" };
_namingConfig = NamingConfig.Default;
_namingConfig.RenameTracks = true;
Mocker.GetMock<INamingConfigService>()
.Setup(c => c.GetConfig()).Returns(_namingConfig);
_customFormats = new List<CustomFormat>()
{
new CustomFormat()
{
Name = "INTERNAL",
IncludeCustomFormatWhenRenaming = true
},
new CustomFormat()
{
Name = "AMZN",
IncludeCustomFormatWhenRenaming = true
},
new CustomFormat()
{
Name = "NAME WITH SPACES",
IncludeCustomFormatWhenRenaming = true
},
new CustomFormat()
{
Name = "NotIncludedFormat",
IncludeCustomFormatWhenRenaming = false
}
};
Mocker.GetMock<IQualityDefinitionService>()
.Setup(v => v.Get(Moq.It.IsAny<Quality>()))
.Returns<Quality>(v => Quality.DefaultQualityDefinitions.First(c => c.Quality == v));
}
[TestCase("{Custom Formats}", "INTERNAL AMZN NAME WITH SPACES")]
public void should_replace_custom_formats(string format, string expected)
{
_namingConfig.StandardTrackFormat = format;
Subject.BuildTrackFileName(new List<Track> { _track }, _artist, _album, _trackFile, customFormats: _customFormats)
.Should().Be(expected);
}
[TestCase("{Custom Formats}", "")]
public void should_replace_custom_formats_with_no_custom_formats(string format, string expected)
{
_namingConfig.StandardTrackFormat = format;
Subject.BuildTrackFileName(new List<Track> { _track }, _artist, _album, _trackFile, customFormats: new List<CustomFormat>())
.Should().Be(expected);
}
[TestCase("{Custom Format}", "")]
[TestCase("{Custom Format:INTERNAL}", "INTERNAL")]
[TestCase("{Custom Format:AMZN}", "AMZN")]
[TestCase("{Custom Format:NAME WITH SPACES}", "NAME WITH SPACES")]
[TestCase("{Custom Format:DOESNOTEXIST}", "")]
[TestCase("{Custom Format:INTERNAL} - {Custom Format:AMZN}", "INTERNAL - AMZN")]
[TestCase("{Custom Format:AMZN} - {Custom Format:INTERNAL}", "AMZN - INTERNAL")]
public void should_replace_custom_format(string format, string expected)
{
_namingConfig.StandardTrackFormat = format;
Subject.BuildTrackFileName(new List<Track> { _track }, _artist, _album, _trackFile, customFormats: _customFormats)
.Should().Be(expected);
}
[TestCase("{Custom Format}", "")]
[TestCase("{Custom Format:INTERNAL}", "")]
[TestCase("{Custom Format:AMZN}", "")]
public void should_replace_custom_format_with_no_custom_formats(string format, string expected)
{
_namingConfig.StandardTrackFormat = format;
Subject.BuildTrackFileName(new List<Track> { _track }, _artist, _album, _trackFile, customFormats: new List<CustomFormat>())
.Should().Be(expected);
}
}
}

View file

@ -1,11 +1,8 @@
using System;
namespace NzbDrone.Core.Authentication
{
public enum AuthenticationType
{
None = 0,
[Obsolete("Use Forms authentication instead")]
Basic = 1,
Forms = 2,
External = 3

View file

@ -204,24 +204,13 @@ public AuthenticationType AuthenticationMethod
if (enabled)
{
SetValue("AuthenticationMethod", AuthenticationType.Forms);
return AuthenticationType.Forms;
SetValue("AuthenticationMethod", AuthenticationType.Basic);
return AuthenticationType.Basic;
}
var value = Enum.TryParse<AuthenticationType>(_authOptions.Method, out var enumValue)
return Enum.TryParse<AuthenticationType>(_authOptions.Method, out var enumValue)
? enumValue
: GetValueEnum("AuthenticationMethod", AuthenticationType.None);
#pragma warning disable CS0618 // Type or member is obsolete
if (value == AuthenticationType.Basic)
#pragma warning restore CS0618 // Type or member is obsolete
{
SetValue("AuthenticationMethod", AuthenticationType.Forms);
return AuthenticationType.Forms;
}
return value;
}
}
@ -396,12 +385,6 @@ public void MigrateConfigFile()
{
SetValue("EnableSsl", false);
}
#pragma warning disable CS0618 // Type or member is obsolete
if (AuthenticationMethod == AuthenticationType.Basic)
#pragma warning restore CS0618 // Type or member is obsolete
{
SetValue("AuthenticationMethod", AuthenticationType.Forms);
}
}
private void DeleteOldValues()

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.Datastore;

View file

@ -1,18 +1,13 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using Dapper;
using NLog;
using NzbDrone.Common.Instrumentation;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.Messaging.Events;
using Polly;
using Polly.Retry;
namespace NzbDrone.Core.Datastore
{
@ -45,31 +40,12 @@ public interface IBasicRepository<TModel>
public class BasicRepository<TModel> : IBasicRepository<TModel>
where TModel : ModelBase, new()
{
private static readonly ILogger Logger = NzbDroneLogger.GetLogger(typeof(BasicRepository<TModel>));
private readonly IEventAggregator _eventAggregator;
private readonly PropertyInfo _keyProperty;
private readonly List<PropertyInfo> _properties;
private readonly string _updateSql;
private readonly string _insertSql;
private static ResiliencePipeline RetryStrategy => new ResiliencePipelineBuilder()
.AddRetry(new RetryStrategyOptions
{
ShouldHandle = new PredicateBuilder().Handle<SQLiteException>(ex => ex.ResultCode == SQLiteErrorCode.Busy),
Delay = TimeSpan.FromMilliseconds(100),
MaxRetryAttempts = 3,
BackoffType = DelayBackoffType.Exponential,
UseJitter = true,
OnRetry = args =>
{
Logger.Warn(args.Outcome.Exception, "Failed writing to database. Retry #{0}", args.AttemptNumber);
return default;
}
})
.Build();
protected readonly IDatabase _database;
protected readonly string _table;
@ -210,9 +186,7 @@ private string GetInsertSql()
private TModel Insert(IDbConnection connection, IDbTransaction transaction, TModel model)
{
SqlBuilderExtensions.LogQuery(_insertSql, model);
var multi = RetryStrategy.Execute(static (state, _) => state.connection.QueryMultiple(state._insertSql, state.model, state.transaction), (connection, _insertSql, model, transaction));
var multi = connection.QueryMultiple(_insertSql, model, transaction);
var multiRead = multi.Read();
var id = (int)(multiRead.First().id ?? multiRead.First().Id);
_keyProperty.SetValue(model, id);
@ -407,7 +381,7 @@ private void UpdateFields(IDbConnection connection, IDbTransaction transaction,
SqlBuilderExtensions.LogQuery(sql, model);
RetryStrategy.Execute(static (state, _) => state.connection.Execute(state.sql, state.model, transaction: state.transaction), (connection, sql, model, transaction));
connection.Execute(sql, model, transaction: transaction);
}
private void UpdateFields(IDbConnection connection, IDbTransaction transaction, IList<TModel> models, List<PropertyInfo> propertiesToUpdate)
@ -419,7 +393,7 @@ private void UpdateFields(IDbConnection connection, IDbTransaction transaction,
SqlBuilderExtensions.LogQuery(sql, model);
}
RetryStrategy.Execute(static (state, _) => state.connection.Execute(state.sql, state.models, transaction: state.transaction), (connection, sql, models, transaction));
connection.Execute(sql, models, transaction: transaction);
}
protected virtual SqlBuilder PagedBuilder() => Builder();

View file

@ -7,7 +7,7 @@
namespace NzbDrone.Core.Datastore.Migration
{
[Maintenance(MigrationStage.BeforeAll, TransactionBehavior.None)]
public class DatabaseEngineVersionCheck : ForwardOnlyMigration
public class DatabaseEngineVersionCheck : FluentMigrator.Migration
{
protected readonly Logger _logger;
@ -22,6 +22,11 @@ public override void Up()
IfDatabase("postgres").Execute.WithConnection(LogPostgresVersion);
}
public override void Down()
{
// No-op
}
private void LogSqliteVersion(IDbConnection conn, IDbTransaction tran)
{
using (var versionCmd = conn.CreateCommand())

View file

@ -6,6 +6,7 @@
using FluentMigrator.Runner.Initialization;
using FluentMigrator.Runner.Processors;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog;
using NLog.Extensions.Logging;
@ -19,10 +20,13 @@ public interface IMigrationController
public class MigrationController : IMigrationController
{
private readonly Logger _logger;
private readonly ILoggerProvider _migrationLoggerProvider;
public MigrationController(Logger logger)
public MigrationController(Logger logger,
ILoggerProvider migrationLoggerProvider)
{
_logger = logger;
_migrationLoggerProvider = migrationLoggerProvider;
}
public void Migrate(string connectionString, MigrationContext migrationContext, DatabaseType databaseType)
@ -31,13 +35,16 @@ public void Migrate(string connectionString, MigrationContext migrationContext,
_logger.Info("*** Migrating {0} ***", connectionString);
ServiceProvider serviceProvider;
var db = databaseType == DatabaseType.SQLite ? "sqlite" : "postgres";
var serviceProvider = new ServiceCollection()
serviceProvider = new ServiceCollection()
.AddLogging(b => b.AddNLog())
.AddFluentMigratorCore()
.Configure<RunnerOptions>(cfg => cfg.IncludeUntaggedMaintenances = true)
.ConfigureRunner(builder => builder
.ConfigureRunner(
builder => builder
.AddPostgres()
.AddNzbDroneSQLite()
.WithGlobalConnectionString(connectionString)

View file

@ -4,14 +4,9 @@
using FluentMigrator.Builders.Create.Table;
using FluentMigrator.Runner;
using FluentMigrator.Runner.BatchParser;
using FluentMigrator.Runner.Generators;
using FluentMigrator.Runner.Generators.SQLite;
using FluentMigrator.Runner.Initialization;
using FluentMigrator.Runner.Processors;
using FluentMigrator.Runner.Processors.SQLite;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace NzbDrone.Core.Datastore.Migration.Framework
{
@ -31,40 +26,23 @@ public static IDbCommand CreateCommand(this IDbConnection conn, IDbTransaction t
return command;
}
public static void AddParameter(this IDbCommand command, object value)
public static void AddParameter(this System.Data.IDbCommand command, object value)
{
var parameter = command.CreateParameter();
parameter.Value = value;
command.Parameters.Add(parameter);
}
public static IMigrationRunnerBuilder AddNzbDroneSQLite(this IMigrationRunnerBuilder builder, bool binaryGuid = false, bool useStrictTables = false)
public static IMigrationRunnerBuilder AddNzbDroneSQLite(this IMigrationRunnerBuilder builder)
{
builder.Services
.AddTransient<SQLiteBatchParser>()
.AddScoped<SQLiteDbFactory>()
.AddScoped<NzbDroneSQLiteProcessor>(sp =>
{
var factory = sp.GetService<SQLiteDbFactory>();
var logger = sp.GetService<ILogger<NzbDroneSQLiteProcessor>>();
var options = sp.GetService<IOptionsSnapshot<ProcessorOptions>>();
var connectionStringAccessor = sp.GetService<IConnectionStringAccessor>();
var sqliteQuoter = new SQLiteQuoter(false);
return new NzbDroneSQLiteProcessor(factory, sp.GetService<SQLiteGenerator>(), logger, options, connectionStringAccessor, sp, sqliteQuoter);
})
.AddScoped<ISQLiteTypeMap>(_ => new NzbDroneSQLiteTypeMap(useStrictTables))
.AddScoped<NzbDroneSQLiteProcessor>()
.AddScoped<IMigrationProcessor>(sp => sp.GetRequiredService<NzbDroneSQLiteProcessor>())
.AddScoped(
sp =>
{
var typeMap = sp.GetRequiredService<ISQLiteTypeMap>();
return new SQLiteGenerator(
new SQLiteQuoter(binaryGuid),
typeMap,
new OptionsWrapper<GeneratorOptions>(new GeneratorOptions()));
})
.AddScoped<SQLiteQuoter>()
.AddScoped<SQLiteGenerator>()
.AddScoped<IMigrationGenerator>(sp => sp.GetRequiredService<SQLiteGenerator>());
return builder;
}
}

View file

@ -15,18 +15,15 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
{
public class NzbDroneSQLiteProcessor : SQLiteProcessor
{
private readonly SQLiteQuoter _quoter;
public NzbDroneSQLiteProcessor(SQLiteDbFactory factory,
SQLiteGenerator generator,
ILogger<NzbDroneSQLiteProcessor> logger,
IOptionsSnapshot<ProcessorOptions> options,
IConnectionStringAccessor connectionStringAccessor,
IServiceProvider serviceProvider,
SQLiteQuoter quoter)
: base(factory, generator, logger, options, connectionStringAccessor, serviceProvider, quoter)
SQLiteQuoter sqliteQuoter)
: base(factory, generator, logger, options, connectionStringAccessor, serviceProvider, sqliteQuoter)
{
_quoter = quoter;
}
public override void Process(AlterColumnExpression expression)
@ -38,7 +35,7 @@ public override void Process(AlterColumnExpression expression)
if (columnIndex == -1)
{
throw new ApplicationException($"Column {expression.Column.Name} does not exist on table {expression.TableName}.");
throw new ApplicationException(string.Format("Column {0} does not exist on table {1}.", expression.Column.Name, expression.TableName));
}
columnDefinitions[columnIndex] = expression.Column;
@ -48,28 +45,6 @@ public override void Process(AlterColumnExpression expression)
ProcessAlterTable(tableDefinition);
}
public override void Process(AlterDefaultConstraintExpression expression)
{
var tableDefinition = GetTableSchema(expression.TableName);
var columnDefinitions = tableDefinition.Columns.ToList();
var columnIndex = columnDefinitions.FindIndex(c => c.Name == expression.ColumnName);
if (columnIndex == -1)
{
throw new ApplicationException($"Column {expression.ColumnName} does not exist on table {expression.TableName}.");
}
var changedColumn = columnDefinitions[columnIndex];
changedColumn.DefaultValue = expression.DefaultValue;
columnDefinitions[columnIndex] = changedColumn;
tableDefinition.Columns = columnDefinitions;
ProcessAlterTable(tableDefinition);
}
public override void Process(DeleteColumnExpression expression)
{
var tableDefinition = GetTableSchema(expression.TableName);
@ -87,7 +62,7 @@ public override void Process(DeleteColumnExpression expression)
if (columnsToRemove.Any())
{
throw new ApplicationException($"Column {columnsToRemove.First()} does not exist on table {expression.TableName}.");
throw new ApplicationException(string.Format("Column {0} does not exist on table {1}.", columnsToRemove.First(), expression.TableName));
}
ProcessAlterTable(tableDefinition);
@ -103,12 +78,12 @@ public override void Process(RenameColumnExpression expression)
if (columnIndex == -1)
{
throw new ApplicationException($"Column {expression.OldName} does not exist on table {expression.TableName}.");
throw new ApplicationException(string.Format("Column {0} does not exist on table {1}.", expression.OldName, expression.TableName));
}
if (columnDefinitions.Any(c => c.Name == expression.NewName))
{
throw new ApplicationException($"Column {expression.NewName} already exists on table {expression.TableName}.");
throw new ApplicationException(string.Format("Column {0} already exists on table {1}.", expression.NewName, expression.TableName));
}
oldColumnDefinitions[columnIndex] = (ColumnDefinition)columnDefinitions[columnIndex].Clone();
@ -153,20 +128,21 @@ protected virtual void ProcessAlterTable(TableDefinition tableDefinition, List<C
}
// What is the cleanest way to do this? Add function to Generator?
var columnsToInsert = string.Join(", ", tableDefinition.Columns.Select(c => _quoter.QuoteColumnName(c.Name)));
var columnsToFetch = string.Join(", ", (oldColumnDefinitions ?? tableDefinition.Columns).Select(c => _quoter.QuoteColumnName(c.Name)));
var quoter = new SQLiteQuoter();
var columnsToInsert = string.Join(", ", tableDefinition.Columns.Select(c => quoter.QuoteColumnName(c.Name)));
var columnsToFetch = string.Join(", ", (oldColumnDefinitions ?? tableDefinition.Columns).Select(c => quoter.QuoteColumnName(c.Name)));
Process(new CreateTableExpression { TableName = tempTableName, Columns = tableDefinition.Columns.ToList() });
Process(new CreateTableExpression() { TableName = tempTableName, Columns = tableDefinition.Columns.ToList() });
Process($"INSERT INTO {_quoter.QuoteTableName(tempTableName)} ({columnsToInsert}) SELECT {columnsToFetch} FROM {_quoter.QuoteTableName(tableName)}");
Process(string.Format("INSERT INTO {0} ({1}) SELECT {2} FROM {3}", quoter.QuoteTableName(tempTableName), columnsToInsert, columnsToFetch, quoter.QuoteTableName(tableName)));
Process(new DeleteTableExpression { TableName = tableName });
Process(new DeleteTableExpression() { TableName = tableName });
Process(new RenameTableExpression { OldName = tempTableName, NewName = tableName });
Process(new RenameTableExpression() { OldName = tempTableName, NewName = tableName });
foreach (var index in tableDefinition.Indexes)
{
Process(new CreateIndexExpression { Index = index });
Process(new CreateIndexExpression() { Index = index });
}
}
}

View file

@ -1,76 +0,0 @@
using System.Data;
using FluentMigrator.Runner.Generators.Base;
using FluentMigrator.Runner.Generators.SQLite;
namespace NzbDrone.Core.Datastore.Migration.Framework;
// Based on https://github.com/fluentmigrator/fluentmigrator/blob/v6.2.0/src/FluentMigrator.Runner.SQLite/Generators/SQLite/SQLiteTypeMap.cs
public sealed class NzbDroneSQLiteTypeMap : TypeMapBase, ISQLiteTypeMap
{
public bool UseStrictTables { get; }
public NzbDroneSQLiteTypeMap(bool useStrictTables = false)
{
UseStrictTables = useStrictTables;
SetupTypeMaps();
}
// Must be kept in sync with upstream
protected override void SetupTypeMaps()
{
SetTypeMap(DbType.Binary, "BLOB");
SetTypeMap(DbType.Byte, "INTEGER");
SetTypeMap(DbType.Int16, "INTEGER");
SetTypeMap(DbType.Int32, "INTEGER");
SetTypeMap(DbType.Int64, "INTEGER");
SetTypeMap(DbType.SByte, "INTEGER");
SetTypeMap(DbType.UInt16, "INTEGER");
SetTypeMap(DbType.UInt32, "INTEGER");
SetTypeMap(DbType.UInt64, "INTEGER");
if (!UseStrictTables)
{
SetTypeMap(DbType.Currency, "NUMERIC");
SetTypeMap(DbType.Decimal, "NUMERIC");
SetTypeMap(DbType.Double, "NUMERIC");
SetTypeMap(DbType.Single, "NUMERIC");
SetTypeMap(DbType.VarNumeric, "NUMERIC");
SetTypeMap(DbType.Date, "DATETIME");
SetTypeMap(DbType.DateTime, "DATETIME");
SetTypeMap(DbType.DateTime2, "DATETIME");
SetTypeMap(DbType.Time, "DATETIME");
SetTypeMap(DbType.Guid, "UNIQUEIDENTIFIER");
// Custom so that we can use DateTimeOffset in Postgres for appropriate DB typing
SetTypeMap(DbType.DateTimeOffset, "DATETIME");
}
else
{
SetTypeMap(DbType.Currency, "TEXT");
SetTypeMap(DbType.Decimal, "TEXT");
SetTypeMap(DbType.Double, "REAL");
SetTypeMap(DbType.Single, "REAL");
SetTypeMap(DbType.VarNumeric, "TEXT");
SetTypeMap(DbType.Date, "TEXT");
SetTypeMap(DbType.DateTime, "TEXT");
SetTypeMap(DbType.DateTime2, "TEXT");
SetTypeMap(DbType.Time, "TEXT");
SetTypeMap(DbType.Guid, "TEXT");
// Custom so that we can use DateTimeOffset in Postgres for appropriate DB typing
SetTypeMap(DbType.DateTimeOffset, "TEXT");
}
SetTypeMap(DbType.AnsiString, "TEXT");
SetTypeMap(DbType.String, "TEXT");
SetTypeMap(DbType.AnsiStringFixedLength, "TEXT");
SetTypeMap(DbType.StringFixedLength, "TEXT");
SetTypeMap(DbType.Boolean, "INTEGER");
}
public override string GetTypeMap(DbType type, int? size, int? precision)
{
return base.GetTypeMap(type, size: null, precision: null);
}
}

View file

@ -424,8 +424,8 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
}
catch (HttpException ex)
{
_logger.Debug(ex, "qbitTorrent authentication failed.");
if (ex.Response.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
_logger.Debug("qbitTorrent authentication failed.");
if (ex.Response.StatusCode == HttpStatusCode.Forbidden)
{
throw new DownloadClientAuthenticationException("Failed to authenticate with qBittorrent.", ex);
}
@ -438,7 +438,7 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
}
// returns "Fails." on bad login
if (response.Content.IsNotNullOrWhiteSpace() && response.Content != "Ok.")
if (response.Content != "Ok.")
{
_logger.Debug("qbitTorrent authentication failed.");
throw new DownloadClientAuthenticationException("Failed to authenticate with qBittorrent.");

View file

@ -221,7 +221,7 @@ private string DownloadFromMagnetUrl(RemoteAlbum remoteAlbum, IIndexer indexer,
try
{
hash = MagnetLink.Parse(magnetUrl).InfoHashes.V1OrV2.ToHex();
hash = MagnetLink.Parse(magnetUrl).InfoHash.ToHex();
}
catch (FormatException ex)
{

View file

@ -111,26 +111,24 @@ private List<TrackedDownload> ProcessClientDownloads(IDownloadClient downloadCli
private TrackedDownload ProcessClientItem(IDownloadClient downloadClient, DownloadClientItem downloadItem)
{
TrackedDownload trackedDownload = null;
try
{
trackedDownload =
_trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition,
downloadItem);
var trackedDownload = _trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition, downloadItem);
if (trackedDownload is { State: TrackedDownloadState.Downloading or TrackedDownloadState.ImportBlocked })
{
_failedDownloadService.Check(trackedDownload);
_completedDownloadService.Check(trackedDownload);
}
return trackedDownload;
}
catch (Exception e)
{
_logger.Error(e, "Couldn't process tracked download {0}", downloadItem.Title);
}
return trackedDownload;
return null;
}
private bool DownloadIsTrackable(TrackedDownload trackedDownload)

View file

@ -169,8 +169,8 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
{
trackedDownload.RemoteAlbum = _parsingService.Map(parsedAlbumInfo,
firstHistoryItem.ArtistId,
historyItems.Where(v => v.EventType == EntityHistoryEventType.Grabbed)
.Select(h => h.AlbumId).Distinct());
historyItems.Where(v => v.EventType == EntityHistoryEventType.Grabbed).Select(h => h.AlbumId)
.Distinct());
}
else
{
@ -183,8 +183,8 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
{
trackedDownload.RemoteAlbum = _parsingService.Map(parsedAlbumInfo,
firstHistoryItem.ArtistId,
historyItems.Where(v => v.EventType == EntityHistoryEventType.Grabbed)
.Select(h => h.AlbumId).Distinct());
historyItems.Where(v => v.EventType == EntityHistoryEventType.Grabbed).Select(h => h.AlbumId)
.Distinct());
}
}
}
@ -211,17 +211,10 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
_logger.Trace("No Album found for download '{0}'", trackedDownload.DownloadItem.Title);
}
}
catch (MultipleArtistsFoundException e)
{
_logger.Debug(e, "Found multiple artists for " + downloadItem.Title);
trackedDownload.Warn("Unable to import automatically, found multiple artists: {0}", string.Join(", ", e.Artists));
}
catch (Exception e)
{
_logger.Debug(e, "Failed to find album for " + downloadItem.Title);
trackedDownload.Warn("Unable to parse albums from title");
return null;
}
LogItemChange(trackedDownload, existingItem?.DownloadItem, trackedDownload.DownloadItem);

View file

@ -82,7 +82,7 @@ protected virtual string GetInfoHash(XElement item)
{
try
{
return MagnetLink.Parse(magnetUrl).InfoHashes.V1OrV2.ToHex();
return MagnetLink.Parse(magnetUrl).InfoHash.ToHex();
}
catch
{

View file

@ -1,35 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.66" />
<PackageReference Include="Dapper" Version="2.0.151" />
<PackageReference Include="Diacritical.Net" Version="1.0.4" />
<PackageReference Include="Equ" Version="2.3.0" />
<PackageReference Include="MailKit" Version="4.14.0" />
<PackageReference Include="Polly" Version="8.6.4" />
<PackageReference Include="System.Text.Json" Version="8.0.6" />
<PackageReference Include="System.Memory" Version="4.6.3" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="8.0.20" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="FluentMigrator.Runner.Core" Version="6.2.0" />
<PackageReference Include="FluentMigrator.Runner.SQLite" Version="6.2.0" />
<PackageReference Include="FluentMigrator.Runner.Postgres" Version="6.2.0" />
<PackageReference Include="MailKit" Version="4.8.0" />
<PackageReference Include="Polly" Version="8.5.2" />
<PackageReference Include="System.Text.Json" Version="6.0.10" />
<PackageReference Include="System.Memory" Version="4.6.2" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="6.0.35" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Servarr.FluentMigrator.Runner" Version="3.3.2.9" />
<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="9.5.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.4.0" />
<PackageReference Include="NLog.Targets.Syslog" Version="7.0.0" />
<PackageReference Include="System.IO.Abstractions" Version="17.0.24" />
<PackageReference Include="TagLibSharp-Lidarr" Version="2.2.0.27" />
<PackageReference Include="Npgsql" Version="9.0.3" />
<PackageReference Include="Npgsql" Version="7.0.10" />
<PackageReference Include="SpotifyAPI.Web" Version="5.1.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="MonoTorrent" Version="3.0.2" />
<PackageReference Include="System.Drawing.Common" Version="8.0.20" />
<PackageReference Include="MonoTorrent" Version="2.0.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Common\Lidarr.Common.csproj" />

View file

@ -18,7 +18,7 @@
"AlbumStudio": "Studio Album",
"AllAlbums": "Tutti gli album",
"Actions": "Azioni",
"AllAlbumsData": "Monitora tutti gli album",
"AllAlbumsData": "Monitora tutti gli album tranne quelli speciali",
"AllowFingerprintingHelpText": "Consenti impronte per migliorare il riconoscimento delle tracce",
"AllowFingerprintingHelpTextWarning": "Questo richiede che {appName} legga le parti dei file e potrebbe causare unalta attività del disco e della rete.",
"AllArtistAlbums": "Tutti gli Artisti degli album",
@ -95,17 +95,17 @@
"DeleteImportListMessageText": "Sei sicuro di voler eliminare la lista '{name}'?",
"DeleteIndexer": "Cancella Indicizzatore",
"DeleteIndexerMessageText": "Sei sicuro di voler eliminare l'indicizzatore '{name}'?",
"DeleteMetadataProfileMessageText": "Sicuro di voler cancellare il profilo di qualità {name}",
"DeleteMetadataProfileMessageText": "Sicuro di voler cancellare il profilo di qualità {0}",
"DeleteNotification": "Cancella Notifica",
"DeleteNotificationMessageText": "Sei sicuro di voler eliminare la notifica '{name}'?",
"DeleteQualityProfile": "Cancellare il profilo di qualità",
"DeleteQualityProfileMessageText": "Sicuro di voler cancellare il profilo di qualità {name}?",
"DeleteReleaseProfile": "Cancellare il profilo di Rilascio",
"DeleteReleaseProfileMessageText": "Sei sicuro di voler cancellare questo profilo di rilascio?",
"DeleteQualityProfileMessageText": "Sicuro di voler cancellare il profilo di qualità {0}",
"DeleteReleaseProfile": "Cancellare il profilo di ritardo",
"DeleteReleaseProfileMessageText": "Sei sicuro di voler cancellare questo profilo di ritardo?",
"DeleteSelectedTrackFiles": "Cancellare i film selezionati",
"DeleteSelectedTrackFilesMessageText": "Sei sicuro di voler eliminare i file del film selezionato?",
"DeleteTag": "Cancella Tag",
"DeleteTagMessageText": "Sei sicuro di voler eliminare il tag '{label}'?",
"DeleteTagMessageText": "Sei sicuro di voler eliminare il tag '{0}'?",
"DestinationPath": "Percorso di destinazione",
"DetailedProgressBar": "Barra di avanzamento dettagliata",
"DetailedProgressBarHelpText": "Mostra testo sulla barra di avanzamento",
@ -144,7 +144,7 @@
"Fixed": "Fissato",
"Folder": "Cartella",
"Folders": "Cartelle",
"ForMoreInformationOnTheIndividualDownloadClientsClickOnTheInfoButtons": "Per maggiori informazioni sui singoli client di download, clicca sul pulsante info.",
"ForMoreInformationOnTheIndividualDownloadClientsClickOnTheInfoButtons": "Per maggiori informazioni sui singoli Indexer clicca sul pulsante info.",
"ForMoreInformationOnTheIndividualIndexersClickOnTheInfoButtons": "Per maggiori informazioni sui singoli Indexer clicca sul pulsante info.",
"ForMoreInformationOnTheIndividualListsClickOnTheInfoButtons": "Per maggiori informazioni sui singoli Indexer clicca sul pulsante info.",
"GeneralSettings": "Impostazioni Generali",
@ -198,7 +198,7 @@
"LogLevelvalueTraceTraceLoggingShouldOnlyBeEnabledTemporarily": "Il Trace Log dovrebbe essere abilitato solo temporaneamente",
"Logs": "Logs",
"LongDateFormat": "Formato Data Lungo",
"MaintenanceRelease": "Release di Manutenzione: bug fix e altri miglioramenti. Vedi la storia dei commit Github per maggiori dettagli",
"MaintenanceRelease": "Release di Manutenzione",
"ManualImport": "Import Manuale",
"MarkAsFailed": "Segna come fallito",
"MarkAsFailedMessageText": "Sei sicuro di voler segnare '{0}' come fallito?",
@ -664,7 +664,7 @@
"CutoffFormatScoreHelpText": "Una volta raggiunto questo formato personalizzato, {appName} non scaricherà più i film",
"DeleteCustomFormat": "Cancella Formato Personalizzato",
"DeleteCustomFormatMessageText": "Sei sicuro di voler eliminare il formato personalizzato '{name}'?",
"DeleteFormatMessageText": "Sei sicuro di voler cancellare il formato etichetta {name} ?",
"DeleteFormatMessageText": "Sei sicuro di voler cancellare il formato etichetta {0} ?",
"DownloadPropersAndRepacksHelpTextWarning": "Usa i formati personalizzati per aggiornare automaticamente ai Proper/Repack",
"DownloadedUnableToImportCheckLogsForDetails": "Scaricato - Impossibile importare: controlla i log per i dettagli",
"ExportCustomFormat": "Esporta formato personalizzato",
@ -732,7 +732,7 @@
"BlocklistReleaseHelpText": "Impedisci a {appName} di re-acquisire automaticamente questa versione",
"FailedToLoadQueue": "Impossibile caricare la coda",
"BlocklistReleases": "Blocca questa Release",
"DeleteConditionMessageText": "Sei sicuro di voler eliminare l'etichetta '{name}'?",
"DeleteConditionMessageText": "Sei sicuro di voler eliminare l'etichetta '{0}'?",
"Negated": "Negato",
"RemoveSelectedItems": "Rimuovi elementi selezionati",
"Required": "necessario",
@ -755,9 +755,9 @@
"Yes": "Si",
"RemoveSelectedItemQueueMessageText": "Sei sicuro di voler rimuovere {0} dalla coda?",
"RemoveSelectedItemsQueueMessageText": "Sei sicuro di voler rimuovere {0} dalla coda?",
"DeleteSelectedDownloadClientsMessageText": "Sei sicuro di voler eliminare {count} client di download selezionato(i)?",
"DeleteSelectedImportListsMessageText": "Sei sicuro di voler eliminare {count} lista(e) di importazione selezionata(e)?",
"DeleteSelectedIndexersMessageText": "Sei sicuro di voler eliminare {count} indice(i) selezionato(i)?",
"DeleteSelectedDownloadClientsMessageText": "Sei sicuro di voler eliminare l'indexer '{0}'?",
"DeleteSelectedImportListsMessageText": "Sei sicuro di voler eliminare l'indexer '{0}'?",
"DeleteSelectedIndexersMessageText": "Sei sicuro di voler eliminare l'indexer '{0}'?",
"ApplyTagsHelpTextHowToApplyArtists": "Come applicare etichette agli indicizzatori selezionati",
"ApplyTagsHelpTextHowToApplyDownloadClients": "Come applicare etichette ai client di download selezionati",
"ApplyTagsHelpTextHowToApplyImportLists": "Come applicare etichette alle liste di importazione selezionate",

View file

@ -126,11 +126,11 @@ public bool ShouldDeleteFolder(IDirectoryInfo directoryInfo, Artist artist)
if (albumParseResult == null)
{
_logger.Warn("Unable to parse file on import: [{0}]", audioFile.FullName);
_logger.Warn("Unable to parse file on import: [{0}]", audioFile);
return false;
}
_logger.Warn("Audio file detected: [{0}]", audioFile.FullName);
_logger.Warn("Audio file detected: [{0}]", audioFile);
return false;
}

View file

@ -22,7 +22,7 @@ public string GetHashFromTorrentFile(byte[] fileContents)
{
try
{
return Torrent.Load(fileContents).InfoHashes.V1OrV2.ToHex();
return Torrent.Load(fileContents).InfoHash.ToHex();
}
catch
{

View file

@ -155,9 +155,9 @@ private bool FingerprintingAllowed(bool newDownload)
private bool ShouldFingerprint(LocalAlbumRelease localAlbumRelease)
{
var worstTrackMatchDist = localAlbumRelease.TrackMapping?.Mapping
.Select(x => x.Value.Item2.NormalizedDistance())
.DefaultIfEmpty(1.0)
.Max() ?? 1.0;
.DefaultIfEmpty()
.MaxBy(x => x.Value.Item2.NormalizedDistance())
.Value.Item2.NormalizedDistance() ?? 1.0;
if (localAlbumRelease.Distance.NormalizedDistance() > 0.15 ||
localAlbumRelease.TrackMapping.LocalExtra.Any() ||

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Runtime.Serialization;
namespace NzbDrone.Core.MediaFiles.TrackImport
{
@ -18,5 +19,10 @@ public RecycleBinException(string message, Exception innerException)
: base(message, innerException)
{
}
protected RecycleBinException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Runtime.Serialization;
namespace NzbDrone.Core.MediaFiles.TrackImport
{
@ -18,5 +19,10 @@ public RootFolderNotFoundException(string message, Exception innerException)
: base(message, innerException)
{
}
protected RootFolderNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}

View file

@ -1,16 +1,27 @@
using System.Collections.Generic;
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Music
{
public class MultipleArtistsFoundException : NzbDroneException
{
public List<Artist> Artists { get; }
public MultipleArtistsFoundException(List<Artist> artists, string message, params object[] args)
public MultipleArtistsFoundException(string message, params object[] args)
: base(message, args)
{
Artists = artists;
}
public MultipleArtistsFoundException(string message)
: base(message)
{
}
public MultipleArtistsFoundException(string message, System.Exception innerException)
: base(message, innerException)
{
}
protected MultipleArtistsFoundException(string message, System.Exception innerException, params object[] args)
: base(message, innerException, args)
{
}
}
}

View file

@ -106,7 +106,7 @@ private static Artist ReturnSingleArtistOrThrow(List<Artist> artists)
return artists[0];
}
throw new MultipleArtistsFoundException(artists, "Expected one artist, but found {0}. Matching artists: {1}", artists.Count, string.Join(", ", artists));
throw new MultipleArtistsFoundException("Expected one artist, but found {0}. Matching artists: {1}", artists.Count, string.Join(",", artists.Select(s => s.Name)));
}
}
}

View file

@ -34,7 +34,7 @@ public class FileNameBuilder : IBuildFileNames
private readonly ICached<AbsoluteTrackFormat[]> _absoluteTrackFormatCache;
private readonly Logger _logger;
private static readonly Regex TitleRegex = new Regex(@"(?<escaped>\{\{|\}\})|\{(?<prefix>[- ._\[(]*)(?<token>(?:[a-z0-9]+)(?:(?<separator>[- ._]+)(?:[a-z0-9]+))?)(?::(?<customFormat>[ a-z0-9+-]+(?<![- ])))?(?<suffix>[- ._)\]]*)\}",
private static readonly Regex TitleRegex = new Regex(@"(?<escaped>\{\{|\}\})|\{(?<prefix>[- ._\[(]*)(?<token>(?:[a-z0-9]+)(?:(?<separator>[- ._]+)(?:[a-z0-9]+))?)(?::(?<customFormat>[a-z0-9+-]+(?<!-)))?(?<suffix>[- ._)\]]*)\}",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
public static readonly Regex TrackRegex = new Regex(@"(?<track>\{track(?:\:0+)?})",
@ -427,15 +427,6 @@ private void AddCustomFormats(Dictionary<string, Func<TokenMatch, string>> token
}
tokenHandlers["{Custom Formats}"] = m => string.Join(" ", customFormats.Where(x => x.IncludeCustomFormatWhenRenaming));
tokenHandlers["{Custom Format}"] = m =>
{
if (m.CustomFormat.IsNullOrWhiteSpace())
{
return string.Empty;
}
return customFormats.Where(x => x.IncludeCustomFormatWhenRenaming && x.Name == m.CustomFormat).FirstOrDefault()?.ToString() ?? string.Empty;
};
}
private string ReplaceTokens(string pattern, Dictionary<string, Func<TokenMatch, string>> tokenHandlers, NamingConfig namingConfig, bool escape = false)

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Host\Lidarr.Host.csproj" />

View file

@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="9.0.6" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.6.2" />
<PackageReference Include="DryIoc.dll" Version="5.4.3" />
<PackageReference Include="DryIoc.Microsoft.DependencyInjection" Version="6.2.0" />
</ItemGroup>

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using DryIoc;
using Lidarr.Api.V1.System;
using Lidarr.Http;
@ -33,7 +32,6 @@
using NzbDrone.Host.AccessControl;
using NzbDrone.Http.Authentication;
using NzbDrone.SignalR;
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
namespace NzbDrone.Host
@ -62,11 +60,8 @@ public void ConfigureServices(IServiceCollection services)
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedHost;
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));
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("fc00::"), 7));
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("fe80::"), 10));
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
});
services.AddRouting(options => options.LowercaseUrls = true);

View file

@ -7,7 +7,7 @@
namespace NzbDrone.Integration.Test.ApiTests
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class ArtistEditorFixture : IntegrationTest
{
private void GivenExistingArtist()

View file

@ -7,7 +7,7 @@
namespace NzbDrone.Integration.Test.ApiTests
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class ArtistFixture : IntegrationTest
{
[Test]

View file

@ -4,7 +4,7 @@
namespace NzbDrone.Integration.Test.ApiTests
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class ArtistLookupFixture : IntegrationTest
{
[TestCase("Kiss", "Kiss")]

View file

@ -6,7 +6,7 @@
namespace NzbDrone.Integration.Test.ApiTests
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class BlocklistFixture : IntegrationTest
{
private ArtistResource _artist;

View file

@ -9,7 +9,7 @@
namespace NzbDrone.Integration.Test.ApiTests
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class CalendarFixture : IntegrationTest
{
public ClientBase<AlbumResource> Calendar;

View file

@ -7,7 +7,7 @@
namespace NzbDrone.Integration.Test.ApiTests
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class TrackFixture : IntegrationTest
{
private ArtistResource _artist;

View file

@ -8,7 +8,7 @@
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class CutoffUnmetFixture : IntegrationTest
{
[SetUp]

View file

@ -7,7 +7,7 @@
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
{
[TestFixture]
[Ignore("Waiting for metadata to be back again", Until = "2025-12-31 00:00:00Z")]
[Ignore("Waiting for metadata to be back again", Until = "2025-10-01 00:00:00Z")]
public class MissingFixture : IntegrationTest
{
[SetUp]

View file

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.20" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.35" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lidarr.Api.V1\Lidarr.Api.V1.csproj" />

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Test.Common\Lidarr.Test.Common.csproj" />

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1.34-servarr20" />

Some files were not shown because too many files have changed in this diff Show more