diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-13 11:59:17 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-09-13 11:59:17 -0400 |
commit | 4189e2f3faa9197e83aebd32fc0af93d46ee1a61 (patch) | |
tree | 246ef5864f8fa54efc22796754595a19a3e58343 /src/SMAPI.Web/Controllers/JsonValidatorController.cs | |
parent | 98dbc68396da23298bfb437fa907336e6229b2aa (diff) | |
download | SMAPI-4189e2f3faa9197e83aebd32fc0af93d46ee1a61.tar.gz SMAPI-4189e2f3faa9197e83aebd32fc0af93d46ee1a61.tar.bz2 SMAPI-4189e2f3faa9197e83aebd32fc0af93d46ee1a61.zip |
add support for renewing uploaded JSON/log files
Diffstat (limited to 'src/SMAPI.Web/Controllers/JsonValidatorController.cs')
-rw-r--r-- | src/SMAPI.Web/Controllers/JsonValidatorController.cs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs index 6ba97749..c77a3036 100644 --- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs +++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs @@ -58,7 +58,7 @@ namespace StardewModdingAPI.Web.Controllers /// <summary>Render the schema validator UI.</summary> /// <param name="schemaName">The schema name with which to validate the JSON, or 'edit' to return to the edit screen.</param> /// <param name="id">The stored file ID.</param> - /// <param name="operation">The operation to perform for the selected log ID. This can be 'edit', or any other value to view.</param> + /// <param name="operation">The operation to perform for the selected log ID. This can be 'edit', 'renew', or any other value to view.</param> [HttpGet] [Route("json")] [Route("json/{schemaName}")] @@ -68,8 +68,10 @@ namespace StardewModdingAPI.Web.Controllers { // parse arguments schemaName = this.NormalizeSchemaName(schemaName); + operation = operation?.Trim().ToLower(); bool hasId = !string.IsNullOrWhiteSpace(id); - bool isEditView = !hasId || operation?.Trim().ToLower() == "edit"; + bool isEditView = !hasId || operation == "edit"; + bool renew = operation == "renew"; // build result model var result = this.GetModel(id, schemaName, isEditView); @@ -77,7 +79,7 @@ namespace StardewModdingAPI.Web.Controllers return this.View("Index", result); // fetch raw JSON - StoredFileInfo file = await this.Storage.GetAsync(id); + StoredFileInfo file = await this.Storage.GetAsync(id, renew); if (string.IsNullOrWhiteSpace(file.Content)) return this.View("Index", result.SetUploadError("The JSON file seems to be empty.")); result.SetContent(file.Content, expiry: file.Expiry, uploadWarning: file.Warning); |