summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Web/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI.Web/Framework')
-rw-r--r--src/StardewModdingAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs6
-rw-r--r--src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs6
2 files changed, 11 insertions, 1 deletions
diff --git a/src/StardewModdingAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs b/src/StardewModdingAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
index 4dbad506..5d55ba18 100644
--- a/src/StardewModdingAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
+++ b/src/StardewModdingAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs
@@ -30,6 +30,12 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels
/// <summary>The Accept header value expected by the GitHub API.</summary>
public string GitHubAcceptHeader { get; set; }
+ /// <summary>The username with which to authenticate to the GitHub API (if any).</summary>
+ public string GitHubUsername { get; set; }
+
+ /// <summary>The password with which to authenticate to the GitHub API (if any).</summary>
+ public string GitHubPassword { get; set; }
+
/****
** Nexus Mods
****/
diff --git a/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs b/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs
index c5772ad9..67e706ed 100644
--- a/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs
+++ b/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs
@@ -35,7 +35,9 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
/// <param name="releaseUrlFormat">The URL for a Nexus Mods API query excluding the <paramref name="baseUrl"/>, where {0} is the mod ID.</param>
/// <param name="userAgent">The user agent for the GitHub API client.</param>
/// <param name="acceptHeader">The Accept header value expected by the GitHub API.</param>
- public GitHubRepository(string vendorKey, string baseUrl, string releaseUrlFormat, string userAgent, string acceptHeader)
+ /// <param name="username">The username with which to authenticate to the GitHub API.</param>
+ /// <param name="password">The password with which to authenticate to the GitHub API.</param>
+ public GitHubRepository(string vendorKey, string baseUrl, string releaseUrlFormat, string userAgent, string acceptHeader, string username, string password)
{
this.VendorKey = vendorKey;
this.ReleaseUrlFormat = releaseUrlFormat;
@@ -43,6 +45,8 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
this.Client = new FluentClient(baseUrl)
.SetUserAgent(string.Format(userAgent, this.GetType().Assembly.GetName().Version))
.AddDefault(req => req.WithHeader("Accept", acceptHeader));
+ if (!string.IsNullOrWhiteSpace(username))
+ this.Client = this.Client.SetBasicAuthentication(username, password);
}
/// <summary>Get metadata about a mod in the repository.</summary>