From ba46491ebc305a66a0a3a1f3cefa8bb677e57ff7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 21 Dec 2019 23:14:15 -0500 Subject: drop Amazon S3 support --- .../Framework/ConfigModels/ApiClientsConfig.cs | 16 --------- src/SMAPI.Web/Framework/Storage/StorageProvider.cs | 41 +++------------------- src/SMAPI.Web/SMAPI.Web.csproj | 1 - src/SMAPI.Web/appsettings.Development.json | 3 -- src/SMAPI.Web/appsettings.json | 5 --- 5 files changed, 5 insertions(+), 61 deletions(-) (limited to 'src') diff --git a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs index 4a73750b..878130bf 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs @@ -13,22 +13,6 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels public string UserAgent { get; set; } - /**** - ** Amazon Web Services - ****/ - /// The access key for AWS authentication. - public string AmazonAccessKey { get; set; } - - /// The secret key for AWS authentication. - public string AmazonSecretKey { get; set; } - - /// The AWS region endpoint (like 'us-east-1'). - public string AmazonRegion { get; set; } - - /// The AWS bucket in which to store temporary uploaded logs. - public string AmazonTempBucket { get; set; } - - /**** ** Azure ****/ diff --git a/src/SMAPI.Web/Framework/Storage/StorageProvider.cs b/src/SMAPI.Web/Framework/Storage/StorageProvider.cs index b2d8ae7e..12a35f18 100644 --- a/src/SMAPI.Web/Framework/Storage/StorageProvider.cs +++ b/src/SMAPI.Web/Framework/Storage/StorageProvider.cs @@ -2,10 +2,6 @@ using System; using System.IO; using System.Text; using System.Threading.Tasks; -using Amazon; -using Amazon.Runtime; -using Amazon.S3; -using Amazon.S3.Model; using Azure; using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; @@ -96,39 +92,12 @@ namespace StardewModdingAPI.Web.Framework.Storage } catch (RequestFailedException ex) { - if (ex.ErrorCode != "BlobNotFound") - return new StoredFileInfo { Error = $"Could not fetch that file from storage ({ex.ErrorCode}: {ex.Message})." }; - } - - // try legacy Amazon S3 - { - var credentials = new BasicAWSCredentials(accessKey: this.ClientsConfig.AmazonAccessKey, secretKey: this.ClientsConfig.AmazonSecretKey); - using IAmazonS3 s3 = new AmazonS3Client(credentials, RegionEndpoint.GetBySystemName(this.ClientsConfig.AmazonRegion)); - - try - { - using GetObjectResponse response = await s3.GetObjectAsync(this.ClientsConfig.AmazonTempBucket, $"uploads/{id}"); - using Stream responseStream = response.ResponseStream; - using StreamReader reader = new StreamReader(responseStream); - - DateTime expiry = response.Expiration.ExpiryDateUtc; - string pastebinError = response.Metadata["x-amz-meta-pastebin-error"]; - string content = this.GzipHelper.DecompressString(reader.ReadToEnd()); - - return new StoredFileInfo - { - Success = true, - Content = content, - Expiry = expiry, - Warning = pastebinError - }; - } - catch (AmazonServiceException ex) + return new StoredFileInfo { - return ex.ErrorCode == "NoSuchKey" - ? new StoredFileInfo { Error = "There's no file with that ID." } - : new StoredFileInfo { Error = $"Could not fetch that file from AWS S3 ({ex.ErrorCode}: {ex.Message})." }; - } + Error = ex.ErrorCode == "BlobNotFound" + ? "There's no file with that ID." + : $"Could not fetch that file from storage ({ex.ErrorCode}: {ex.Message})." + }; } } diff --git a/src/SMAPI.Web/SMAPI.Web.csproj b/src/SMAPI.Web/SMAPI.Web.csproj index 773a7316..22f5e975 100644 --- a/src/SMAPI.Web/SMAPI.Web.csproj +++ b/src/SMAPI.Web/SMAPI.Web.csproj @@ -12,7 +12,6 @@ - diff --git a/src/SMAPI.Web/appsettings.Development.json b/src/SMAPI.Web/appsettings.Development.json index 05f0da1d..3c2001ef 100644 --- a/src/SMAPI.Web/appsettings.Development.json +++ b/src/SMAPI.Web/appsettings.Development.json @@ -9,9 +9,6 @@ */ { "ApiClients": { - "AmazonAccessKey": null, - "AmazonSecretKey": null, - "AzureBlobConnectionString": null, "GitHubUsername": null, diff --git a/src/SMAPI.Web/appsettings.json b/src/SMAPI.Web/appsettings.json index c6dc1b69..0f61ebb9 100644 --- a/src/SMAPI.Web/appsettings.json +++ b/src/SMAPI.Web/appsettings.json @@ -24,11 +24,6 @@ "ApiClients": { "UserAgent": "SMAPI/{0} (+https://smapi.io)", - "AmazonAccessKey": null, - "AmazonSecretKey": null, - "AmazonRegion": "us-east-1", - "AmazonTempBucket": "smapi-web-temp", - "AzureBlobConnectionString": null, "AzureBlobTempContainer": "smapi-web-temp", "AzureBlobTempExpiryDays": 30, -- cgit