diff --git a/appveyor.yml b/appveyor.yml index c463fa4ce3..330ae69696 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ image: -- Visual Studio 2017 +- Visual Studio 2019 - Ubuntu1804 services: diff --git a/src/Api/Controllers/PushController.cs b/src/Api/Controllers/PushController.cs index c337073754..528de7a9b9 100644 --- a/src/Api/Controllers/PushController.cs +++ b/src/Api/Controllers/PushController.cs @@ -9,6 +9,7 @@ using System.Linq; using Microsoft.AspNetCore.Hosting; using Bit.Api.Utilities; using Bit.Core.Utilities; +using Microsoft.Extensions.Hosting; namespace Bit.Api.Controllers { @@ -19,14 +20,14 @@ namespace Bit.Api.Controllers { private readonly IPushRegistrationService _pushRegistrationService; private readonly IPushNotificationService _pushNotificationService; - private readonly IHostingEnvironment _environment; + private readonly IWebHostEnvironment _environment; private readonly CurrentContext _currentContext; private readonly GlobalSettings _globalSettings; public PushController( IPushRegistrationService pushRegistrationService, IPushNotificationService pushNotificationService, - IHostingEnvironment environment, + IWebHostEnvironment environment, CurrentContext currentContext, GlobalSettings globalSettings) { diff --git a/src/Api/Utilities/ExceptionHandlerFilterAttribute.cs b/src/Api/Utilities/ExceptionHandlerFilterAttribute.cs index aace99648d..fe99d5fbfd 100644 --- a/src/Api/Utilities/ExceptionHandlerFilterAttribute.cs +++ b/src/Api/Utilities/ExceptionHandlerFilterAttribute.cs @@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Tokens; using Stripe; +using Microsoft.Extensions.Hosting; namespace Bit.Api.Utilities { @@ -113,7 +114,7 @@ namespace Bit.Api.Utilities else { var errorModel = internalErrorModel ?? new InternalApi.ErrorResponseModel(errorMessage); - var env = context.HttpContext.RequestServices.GetRequiredService(); + var env = context.HttpContext.RequestServices.GetRequiredService(); if(env.IsDevelopment()) { errorModel.ExceptionMessage = exception.Message; diff --git a/src/Billing/Controllers/StripeController.cs b/src/Billing/Controllers/StripeController.cs index a8e869be7b..a9e7098ff6 100644 --- a/src/Billing/Controllers/StripeController.cs +++ b/src/Billing/Controllers/StripeController.cs @@ -6,6 +6,7 @@ using Bit.Core.Services; using Bit.Core.Utilities; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Stripe; @@ -24,7 +25,7 @@ namespace Bit.Billing.Controllers private const decimal PremiumPlanAppleIapPrice = 14.99M; private readonly BillingSettings _billingSettings; - private readonly IHostingEnvironment _hostingEnvironment; + private readonly IWebHostEnvironment _hostingEnvironment; private readonly IOrganizationService _organizationService; private readonly IOrganizationRepository _organizationRepository; private readonly ITransactionRepository _transactionRepository; @@ -37,7 +38,7 @@ namespace Bit.Billing.Controllers public StripeController( GlobalSettings globalSettings, IOptions billingSettings, - IHostingEnvironment hostingEnvironment, + IWebHostEnvironment hostingEnvironment, IOrganizationService organizationService, IOrganizationRepository organizationRepository, ITransactionRepository transactionRepository, diff --git a/src/Core/Repositories/EntityFramework/OrganizationRepository.cs b/src/Core/Repositories/EntityFramework/OrganizationRepository.cs index 8cbc27b481..0aaae9a474 100644 --- a/src/Core/Repositories/EntityFramework/OrganizationRepository.cs +++ b/src/Core/Repositories/EntityFramework/OrganizationRepository.cs @@ -49,9 +49,10 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task UpdateStorageAsync(Guid id) + public Task UpdateStorageAsync(Guid id) { // TODO + return Task.FromResult(0); } public async Task> GetManyAbilitiesAsync() diff --git a/src/Core/Repositories/EntityFramework/UserRepository.cs b/src/Core/Repositories/EntityFramework/UserRepository.cs index 0285033c89..61ad51ff8e 100644 --- a/src/Core/Repositories/EntityFramework/UserRepository.cs +++ b/src/Core/Repositories/EntityFramework/UserRepository.cs @@ -83,9 +83,10 @@ namespace Bit.Core.Repositories.EntityFramework } } - public async Task UpdateStorageAsync(Guid id) + public Task UpdateStorageAsync(Guid id) { // TODO + return Task.FromResult(0); } public async Task UpdateRenewalReminderDateAsync(Guid id, DateTime renewalReminderDate) diff --git a/src/Core/Services/Implementations/AmazonSesMailDeliveryService.cs b/src/Core/Services/Implementations/AmazonSesMailDeliveryService.cs index 7276a4731f..1d2977591d 100644 --- a/src/Core/Services/Implementations/AmazonSesMailDeliveryService.cs +++ b/src/Core/Services/Implementations/AmazonSesMailDeliveryService.cs @@ -14,7 +14,7 @@ namespace Bit.Core.Services public class AmazonSesMailDeliveryService : IMailDeliveryService, IDisposable { private readonly GlobalSettings _globalSettings; - private readonly IHostingEnvironment _hostingEnvironment; + private readonly IWebHostEnvironment _hostingEnvironment; private readonly ILogger _logger; private readonly AmazonSimpleEmailServiceClient _client; private readonly string _source; @@ -23,7 +23,7 @@ namespace Bit.Core.Services public AmazonSesMailDeliveryService( GlobalSettings globalSettings, - IHostingEnvironment hostingEnvironment, + IWebHostEnvironment hostingEnvironment, ILogger logger) { if(string.IsNullOrWhiteSpace(globalSettings.Amazon?.AccessKeyId)) diff --git a/src/Core/Services/Implementations/AppleIapService.cs b/src/Core/Services/Implementations/AppleIapService.cs index f02fac7d32..b070ac8946 100644 --- a/src/Core/Services/Implementations/AppleIapService.cs +++ b/src/Core/Services/Implementations/AppleIapService.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Bit.Billing.Models; using Bit.Core.Repositories; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -17,13 +18,13 @@ namespace Bit.Core.Services private readonly HttpClient _httpClient = new HttpClient(); private readonly GlobalSettings _globalSettings; - private readonly IHostingEnvironment _hostingEnvironment; + private readonly IWebHostEnvironment _hostingEnvironment; private readonly IMetaDataRepository _metaDataRespository; private readonly ILogger _logger; public AppleIapService( GlobalSettings globalSettings, - IHostingEnvironment hostingEnvironment, + IWebHostEnvironment hostingEnvironment, IMetaDataRepository metaDataRespository, ILogger logger) { diff --git a/src/Core/Services/Implementations/LicensingService.cs b/src/Core/Services/Implementations/LicensingService.cs index aa904da944..037c42b656 100644 --- a/src/Core/Services/Implementations/LicensingService.cs +++ b/src/Core/Services/Implementations/LicensingService.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; namespace Bit.Core.Services { @@ -31,7 +32,7 @@ namespace Bit.Core.Services IUserRepository userRepository, IOrganizationRepository organizationRepository, IOrganizationUserRepository organizationUserRepository, - IHostingEnvironment environment, + IWebHostEnvironment environment, ILogger logger, GlobalSettings globalSettings) { diff --git a/src/Core/Services/NoopImplementations/NoopLicensingService.cs b/src/Core/Services/NoopImplementations/NoopLicensingService.cs index 37e48c0f1b..61d7eb15ec 100644 --- a/src/Core/Services/NoopImplementations/NoopLicensingService.cs +++ b/src/Core/Services/NoopImplementations/NoopLicensingService.cs @@ -3,13 +3,14 @@ using Microsoft.AspNetCore.Hosting; using System; using Bit.Core.Models.Business; using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; namespace Bit.Core.Services { public class NoopLicensingService : ILicensingService { public NoopLicensingService( - IHostingEnvironment environment, + IWebHostEnvironment environment, GlobalSettings globalSettings) { if(!environment.IsDevelopment() && globalSettings.SelfHosted) diff --git a/test/Core.Test/Services/AmazonSesMailDeliveryServiceTests.cs b/test/Core.Test/Services/AmazonSesMailDeliveryServiceTests.cs index edea84eae8..b1c0a4988e 100644 --- a/test/Core.Test/Services/AmazonSesMailDeliveryServiceTests.cs +++ b/test/Core.Test/Services/AmazonSesMailDeliveryServiceTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.Core.Services; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Logging; @@ -12,13 +12,13 @@ namespace Bit.Core.Test.Services private readonly AmazonSesMailDeliveryService _sut; private readonly GlobalSettings _globalSettings; - private readonly IHostingEnvironment _hostingEnvironment; + private readonly IWebHostEnvironment _hostingEnvironment; private readonly ILogger _logger; public AmazonSesMailDeliveryServiceTests() { _globalSettings = new GlobalSettings(); - _hostingEnvironment = Substitute.For(); + _hostingEnvironment = Substitute.For(); _logger = Substitute.For>(); _sut = new AmazonSesMailDeliveryService( _globalSettings, diff --git a/test/Core.Test/Services/LicensingServiceTests.cs b/test/Core.Test/Services/LicensingServiceTests.cs index bd7e9ea657..025ab1f561 100644 --- a/test/Core.Test/Services/LicensingServiceTests.cs +++ b/test/Core.Test/Services/LicensingServiceTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Bit.Core.Repositories; using Bit.Core.Services; using Microsoft.AspNetCore.Hosting; @@ -16,7 +16,7 @@ namespace Bit.Core.Test.Services private readonly IUserRepository _userRepository; private readonly IOrganizationRepository _organizationRepository; private readonly IOrganizationUserRepository _organizationUserRepository; - private readonly IHostingEnvironment _hostingEnvironment; + private readonly IWebHostEnvironment _hostingEnvironment; private readonly ILogger _logger; public LicensingServiceTests() @@ -24,7 +24,7 @@ namespace Bit.Core.Test.Services _userRepository = Substitute.For(); _organizationRepository = Substitute.For(); _organizationUserRepository = Substitute.For(); - _hostingEnvironment = Substitute.For(); + _hostingEnvironment = Substitute.For(); _logger = Substitute.For>(); _globalSettings = new GlobalSettings();