From ec628e9217cb0a1cf8e02c3af93c7b7ef66079d8 Mon Sep 17 00:00:00 2001 From: Jamie Date: Sat, 21 Jul 2018 21:13:56 +0100 Subject: [PATCH 1/5] Updated to 2.1.1 --- src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj | 2 +- src/Ombi.Api.Service/Ombi.Api.Service.csproj | 2 +- src/Ombi.Api/Ombi.Api.csproj | 2 +- src/Ombi.Core.Tests/Ombi.Core.Tests.csproj | 4 ++-- src/Ombi.Core/Ombi.Core.csproj | 6 +++--- .../Ombi.DependencyInjection.csproj | 6 +++--- src/Ombi.Helpers/Ombi.Helpers.csproj | 4 ++-- .../Ombi.Notifications.Tests.csproj | 4 ++-- .../Ombi.Schedule.Tests.csproj | 6 +++--- src/Ombi.Settings/Ombi.Settings.csproj | 2 +- src/Ombi.Store/Ombi.Store.csproj | 8 ++++---- src/Ombi.Tests/Ombi.Tests.csproj | 4 ++-- src/Ombi.Updater/Ombi.Updater.csproj | 18 +++++++++--------- src/Ombi/Ombi.csproj | 10 +++++----- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj b/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj index d2b605337..0c615f301 100644 --- a/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj +++ b/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Ombi.Api.Service/Ombi.Api.Service.csproj b/src/Ombi.Api.Service/Ombi.Api.Service.csproj index 67f37c80d..8cbddd874 100644 --- a/src/Ombi.Api.Service/Ombi.Api.Service.csproj +++ b/src/Ombi.Api.Service/Ombi.Api.Service.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Ombi.Api/Ombi.Api.csproj b/src/Ombi.Api/Ombi.Api.csproj index 32fc60bb6..804512945 100644 --- a/src/Ombi.Api/Ombi.Api.csproj +++ b/src/Ombi.Api/Ombi.Api.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj index db98876df..8f0abee8f 100644 --- a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj +++ b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + netcoreapp2.1 @@ -9,7 +9,7 @@ - + diff --git a/src/Ombi.Core/Ombi.Core.csproj b/src/Ombi.Core/Ombi.Core.csproj index 2037113bd..104db24fc 100644 --- a/src/Ombi.Core/Ombi.Core.csproj +++ b/src/Ombi.Core/Ombi.Core.csproj @@ -12,9 +12,9 @@ - - - + + + diff --git a/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj b/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj index 675f6461b..2e7f984a7 100644 --- a/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj +++ b/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj @@ -9,9 +9,9 @@ - - - + + + diff --git a/src/Ombi.Helpers/Ombi.Helpers.csproj b/src/Ombi.Helpers/Ombi.Helpers.csproj index 12c6fecc4..e94afc816 100644 --- a/src/Ombi.Helpers/Ombi.Helpers.csproj +++ b/src/Ombi.Helpers/Ombi.Helpers.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj b/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj index 339986ef5..de1c55533 100644 --- a/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj +++ b/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj @@ -1,14 +1,14 @@  - netcoreapp2.0 + netcoreapp2.1 - + diff --git a/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj b/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj index bdfbd60e6..a124f01bd 100644 --- a/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj +++ b/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj @@ -1,16 +1,16 @@ - netcoreapp2.0 + netcoreapp2.1 - + - + diff --git a/src/Ombi.Settings/Ombi.Settings.csproj b/src/Ombi.Settings/Ombi.Settings.csproj index 3cb56cb07..19a415a47 100644 --- a/src/Ombi.Settings/Ombi.Settings.csproj +++ b/src/Ombi.Settings/Ombi.Settings.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Ombi.Store/Ombi.Store.csproj b/src/Ombi.Store/Ombi.Store.csproj index 703bbf672..2ceb78424 100644 --- a/src/Ombi.Store/Ombi.Store.csproj +++ b/src/Ombi.Store/Ombi.Store.csproj @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/src/Ombi.Tests/Ombi.Tests.csproj b/src/Ombi.Tests/Ombi.Tests.csproj index 6296d9e8c..95eb09353 100644 --- a/src/Ombi.Tests/Ombi.Tests.csproj +++ b/src/Ombi.Tests/Ombi.Tests.csproj @@ -7,12 +7,12 @@ - + - + diff --git a/src/Ombi.Updater/Ombi.Updater.csproj b/src/Ombi.Updater/Ombi.Updater.csproj index 3a55a7040..07fb92d81 100644 --- a/src/Ombi.Updater/Ombi.Updater.csproj +++ b/src/Ombi.Updater/Ombi.Updater.csproj @@ -3,7 +3,7 @@ Exe win10-x64;win10-x86;osx-x64;ubuntu-x64;debian.8-x64;centos.7-x64;linux-x64;linux-arm;linux-arm64; - netcoreapp2.0 + netcoreapp2.1 3.0.0.0 3.0.0.0 @@ -12,14 +12,14 @@ - - - - - - - - + + + + + + + + diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index 8b9e00c45..06fc02b81 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + netcoreapp2.1 win10-x64;win10-x86;osx-x64;ubuntu-x64;debian.8-x64;centos.7-x64;linux-x64;linux-arm;linux-arm64; false Latest @@ -67,10 +67,10 @@ - - - - + + + + From a5435fe15d25675b1ef89d02179e796a9d8707dd Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 26 Jul 2018 15:35:42 +0100 Subject: [PATCH 2/5] Upgraded to .net 2.1.2 (Includes security fixes) --- appveyor.yml | 10 +++++----- build.cake | 2 +- src/Ombi/Ombi.csproj | 2 +- src/Ombi/Startup.cs | 2 -- src/Ombi/StartupExtensions.cs | 13 +------------ 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 39d67b91d..862993a21 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,19 +15,19 @@ test: off after_build: - cmd: >- - appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\windows.zip" + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\windows.zip" - appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\osx.tar.gz" + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\osx.tar.gz" - appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\linux.tar.gz" + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\linux.tar.gz" - appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\linux-arm.tar.gz" + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\linux-arm.tar.gz" - appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\windows-32bit.zip" + appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\windows-32bit.zip" # appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\linux-arm64.tar.gz" diff --git a/build.cake b/build.cake index a497c5f77..d200eac98 100644 --- a/build.cake +++ b/build.cake @@ -26,7 +26,7 @@ var csProj = "./src/Ombi/Ombi.csproj"; // Path to the project.csproj var solutionFile = "Ombi.sln"; // Solution file if needed GitVersion versionInfo = null; -var frameworkVer = "netcoreapp2.0"; +var frameworkVer = "netcoreapp2.1"; var buildSettings = new DotNetCoreBuildSettings { diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index 06fc02b81..f2adbe506 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -67,7 +67,7 @@ - + diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index b8a841592..42503a5c6 100644 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -5,7 +5,6 @@ using AutoMapper.EquivalencyExpression; using Hangfire; using Hangfire.Dashboard; using Hangfire.SQLite; -using Microsoft.ApplicationInsights.Extensibility; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; @@ -79,7 +78,6 @@ namespace Ombi // This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { - TelemetryConfiguration.Active.DisableTelemetry = true; // Add framework services. services.AddDbContext(); diff --git a/src/Ombi/StartupExtensions.cs b/src/Ombi/StartupExtensions.cs index a2c44e7f3..0304ae48d 100644 --- a/src/Ombi/StartupExtensions.cs +++ b/src/Ombi/StartupExtensions.cs @@ -1,25 +1,14 @@ using System; using System.IO; -using System.Linq; -using System.Net; using System.Reflection; -using System.Security.Principal; using System.Text; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.PlatformAbstractions; using Microsoft.IdentityModel.Tokens; using Ombi.Config; -using Ombi.Core.Authentication; -using Ombi.Core.Settings; using Ombi.Helpers; using Ombi.Models.Identity; -using Ombi.Settings.Settings.Models; using Swashbuckle.AspNetCore.Swagger; namespace Ombi @@ -45,7 +34,7 @@ namespace Ombi } }); c.CustomSchemaIds(x => x.FullName); - var basePath = PlatformServices.Default.Application.ApplicationBasePath; + var basePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var xmlPath = Path.Combine(basePath, "Swagger.xml"); try { From f5f05db4f1e465413efe4e9aa8642f431b7edd76 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 26 Jul 2018 15:38:03 +0100 Subject: [PATCH 3/5] Updated Polly !wip --- src/Ombi.Api/Ombi.Api.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi.Api/Ombi.Api.csproj b/src/Ombi.Api/Ombi.Api.csproj index 804512945..a37c128fb 100644 --- a/src/Ombi.Api/Ombi.Api.csproj +++ b/src/Ombi.Api/Ombi.Api.csproj @@ -11,7 +11,7 @@ - + From efd1d6e08a285f173b4ebd39c2990ffdb6f9ba98 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 26 Jul 2018 15:53:06 +0100 Subject: [PATCH 4/5] Updated swagger --- src/Ombi/Ombi.csproj | 2 +- src/Ombi/StartupExtensions.cs | 54 ++++++++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index f2adbe506..9212b3f79 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -78,7 +78,7 @@ - + diff --git a/src/Ombi/StartupExtensions.cs b/src/Ombi/StartupExtensions.cs index 0304ae48d..d81227ff4 100644 --- a/src/Ombi/StartupExtensions.cs +++ b/src/Ombi/StartupExtensions.cs @@ -1,8 +1,10 @@ using System; +using System.Collections.Generic; using System.IO; using System.Reflection; using System.Text; using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.IdentityModel.Tokens; @@ -10,9 +12,27 @@ using Ombi.Config; using Ombi.Helpers; using Ombi.Models.Identity; using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; namespace Ombi { + public class AddRequiredHeaderParameter : IOperationFilter + { + + public void Apply(Operation operation, OperationFilterContext context) + { + if (operation.Parameters == null) + operation.Parameters = new List(); + + operation.Parameters.Add(new NonBodyParameter + { + Name = "ApiKey", + In = "header", + Type = "apiKey", + + }); + } + } public static class StartupExtensions { public static void AddSwagger(this IServiceCollection services) @@ -24,16 +44,36 @@ namespace Ombi { Version = "v1", Title = "Ombi Api", - Description = "The API for Ombi, most of these calls require an auth token that you can get from calling POST:\"/api/v1/token\" with the body of: \n {\n\"username\":\"YOURUSERNAME\",\n\"password\":\"YOURPASSWORD\"\n} \n" + - "You can then use the returned token in the JWT Token field e.g. \"Bearer Token123xxff\"", Contact = new Contact { - Email = "tidusjar@gmail.com", Name = "Jamie Rees", Url = "https://www.ombi.io/" } }); + var security = new Dictionary> + { + //{"Bearer", new string[] { }}, + {"ApiKey", new string[] { }}, + }; + + //c.AddSecurityDefinition("Bearer", new ApiKeyScheme + //{ + // Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", + // Name = "Authorization", + // In = "header", + // Type = "apiKey" + //}); + + c.AddSecurityDefinition("ApiKey", new ApiKeyScheme + { + Description = "API Key provided by Ombi. Example: \"ApiKey: {token}\"", + Name = "ApiKey", + In = "header", + Type = "apiKey" + }); + c.AddSecurityRequirement(security); c.CustomSchemaIds(x => x.FullName); + c.OperationFilter(); var basePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var xmlPath = Path.Combine(basePath, "Swagger.xml"); try @@ -44,13 +84,7 @@ namespace Ombi { Console.WriteLine(e); } - c.AddSecurityDefinition("Bearer", new JwtBearer - { - Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", - Name = "Authorization", - In = "header", - Type = "apiKey", - }); + c.OperationFilter(); c.DescribeAllParametersInCamelCase(); From 503afd6c744a948ec65e415025e0f1502fafd947 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 26 Jul 2018 15:54:14 +0100 Subject: [PATCH 5/5] updated mailkit !wip --- src/Ombi.Notifications/Ombi.Notifications.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi.Notifications/Ombi.Notifications.csproj b/src/Ombi.Notifications/Ombi.Notifications.csproj index 46a64072e..2b5c95154 100644 --- a/src/Ombi.Notifications/Ombi.Notifications.csproj +++ b/src/Ombi.Notifications/Ombi.Notifications.csproj @@ -10,7 +10,7 @@ - +