From 4189e2f3faa9197e83aebd32fc0af93d46ee1a61 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 13 Sep 2020 11:59:17 -0400 Subject: add support for renewing uploaded JSON/log files --- src/SMAPI.Web/Controllers/JsonValidatorController.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/SMAPI.Web/Controllers/JsonValidatorController.cs') 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 /// Render the schema validator UI. /// The schema name with which to validate the JSON, or 'edit' to return to the edit screen. /// The stored file ID. - /// The operation to perform for the selected log ID. This can be 'edit', or any other value to view. + /// The operation to perform for the selected log ID. This can be 'edit', 'renew', or any other value to view. [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); -- cgit