summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-19 13:48:19 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-19 13:48:19 -0500
commit593723b7940ba72a786fc4c7366c56f9813d977b (patch)
tree4d23fbef5bc5a20115f10ca04ae3379df78cc8e1 /src/SMAPI.Web/Framework
parent4f28ea33bd7cc65485402c5e85259083e86b49e1 (diff)
parent3dc27a5681dcfc4ae30e95570d9966f2e14a4dd7 (diff)
downloadSMAPI-593723b7940ba72a786fc4c7366c56f9813d977b.tar.gz
SMAPI-593723b7940ba72a786fc4c7366c56f9813d977b.tar.bz2
SMAPI-593723b7940ba72a786fc4c7366c56f9813d977b.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Web/Framework')
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs1
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs11
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs8
-rw-r--r--src/SMAPI.Web/Framework/LogParsing/LogParser.cs25
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/BaseRepository.cs6
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs7
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs7
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/IModRepository.cs3
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs7
9 files changed, 42 insertions, 33 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
index 4ecf2f76..f4909155 100644
--- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
-using StardewModdingAPI.Toolkit;
namespace StardewModdingAPI.Web.Framework.Clients.Nexus
{
diff --git a/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
index ce4f3cb5..bde566c0 100644
--- a/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
+++ b/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
@@ -16,16 +16,7 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels
/// <remarks>Derived from SMAPI's SemanticVersion implementation.</remarks>
public string SemanticVersionRegex { get; set; }
- /// <summary>The repository key for the Chucklefish mod site.</summary>
- public string ChucklefishKey { get; set; }
-
- /// <summary>The repository key for Nexus Mods.</summary>
- public string GitHubKey { get; set; }
-
- /// <summary>The repository key for Nexus Mods.</summary>
- public string NexusKey { get; set; }
-
/// <summary>The web URL for the wiki compatibility list.</summary>
- public string WikiCompatibilityPageUrl { get; set; }
+ public string CompatibilityPageUrl { get; set; }
}
}
diff --git a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs
index 3d428015..d89a4260 100644
--- a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs
+++ b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs
@@ -12,7 +12,13 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels
/// <summary>The root URL for the log parser.</summary>
public string LogParserUrl { get; set; }
+ /// <summary>The root URL for the mod list.</summary>
+ public string ModListUrl { get; set; }
+
/// <summary>Whether to show SMAPI beta versions on the main page, if any.</summary>
- public bool EnableSmapiBeta { get; set; }
+ public bool BetaEnabled { get; set; }
+
+ /// <summary>A short sentence shown under the beta download button, if any.</summary>
+ public string BetaBlurb { get; set; }
}
}
diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
index 013c6c47..f9b5ba76 100644
--- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
+++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
@@ -70,6 +70,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
// parse log messages
LogModInfo smapiMod = new LogModInfo { Name = "SMAPI", Author = "Pathoschild", Description = "" };
+ LogModInfo gameMod = new LogModInfo { Name = "game", Author = "", Description = "" };
IDictionary<string, LogModInfo> mods = new Dictionary<string, LogModInfo>();
bool inModList = false;
bool inContentPackList = false;
@@ -78,10 +79,23 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
// collect stats
if (message.Level == LogLevel.Error)
{
- if (message.Mod == "SMAPI")
- smapiMod.Errors++;
- else if (mods.ContainsKey(message.Mod))
- mods[message.Mod].Errors++;
+ switch (message.Mod)
+ {
+ case "SMAPI":
+ smapiMod.Errors++;
+ break;
+
+ case "game":
+ gameMod.Errors++;
+ break;
+
+ default:
+ {
+ if (mods.ContainsKey(message.Mod))
+ mods[message.Mod].Errors++;
+ break;
+ }
+ }
}
// collect SMAPI metadata
@@ -151,7 +165,8 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
}
// finalise log
- log.Mods = new[] { smapiMod }.Concat(mods.Values.OrderBy(p => p.Name)).ToArray();
+ gameMod.Version = log.GameVersion;
+ log.Mods = new[] { gameMod, smapiMod }.Concat(mods.Values.OrderBy(p => p.Name)).ToArray();
return log;
}
catch (LogParseException ex)
diff --git a/src/SMAPI.Web/Framework/ModRepositories/BaseRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/BaseRepository.cs
index 4a4a40cd..94256005 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/BaseRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/BaseRepository.cs
@@ -1,6 +1,6 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using StardewModdingAPI.Toolkit.Framework.Clients.WebApi;
+using StardewModdingAPI.Toolkit.Framework.UpdateData;
namespace StardewModdingAPI.Web.Framework.ModRepositories
{
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
** Accessors
*********/
/// <summary>The unique key for this vendor.</summary>
- public string VendorKey { get; }
+ public ModRepositoryKey VendorKey { get; }
/*********
@@ -29,7 +29,7 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
*********/
/// <summary>Construct an instance.</summary>
/// <param name="vendorKey">The unique key for this vendor.</param>
- protected RepositoryBase(string vendorKey)
+ protected RepositoryBase(ModRepositoryKey vendorKey)
{
this.VendorKey = vendorKey;
}
diff --git a/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
index e6074a60..6e2a8814 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
@@ -1,6 +1,6 @@
using System;
using System.Threading.Tasks;
-using StardewModdingAPI.Toolkit.Framework.Clients.WebApi;
+using StardewModdingAPI.Toolkit.Framework.UpdateData;
using StardewModdingAPI.Web.Framework.Clients.Chucklefish;
namespace StardewModdingAPI.Web.Framework.ModRepositories
@@ -19,10 +19,9 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
** Public methods
*********/
/// <summary>Construct an instance.</summary>
- /// <param name="vendorKey">The unique key for this vendor.</param>
/// <param name="client">The underlying HTTP client.</param>
- public ChucklefishRepository(string vendorKey, IChucklefishClient client)
- : base(vendorKey)
+ public ChucklefishRepository(IChucklefishClient client)
+ : base(ModRepositoryKey.Chucklefish)
{
this.Client = client;
}
diff --git a/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
index 1d7e4fff..7ff22d0e 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
@@ -1,6 +1,6 @@
using System;
using System.Threading.Tasks;
-using StardewModdingAPI.Toolkit.Framework.Clients.WebApi;
+using StardewModdingAPI.Toolkit.Framework.UpdateData;
using StardewModdingAPI.Web.Framework.Clients.GitHub;
namespace StardewModdingAPI.Web.Framework.ModRepositories
@@ -19,10 +19,9 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
** Public methods
*********/
/// <summary>Construct an instance.</summary>
- /// <param name="vendorKey">The unique key for this vendor.</param>
/// <param name="client">The underlying GitHub API client.</param>
- public GitHubRepository(string vendorKey, IGitHubClient client)
- : base(vendorKey)
+ public GitHubRepository(IGitHubClient client)
+ : base(ModRepositoryKey.GitHub)
{
this.Client = client;
}
diff --git a/src/SMAPI.Web/Framework/ModRepositories/IModRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/IModRepository.cs
index 09c59a86..68f754ae 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/IModRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/IModRepository.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using StardewModdingAPI.Toolkit.Framework.UpdateData;
namespace StardewModdingAPI.Web.Framework.ModRepositories
{
@@ -10,7 +11,7 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
** Accessors
*********/
/// <summary>The unique key for this vendor.</summary>
- string VendorKey { get; }
+ ModRepositoryKey VendorKey { get; }
/*********
diff --git a/src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs
index 4afcda10..1e242c60 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs
@@ -1,6 +1,6 @@
using System;
using System.Threading.Tasks;
-using StardewModdingAPI.Toolkit.Framework.Clients.WebApi;
+using StardewModdingAPI.Toolkit.Framework.UpdateData;
using StardewModdingAPI.Web.Framework.Clients.Nexus;
namespace StardewModdingAPI.Web.Framework.ModRepositories
@@ -19,10 +19,9 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
** Public methods
*********/
/// <summary>Construct an instance.</summary>
- /// <param name="vendorKey">The unique key for this vendor.</param>
/// <param name="client">The underlying Nexus Mods API client.</param>
- public NexusRepository(string vendorKey, INexusClient client)
- : base(vendorKey)
+ public NexusRepository(INexusClient client)
+ : base(ModRepositoryKey.Nexus)
{
this.Client = client;
}