diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs index 7fcc666fd..2c5d495e4 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs @@ -479,6 +479,7 @@ private void InitializeComponent() this.lblPaste_eeUserAPIKey = new System.Windows.Forms.Label(); this.txtPaste_eeUserAPIKey = new System.Windows.Forms.TextBox(); this.tpGist = new System.Windows.Forms.TabPage(); + this.lblGistOAuthInfo = new System.Windows.Forms.Label(); this.lblGistCustomURL = new System.Windows.Forms.Label(); this.txtGistCustomURL = new System.Windows.Forms.TextBox(); this.cbGistUseRawURL = new System.Windows.Forms.CheckBox(); @@ -593,7 +594,7 @@ private void InitializeComponent() this.lblWidthHint = new System.Windows.Forms.Label(); this.ttlvMain = new ShareX.HelpersLib.TabToListView(); this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl(); - this.lblGistOAuthInfo = new System.Windows.Forms.Label(); + this.lblGistCustomURLExample = new System.Windows.Forms.Label(); this.tpOtherUploaders.SuspendLayout(); this.tcOtherUploaders.SuspendLayout(); this.tpTwitter.SuspendLayout(); @@ -3956,6 +3957,7 @@ private void InitializeComponent() // // tpGist // + this.tpGist.Controls.Add(this.lblGistCustomURLExample); this.tpGist.Controls.Add(this.lblGistOAuthInfo); this.tpGist.Controls.Add(this.lblGistCustomURL); this.tpGist.Controls.Add(this.txtGistCustomURL); @@ -3967,6 +3969,11 @@ private void InitializeComponent() this.tpGist.Name = "tpGist"; this.tpGist.UseVisualStyleBackColor = true; // + // lblGistOAuthInfo + // + resources.ApplyResources(this.lblGistOAuthInfo, "lblGistOAuthInfo"); + this.lblGistOAuthInfo.Name = "lblGistOAuthInfo"; + // // lblGistCustomURL // resources.ApplyResources(this.lblGistCustomURL, "lblGistCustomURL"); @@ -4791,10 +4798,10 @@ private void InitializeComponent() this.actRapidShareAccountType.Name = "actRapidShareAccountType"; this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous; // - // lblGistOAuthInfo + // lblGistCustomURLExample // - resources.ApplyResources(this.lblGistOAuthInfo, "lblGistOAuthInfo"); - this.lblGistOAuthInfo.Name = "lblGistOAuthInfo"; + resources.ApplyResources(this.lblGistCustomURLExample, "lblGistCustomURLExample"); + this.lblGistCustomURLExample.Name = "lblGistCustomURLExample"; // // UploadersConfigForm // @@ -5531,5 +5538,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtGistCustomURL; private System.Windows.Forms.Label lblGistCustomURL; private System.Windows.Forms.Label lblGistOAuthInfo; + private System.Windows.Forms.Label lblGistCustomURLExample; } } diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx index b174df642..cc5771843 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx @@ -11689,20 +11689,47 @@ Using an encrypted library disables sharing. 1 + + True + + + 224, 364 + + + 158, 13 + + + 24 + + + Example: https://api.github.com + + + lblGistCustomURLExample + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGist + + + 0 + True - 13, 59 + 16, 64 - 299, 13 + 282, 13 23 - OAuth is only working for Github directly (no Github Enterprise) + Note: User account is not supported for GitHub Enterprise. lblGistOAuthInfo @@ -11714,7 +11741,7 @@ Using an encrypted library disables sharing. tpGist - 0 + 1 True @@ -11723,7 +11750,7 @@ Using an encrypted library disables sharing. NoControl - 13, 327 + 13, 344 82, 13 @@ -11744,10 +11771,10 @@ Using an encrypted library disables sharing. tpGist - 1 + 2 - 16, 343 + 16, 360 200, 20 @@ -11765,7 +11792,7 @@ Using an encrypted library disables sharing. tpGist - 2 + 3 True @@ -11774,7 +11801,7 @@ Using an encrypted library disables sharing. NoControl - 16, 307 + 16, 320 90, 17 @@ -11795,7 +11822,7 @@ Using an encrypted library disables sharing. tpGist - 3 + 4 True @@ -11804,7 +11831,7 @@ Using an encrypted library disables sharing. NoControl - 16, 283 + 16, 296 109, 17 @@ -11825,13 +11852,13 @@ Using an encrypted library disables sharing. tpGist - 4 + 5 False - 16, 75 + 16, 88 328, 205 @@ -11849,7 +11876,7 @@ Using an encrypted library disables sharing. tpGist - 5 + 6 16, 16 @@ -11870,7 +11897,7 @@ Using an encrypted library disables sharing. tpGist - 6 + 7 4, 22 diff --git a/ShareX.UploadersLib/TextUploaders/GitHubGist.cs b/ShareX.UploadersLib/TextUploaders/GitHubGist.cs index 8d2e88adc..1c0df6880 100644 --- a/ShareX.UploadersLib/TextUploaders/GitHubGist.cs +++ b/ShareX.UploadersLib/TextUploaders/GitHubGist.cs @@ -56,7 +56,7 @@ public override GenericUploader CreateUploader(UploadersConfig config, TaskRefer { PublicUpload = config.GistPublishPublic, RawURL = config.GistRawURL, - URLAPI = config.GistCustomURL + CustomURLAPI = config.GistCustomURL }; } @@ -65,11 +65,13 @@ public override GenericUploader CreateUploader(UploadersConfig config, TaskRefer public sealed class GitHubGist : TextUploader, IOAuth2Basic { + private const string URLAPI = "https://api.github.com/"; + public OAuth2Info AuthInfo { get; private set; } public bool PublicUpload { get; set; } public bool RawURL { get; set; } - public string URLAPI { get; set; } + public string CustomURLAPI { get; set; } public GitHubGist() { @@ -133,7 +135,18 @@ public override UploadResult UploadText(string text, string fileName) string json = JsonConvert.SerializeObject(gistUploadObject); - string url = $"{URLAPI}/gists"; + string url; + + if (!string.IsNullOrEmpty(CustomURLAPI)) + { + url = CustomURLAPI; + } + else + { + url = URLAPI; + } + + url = URLHelpers.CombineURL(url, "gists"); if (AuthInfo != null) { diff --git a/ShareX.UploadersLib/UploadersConfig.cs b/ShareX.UploadersLib/UploadersConfig.cs index 3eb2da3d4..ee1373ade 100644 --- a/ShareX.UploadersLib/UploadersConfig.cs +++ b/ShareX.UploadersLib/UploadersConfig.cs @@ -107,7 +107,7 @@ public class UploadersConfig : SettingsBase public OAuth2Info GistOAuth2Info = null; public bool GistPublishPublic = false; public bool GistRawURL = false; - public string GistCustomURL = "https://api.github.com"; + public string GistCustomURL = ""; // uPaste