diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-11-27 22:45:14 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-11-27 22:45:14 -0500 |
commit | b64cec918d1511b6b71c9d2e30f987e9b5cc24fd (patch) | |
tree | c5dbe084c59d6a660cdc4a416b7ee21e3c922068 /src/SMAPI.Web | |
parent | 12e0c1519663b7106c5672ce75c6e94d8ab7638f (diff) | |
download | SMAPI-b64cec918d1511b6b71c9d2e30f987e9b5cc24fd.tar.gz SMAPI-b64cec918d1511b6b71c9d2e30f987e9b5cc24fd.tar.bz2 SMAPI-b64cec918d1511b6b71c9d2e30f987e9b5cc24fd.zip |
remove direct download for beta versions
With this change, only the main version has a direct download.
Showing beta info here caused a few issues:
* The vast majority of players don't use the game beta, so they were often confused about which version to download.
* Beta versions typically have much longer release info (e.g. detailed summary, release notes, caveats and warnings, etc), and the extra download button made the player guide button under it less prominent and visible. Those both contributed to information overload and the above confusion.
* Unlike main versions, beta versions aren't permanently archived on GitHub (since the beta branch is routinely rebased onto the latest stable update). That makes it messy to manage beta releases through GitHub.
Instead there's now a message under the download button which clearly links to where the beta version can be downloaded.
Diffstat (limited to 'src/SMAPI.Web')
-rw-r--r-- | src/SMAPI.Web/Controllers/IndexController.cs | 52 | ||||
-rw-r--r-- | src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs | 7 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/IndexModel.cs | 15 | ||||
-rw-r--r-- | src/SMAPI.Web/Views/Index/Index.cshtml | 57 | ||||
-rw-r--r-- | src/SMAPI.Web/appsettings.json | 3 | ||||
-rw-r--r-- | src/SMAPI.Web/wwwroot/Content/css/index.css | 4 |
6 files changed, 35 insertions, 103 deletions
diff --git a/src/SMAPI.Web/Controllers/IndexController.cs b/src/SMAPI.Web/Controllers/IndexController.cs index 080285ab..f2f4c342 100644 --- a/src/SMAPI.Web/Controllers/IndexController.cs +++ b/src/SMAPI.Web/Controllers/IndexController.cs @@ -57,21 +57,16 @@ namespace StardewModdingAPI.Web.Controllers { // choose versions ReleaseVersion[] versions = await this.GetReleaseVersionsAsync(); - ReleaseVersion stableVersion = versions.LastOrDefault(version => !version.IsBeta && !version.IsForDevs); - ReleaseVersion stableVersionForDevs = versions.LastOrDefault(version => !version.IsBeta && version.IsForDevs); - ReleaseVersion betaVersion = versions.LastOrDefault(version => version.IsBeta && !version.IsForDevs); - ReleaseVersion betaVersionForDevs = versions.LastOrDefault(version => version.IsBeta && version.IsForDevs); + ReleaseVersion stableVersion = versions.LastOrDefault(version => !version.IsForDevs); + ReleaseVersion stableVersionForDevs = versions.LastOrDefault(version => version.IsForDevs); // render view IndexVersionModel stableVersionModel = stableVersion != null ? new IndexVersionModel(stableVersion.Version.ToString(), stableVersion.Release.Body, stableVersion.Asset.DownloadUrl, stableVersionForDevs?.Asset.DownloadUrl) - : new IndexVersionModel("unknown", "", "https://github.com/Pathoschild/SMAPI/releases", null); // just in case something goes wrong) - IndexVersionModel betaVersionModel = betaVersion != null && this.SiteConfig.BetaEnabled - ? new IndexVersionModel(betaVersion.Version.ToString(), betaVersion.Release.Body, betaVersion.Asset.DownloadUrl, betaVersionForDevs?.Asset.DownloadUrl) - : null; + : new IndexVersionModel("unknown", "", "https://github.com/Pathoschild/SMAPI/releases", null); // just in case something goes wrong // render view - var model = new IndexModel(stableVersionModel, betaVersionModel, this.SiteConfig.BetaBlurb, this.SiteConfig.SupporterList); + var model = new IndexModel(stableVersionModel, this.SiteConfig.OtherBlurb, this.SiteConfig.SupporterList); return this.View(model); } @@ -93,27 +88,12 @@ namespace StardewModdingAPI.Web.Controllers { entry.AbsoluteExpiration = DateTimeOffset.UtcNow.Add(this.CacheTime); - // get latest release (whether preview or stable) - GitRelease stableRelease = await this.GitHub.GetLatestReleaseAsync(this.RepositoryName, includePrerelease: true); + // get latest stable release + GitRelease release = await this.GitHub.GetLatestReleaseAsync(this.RepositoryName, includePrerelease: false); - // split stable/prerelease if applicable - GitRelease betaRelease = null; - if (stableRelease.IsPrerelease) + // strip 'noinclude' blocks from release description + if (release != null) { - GitRelease result = await this.GitHub.GetLatestReleaseAsync(this.RepositoryName, includePrerelease: false); - if (result != null) - { - betaRelease = stableRelease; - stableRelease = result; - } - } - - // strip 'noinclude' blocks from release descriptions - foreach (GitRelease release in new[] { stableRelease, betaRelease }) - { - if (release == null) - continue; - HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(release.Body); foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//*[@class='noinclude']")?.ToArray() ?? new HtmlNode[0]) @@ -122,10 +102,8 @@ namespace StardewModdingAPI.Web.Controllers } // get versions - ReleaseVersion[] stableVersions = this.ParseReleaseVersions(stableRelease).ToArray(); - ReleaseVersion[] betaVersions = this.ParseReleaseVersions(betaRelease).ToArray(); - return stableVersions - .Concat(betaVersions) + return this + .ParseReleaseVersions(release) .OrderBy(p => p.Version) .ToArray(); }); @@ -146,10 +124,9 @@ namespace StardewModdingAPI.Web.Controllers Match match = Regex.Match(asset.FileName, @"SMAPI-(?<version>[\d\.]+(?:-.+)?)-installer(?<forDevs>-for-developers)?.zip"); if (!match.Success || !SemanticVersion.TryParse(match.Groups["version"].Value, out ISemanticVersion version)) continue; - bool isBeta = version.IsPrerelease(); bool isForDevs = match.Groups["forDevs"].Success; - yield return new ReleaseVersion(release, asset, version, isBeta, isForDevs); + yield return new ReleaseVersion(release, asset, version, isForDevs); } } @@ -168,9 +145,6 @@ namespace StardewModdingAPI.Web.Controllers /// <summary>The SMAPI version.</summary> public ISemanticVersion Version { get; } - /// <summary>Whether this is a beta download.</summary> - public bool IsBeta { get; } - /// <summary>Whether this is a 'for developers' download.</summary> public bool IsForDevs { get; } @@ -182,14 +156,12 @@ namespace StardewModdingAPI.Web.Controllers /// <param name="release">The underlying GitHub release.</param> /// <param name="asset">The underlying download asset.</param> /// <param name="version">The SMAPI version.</param> - /// <param name="isBeta">Whether this is a beta download.</param> /// <param name="isForDevs">Whether this is a 'for developers' download.</param> - public ReleaseVersion(GitRelease release, GitAsset asset, ISemanticVersion version, bool isBeta, bool isForDevs) + public ReleaseVersion(GitRelease release, GitAsset asset, ISemanticVersion version, bool isForDevs) { this.Release = release; this.Asset = asset; this.Version = version; - this.IsBeta = isBeta; this.IsForDevs = isForDevs; } } diff --git a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs index 43969f51..664dbef3 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs @@ -6,11 +6,8 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels /********* ** Accessors *********/ - /// <summary>Whether to show SMAPI beta versions on the main page, if any.</summary> - public bool BetaEnabled { get; set; } - - /// <summary>A short sentence shown under the beta download button, if any.</summary> - public string BetaBlurb { get; set; } + /// <summary>A message to show below the download button (e.g. for details on downloading a beta version), in Markdown format.</summary> + public string OtherBlurb { get; set; } /// <summary>A list of supports to credit on the main page, in Markdown format.</summary> public string SupporterList { get; set; } diff --git a/src/SMAPI.Web/ViewModels/IndexModel.cs b/src/SMAPI.Web/ViewModels/IndexModel.cs index 450fdc0e..d8d2d27f 100644 --- a/src/SMAPI.Web/ViewModels/IndexModel.cs +++ b/src/SMAPI.Web/ViewModels/IndexModel.cs @@ -9,11 +9,8 @@ namespace StardewModdingAPI.Web.ViewModels /// <summary>The latest stable SMAPI version.</summary> public IndexVersionModel StableVersion { get; set; } - /// <summary>The latest prerelease SMAPI version (if newer than <see cref="StableVersion"/>).</summary> - public IndexVersionModel BetaVersion { get; set; } - - /// <summary>A short sentence shown under the beta download button, if any.</summary> - public string BetaBlurb { get; set; } + /// <summary>A message to show below the download button (e.g. for details on downloading a beta version), in Markdown format.</summary> + public string OtherBlurb { get; set; } /// <summary>A list of supports to credit on the main page, in Markdown format.</summary> public string SupporterList { get; set; } @@ -27,14 +24,12 @@ namespace StardewModdingAPI.Web.ViewModels /// <summary>Construct an instance.</summary> /// <param name="stableVersion">The latest stable SMAPI version.</param> - /// <param name="betaVersion">The latest prerelease SMAPI version (if newer than <paramref name="stableVersion"/>).</param> - /// <param name="betaBlurb">A short sentence shown under the beta download button, if any.</param> + /// <param name="otherBlurb">A message to show below the download button (e.g. for details on downloading a beta version), in Markdown format.</param> /// <param name="supporterList">A list of supports to credit on the main page, in Markdown format.</param> - internal IndexModel(IndexVersionModel stableVersion, IndexVersionModel betaVersion, string betaBlurb, string supporterList) + internal IndexModel(IndexVersionModel stableVersion, string otherBlurb, string supporterList) { this.StableVersion = stableVersion; - this.BetaVersion = betaVersion; - this.BetaBlurb = betaBlurb; + this.OtherBlurb = otherBlurb; this.SupporterList = supporterList; } } diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index 9d6e4bed..669cfd99 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -8,9 +8,9 @@ ViewData["ViewTitle"] = string.Empty; } @section Head { - <link rel="stylesheet" href="~/Content/css/index.css?r=20200105" /> + <link rel="stylesheet" href="~/Content/css/index.css" /> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1" crossorigin="anonymous"></script> - <script src="~/Content/js/index.js?r=20200105"></script> + <script src="~/Content/js/index.js"></script> } <h1> @@ -29,25 +29,12 @@ <a href="https://www.nexusmods.com/stardewvalley/mods/2400"><img src="Content/images/nexus-icon.png" /> Download from Nexus</a> <a href="@Model.StableVersion.DownloadUrl"><img src="Content/images/direct-download-icon.png" /> Direct download</a> </div> - </div><br /> - - @if (Model.BetaVersion != null) + </div> + <div><a href="https://stardewvalleywiki.com/Modding:Player_Guide" class="secondary-cta">Player guide</a></div> + @if (Model.OtherBlurb != null) { - <div class="cta-dropdown secondary-cta-dropdown"> - <a href="@Model.BetaVersion.DownloadUrl" class="secondary-cta download"> - Download SMAPI @Model.BetaVersion.Version - @if (!string.IsNullOrWhiteSpace(Model.BetaBlurb)) - { - <br /><small>@Model.BetaBlurb</small> - } - </a><br /> - <div class="dropdown-content"> - <a href="https://www.nexusmods.com/stardewvalley/mods/2400"><img src="Content/images/nexus-icon.png" /> Download from Nexus</a> - <a href="@Model.BetaVersion.DownloadUrl"><img src="Content/images/direct-download-icon.png" /> Direct download</a> - </div> - </div><br /> + <div>@Html.Raw(Markdig.Markdown.ToHtml(Model.OtherBlurb))</div> } - <div><a href="https://stardewvalleywiki.com/Modding:Player_Guide" class="secondary-cta">Player guide</a></div> </div> <div class="area"> @@ -61,29 +48,11 @@ </div> <div class="area"> - @if (Model.BetaVersion == null) - { - <h2 id="whatsnew">What's new</h2> - <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="@Url.PlainAction("Index", "Mods")">mod compatibility list</a> for more info.</p> - } - else - { - <h2 id="whatsnew">What's new in...</h2> - <h3>SMAPI @Model.StableVersion.Version?</h3> - <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="@Url.PlainAction("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="@Url.PlainAction("Index", "Mods")">mod compatibility list</a> for more info.</p> - } + <h2 id="whatsnew">What's new</h2> + <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="@Url.PlainAction("Index", "Mods")">mod compatibility list</a> for more info.</p> </div> <div class="area"> @@ -122,10 +91,6 @@ <h2 id="modcreators">For mod creators</h2> <ul> <li><a href="@Model.StableVersion.DevDownloadUrl">SMAPI @Model.StableVersion.Version for developers</a> (includes <a href="https://docs.microsoft.com/en-us/visualstudio/ide/using-intellisense">intellisense</a> and full console output)</li> - @if (Model.BetaVersion != null) - { - <li><a href="@Model.BetaVersion.DevDownloadUrl">SMAPI @Model.BetaVersion.Version for developers</a> (includes <a href="https://docs.microsoft.com/en-us/visualstudio/ide/using-intellisense">intellisense</a> and full console output)</li> - } <li><a href="https://stardewvalleywiki.com/Modding:Index">Modding documentation</a></li> <li><a href="https://github.com/Pathoschild/SMAPI">Source code</a></li> </ul> diff --git a/src/SMAPI.Web/appsettings.json b/src/SMAPI.Web/appsettings.json index 22fd7396..1837170b 100644 --- a/src/SMAPI.Web/appsettings.json +++ b/src/SMAPI.Web/appsettings.json @@ -17,8 +17,7 @@ "Site": { "BetaEnabled": false, - "BetaBlurb": null, - "SupporterList": null + "OtherBlurb": null }, "ApiClients": { diff --git a/src/SMAPI.Web/wwwroot/Content/css/index.css b/src/SMAPI.Web/wwwroot/Content/css/index.css index 1cf8d261..150ccc0a 100644 --- a/src/SMAPI.Web/wwwroot/Content/css/index.css +++ b/src/SMAPI.Web/wwwroot/Content/css/index.css @@ -97,6 +97,10 @@ h1 { display: block; } +.cta-blurb { + font-size: 0.85em; +} + .sublinks { font-size: 0.9em; margin-bottom: 1em; |