summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web/Controllers')
-rw-r--r--src/SMAPI.Web/Controllers/JsonValidatorController.cs8
-rw-r--r--src/SMAPI.Web/Controllers/LogParserController.cs5
2 files changed, 8 insertions, 5 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);
diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs
index 97c419d9..39de4b5d 100644
--- a/src/SMAPI.Web/Controllers/LogParserController.cs
+++ b/src/SMAPI.Web/Controllers/LogParserController.cs
@@ -40,17 +40,18 @@ namespace StardewModdingAPI.Web.Controllers
/// <summary>Render the log parser UI.</summary>
/// <param name="id">The stored file ID.</param>
/// <param name="raw">Whether to display the raw unparsed log.</param>
+ /// <param name="renew">Whether to reset the log expiry.</param>
[HttpGet]
[Route("log")]
[Route("log/{id}")]
- public async Task<ViewResult> Index(string id = null, bool raw = false)
+ public async Task<ViewResult> Index(string id = null, bool raw = false, bool renew = false)
{
// fresh page
if (string.IsNullOrWhiteSpace(id))
return this.View("Index", this.GetModel(id));
// log page
- StoredFileInfo file = await this.Storage.GetAsync(id);
+ StoredFileInfo file = await this.Storage.GetAsync(id, renew);
ParsedLog log = file.Success
? new LogParser().Parse(file.Content)
: new ParsedLog { IsValid = false, Error = file.Error };