summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web')
-rw-r--r--src/SMAPI.Web/Controllers/IndexController.cs2
-rw-r--r--src/SMAPI.Web/Controllers/LogParserController.cs2
-rw-r--r--src/SMAPI.Web/Controllers/ModsApiController.cs2
-rw-r--r--src/SMAPI.Web/Controllers/ModsController.cs12
-rw-r--r--src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs2
-rw-r--r--src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs2
-rw-r--r--src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs2
-rw-r--r--src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs2
-rw-r--r--src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs2
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs2
-rw-r--r--src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs2
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/ModCompatibilityListConfig.cs12
-rw-r--r--src/SMAPI.Web/Framework/LogParsing/LogParser.cs2
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs2
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs2
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/ModDropRepository.cs2
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs2
-rw-r--r--src/SMAPI.Web/Framework/RewriteRules/ConditionalRedirectToHttpsRule.cs2
-rw-r--r--src/SMAPI.Web/Framework/RewriteRules/RedirectToUrlRule.cs2
-rw-r--r--src/SMAPI.Web/StardewModdingAPI.Web.csproj1
-rw-r--r--src/SMAPI.Web/Startup.cs1
-rw-r--r--src/SMAPI.Web/ViewModels/LogParserModel.cs2
-rw-r--r--src/SMAPI.Web/appsettings.json4
23 files changed, 42 insertions, 24 deletions
diff --git a/src/SMAPI.Web/Controllers/IndexController.cs b/src/SMAPI.Web/Controllers/IndexController.cs
index d7be664d..7b3b3e80 100644
--- a/src/SMAPI.Web/Controllers/IndexController.cs
+++ b/src/SMAPI.Web/Controllers/IndexController.cs
@@ -20,7 +20,7 @@ namespace StardewModdingAPI.Web.Controllers
internal class IndexController : Controller
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The site config settings.</summary>
private readonly SiteConfig SiteConfig;
diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs
index 17f8d3aa..21e4a56f 100644
--- a/src/SMAPI.Web/Controllers/LogParserController.cs
+++ b/src/SMAPI.Web/Controllers/LogParserController.cs
@@ -19,7 +19,7 @@ namespace StardewModdingAPI.Web.Controllers
internal class LogParserController : Controller
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The site config settings.</summary>
private readonly SiteConfig Config;
diff --git a/src/SMAPI.Web/Controllers/ModsApiController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs
index 12d349e0..7e6f592c 100644
--- a/src/SMAPI.Web/Controllers/ModsApiController.cs
+++ b/src/SMAPI.Web/Controllers/ModsApiController.cs
@@ -28,7 +28,7 @@ namespace StardewModdingAPI.Web.Controllers
internal class ModsApiController : Controller
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The mod repositories which provide mod metadata.</summary>
private readonly IDictionary<ModRepositoryKey, IModRepository> Repositories;
diff --git a/src/SMAPI.Web/Controllers/ModsController.cs b/src/SMAPI.Web/Controllers/ModsController.cs
index 57aa9da9..ca866a8d 100644
--- a/src/SMAPI.Web/Controllers/ModsController.cs
+++ b/src/SMAPI.Web/Controllers/ModsController.cs
@@ -16,13 +16,13 @@ namespace StardewModdingAPI.Web.Controllers
internal class ModsController : Controller
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The cache in which to store mod metadata.</summary>
private readonly IMemoryCache Cache;
/// <summary>The number of minutes successful update checks should be cached before refetching them.</summary>
- private readonly int SuccessCacheMinutes;
+ private readonly int CacheMinutes;
/*********
@@ -31,12 +31,12 @@ namespace StardewModdingAPI.Web.Controllers
/// <summary>Construct an instance.</summary>
/// <param name="cache">The cache in which to store mod metadata.</param>
/// <param name="configProvider">The config settings for mod update checks.</param>
- public ModsController(IMemoryCache cache, IOptions<ModUpdateCheckConfig> configProvider)
+ public ModsController(IMemoryCache cache, IOptions<ModCompatibilityListConfig> configProvider)
{
- ModUpdateCheckConfig config = configProvider.Value;
+ ModCompatibilityListConfig config = configProvider.Value;
this.Cache = cache;
- this.SuccessCacheMinutes = config.SuccessCacheMinutes;
+ this.CacheMinutes = config.CacheMinutes;
}
/// <summary>Display information for all mods.</summary>
@@ -66,7 +66,7 @@ namespace StardewModdingAPI.Web.Controllers
.OrderBy(p => Regex.Replace(p.Name.ToLower(), "[^a-z0-9]", "")) // ignore case, spaces, and special characters when sorting
);
- entry.AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(this.SuccessCacheMinutes);
+ entry.AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(this.CacheMinutes);
return model;
});
}
diff --git a/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs b/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs
index 68ead3c2..5dc0feb6 100644
--- a/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs
+++ b/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Web.Framework
public class AllowLargePostsAttribute : Attribute, IAuthorizationFilter, IOrderedFilter
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The underlying form options.</summary>
private readonly FormOptions FormOptions;
diff --git a/src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs b/src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs
index b39a3b61..fe27fe2f 100644
--- a/src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs
+++ b/src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs
@@ -12,7 +12,7 @@ namespace StardewModdingAPI.Web.Framework
internal class BeanstalkEnvPropsConfigProvider : ConfigurationProvider, IConfigurationSource
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The absolute path to the container configuration file on an Amazon EC2 instance.</summary>
private const string ContainerConfigPath = @"C:\Program Files\Amazon\ElasticBeanstalk\config\containerconfiguration";
diff --git a/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs b/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs
index 029553ce..2753e33a 100644
--- a/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs
+++ b/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Chucklefish
internal class ChucklefishClient : IChucklefishClient
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The URL for a mod page excluding the base URL, where {0} is the mod ID.</summary>
private readonly string ModPageUrlFormat;
diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs
index 2cfc6903..22950db9 100644
--- a/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs
+++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub
internal class GitHubClient : IGitHubClient
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The URL for a GitHub API query for the latest stable release, excluding the base URL, where {0} is the organisation and project name.</summary>
private readonly string StableReleaseUrlFormat;
diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs
index 19b0b24d..5ad2d2f8 100644
--- a/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs
+++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs
@@ -9,7 +9,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.ModDrop
internal class ModDropClient : IModDropClient
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The underlying HTTP client.</summary>
private readonly IClient Client;
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
index 1b3fa195..e83a6041 100644
--- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
@@ -13,7 +13,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus
internal class NexusWebScrapeClient : INexusClient
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The URL for a Nexus mod page for the user, excluding the base URL, where {0} is the mod ID.</summary>
private readonly string ModUrlFormat;
diff --git a/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs b/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs
index ef83a91e..12c3e83f 100644
--- a/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs
+++ b/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs
@@ -14,7 +14,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Pastebin
internal class PastebinClient : IPastebinClient
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The underlying HTTP client.</summary>
private readonly IClient Client;
diff --git a/src/SMAPI.Web/Framework/ConfigModels/ModCompatibilityListConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ModCompatibilityListConfig.cs
new file mode 100644
index 00000000..d9ac9f02
--- /dev/null
+++ b/src/SMAPI.Web/Framework/ConfigModels/ModCompatibilityListConfig.cs
@@ -0,0 +1,12 @@
+namespace StardewModdingAPI.Web.Framework.ConfigModels
+{
+ /// <summary>The config settings for mod compatibility list.</summary>
+ internal class ModCompatibilityListConfig
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The number of minutes data from the wiki should be cached before refetching it.</summary>
+ public int CacheMinutes { get; set; }
+ }
+}
diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
index f9b5ba76..6f848469 100644
--- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
+++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
@@ -12,7 +12,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
public class LogParser
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>A regex pattern matching the start of a SMAPI message.</summary>
private readonly Regex MessageHeaderPattern = new Regex(@"^\[(?<time>\d\d:\d\d:\d\d) (?<level>[a-z]+) +(?<modName>[^\]]+)\] ", RegexOptions.Compiled | RegexOptions.IgnoreCase);
diff --git a/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
index 6e2a8814..87e29a2f 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs
@@ -9,7 +9,7 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
internal class ChucklefishRepository : RepositoryBase
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The underlying HTTP client.</summary>
private readonly IChucklefishClient Client;
diff --git a/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
index 7ff22d0e..14f44dc0 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
@@ -9,7 +9,7 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
internal class GitHubRepository : RepositoryBase
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The underlying GitHub API client.</summary>
private readonly IGitHubClient Client;
diff --git a/src/SMAPI.Web/Framework/ModRepositories/ModDropRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/ModDropRepository.cs
index 09484aa8..1994f515 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/ModDropRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/ModDropRepository.cs
@@ -9,7 +9,7 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
internal class ModDropRepository : RepositoryBase
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The underlying ModDrop API client.</summary>
private readonly IModDropClient Client;
diff --git a/src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs
index 1e242c60..4c5fe9bf 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs
@@ -9,7 +9,7 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
internal class NexusRepository : RepositoryBase
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>The underlying Nexus Mods API client.</summary>
private readonly INexusClient Client;
diff --git a/src/SMAPI.Web/Framework/RewriteRules/ConditionalRedirectToHttpsRule.cs b/src/SMAPI.Web/Framework/RewriteRules/ConditionalRedirectToHttpsRule.cs
index d6a56bb7..36effd82 100644
--- a/src/SMAPI.Web/Framework/RewriteRules/ConditionalRedirectToHttpsRule.cs
+++ b/src/SMAPI.Web/Framework/RewriteRules/ConditionalRedirectToHttpsRule.cs
@@ -11,7 +11,7 @@ namespace StardewModdingAPI.Web.Framework.RewriteRules
internal class ConditionalRedirectToHttpsRule : IRule
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>A predicate which indicates when the rule should be applied.</summary>
private readonly Func<HttpRequest, bool> ShouldRewrite;
diff --git a/src/SMAPI.Web/Framework/RewriteRules/RedirectToUrlRule.cs b/src/SMAPI.Web/Framework/RewriteRules/RedirectToUrlRule.cs
index 4bae0b4c..ab9e019c 100644
--- a/src/SMAPI.Web/Framework/RewriteRules/RedirectToUrlRule.cs
+++ b/src/SMAPI.Web/Framework/RewriteRules/RedirectToUrlRule.cs
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Web.Framework.RewriteRules
internal class RedirectToUrlRule : IRule
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>Get the new URL to which to redirect (or <c>null</c> to skip).</summary>
private readonly Func<HttpRequest, string> NewUrl;
diff --git a/src/SMAPI.Web/StardewModdingAPI.Web.csproj b/src/SMAPI.Web/StardewModdingAPI.Web.csproj
index 9d1990d9..32fdf135 100644
--- a/src/SMAPI.Web/StardewModdingAPI.Web.csproj
+++ b/src/SMAPI.Web/StardewModdingAPI.Web.csproj
@@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+ <LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs
index 4e3aaed3..91553513 100644
--- a/src/SMAPI.Web/Startup.cs
+++ b/src/SMAPI.Web/Startup.cs
@@ -50,6 +50,7 @@ namespace StardewModdingAPI.Web
{
// init configuration
services
+ .Configure<ModCompatibilityListConfig>(this.Configuration.GetSection("ModCompatibilityList"))
.Configure<ModUpdateCheckConfig>(this.Configuration.GetSection("ModUpdateCheck"))
.Configure<SiteConfig>(this.Configuration.GetSection("Site"))
.Configure<RouteOptions>(options => options.ConstraintMap.Add("semanticVersion", typeof(VersionConstraint)))
diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs
index df36ca73..41864c99 100644
--- a/src/SMAPI.Web/ViewModels/LogParserModel.cs
+++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs
@@ -9,7 +9,7 @@ namespace StardewModdingAPI.Web.ViewModels
public class LogParserModel
{
/*********
- ** Properties
+ ** Fields
*********/
/// <summary>A regex pattern matching characters to remove from a mod name to create the slug ID.</summary>
private readonly Regex SlugInvalidCharPattern = new Regex("[^a-z0-9]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
diff --git a/src/SMAPI.Web/appsettings.json b/src/SMAPI.Web/appsettings.json
index 89505a45..e97b2339 100644
--- a/src/SMAPI.Web/appsettings.json
+++ b/src/SMAPI.Web/appsettings.json
@@ -47,6 +47,10 @@
"PastebinDevKey": null // see top note
},
+ "ModCompatibilityList": {
+ "WikiCacheMinutes": 10
+ },
+
"ModUpdateCheck": {
"SuccessCacheMinutes": 60,
"ErrorCacheMinutes": 5,