diff options
-rw-r--r-- | docs/release-notes.md | 2 | ||||
-rw-r--r-- | src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs | 16 | ||||
-rw-r--r-- | src/SMAPI.Web/Framework/Storage/StorageProvider.cs | 41 | ||||
-rw-r--r-- | src/SMAPI.Web/SMAPI.Web.csproj | 1 | ||||
-rw-r--r-- | src/SMAPI.Web/appsettings.Development.json | 3 | ||||
-rw-r--r-- | src/SMAPI.Web/appsettings.json | 5 |
6 files changed, 6 insertions, 62 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index fa64a037..591f4cc2 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -13,7 +13,7 @@ * For the web UI: * Added option to edit & reupload in the JSON validator. - * If a JSON validator upload can't be saved to Pastebin (e.g. due to rate limits), it's now uploaded to Amazon S3 instead. Files uploaded to S3 expire after one month. + * The log parser and JSON validator no longer save files to Pastebin due to ongoing performance issues. All files are now saved to Azure Blob storage instead and expire after one month. * Updated the JSON validator for Content Patcher 1.10 and 1.11. * Fixed JSON validator no longer letting you change format when viewing results. 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 @@ -14,22 +14,6 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels /**** - ** Amazon Web Services - ****/ - /// <summary>The access key for AWS authentication.</summary> - public string AmazonAccessKey { get; set; } - - /// <summary>The secret key for AWS authentication.</summary> - public string AmazonSecretKey { get; set; } - - /// <summary>The AWS region endpoint (like 'us-east-1').</summary> - public string AmazonRegion { get; set; } - - /// <summary>The AWS bucket in which to store temporary uploaded logs.</summary> - public string AmazonTempBucket { get; set; } - - - /**** ** Azure ****/ /// <summary>The connection string for the Azure Blob storage account.</summary> 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 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="AWSSDK.S3" Version="3.3.108.4" /> <PackageReference Include="Azure.Storage.Blobs" Version="12.1.0" /> <PackageReference Include="Hangfire.AspNetCore" Version="1.7.7" /> <PackageReference Include="Hangfire.Mongo" Version="0.6.5" /> 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, |