mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-06 05:05:42 +13:00
Merge pull request #234 from Jusonex/master
Added a way to ignore invalid SSL certs (ownCloud)
This commit is contained in:
commit
870804c3b8
5 changed files with 42 additions and 12 deletions
|
@ -950,7 +950,8 @@ public UploadResult UploadFile(Stream stream, string fileName)
|
||||||
{
|
{
|
||||||
Path = Program.UploadersConfig.OwnCloudPath,
|
Path = Program.UploadersConfig.OwnCloudPath,
|
||||||
CreateShare = Program.UploadersConfig.OwnCloudCreateShare,
|
CreateShare = Program.UploadersConfig.OwnCloudCreateShare,
|
||||||
DirectLink = Program.UploadersConfig.OwnCloudDirectLink
|
DirectLink = Program.UploadersConfig.OwnCloudDirectLink,
|
||||||
|
IgnoreInvalidCert = Program.UploadersConfig.OwnCloudIgnoreInvalidCert
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case FileDestination.Pushbullet:
|
case FileDestination.Pushbullet:
|
||||||
|
|
|
@ -40,6 +40,7 @@ public sealed class OwnCloud : FileUploader
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public bool CreateShare { get; set; }
|
public bool CreateShare { get; set; }
|
||||||
public bool DirectLink { get; set; }
|
public bool DirectLink { get; set; }
|
||||||
|
public bool IgnoreInvalidCert { get; set; }
|
||||||
|
|
||||||
public OwnCloud(string host, string username, string password)
|
public OwnCloud(string host, string username, string password)
|
||||||
{
|
{
|
||||||
|
@ -70,6 +71,10 @@ public override UploadResult Upload(Stream stream, string fileName)
|
||||||
url = URLHelpers.FixPrefix(url);
|
url = URLHelpers.FixPrefix(url);
|
||||||
NameValueCollection headers = CreateAuthenticationHeader(Username, Password);
|
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);
|
string response = SendRequestStream(url, stream, Helpers.GetMimeType(fileName), headers, method: HttpMethod.PUT);
|
||||||
|
|
||||||
UploadResult result = new UploadResult(response);
|
UploadResult result = new UploadResult(response);
|
||||||
|
@ -87,6 +92,9 @@ public override UploadResult Upload(Stream stream, string fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sslBypassHelper != null)
|
||||||
|
sslBypassHelper.Dispose();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
36
UploadersLib/Forms/UploadersConfigForm.Designer.cs
generated
36
UploadersLib/Forms/UploadersConfigForm.Designer.cs
generated
|
@ -242,6 +242,7 @@ private void InitializeComponent()
|
||||||
this.txtSendSpaceUserName = new System.Windows.Forms.TextBox();
|
this.txtSendSpaceUserName = new System.Windows.Forms.TextBox();
|
||||||
this.atcSendSpaceAccountType = new UploadersLib.AccountTypeControl();
|
this.atcSendSpaceAccountType = new UploadersLib.AccountTypeControl();
|
||||||
this.tpMediaCrush = new System.Windows.Forms.TabPage();
|
this.tpMediaCrush = new System.Windows.Forms.TabPage();
|
||||||
|
this.cbMediaCrushDirectLink = new System.Windows.Forms.CheckBox();
|
||||||
this.tpGe_tt = new System.Windows.Forms.TabPage();
|
this.tpGe_tt = new System.Windows.Forms.TabPage();
|
||||||
this.lblGe_ttStatus = new System.Windows.Forms.Label();
|
this.lblGe_ttStatus = new System.Windows.Forms.Label();
|
||||||
this.lblGe_ttPassword = 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.ttlvMain = new HelpersLib.TabToListView();
|
||||||
this.lblWidthHint = new System.Windows.Forms.Label();
|
this.lblWidthHint = new System.Windows.Forms.Label();
|
||||||
this.actRapidShareAccountType = new UploadersLib.AccountTypeControl();
|
this.actRapidShareAccountType = new UploadersLib.AccountTypeControl();
|
||||||
this.cbMediaCrushDirectLink = new System.Windows.Forms.CheckBox();
|
this.cbOwnCloudIgnoreInvalidCert = new System.Windows.Forms.CheckBox();
|
||||||
this.tpOtherUploaders.SuspendLayout();
|
this.tpOtherUploaders.SuspendLayout();
|
||||||
this.tcOtherUploaders.SuspendLayout();
|
this.tcOtherUploaders.SuspendLayout();
|
||||||
this.tpCustomUploaders.SuspendLayout();
|
this.tpCustomUploaders.SuspendLayout();
|
||||||
|
@ -2245,6 +2246,7 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
// tpOwnCloud
|
// tpOwnCloud
|
||||||
//
|
//
|
||||||
|
this.tpOwnCloud.Controls.Add(this.cbOwnCloudIgnoreInvalidCert);
|
||||||
this.tpOwnCloud.Controls.Add(this.cbOwnCloudDirectLink);
|
this.tpOwnCloud.Controls.Add(this.cbOwnCloudDirectLink);
|
||||||
this.tpOwnCloud.Controls.Add(this.cbOwnCloudCreateShare);
|
this.tpOwnCloud.Controls.Add(this.cbOwnCloudCreateShare);
|
||||||
this.tpOwnCloud.Controls.Add(this.txtOwnCloudPath);
|
this.tpOwnCloud.Controls.Add(this.txtOwnCloudPath);
|
||||||
|
@ -2667,6 +2669,17 @@ private void InitializeComponent()
|
||||||
this.tpMediaCrush.Text = "MediaCrush";
|
this.tpMediaCrush.Text = "MediaCrush";
|
||||||
this.tpMediaCrush.UseVisualStyleBackColor = true;
|
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
|
// tpGe_tt
|
||||||
//
|
//
|
||||||
this.tpGe_tt.Controls.Add(this.lblGe_ttStatus);
|
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.Size = new System.Drawing.Size(214, 29);
|
||||||
this.actRapidShareAccountType.TabIndex = 16;
|
this.actRapidShareAccountType.TabIndex = 16;
|
||||||
//
|
//
|
||||||
// cbMediaCrushDirectLink
|
// cbOwnCloudIgnoreInvalidCert
|
||||||
//
|
//
|
||||||
this.cbMediaCrushDirectLink.AutoSize = true;
|
this.cbOwnCloudIgnoreInvalidCert.AutoSize = true;
|
||||||
this.cbMediaCrushDirectLink.Location = new System.Drawing.Point(16, 16);
|
this.cbOwnCloudIgnoreInvalidCert.Location = new System.Drawing.Point(19, 159);
|
||||||
this.cbMediaCrushDirectLink.Name = "cbMediaCrushDirectLink";
|
this.cbOwnCloudIgnoreInvalidCert.Name = "cbOwnCloudIgnoreInvalidCert";
|
||||||
this.cbMediaCrushDirectLink.Size = new System.Drawing.Size(187, 17);
|
this.cbOwnCloudIgnoreInvalidCert.Size = new System.Drawing.Size(161, 17);
|
||||||
this.cbMediaCrushDirectLink.TabIndex = 10;
|
this.cbOwnCloudIgnoreInvalidCert.TabIndex = 10;
|
||||||
this.cbMediaCrushDirectLink.Text = "Direct link (Adds \"/direct\" to URL)";
|
this.cbOwnCloudIgnoreInvalidCert.Text = "Ignore invalid SSL certificate";
|
||||||
this.cbMediaCrushDirectLink.UseVisualStyleBackColor = true;
|
this.cbOwnCloudIgnoreInvalidCert.UseVisualStyleBackColor = true;
|
||||||
this.cbMediaCrushDirectLink.CheckedChanged += new System.EventHandler(this.cbMediaCrushDirectLink_CheckedChanged);
|
this.cbOwnCloudIgnoreInvalidCert.CheckedChanged += new System.EventHandler(this.cbOwnCloudIgnoreInvalidCert_CheckedChanged);
|
||||||
//
|
//
|
||||||
// UploadersConfigForm
|
// UploadersConfigForm
|
||||||
//
|
//
|
||||||
|
@ -4701,6 +4714,7 @@ private void InitializeComponent()
|
||||||
private System.Windows.Forms.TabPage tpOneDrive;
|
private System.Windows.Forms.TabPage tpOneDrive;
|
||||||
private OAuthControl oAuth2OneDrive;
|
private OAuthControl oAuth2OneDrive;
|
||||||
private System.Windows.Forms.TabPage tpMediaCrush;
|
private System.Windows.Forms.TabPage tpMediaCrush;
|
||||||
private System.Windows.Forms.CheckBox cbMediaCrushDirectLink;
|
private System.Windows.Forms.CheckBox cbMediaCrushDirectLink;
|
||||||
|
private System.Windows.Forms.CheckBox cbOwnCloudIgnoreInvalidCert;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -472,6 +472,7 @@ public void LoadSettings(UploadersConfig uploadersConfig)
|
||||||
txtOwnCloudPath.Text = Config.OwnCloudPath;
|
txtOwnCloudPath.Text = Config.OwnCloudPath;
|
||||||
cbOwnCloudCreateShare.Checked = Config.OwnCloudCreateShare;
|
cbOwnCloudCreateShare.Checked = Config.OwnCloudCreateShare;
|
||||||
cbOwnCloudDirectLink.Checked = Config.OwnCloudDirectLink;
|
cbOwnCloudDirectLink.Checked = Config.OwnCloudDirectLink;
|
||||||
|
cbOwnCloudIgnoreInvalidCert.Checked = Config.OwnCloudIgnoreInvalidCert;
|
||||||
|
|
||||||
// MediaFire
|
// MediaFire
|
||||||
|
|
||||||
|
@ -1702,6 +1703,11 @@ private void cbOwnCloudDirectLink_CheckedChanged(object sender, EventArgs e)
|
||||||
Config.OwnCloudDirectLink = cbOwnCloudDirectLink.Checked;
|
Config.OwnCloudDirectLink = cbOwnCloudDirectLink.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cbOwnCloudIgnoreInvalidCert_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Config.OwnCloudIgnoreInvalidCert = cbOwnCloudIgnoreInvalidCert.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion ownCloud
|
#endregion ownCloud
|
||||||
|
|
||||||
#region Pushbullet
|
#region Pushbullet
|
||||||
|
|
|
@ -217,6 +217,7 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
|
||||||
public string OwnCloudPath = "/";
|
public string OwnCloudPath = "/";
|
||||||
public bool OwnCloudCreateShare = true;
|
public bool OwnCloudCreateShare = true;
|
||||||
public bool OwnCloudDirectLink = false;
|
public bool OwnCloudDirectLink = false;
|
||||||
|
public bool OwnCloudIgnoreInvalidCert = false;
|
||||||
|
|
||||||
// MediaFire
|
// MediaFire
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue