diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs index 081bff2..dffa13a 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/GlobalOptions.cs @@ -162,6 +162,14 @@ namespace Acacia } private static readonly BoolOption RELEASE_ITEM_EVENT_WRAPPERS = new BoolOption("ReleaseItemEventWrappers", true); + [AcaciaOption("If enabled, certificate errors from Z-Push servers are ignored silently.")] + virtual public bool IgnoreCertificateErrors + { + get { return GetOption(null, IGNORE_CERTIFICATE_ERRORS); } + set { SetOption(null, IGNORE_CERTIFICATE_ERRORS, value); } + } + private static readonly BoolOption IGNORE_CERTIFICATE_ERRORS = new BoolOption("IgnoreCertificateErrors", false); + #region UI Options diff --git a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/Connect/ZPushConnection.cs b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/Connect/ZPushConnection.cs index f2e5171..710a81a 100644 --- a/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/Connect/ZPushConnection.cs +++ b/src/AcaciaZPushPlugin/AcaciaZPushPlugin/ZPush/Connect/ZPushConnection.cs @@ -63,15 +63,22 @@ namespace Acacia.ZPush.Connect bool allow = false; if (!_allowCertificateErrors.TryGetValue(request.Host, out allow)) { - ThisAddIn.Instance.InvokeUI(() => + if (GlobalOptions.INSTANCE.IgnoreCertificateErrors) { - allow = MessageBox.Show( - string.Format(Properties.Resources.SSLFailed_Body, request.Host), - Properties.Resources.SSLFailed_Title, - MessageBoxButtons.YesNo, - MessageBoxIcon.Error - ) == DialogResult.Yes; - }); + allow = true; + } + else + { + ThisAddIn.Instance.InvokeUI(() => + { + allow = MessageBox.Show( + string.Format(Properties.Resources.SSLFailed_Body, request.Host), + Properties.Resources.SSLFailed_Title, + MessageBoxButtons.YesNo, + MessageBoxIcon.Error + ) == DialogResult.Yes; + }); + } _allowCertificateErrors.Add(request.Host, allow); }