summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web')
-rw-r--r--src/SMAPI.Web/Controllers/JsonValidatorController.cs24
-rw-r--r--src/SMAPI.Web/Controllers/LogParserController.cs14
-rw-r--r--src/SMAPI.Web/Controllers/ModsApiController.cs8
-rw-r--r--src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs54
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs3
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs12
-rw-r--r--src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs48
-rw-r--r--src/SMAPI.Web/Startup.cs17
-rw-r--r--src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs7
-rw-r--r--src/SMAPI.Web/ViewModels/LogParserModel.cs7
-rw-r--r--src/SMAPI.Web/Views/Index/Index.cshtml10
-rw-r--r--src/SMAPI.Web/Views/Index/Privacy.cshtml4
-rw-r--r--src/SMAPI.Web/Views/JsonValidator/Index.cshtml10
-rw-r--r--src/SMAPI.Web/Views/LogParser/Index.cshtml16
-rw-r--r--src/SMAPI.Web/Views/Shared/_Layout.cshtml8
-rw-r--r--src/SMAPI.Web/appsettings.Development.json4
-rw-r--r--src/SMAPI.Web/appsettings.json7
17 files changed, 41 insertions, 212 deletions
diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs
index b2eb9a87..c32fb084 100644
--- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs
+++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs
@@ -5,14 +5,12 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema;
using StardewModdingAPI.Web.Framework;
using StardewModdingAPI.Web.Framework.Clients.Pastebin;
using StardewModdingAPI.Web.Framework.Compression;
-using StardewModdingAPI.Web.Framework.ConfigModels;
using StardewModdingAPI.Web.ViewModels.JsonValidator;
namespace StardewModdingAPI.Web.Controllers
@@ -23,18 +21,12 @@ namespace StardewModdingAPI.Web.Controllers
/*********
** Fields
*********/
- /// <summary>The site config settings.</summary>
- private readonly SiteConfig Config;
-
/// <summary>The underlying Pastebin client.</summary>
private readonly IPastebinClient Pastebin;
/// <summary>The underlying text compression helper.</summary>
private readonly IGzipHelper GzipHelper;
- /// <summary>The section URL for the schema validator.</summary>
- private string SectionUrl => this.Config.JsonValidatorUrl;
-
/// <summary>The supported JSON schemas (names indexed by ID).</summary>
private readonly IDictionary<string, string> SchemaFormats = new Dictionary<string, string>
{
@@ -57,12 +49,10 @@ namespace StardewModdingAPI.Web.Controllers
** Constructor
***/
/// <summary>Construct an instance.</summary>
- /// <param name="siteConfig">The context config settings.</param>
/// <param name="pastebin">The Pastebin API client.</param>
/// <param name="gzipHelper">The underlying text compression helper.</param>
- public JsonValidatorController(IOptions<SiteConfig> siteConfig, IPastebinClient pastebin, IGzipHelper gzipHelper)
+ public JsonValidatorController(IPastebinClient pastebin, IGzipHelper gzipHelper)
{
- this.Config = siteConfig.Value;
this.Pastebin = pastebin;
this.GzipHelper = gzipHelper;
}
@@ -81,7 +71,7 @@ namespace StardewModdingAPI.Web.Controllers
{
schemaName = this.NormalizeSchemaName(schemaName);
- var result = new JsonValidatorModel(this.SectionUrl, id, schemaName, this.SchemaFormats);
+ var result = new JsonValidatorModel(id, schemaName, this.SchemaFormats);
if (string.IsNullOrWhiteSpace(id))
return this.View("Index", result);
@@ -142,7 +132,7 @@ namespace StardewModdingAPI.Web.Controllers
public async Task<ActionResult> PostAsync(JsonValidatorRequestModel request)
{
if (request == null)
- return this.View("Index", new JsonValidatorModel(this.SectionUrl, null, null, this.SchemaFormats).SetUploadError("The request seems to be invalid."));
+ return this.View("Index", new JsonValidatorModel(null, null, this.SchemaFormats).SetUploadError("The request seems to be invalid."));
// normalize schema name
string schemaName = this.NormalizeSchemaName(request.SchemaName);
@@ -150,7 +140,7 @@ namespace StardewModdingAPI.Web.Controllers
// get raw log text
string input = request.Content;
if (string.IsNullOrWhiteSpace(input))
- return this.View("Index", new JsonValidatorModel(this.SectionUrl, null, schemaName, this.SchemaFormats).SetUploadError("The JSON file seems to be empty."));
+ return this.View("Index", new JsonValidatorModel(null, schemaName, this.SchemaFormats).SetUploadError("The JSON file seems to be empty."));
// upload log
input = this.GzipHelper.CompressString(input);
@@ -158,12 +148,10 @@ namespace StardewModdingAPI.Web.Controllers
// handle errors
if (!result.Success)
- return this.View("Index", new JsonValidatorModel(this.SectionUrl, result.ID, schemaName, this.SchemaFormats).SetUploadError($"Pastebin error: {result.Error ?? "unknown error"}"));
+ return this.View("Index", new JsonValidatorModel(result.ID, schemaName, this.SchemaFormats).SetUploadError($"Pastebin error: {result.Error ?? "unknown error"}"));
// redirect to view
- UriBuilder uri = new UriBuilder(new Uri(this.SectionUrl));
- uri.Path = $"{uri.Path.TrimEnd('/')}/{schemaName}/{result.ID}";
- return this.Redirect(uri.Uri.ToString());
+ return this.Redirect(this.Url.Action("Index", "LogParser", new { schemaName = schemaName, id = result.ID }));
}
diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs
index 32c45038..2ced5a05 100644
--- a/src/SMAPI.Web/Controllers/LogParserController.cs
+++ b/src/SMAPI.Web/Controllers/LogParserController.cs
@@ -27,9 +27,6 @@ namespace StardewModdingAPI.Web.Controllers
/*********
** Fields
*********/
- /// <summary>The site config settings.</summary>
- private readonly SiteConfig SiteConfig;
-
/// <summary>The API client settings.</summary>
private readonly ApiClientsConfig ClientsConfig;
@@ -47,13 +44,11 @@ namespace StardewModdingAPI.Web.Controllers
** Constructor
***/
/// <summary>Construct an instance.</summary>
- /// <param name="siteConfig">The context config settings.</param>
/// <param name="clientsConfig">The API client settings.</param>
/// <param name="pastebin">The Pastebin API client.</param>
/// <param name="gzipHelper">The underlying text compression helper.</param>
- public LogParserController(IOptions<SiteConfig> siteConfig, IOptions<ApiClientsConfig> clientsConfig, IPastebinClient pastebin, IGzipHelper gzipHelper)
+ public LogParserController(IOptions<ApiClientsConfig> clientsConfig, IPastebinClient pastebin, IGzipHelper gzipHelper)
{
- this.SiteConfig = siteConfig.Value;
this.ClientsConfig = clientsConfig.Value;
this.Pastebin = pastebin;
this.GzipHelper = gzipHelper;
@@ -103,9 +98,7 @@ namespace StardewModdingAPI.Web.Controllers
return this.View("Index", this.GetModel(null, uploadError: uploadResult.UploadError));
// redirect to view
- UriBuilder uri = new UriBuilder(new Uri(this.SiteConfig.LogParserUrl));
- uri.Path = $"{uri.Path.TrimEnd('/')}/{uploadResult.ID}";
- return this.Redirect(uri.Uri.ToString());
+ return this.Redirect(this.Url.Action("Index", "LogParser", new { id = uploadResult.ID }));
}
@@ -217,10 +210,9 @@ namespace StardewModdingAPI.Web.Controllers
/// <param name="uploadError">An error which occurred while uploading the log.</param>
private LogParserModel GetModel(string pasteID, DateTime? expiry = null, string uploadWarning = null, string uploadError = null)
{
- string sectionUrl = this.SiteConfig.LogParserUrl;
Platform? platform = this.DetectClientPlatform();
- return new LogParserModel(sectionUrl, pasteID, platform)
+ return new LogParserModel(pasteID, platform)
{
UploadWarning = uploadWarning,
UploadError = uploadError,
diff --git a/src/SMAPI.Web/Controllers/ModsApiController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs
index fe220eb5..f10e0067 100644
--- a/src/SMAPI.Web/Controllers/ModsApiController.cs
+++ b/src/SMAPI.Web/Controllers/ModsApiController.cs
@@ -49,9 +49,6 @@ namespace StardewModdingAPI.Web.Controllers
/// <summary>The internal mod metadata list.</summary>
private readonly ModDatabase ModDatabase;
- /// <summary>The web URL for the compatibility list.</summary>
- private readonly string CompatibilityPageUrl;
-
/*********
** Public methods
@@ -70,7 +67,6 @@ namespace StardewModdingAPI.Web.Controllers
{
this.ModDatabase = new ModToolkit().GetModDatabase(Path.Combine(environment.WebRootPath, "SMAPI.metadata.json"));
ModUpdateCheckConfig config = configProvider.Value;
- this.CompatibilityPageUrl = config.CompatibilityPageUrl;
this.WikiCache = wikiCache;
this.ModCache = modCache;
@@ -205,7 +201,7 @@ namespace StardewModdingAPI.Web.Controllers
// get unofficial version
if (wikiEntry?.Compatibility.UnofficialVersion != null && this.IsNewer(wikiEntry.Compatibility.UnofficialVersion, main?.Version) && this.IsNewer(wikiEntry.Compatibility.UnofficialVersion, optional?.Version))
- unofficial = new ModEntryVersionModel(wikiEntry.Compatibility.UnofficialVersion, $"{this.CompatibilityPageUrl}/#{wikiEntry.Anchor}");
+ unofficial = new ModEntryVersionModel(wikiEntry.Compatibility.UnofficialVersion, $"{this.Url.Action("Index", "Mods")}#{wikiEntry.Anchor}");
// get unofficial version for beta
if (wikiEntry?.HasBetaInfo == true)
@@ -215,7 +211,7 @@ namespace StardewModdingAPI.Web.Controllers
if (wikiEntry.BetaCompatibility.UnofficialVersion != null)
{
unofficialForBeta = (wikiEntry.BetaCompatibility.UnofficialVersion != null && this.IsNewer(wikiEntry.BetaCompatibility.UnofficialVersion, main?.Version) && this.IsNewer(wikiEntry.BetaCompatibility.UnofficialVersion, optional?.Version))
- ? new ModEntryVersionModel(wikiEntry.BetaCompatibility.UnofficialVersion, $"{this.CompatibilityPageUrl}/#{wikiEntry.Anchor}")
+ ? new ModEntryVersionModel(wikiEntry.BetaCompatibility.UnofficialVersion, $"{this.Url.Action("Index", "Mods")}#{wikiEntry.Anchor}")
: null;
}
else
diff --git a/src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs b/src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs
deleted file mode 100644
index fe27fe2f..00000000
--- a/src/SMAPI.Web/Framework/BeanstalkEnvPropsConfigProvider.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Microsoft.Extensions.Configuration;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-
-namespace StardewModdingAPI.Web.Framework
-{
- /// <summary>Reads configuration values from the AWS Beanstalk environment properties file (if present).</summary>
- /// <remarks>This is a workaround for AWS Beanstalk injection not working with .NET Core apps.</remarks>
- internal class BeanstalkEnvPropsConfigProvider : ConfigurationProvider, IConfigurationSource
- {
- /*********
- ** 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";
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Build the configuration provider for this source.</summary>
- /// <param name="builder">The configuration builder.</param>
- public IConfigurationProvider Build(IConfigurationBuilder builder)
- {
- return new BeanstalkEnvPropsConfigProvider();
- }
-
- /// <summary>Load the environment properties.</summary>
- public override void Load()
- {
- this.Data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
-
- // get Beanstalk config file
- FileInfo file = new FileInfo(BeanstalkEnvPropsConfigProvider.ContainerConfigPath);
- if (!file.Exists)
- return;
-
- // parse JSON
- JObject jsonRoot = (JObject)JsonConvert.DeserializeObject(File.ReadAllText(file.FullName));
- if (jsonRoot["iis"]?["env"] is JArray jsonProps)
- {
- foreach (string prop in jsonProps.Values<string>())
- {
- string[] parts = prop.Split('=', 2); // key=value
- if (parts.Length == 2)
- this.Data[parts[0]] = parts[1];
- }
- }
- }
- }
-}
diff --git a/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
index ab935bb3..46073eb8 100644
--- a/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
+++ b/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
@@ -11,8 +11,5 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels
/// <summary>The number of minutes failed update checks should be cached before refetching them.</summary>
public int ErrorCacheMinutes { get; set; }
-
- /// <summary>The web URL for the wiki compatibility list.</summary>
- public string CompatibilityPageUrl { get; set; }
}
}
diff --git a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs
index bc6e868a..d379c423 100644
--- a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs
+++ b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs
@@ -6,18 +6,6 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels
/*********
** Accessors
*********/
- /// <summary>The root URL for the app.</summary>
- public string RootUrl { get; set; }
-
- /// <summary>The root URL for the log parser.</summary>
- public string LogParserUrl { get; set; }
-
- /// <summary>The root URL for the JSON validator.</summary>
- public string JsonValidatorUrl { 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 BetaEnabled { get; set; }
diff --git a/src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs b/src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs
deleted file mode 100644
index 920632ab..00000000
--- a/src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Rewrite;
-
-namespace StardewModdingAPI.Web.Framework.RewriteRules
-{
- /// <summary>Rewrite requests to prepend the subdomain portion (if any) to the path.</summary>
- /// <remarks>Derived from <a href="https://stackoverflow.com/a/44526747/262123" />.</remarks>
- internal class ConditionalRewriteSubdomainRule : IRule
- {
- /*********
- ** Accessors
- *********/
- /// <summary>A predicate which indicates when the rule should be applied.</summary>
- private readonly Func<HttpRequest, bool> ShouldRewrite;
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- /// <param name="shouldRewrite">A predicate which indicates when the rule should be applied.</param>
- public ConditionalRewriteSubdomainRule(Func<HttpRequest, bool> shouldRewrite = null)
- {
- this.ShouldRewrite = shouldRewrite ?? (req => true);
- }
-
- /// <summary>Applies the rule. Implementations of ApplyRule should set the value for <see cref="RewriteContext.Result" /> (defaults to RuleResult.ContinueRules).</summary>
- /// <param name="context">The rewrite context.</param>
- public void ApplyRule(RewriteContext context)
- {
- HttpRequest request = context.HttpContext.Request;
-
- // check condition
- if (!this.ShouldRewrite(request))
- return;
-
- // get host parts
- string host = request.Host.Host;
- string[] parts = host.Split('.');
- if (parts.Length < 2)
- return;
-
- // prepend to path
- request.Path = $"/{parts[0]}{request.Path}";
- }
- }
-}
diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs
index fc6161b5..53823771 100644
--- a/src/SMAPI.Web/Startup.cs
+++ b/src/SMAPI.Web/Startup.cs
@@ -48,7 +48,7 @@ namespace StardewModdingAPI.Web
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
- .Add(new BeanstalkEnvPropsConfigProvider())
+ .AddEnvironmentVariables()
.Build();
}
@@ -173,8 +173,7 @@ namespace StardewModdingAPI.Web
.UseCors(policy => policy
.AllowAnyHeader()
.AllowAnyMethod()
- .WithOrigins("https://smapi.io", "https://*.smapi.io", "https://*.edge.smapi.io")
- .SetIsOriginAllowedToAllowWildcardSubdomains()
+ .WithOrigins("https://smapi.io")
)
.UseRewriter(this.GetRedirectRules())
.UseStaticFiles() // wwwroot folder
@@ -202,23 +201,13 @@ namespace StardewModdingAPI.Web
shouldRewrite: req =>
req.Host.Host != "localhost"
&& !req.Path.StartsWithSegments("/api")
- && !req.Host.Host.StartsWith("api.")
- ));
-
- // convert subdomain.smapi.io => smapi.io/subdomain for routing
- redirects.Add(new ConditionalRewriteSubdomainRule(
- shouldRewrite: req =>
- req.Host.Host != "localhost"
- && (req.Host.Host.StartsWith("api.") || req.Host.Host.StartsWith("json.") || req.Host.Host.StartsWith("log.") || req.Host.Host.StartsWith("mods."))
- && !req.Path.StartsWithSegments("/content")
- && !req.Path.StartsWithSegments("/favicon.ico")
));
// shortcut redirects
redirects.Add(new RedirectToUrlRule(@"^/3\.0\.?$", "https://stardewvalleywiki.com/Modding:Migrate_to_SMAPI_3.0"));
redirects.Add(new RedirectToUrlRule(@"^/(?:buildmsg|package)(?:/?(.*))$", "https://github.com/Pathoschild/SMAPI/blob/develop/docs/technical/mod-package.md#$1")); // buildmsg deprecated, remove when SDV 1.4 is released
redirects.Add(new RedirectToUrlRule(@"^/community\.?$", "https://stardewvalleywiki.com/Modding:Community"));
- redirects.Add(new RedirectToUrlRule(@"^/compat\.?$", "https://mods.smapi.io"));
+ redirects.Add(new RedirectToUrlRule(@"^/compat\.?$", "https://smapi.io/mods"));
redirects.Add(new RedirectToUrlRule(@"^/docs\.?$", "https://stardewvalleywiki.com/Modding:Index"));
redirects.Add(new RedirectToUrlRule(@"^/install\.?$", "https://stardewvalleywiki.com/Modding:Player_Guide/Getting_Started#Install_SMAPI"));
redirects.Add(new RedirectToUrlRule(@"^/troubleshoot(.*)$", "https://stardewvalleywiki.com/Modding:Player_Guide/Troubleshooting$1"));
diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs
index 2d13bf23..5b18331f 100644
--- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs
+++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs
@@ -9,9 +9,6 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator
/*********
** Accessors
*********/
- /// <summary>The root URL for the log parser controller.</summary>
- public string SectionUrl { get; set; }
-
/// <summary>The paste ID.</summary>
public string PasteID { get; set; }
@@ -44,13 +41,11 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator
public JsonValidatorModel() { }
/// <summary>Construct an instance.</summary>
- /// <param name="sectionUrl">The root URL for the log parser controller.</param>
/// <param name="pasteID">The paste ID.</param>
/// <param name="schemaName">The schema name with which the JSON was validated.</param>
/// <param name="schemaFormats">The supported JSON schemas (names indexed by ID).</param>
- public JsonValidatorModel(string sectionUrl, string pasteID, string schemaName, IDictionary<string, string> schemaFormats)
+ public JsonValidatorModel(string pasteID, string schemaName, IDictionary<string, string> schemaFormats)
{
- this.SectionUrl = sectionUrl;
this.PasteID = pasteID;
this.SchemaName = schemaName;
this.SchemaFormats = schemaFormats;
diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs
index b06b5b2d..bea79eae 100644
--- a/src/SMAPI.Web/ViewModels/LogParserModel.cs
+++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs
@@ -20,9 +20,6 @@ namespace StardewModdingAPI.Web.ViewModels
/*********
** Accessors
*********/
- /// <summary>The root URL for the log parser controller.</summary>
- public string SectionUrl { get; set; }
-
/// <summary>The paste ID.</summary>
public string PasteID { get; set; }
@@ -55,12 +52,10 @@ namespace StardewModdingAPI.Web.ViewModels
public LogParserModel() { }
/// <summary>Construct an instance.</summary>
- /// <param name="sectionUrl">The root URL for the log parser controller.</param>
/// <param name="pasteID">The paste ID.</param>
/// <param name="platform">The viewer's detected OS, if known.</param>
- public LogParserModel(string sectionUrl, string pasteID, Platform? platform)
+ public LogParserModel(string pasteID, Platform? platform)
{
- this.SectionUrl = sectionUrl;
this.PasteID = pasteID;
this.DetectedPlatform = platform;
this.ParsedLog = null;
diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml
index f42dde3b..a79a08f5 100644
--- a/src/SMAPI.Web/Views/Index/Index.cshtml
+++ b/src/SMAPI.Web/Views/Index/Index.cshtml
@@ -44,14 +44,14 @@
}
<div><a href="https://stardewvalleywiki.com/Modding:Player_Guide" class="secondary-cta">Player guide</a></div>
<div class="sublinks">
- <a href="https://github.com/Pathoschild/SMAPI">source code</a> | <a href="@(new UriBuilder(SiteConfig.Value.RootUrl) { Path = "privacy" }.Uri)">privacy</a>
+ <a href="https://github.com/Pathoschild/SMAPI">source code</a> | <a href="@Url.Action("Privacy", "Index")">privacy</a>
</div>
<img id="pufferchick" src="Content/images/pufferchick.png" />
</div>
<h2 id="help">Get help</h2>
<ul>
- <li><a href="@SiteConfig.Value.ModListUrl">Mod compatibility list</a></li>
+ <li><a href="@Url.Action("Index", "Mods")">Mod compatibility list</a></li>
<li>Get help <a href="https://smapi.io/community">on Discord or in the forums</a></li>
</ul>
@@ -61,7 +61,7 @@
<div class="github-description">
@Html.Raw(Markdig.Markdown.ToHtml(Model.StableVersion.Description))
</div>
- <p>See the <a href="https://github.com/Pathoschild/SMAPI/blob/develop/docs/release-notes.md#release-notes">release notes</a> and <a href="@SiteConfig.Value.ModListUrl">mod compatibility list</a> for more info.</p>
+ <p>See the <a href="https://github.com/Pathoschild/SMAPI/blob/develop/docs/release-notes.md#release-notes">release notes</a> and <a href="@Url.Action("Index", "Mods")">mod compatibility list</a> for more info.</p>
}
else
{
@@ -70,13 +70,13 @@ else
<div class="github-description">
@Html.Raw(Markdig.Markdown.ToHtml(Model.StableVersion.Description))
</div>
- <p>See the <a href="https://github.com/Pathoschild/SMAPI/blob/develop/docs/release-notes.md#release-notes">release notes</a> and <a href="@SiteConfig.Value.ModListUrl">mod compatibility list</a> for more info.</p>
+ <p>See the <a href="https://github.com/Pathoschild/SMAPI/blob/develop/docs/release-notes.md#release-notes">release notes</a> and <a href="@Url.Action("Index", "Mods")">mod compatibility list</a> for more info.</p>
<h3>SMAPI @Model.BetaVersion.Version?</h3>
<div class="github-description">
@Html.Raw(Markdig.Markdown.ToHtml(Model.BetaVersion.Description))
</div>
- <p>See the <a href="https://github.com/Pathoschild/SMAPI/blob/develop/docs/release-notes.md#release-notes">release notes</a> and <a href="@SiteConfig.Value.ModListUrl">mod compatibility list</a> for more info.</p>
+ <p>See the <a href="https://github.com/Pathoschild/SMAPI/blob/develop/docs/release-notes.md#release-notes">release notes</a> and <a href="@Url.Action("Index", "Mods")">mod compatibility list</a> for more info.</p>
}
<h2 id="donate">Support SMAPI ♥</h2>
diff --git a/src/SMAPI.Web/Views/Index/Privacy.cshtml b/src/SMAPI.Web/Views/Index/Privacy.cshtml
index 914384a8..fe4d773a 100644
--- a/src/SMAPI.Web/Views/Index/Privacy.cshtml
+++ b/src/SMAPI.Web/Views/Index/Privacy.cshtml
@@ -8,7 +8,7 @@
<link rel="stylesheet" href="~/Content/css/privacy.css" />
}
-&larr; <a href="@SiteConfig.Value.RootUrl">back to SMAPI page</a>
+&larr; <a href="@Url.Action("Index", "Index")">back to SMAPI page</a>
<p>SMAPI is an <a href="https://github.com/Pathoschild/SMAPI">open-source</a> and non-profit project. Your privacy is important, so this page explains what information SMAPI uses and transmits. <strong>This page is informational only, it's not a legal document.</strong></p>
@@ -34,7 +34,7 @@
</ol>
<h3>Log parser</h3>
-<p>The <a href="https://log.smapi.io/">log parser page</a> lets you store a log file for analysis and sharing. The log data is stored indefinitely in an obfuscated form as unlisted pastes in <a href="https://pastebin.com/">Pastebin</a>. No personal information is stored by the log parser beyond what you choose to upload, but see <em><a href="#web-logging">web logging</a></em> and the <a href="https://pastebin.com/doc_privacy_statement">Pastebin Privacy Statement</a>.</p>
+<p>The <a href="https://smapi.io/log">log parser page</a> lets you store a log file for analysis and sharing. The log data is stored indefinitely in an obfuscated form as unlisted pastes in <a href="https://pastebin.com/">Pastebin</a>. No personal information is stored by the log parser beyond what you choose to upload, but see <em><a href="#web-logging">web logging</a></em> and the <a href="https://pastebin.com/doc_privacy_statement">Pastebin Privacy Statement</a>.</p>
<h3>Multiplayer sync</h3>
<p>As part of its multiplayer API, SMAPI transmits basic context to players you connect to (mainly your OS, SMAPI version, game version, and installed mods). This is used to enable multiplayer features like inter-mod messages, compatibility checks, etc. Although this information is normally hidden from players, it may be visible due to mods or configuration changes.</p>
diff --git a/src/SMAPI.Web/Views/JsonValidator/Index.cshtml b/src/SMAPI.Web/Views/JsonValidator/Index.cshtml
index 3143fad9..41dec929 100644
--- a/src/SMAPI.Web/Views/JsonValidator/Index.cshtml
+++ b/src/SMAPI.Web/Views/JsonValidator/Index.cshtml
@@ -3,8 +3,8 @@
@{
// get view data
- string curPageUrl = new Uri(new Uri(Model.SectionUrl), $"{Model.SchemaName}/{Model.PasteID}").ToString();
- string newUploadUrl = Model.SchemaName != null ? new Uri(new Uri(Model.SectionUrl), Model.SchemaName).ToString() : Model.SectionUrl;
+ string curPageUrl = this.Url.Action("Index", "JsonValidator", new { schemaName = Model.SchemaName, id = Model.PasteID });
+ string newUploadUrl = this.Url.Action("Index", "JsonValidator", new { schemaName = Model.SchemaName });
string schemaDisplayName = null;
bool isValidSchema = Model.SchemaName != null && Model.SchemaFormats.TryGetValue(Model.SchemaName, out schemaDisplayName) && schemaDisplayName != "None";
@@ -34,8 +34,8 @@
<script src="https://cdn.jsdelivr.net/gh/tmont/sunlight@1.22.0/src/lang/sunlight.javascript.min.js" crossorigin="anonymous"></script>
<script src="~/Content/js/json-validator.js"></script>
<script>
- $(function () {
- smapi.jsonValidator(@Json.Serialize(Model.SectionUrl), @Json.Serialize(Model.PasteID));
+ $(function() {
+ smapi.jsonValidator(@Json.Serialize(this.Url.Action("Index", "JsonValidator")), @Json.Serialize(Model.PasteID));
});
</script>
}
@@ -70,7 +70,7 @@ else if (Model.PasteID != null)
@if (Model.Content == null)
{
<h2>Upload a JSON file</h2>
- <form action="@Model.SectionUrl" method="post">
+ <form action="@this.Url.Action("PostAsync", "JsonValidator")" method="post">
<ol>
<li>
Choose the JSON format:<br />
diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
index df2ac115..07e18421 100644
--- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
+++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
@@ -32,7 +32,7 @@
showSections: @Json.Serialize(Enum.GetNames(typeof(LogSection)).ToDictionary(section => section, section => false), noFormatting),
showLevels: @Json.Serialize(defaultFilters, noFormatting),
enableFilters: @Json.Serialize(!Model.ShowRaw)
- }, '@Model.SectionUrl');
+ }, '@this.Url.Action("Index", "LogParser")');
});
</script>
}
@@ -49,8 +49,8 @@ else if (Model.ParseError != null)
{
<div class="banner error" v-pre>
<strong>Oops, couldn't parse that log. (Make sure you upload the log file, not the console text.)</strong><br />
- Share this URL when asking for help: <code>@(new Uri(new Uri(Model.SectionUrl), Model.PasteID))</code><br />
- (Or <a href="@Model.SectionUrl">upload a new log</a>.)<br />
+ Share this URL when asking for help: <code>https://@this.Context.Request.Host.ToUriComponent()@this.Url.Action("Index", "LogParser", new { id = Model.PasteID }))</code><br />
+ (Or <a href="@this.Url.Action("Index", "LogParser")">upload a new log</a>.)<br />
<br />
<small v-pre>Error details: @Model.ParseError</small>
</div>
@@ -58,8 +58,8 @@ else if (Model.ParseError != null)
else if (Model.ParsedLog?.IsValid == true)
{
<div class="banner success" v-pre>
- <strong>Share this link to let someone else see the log:</strong> <code>@(new Uri(new Uri(Model.SectionUrl), Model.PasteID))</code><br />
- (Or <a href="@Model.SectionUrl">upload a new log</a>.)
+ <strong>Share this link to let someone else see the log:</strong> <code>https://@this.Context.Request.Host.ToUriComponent()@this.Url.Action("Index", "LogParser", new { id = Model.PasteID })</code><br />
+ (Or <a href="@this.Url.Action("Index", "LogParser")">upload a new log</a>.)
</div>
}
@@ -127,7 +127,7 @@ else if (Model.ParsedLog?.IsValid == true)
</div>
<h2>How do I share my log?</h2>
- <form action="@Model.SectionUrl" method="post">
+ <form action="@this.Url.Action("PostAsync", "LogParser")" method="post">
<ol>
<li>
Drag the file onto this textbox (or paste the text in):<br />
@@ -322,12 +322,12 @@ else if (Model.ParsedLog?.IsValid == true)
}
</table>
- <small><a href="@(new Uri(new Uri(Model.SectionUrl), Model.PasteID))?raw=true">view raw log</a></small>
+ <small><a href="@this.Url.Action("Index", "LogParser", new { id = Model.PasteID })?raw=true">view raw log</a></small>
}
else
{
<pre v-pre>@Model.ParsedLog.RawText</pre>
- <small><a href="@(new Uri(new Uri(Model.SectionUrl), Model.PasteID))">view parsed log</a></small>
+ <small><a href="@this.Url.Action("Index", "LogParser", new { id = Model.PasteID })">view parsed log</a></small>
}
</div>
}
diff --git a/src/SMAPI.Web/Views/Shared/_Layout.cshtml b/src/SMAPI.Web/Views/Shared/_Layout.cshtml
index 87a22f06..e4b6ca94 100644
--- a/src/SMAPI.Web/Views/Shared/_Layout.cshtml
+++ b/src/SMAPI.Web/Views/Shared/_Layout.cshtml
@@ -15,15 +15,15 @@
<div id="sidebar">
<h4>SMAPI</h4>
<ul>
- <li><a href="@SiteConfig.Value.RootUrl">About SMAPI</a></li>
+ <li><a href="@Url.Action("Index", "Index")">About SMAPI</a></li>
<li><a href="https://stardewvalleywiki.com/Modding:Index">Modding docs</a></li>
</ul>
<h4>Tools</h4>
<ul>
- <li><a href="@SiteConfig.Value.ModListUrl">Mod compatibility</a></li>
- <li><a href="@SiteConfig.Value.LogParserUrl">Log parser</a></li>
- <li><a href="@SiteConfig.Value.JsonValidatorUrl">JSON validator</a></li>
+ <li><a href="@Url.Action("Index", "Mods")">Mod compatibility</a></li>
+ <li><a href="@Url.Action("Index", "LogParser")">Log parser</a></li>
+ <li><a href="@Url.Action("Index", "JsonValidator")">JSON validator</a></li>
</ul>
</div>
<div id="content-column">
diff --git a/src/SMAPI.Web/appsettings.Development.json b/src/SMAPI.Web/appsettings.Development.json
index 8e863591..6b32f4ab 100644
--- a/src/SMAPI.Web/appsettings.Development.json
+++ b/src/SMAPI.Web/appsettings.Development.json
@@ -9,10 +9,6 @@
*/
{
"Site": {
- "RootUrl": "http://localhost:59482/",
- "ModListUrl": "http://localhost:59482/mods/",
- "LogParserUrl": "http://localhost:59482/log/",
- "JsonValidatorUrl": "http://localhost:59482/json/",
"BetaEnabled": false,
"BetaBlurb": null
},
diff --git a/src/SMAPI.Web/appsettings.json b/src/SMAPI.Web/appsettings.json
index 3b6f8fbd..f81587ef 100644
--- a/src/SMAPI.Web/appsettings.json
+++ b/src/SMAPI.Web/appsettings.json
@@ -16,10 +16,6 @@
},
"Site": {
- "RootUrl": null,
- "ModListUrl": null,
- "LogParserUrl": null,
- "JsonValidatorUrl": null,
"BetaEnabled": null,
"BetaBlurb": null
},
@@ -72,7 +68,6 @@
"ModUpdateCheck": {
"SuccessCacheMinutes": 60,
- "ErrorCacheMinutes": 5,
- "CompatibilityPageUrl": "https://mods.smapi.io"
+ "ErrorCacheMinutes": 5
}
}