summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/LogParser/PastebinClient.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-10-28 14:05:29 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-10-28 14:05:29 -0400
commit790a62920b15f1f948724f5b2a70a937829355dd (patch)
tree03b14ba6c13f93ba60f57f5cbb3b5797318d3007 /src/SMAPI.Web/Framework/LogParser/PastebinClient.cs
parentf895fedc6aa12742842c97e536b5bf2e5ca3553c (diff)
downloadSMAPI-790a62920b15f1f948724f5b2a70a937829355dd.tar.gz
SMAPI-790a62920b15f1f948724f5b2a70a937829355dd.tar.bz2
SMAPI-790a62920b15f1f948724f5b2a70a937829355dd.zip
link pastes to Pastebin account & tweak paste options (#358)
Diffstat (limited to 'src/SMAPI.Web/Framework/LogParser/PastebinClient.cs')
-rw-r--r--src/SMAPI.Web/Framework/LogParser/PastebinClient.cs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/SMAPI.Web/Framework/LogParser/PastebinClient.cs b/src/SMAPI.Web/Framework/LogParser/PastebinClient.cs
index e45a9eed..738330d3 100644
--- a/src/SMAPI.Web/Framework/LogParser/PastebinClient.cs
+++ b/src/SMAPI.Web/Framework/LogParser/PastebinClient.cs
@@ -17,6 +17,9 @@ namespace StardewModdingAPI.Web.Framework.LogParser
/// <summary>The underlying HTTP client.</summary>
private readonly IClient Client;
+ /// <summary>The user key used to authenticate with the Pastebin API.</summary>
+ private readonly string UserKey;
+
/// <summary>The developer key used to authenticate with the Pastebin API.</summary>
private readonly string DevKey;
@@ -27,10 +30,12 @@ namespace StardewModdingAPI.Web.Framework.LogParser
/// <summary>Construct an instance.</summary>
/// <param name="baseUrl">The base URL for the Pastebin API.</param>
/// <param name="userAgent">The user agent for the API client.</param>
+ /// <param name="userKey">The user key used to authenticate with the Pastebin API.</param>
/// <param name="devKey">The developer key used to authenticate with the Pastebin API.</param>
- public PastebinClient(string baseUrl, string userAgent, string devKey)
+ public PastebinClient(string baseUrl, string userAgent, string userKey, string devKey)
{
this.Client = new FluentClient(baseUrl).SetUserAgent(userAgent);
+ this.UserKey = userKey;
this.DevKey = devKey;
}
@@ -75,11 +80,13 @@ namespace StardewModdingAPI.Web.Framework.LogParser
.PostAsync("api/api_post.php")
.WithBodyContent(new FormUrlEncodedContent(new Dictionary<string, string>
{
- ["api_dev_key"] = this.DevKey,
["api_option"] = "paste",
- ["api_paste_private"] = "1",
- ["api_paste_code"] = content,
- ["api_paste_expire_date"] = "1W"
+ ["api_user_key"] = this.UserKey,
+ ["api_dev_key"] = this.DevKey,
+ ["api_paste_private"] = "1", // unlisted
+ ["api_paste_name"] = $"SMAPI log {DateTime.UtcNow:s}",
+ ["api_paste_expire_date"] = "1W", // one week
+ ["api_paste_code"] = content
}))
.AsString();