summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-12-21 23:14:15 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-12-21 23:14:15 -0500
commitba46491ebc305a66a0a3a1f3cefa8bb677e57ff7 (patch)
tree87073105301f9348a01322e5715cae183039c6e2 /src
parent242dc718cdedf2c7a264670008b9f760eba160d9 (diff)
downloadSMAPI-ba46491ebc305a66a0a3a1f3cefa8bb677e57ff7.tar.gz
SMAPI-ba46491ebc305a66a0a3a1f3cefa8bb677e57ff7.tar.bz2
SMAPI-ba46491ebc305a66a0a3a1f3cefa8bb677e57ff7.zip
drop Amazon S3 support
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs16
-rw-r--r--src/SMAPI.Web/Framework/Storage/StorageProvider.cs41
-rw-r--r--src/SMAPI.Web/SMAPI.Web.csproj1
-rw-r--r--src/SMAPI.Web/appsettings.Development.json3
-rw-r--r--src/SMAPI.Web/appsettings.json5
5 files changed, 5 insertions, 61 deletions
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,