diff --git a/ShareX/UploadTask.cs b/ShareX/UploadTask.cs index 3bedc2100..7ceb94c4c 100644 --- a/ShareX/UploadTask.cs +++ b/ShareX/UploadTask.cs @@ -950,7 +950,8 @@ public UploadResult UploadFile(Stream stream, string fileName) { Path = Program.UploadersConfig.OwnCloudPath, CreateShare = Program.UploadersConfig.OwnCloudCreateShare, - DirectLink = Program.UploadersConfig.OwnCloudDirectLink + DirectLink = Program.UploadersConfig.OwnCloudDirectLink, + IgnoreInvalidCert = Program.UploadersConfig.OwnCloudIgnoreInvalidCert }; break; case FileDestination.Pushbullet: diff --git a/UploadersLib/FileUploaders/OwnCloud.cs b/UploadersLib/FileUploaders/OwnCloud.cs index 9573fbcf9..5d818e36a 100644 --- a/UploadersLib/FileUploaders/OwnCloud.cs +++ b/UploadersLib/FileUploaders/OwnCloud.cs @@ -40,6 +40,7 @@ public sealed class OwnCloud : FileUploader public string Path { get; set; } public bool CreateShare { get; set; } public bool DirectLink { get; set; } + public bool IgnoreInvalidCert { get; set; } public OwnCloud(string host, string username, string password) { @@ -70,6 +71,10 @@ public override UploadResult Upload(Stream stream, string fileName) url = URLHelpers.FixPrefix(url); NameValueCollection headers = CreateAuthenticationHeader(Username, Password); + SSLBypassHelper sslBypassHelper = null; + if (IgnoreInvalidCert) + sslBypassHelper = new SSLBypassHelper(); + string response = SendRequestStream(url, stream, Helpers.GetMimeType(fileName), headers, method: HttpMethod.PUT); UploadResult result = new UploadResult(response); @@ -87,6 +92,9 @@ public override UploadResult Upload(Stream stream, string fileName) } } + if (sslBypassHelper != null) + sslBypassHelper.Dispose(); + return result; } diff --git a/UploadersLib/Forms/UploadersConfigForm.Designer.cs b/UploadersLib/Forms/UploadersConfigForm.Designer.cs index b870ce756..d0dee4ae5 100644 --- a/UploadersLib/Forms/UploadersConfigForm.Designer.cs +++ b/UploadersLib/Forms/UploadersConfigForm.Designer.cs @@ -242,6 +242,7 @@ private void InitializeComponent() this.txtSendSpaceUserName = new System.Windows.Forms.TextBox(); this.atcSendSpaceAccountType = new UploadersLib.AccountTypeControl(); this.tpMediaCrush = new System.Windows.Forms.TabPage(); + this.cbMediaCrushDirectLink = new System.Windows.Forms.CheckBox(); this.tpGe_tt = new System.Windows.Forms.TabPage(); this.lblGe_ttStatus = new System.Windows.Forms.Label(); this.lblGe_ttPassword = new System.Windows.Forms.Label(); @@ -391,7 +392,7 @@ private void InitializeComponent() this.ttlvMain = new HelpersLib.TabToListView(); this.lblWidthHint = new System.Windows.Forms.Label(); this.actRapidShareAccountType = new UploadersLib.AccountTypeControl(); - this.cbMediaCrushDirectLink = new System.Windows.Forms.CheckBox(); + this.cbOwnCloudIgnoreInvalidCert = new System.Windows.Forms.CheckBox(); this.tpOtherUploaders.SuspendLayout(); this.tcOtherUploaders.SuspendLayout(); this.tpCustomUploaders.SuspendLayout(); @@ -2245,6 +2246,7 @@ private void InitializeComponent() // // tpOwnCloud // + this.tpOwnCloud.Controls.Add(this.cbOwnCloudIgnoreInvalidCert); this.tpOwnCloud.Controls.Add(this.cbOwnCloudDirectLink); this.tpOwnCloud.Controls.Add(this.cbOwnCloudCreateShare); this.tpOwnCloud.Controls.Add(this.txtOwnCloudPath); @@ -2667,6 +2669,17 @@ private void InitializeComponent() this.tpMediaCrush.Text = "MediaCrush"; this.tpMediaCrush.UseVisualStyleBackColor = true; // + // cbMediaCrushDirectLink + // + this.cbMediaCrushDirectLink.AutoSize = true; + this.cbMediaCrushDirectLink.Location = new System.Drawing.Point(16, 16); + this.cbMediaCrushDirectLink.Name = "cbMediaCrushDirectLink"; + this.cbMediaCrushDirectLink.Size = new System.Drawing.Size(187, 17); + this.cbMediaCrushDirectLink.TabIndex = 10; + this.cbMediaCrushDirectLink.Text = "Direct link (Adds \"/direct\" to URL)"; + this.cbMediaCrushDirectLink.UseVisualStyleBackColor = true; + this.cbMediaCrushDirectLink.CheckedChanged += new System.EventHandler(this.cbMediaCrushDirectLink_CheckedChanged); + // // tpGe_tt // this.tpGe_tt.Controls.Add(this.lblGe_ttStatus); @@ -4206,16 +4219,16 @@ private void InitializeComponent() this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29); this.actRapidShareAccountType.TabIndex = 16; // - // cbMediaCrushDirectLink + // cbOwnCloudIgnoreInvalidCert // - this.cbMediaCrushDirectLink.AutoSize = true; - this.cbMediaCrushDirectLink.Location = new System.Drawing.Point(16, 16); - this.cbMediaCrushDirectLink.Name = "cbMediaCrushDirectLink"; - this.cbMediaCrushDirectLink.Size = new System.Drawing.Size(187, 17); - this.cbMediaCrushDirectLink.TabIndex = 10; - this.cbMediaCrushDirectLink.Text = "Direct link (Adds \"/direct\" to URL)"; - this.cbMediaCrushDirectLink.UseVisualStyleBackColor = true; - this.cbMediaCrushDirectLink.CheckedChanged += new System.EventHandler(this.cbMediaCrushDirectLink_CheckedChanged); + this.cbOwnCloudIgnoreInvalidCert.AutoSize = true; + this.cbOwnCloudIgnoreInvalidCert.Location = new System.Drawing.Point(19, 159); + this.cbOwnCloudIgnoreInvalidCert.Name = "cbOwnCloudIgnoreInvalidCert"; + this.cbOwnCloudIgnoreInvalidCert.Size = new System.Drawing.Size(161, 17); + this.cbOwnCloudIgnoreInvalidCert.TabIndex = 10; + this.cbOwnCloudIgnoreInvalidCert.Text = "Ignore invalid SSL certificate"; + this.cbOwnCloudIgnoreInvalidCert.UseVisualStyleBackColor = true; + this.cbOwnCloudIgnoreInvalidCert.CheckedChanged += new System.EventHandler(this.cbOwnCloudIgnoreInvalidCert_CheckedChanged); // // UploadersConfigForm // @@ -4701,6 +4714,7 @@ private void InitializeComponent() private System.Windows.Forms.TabPage tpOneDrive; private OAuthControl oAuth2OneDrive; private System.Windows.Forms.TabPage tpMediaCrush; - private System.Windows.Forms.CheckBox cbMediaCrushDirectLink; + private System.Windows.Forms.CheckBox cbMediaCrushDirectLink; + private System.Windows.Forms.CheckBox cbOwnCloudIgnoreInvalidCert; } } \ No newline at end of file diff --git a/UploadersLib/Forms/UploadersConfigForm.cs b/UploadersLib/Forms/UploadersConfigForm.cs index 308289eee..6ae5b46af 100644 --- a/UploadersLib/Forms/UploadersConfigForm.cs +++ b/UploadersLib/Forms/UploadersConfigForm.cs @@ -472,6 +472,7 @@ public void LoadSettings(UploadersConfig uploadersConfig) txtOwnCloudPath.Text = Config.OwnCloudPath; cbOwnCloudCreateShare.Checked = Config.OwnCloudCreateShare; cbOwnCloudDirectLink.Checked = Config.OwnCloudDirectLink; + cbOwnCloudIgnoreInvalidCert.Checked = Config.OwnCloudIgnoreInvalidCert; // MediaFire @@ -1702,6 +1703,11 @@ private void cbOwnCloudDirectLink_CheckedChanged(object sender, EventArgs e) Config.OwnCloudDirectLink = cbOwnCloudDirectLink.Checked; } + private void cbOwnCloudIgnoreInvalidCert_CheckedChanged(object sender, EventArgs e) + { + Config.OwnCloudIgnoreInvalidCert = cbOwnCloudIgnoreInvalidCert.Checked; + } + #endregion ownCloud #region Pushbullet diff --git a/UploadersLib/UploadersConfig.cs b/UploadersLib/UploadersConfig.cs index a6d10a540..9bd1d2118 100644 --- a/UploadersLib/UploadersConfig.cs +++ b/UploadersLib/UploadersConfig.cs @@ -217,6 +217,7 @@ public class UploadersConfig : SettingsBase public string OwnCloudPath = "/"; public bool OwnCloudCreateShare = true; public bool OwnCloudDirectLink = false; + public bool OwnCloudIgnoreInvalidCert = false; // MediaFire