Merge branch 'feature/ignore-ssl-option' into 'release/0.4.1.006'
Added: ignore ssl option See merge request SympatheticFire/bookmark-manager-r4!4
This commit is contained in:
commit
2faeedc72e
@ -1,5 +1,6 @@
|
|||||||
using BookmarkManager;
|
using BookmarkManager;
|
||||||
using bzit.bomg.Models;
|
using bzit.bomg.Models;
|
||||||
|
using FizzyLauncher.Models;
|
||||||
using RyzStudio.Windows.Forms;
|
using RyzStudio.Windows.Forms;
|
||||||
using RyzStudio.Windows.ThemedForms;
|
using RyzStudio.Windows.ThemedForms;
|
||||||
using System;
|
using System;
|
||||||
@ -34,12 +35,15 @@ namespace FizzyLauncher
|
|||||||
protected WebParser webParser = null;
|
protected WebParser webParser = null;
|
||||||
protected WebClient webClient = null;
|
protected WebClient webClient = null;
|
||||||
protected bool isBusy = false;
|
protected bool isBusy = false;
|
||||||
|
protected AppSession appSession = null;
|
||||||
|
|
||||||
|
|
||||||
public BookmarkForm(BookmarkItem model, Image icon) : base()
|
public BookmarkForm(AppSession session, BookmarkItem model, Image icon) : base()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
appSession = session;
|
||||||
|
|
||||||
textBox1.Text = model.SiteName?.Trim() ?? string.Empty;
|
textBox1.Text = model.SiteName?.Trim() ?? string.Empty;
|
||||||
textBox2.Text = model.SiteAddress?.Trim() ?? string.Empty;
|
textBox2.Text = model.SiteAddress?.Trim() ?? string.Empty;
|
||||||
memoBox1.Text = model.SiteDescription?.Trim() ?? string.Empty;
|
memoBox1.Text = model.SiteDescription?.Trim() ?? string.Empty;
|
||||||
@ -371,7 +375,7 @@ namespace FizzyLauncher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkResult rs = webParser.RetrieveDetails(textBox2.Text);
|
BookmarkResult rs = webParser.RetrieveDetails(textBox2.Text, appSession.IgnoreSSL);
|
||||||
if (rs == null)
|
if (rs == null)
|
||||||
{
|
{
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
11
MainForm.cs
11
MainForm.cs
@ -487,7 +487,7 @@ namespace FizzyLauncher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateIconsForm == null) updateIconsForm = new UpdateIconsForm(treeView1, iconDatabase);
|
if (updateIconsForm == null) updateIconsForm = new UpdateIconsForm(this.CurrentSession, treeView1, iconDatabase);
|
||||||
updateIconsForm.ShowDialog();
|
updateIconsForm.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,14 +1201,7 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
icon = iconDatabase.FindIcon(iconID);
|
icon = iconDatabase.FindIcon(iconID);
|
||||||
|
|
||||||
//if (!string.IsNullOrWhiteSpace(model.SiteAddress))
|
BookmarkForm bookmarkForm = new BookmarkForm(this.CurrentSession, model, icon);
|
||||||
//{
|
|
||||||
// string iconID = model?.ToHash();
|
|
||||||
|
|
||||||
// icon = iconDatabase.FindIcon(iconID);
|
|
||||||
//}
|
|
||||||
|
|
||||||
BookmarkForm bookmarkForm = new BookmarkForm(model, icon);
|
|
||||||
if (bookmarkForm.ShowDialog() == DialogResult.OK)
|
if (bookmarkForm.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
//string iconID = bookmarkForm.Model.Item?.ToHash();
|
//string iconID = bookmarkForm.Model.Item?.ToHash();
|
||||||
|
@ -18,5 +18,7 @@
|
|||||||
|
|
||||||
public string RunCommand { get; set; } = "{0}";
|
public string RunCommand { get; set; } = "{0}";
|
||||||
|
|
||||||
|
public bool IgnoreSSL { get; set; } = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,9 +14,9 @@ namespace BookmarkManager
|
|||||||
protected WebClient webClient2 = null;
|
protected WebClient webClient2 = null;
|
||||||
|
|
||||||
|
|
||||||
public BookmarkResult RetrieveDetails(string url)
|
public BookmarkResult RetrieveDetails(string url, bool ignoreSSL)
|
||||||
{
|
{
|
||||||
string sourceCode = retrieveSourceCode(url);
|
string sourceCode = retrieveSourceCode(url, ignoreSSL);
|
||||||
if (string.IsNullOrWhiteSpace(sourceCode))
|
if (string.IsNullOrWhiteSpace(sourceCode))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -77,9 +77,10 @@ namespace BookmarkManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected string retrieveSourceCode(string url)
|
protected string retrieveSourceCode(string url, bool ignoreSSL)
|
||||||
{
|
{
|
||||||
if (webClient == null) webClient = new HttpWeb();
|
if (webClient == null) webClient = new HttpWeb();
|
||||||
|
webClient.IgnoreSSL = ignoreSSL;
|
||||||
|
|
||||||
string sourceCode;
|
string sourceCode;
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ namespace FizzyLauncher
|
|||||||
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator3;
|
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator3;
|
||||||
private TTextBox textBox1;
|
private TTextBox textBox1;
|
||||||
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
|
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
|
||||||
|
private TYesNoPickerBox pickerBox4;
|
||||||
|
private Label label2;
|
||||||
protected MainForm parentForm = null;
|
protected MainForm parentForm = null;
|
||||||
|
|
||||||
|
|
||||||
@ -54,6 +54,8 @@ namespace FizzyLauncher
|
|||||||
this.tHorizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
this.tHorizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||||
this.tHorizontalSeparator3 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
this.tHorizontalSeparator3 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||||
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
|
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
|
||||||
|
this.pickerBox4 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@ -233,11 +235,41 @@ namespace FizzyLauncher
|
|||||||
this.textBox1.TabIndex = 192;
|
this.textBox1.TabIndex = 192;
|
||||||
this.textBox1.UseSystemPasswordChar = false;
|
this.textBox1.UseSystemPasswordChar = false;
|
||||||
//
|
//
|
||||||
|
// pickerBox4
|
||||||
|
//
|
||||||
|
this.pickerBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.pickerBox4.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.pickerBox4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.pickerBox4.Location = new System.Drawing.Point(285, 237);
|
||||||
|
this.pickerBox4.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
|
||||||
|
this.pickerBox4.Name = "pickerBox4";
|
||||||
|
this.pickerBox4.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||||
|
this.pickerBox4.Size = new System.Drawing.Size(84, 34);
|
||||||
|
this.pickerBox4.SubmitButton = null;
|
||||||
|
this.pickerBox4.TabIndex = 194;
|
||||||
|
this.pickerBox4.Value = true;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||||
|
this.label2.Location = new System.Drawing.Point(10, 237);
|
||||||
|
this.label2.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||||
|
this.label2.Size = new System.Drawing.Size(95, 34);
|
||||||
|
this.label2.TabIndex = 193;
|
||||||
|
this.label2.Text = "Ignore SSL Errors";
|
||||||
|
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
// OptionsForm
|
// OptionsForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(384, 521);
|
this.ClientSize = new System.Drawing.Size(384, 521);
|
||||||
|
this.Controls.Add(this.pickerBox4);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.textBox1);
|
this.Controls.Add(this.textBox1);
|
||||||
this.Controls.Add(this.tHorizontalSeparator3);
|
this.Controls.Add(this.tHorizontalSeparator3);
|
||||||
this.Controls.Add(this.tHorizontalSeparator2);
|
this.Controls.Add(this.tHorizontalSeparator2);
|
||||||
@ -278,6 +310,7 @@ namespace FizzyLauncher
|
|||||||
pickerBox1.Value = parentForm.CurrentSession.EnableAutoPosition;
|
pickerBox1.Value = parentForm.CurrentSession.EnableAutoPosition;
|
||||||
pickerBox2.Value = parentForm.CurrentSession.AlwaysOnTop;
|
pickerBox2.Value = parentForm.CurrentSession.AlwaysOnTop;
|
||||||
textBox1.Text = parentForm.CurrentSession.RunCommand ?? string.Empty;
|
textBox1.Text = parentForm.CurrentSession.RunCommand ?? string.Empty;
|
||||||
|
pickerBox4.Value = parentForm.CurrentSession.IgnoreSSL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button1_MouseClick(object sender, MouseEventArgs e)
|
private void button1_MouseClick(object sender, MouseEventArgs e)
|
||||||
@ -290,6 +323,7 @@ namespace FizzyLauncher
|
|||||||
parentForm.CurrentSession.EnableAutoPosition = pickerBox1.Value;
|
parentForm.CurrentSession.EnableAutoPosition = pickerBox1.Value;
|
||||||
parentForm.CurrentSession.AlwaysOnTop = pickerBox2.Value;
|
parentForm.CurrentSession.AlwaysOnTop = pickerBox2.Value;
|
||||||
parentForm.CurrentSession.RunCommand = textBox1.Text?.Trim();
|
parentForm.CurrentSession.RunCommand = textBox1.Text?.Trim();
|
||||||
|
parentForm.CurrentSession.IgnoreSSL = pickerBox4.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.DialogResult = DialogResult.OK;
|
this.DialogResult = DialogResult.OK;
|
||||||
|
@ -8,35 +8,41 @@ namespace RyzStudio.Net
|
|||||||
{
|
{
|
||||||
public class HttpWeb
|
public class HttpWeb
|
||||||
{
|
{
|
||||||
public string defaultUserAgent = "Momozilla/5.0 (" + Environment.OSVersion.Platform.ToString() + " ; " + Environment.OSVersion.VersionString + "; " + Application.CurrentCulture.TwoLetterISOLanguageName + ")";
|
|
||||||
public int defaultTimeout = 6000;
|
|
||||||
public int defaultMaxRedirect = 8;
|
|
||||||
public bool defaultAllowRedirect = true;
|
|
||||||
public CookieContainer defaultCookierContainer = null;
|
|
||||||
|
|
||||||
public HttpWeb()
|
public HttpWeb()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpWebRequest CreateRequest(string url)
|
|
||||||
{
|
public string UserAgent { get; set; } = "Momozilla/5.0 (" + Environment.OSVersion.Platform.ToString() + " ; " + Environment.OSVersion.VersionString + "; " + Application.CurrentCulture.TwoLetterISOLanguageName + ")";
|
||||||
return this.CreateRequest(url, url);
|
|
||||||
}
|
public int Timeout { get; set; } = 6000;
|
||||||
|
|
||||||
|
public int MaxRedirect { get; set; } = 8;
|
||||||
|
|
||||||
|
public bool AllowRedirect { get; set; } = true;
|
||||||
|
|
||||||
|
public bool IgnoreSSL { get; set; } = false;
|
||||||
|
|
||||||
|
public CookieContainer CookierJar { get; set; } = null;
|
||||||
|
|
||||||
|
|
||||||
|
public HttpWebRequest CreateRequest(string url) => this.CreateRequest(url, url);
|
||||||
|
|
||||||
public HttpWebRequest CreateRequest(string url, string referrerURL)
|
public HttpWebRequest CreateRequest(string url, string referrerURL)
|
||||||
{
|
{
|
||||||
if (defaultCookierContainer == null)
|
if (this.CookierJar == null) this.CookierJar = new CookieContainer();
|
||||||
{
|
|
||||||
defaultCookierContainer = new CookieContainer();
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
|
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||||
webRequest.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
|
webRequest.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
|
||||||
webRequest.MaximumAutomaticRedirections = defaultMaxRedirect;
|
webRequest.MaximumAutomaticRedirections = this.MaxRedirect;
|
||||||
webRequest.CookieContainer = defaultCookierContainer;
|
webRequest.CookieContainer = this.CookierJar;
|
||||||
webRequest.UserAgent = defaultUserAgent;
|
webRequest.UserAgent = this.UserAgent;
|
||||||
webRequest.AllowAutoRedirect = defaultAllowRedirect;
|
webRequest.AllowAutoRedirect = this.AllowRedirect;
|
||||||
webRequest.Timeout = defaultTimeout;
|
webRequest.Timeout = this.Timeout;
|
||||||
|
|
||||||
|
if (this.IgnoreSSL) webRequest.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
|
||||||
|
|
||||||
return webRequest;
|
return webRequest;
|
||||||
}
|
}
|
||||||
@ -164,5 +170,6 @@ namespace RyzStudio.Net
|
|||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using BookmarkManager;
|
using BookmarkManager;
|
||||||
using bzit.bomg.Models;
|
using bzit.bomg.Models;
|
||||||
|
using FizzyLauncher.Models;
|
||||||
using RyzStudio.Windows.Forms;
|
using RyzStudio.Windows.Forms;
|
||||||
using RyzStudio.Windows.ThemedForms;
|
using RyzStudio.Windows.ThemedForms;
|
||||||
using System;
|
using System;
|
||||||
@ -27,6 +28,7 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
protected BookmarkTreeView bookmarkTreeView = null;
|
protected BookmarkTreeView bookmarkTreeView = null;
|
||||||
protected IconDatabase iconDatabase = null;
|
protected IconDatabase iconDatabase = null;
|
||||||
|
protected AppSession appSession = null;
|
||||||
|
|
||||||
protected WebParser webParser = null;
|
protected WebParser webParser = null;
|
||||||
protected WebClient webClient = null;
|
protected WebClient webClient = null;
|
||||||
@ -39,12 +41,13 @@ namespace FizzyLauncher
|
|||||||
protected bool requestCancellation = false;
|
protected bool requestCancellation = false;
|
||||||
|
|
||||||
|
|
||||||
public UpdateIconsForm(BookmarkTreeView treeView, IconDatabase database)
|
public UpdateIconsForm(AppSession session, BookmarkTreeView treeView, IconDatabase database)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
bookmarkTreeView = treeView;
|
bookmarkTreeView = treeView;
|
||||||
iconDatabase = database;
|
iconDatabase = database;
|
||||||
|
appSession = session;
|
||||||
|
|
||||||
pickerBox1.InnerControl.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
|
pickerBox1.InnerControl.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
|
||||||
|
|
||||||
@ -314,7 +317,7 @@ namespace FizzyLauncher
|
|||||||
|
|
||||||
BookmarkItem item = bookmarkList[i];
|
BookmarkItem item = bookmarkList[i];
|
||||||
|
|
||||||
BookmarkResult result = webParser.RetrieveDetails(item.SiteAddress);
|
BookmarkResult result = webParser.RetrieveDetails(item.SiteAddress, appSession.IgnoreSSL);
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user