summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/SMAPI.Web/Controllers/JsonValidatorController.cs2
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs3
-rw-r--r--src/SMAPI.Web/Framework/Storage/StorageProvider.cs3
-rw-r--r--src/SMAPI.Web/appsettings.json3
4 files changed, 8 insertions, 3 deletions
diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs
index e4eff0f4..c4bfff3b 100644
--- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs
+++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs
@@ -141,7 +141,7 @@ namespace StardewModdingAPI.Web.Controllers
return this.View("Index", this.GetModel(null, schemaName).SetUploadError("The JSON file seems to be empty."));
// upload file
- var result = await this.Storage.SaveAsync(title: $"JSON validator {DateTime.UtcNow:s}", content: input, compress: true);
+ UploadResult result = await this.Storage.SaveAsync(title: $"JSON validator {DateTime.UtcNow:s}", content: input, compress: true);
if (!result.Succeeded)
return this.View("Index", this.GetModel(result.ID, schemaName).SetUploadError(result.UploadError));
diff --git a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs
index 1e020840..e88f351f 100644
--- a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs
+++ b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs
@@ -97,5 +97,8 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels
/// <summary>The developer key used to authenticate with the Pastebin API.</summary>
public string PastebinDevKey { get; set; }
+ /// <summary>Whether to enable uploading new files to Pastebin. This doesn't affect fetching already-uploaded files.</summary>
+ public bool PastebinEnableUploads { get; set; }
+
}
}
diff --git a/src/SMAPI.Web/Framework/Storage/StorageProvider.cs b/src/SMAPI.Web/Framework/Storage/StorageProvider.cs
index bbb6e06b..e5e71325 100644
--- a/src/SMAPI.Web/Framework/Storage/StorageProvider.cs
+++ b/src/SMAPI.Web/Framework/Storage/StorageProvider.cs
@@ -52,7 +52,8 @@ namespace StardewModdingAPI.Web.Framework.Storage
public async Task<UploadResult> SaveAsync(string title, string content, bool compress = true)
{
// save to PasteBin
- string uploadError;
+ string uploadError = null;
+ if (this.ClientsConfig.PastebinEnableUploads)
{
SavePasteResult result = await this.Pastebin.PostAsync(title, content);
if (result.Success)
diff --git a/src/SMAPI.Web/appsettings.json b/src/SMAPI.Web/appsettings.json
index 2e20b299..6ba05a22 100644
--- a/src/SMAPI.Web/appsettings.json
+++ b/src/SMAPI.Web/appsettings.json
@@ -49,7 +49,8 @@
"PastebinBaseUrl": "https://pastebin.com/",
"PastebinUserKey": null,
- "PastebinDevKey": null
+ "PastebinDevKey": null,
+ "PastebinEnableUploads": true
},
"MongoDB": {