diff --git a/UploadersLib/APIKeys/APIKeys.cs b/UploadersLib/APIKeys/APIKeys.cs
index 7d60d44e1..ef4015efb 100644
--- a/UploadersLib/APIKeys/APIKeys.cs
+++ b/UploadersLib/APIKeys/APIKeys.cs
@@ -49,7 +49,6 @@ public static partial class APIKeys
public static string DropboxConsumerSecret = "";
public static string MinusConsumerKey = "";
public static string MinusConsumerSecret = "";
- public static string BoxKey = "";
public static string BoxClientID = "";
public static string BoxClientSecret = "";
public static string SendSpaceKey = "";
diff --git a/UploadersLib/GUI/OAuthWebForm.Designer.cs b/UploadersLib/GUI/OAuthWebForm.Designer.cs
new file mode 100644
index 000000000..343f8215a
--- /dev/null
+++ b/UploadersLib/GUI/OAuthWebForm.Designer.cs
@@ -0,0 +1,127 @@
+namespace UploadersLib.GUI
+{
+ partial class OAuthWebForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.wbMain = new System.Windows.Forms.WebBrowser();
+ this.tscMain = new System.Windows.Forms.ToolStripContainer();
+ this.tsMain = new System.Windows.Forms.ToolStrip();
+ this.tstbURL = new System.Windows.Forms.ToolStripTextBox();
+ this.tslURL = new System.Windows.Forms.ToolStripLabel();
+ this.tscMain.ContentPanel.SuspendLayout();
+ this.tscMain.TopToolStripPanel.SuspendLayout();
+ this.tscMain.SuspendLayout();
+ this.tsMain.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // wbMain
+ //
+ this.wbMain.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.wbMain.Location = new System.Drawing.Point(0, 0);
+ this.wbMain.MinimumSize = new System.Drawing.Size(20, 20);
+ this.wbMain.Name = "wbMain";
+ this.wbMain.ScriptErrorsSuppressed = true;
+ this.wbMain.Size = new System.Drawing.Size(1056, 545);
+ this.wbMain.TabIndex = 0;
+ this.wbMain.Navigated += new System.Windows.Forms.WebBrowserNavigatedEventHandler(this.wbMain_Navigated);
+ //
+ // tscMain
+ //
+ //
+ // tscMain.ContentPanel
+ //
+ this.tscMain.ContentPanel.Controls.Add(this.wbMain);
+ this.tscMain.ContentPanel.Size = new System.Drawing.Size(1056, 545);
+ this.tscMain.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tscMain.Location = new System.Drawing.Point(0, 0);
+ this.tscMain.Name = "tscMain";
+ this.tscMain.Size = new System.Drawing.Size(1056, 574);
+ this.tscMain.TabIndex = 2;
+ this.tscMain.Text = "toolStripContainer1";
+ //
+ // tscMain.TopToolStripPanel
+ //
+ this.tscMain.TopToolStripPanel.Controls.Add(this.tsMain);
+ //
+ // tsMain
+ //
+ this.tsMain.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
+ this.tsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.tslURL,
+ this.tstbURL});
+ this.tsMain.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
+ this.tsMain.Location = new System.Drawing.Point(0, 0);
+ this.tsMain.Name = "tsMain";
+ this.tsMain.Padding = new System.Windows.Forms.Padding(3);
+ this.tsMain.Size = new System.Drawing.Size(1056, 29);
+ this.tsMain.Stretch = true;
+ this.tsMain.TabIndex = 0;
+ //
+ // tstbURL
+ //
+ this.tstbURL.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.tstbURL.Name = "tstbURL";
+ this.tstbURL.Size = new System.Drawing.Size(800, 23);
+ //
+ // tslURL
+ //
+ this.tslURL.Name = "tslURL";
+ this.tslURL.Size = new System.Drawing.Size(31, 20);
+ this.tslURL.Text = "URL:";
+ //
+ // OAuthWebForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.White;
+ this.ClientSize = new System.Drawing.Size(1056, 574);
+ this.Controls.Add(this.tscMain);
+ this.Name = "OAuthWebForm";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "ShareX - Authorization";
+ this.tscMain.ContentPanel.ResumeLayout(false);
+ this.tscMain.TopToolStripPanel.ResumeLayout(false);
+ this.tscMain.TopToolStripPanel.PerformLayout();
+ this.tscMain.ResumeLayout(false);
+ this.tscMain.PerformLayout();
+ this.tsMain.ResumeLayout(false);
+ this.tsMain.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.WebBrowser wbMain;
+ private System.Windows.Forms.ToolStripContainer tscMain;
+ private System.Windows.Forms.ToolStrip tsMain;
+ private System.Windows.Forms.ToolStripLabel tslURL;
+ private System.Windows.Forms.ToolStripTextBox tstbURL;
+ }
+}
\ No newline at end of file
diff --git a/UploadersLib/GUI/OAuthWebForm.cs b/UploadersLib/GUI/OAuthWebForm.cs
new file mode 100644
index 000000000..11e55c848
--- /dev/null
+++ b/UploadersLib/GUI/OAuthWebForm.cs
@@ -0,0 +1,83 @@
+#region License Information (GPL v3)
+
+/*
+ ShareX - A program that allows you to take screenshots and share any file type
+ Copyright (C) 2008-2014 ShareX Developers
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Optionally you can also view the license at .
+*/
+
+#endregion License Information (GPL v3)
+
+using HelpersLib;
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Web;
+using System.Windows.Forms;
+
+namespace UploadersLib.GUI
+{
+ public partial class OAuthWebForm : Form
+ {
+ public string AuthorizeURL { get; set; }
+ public string CallbackURL { get; set; }
+ public string Code { get; set; }
+
+ public OAuthWebForm(string authorizeURL, string callbackURL)
+ {
+ InitializeComponent();
+ Icon = ShareXResources.Icon;
+ AuthorizeURL = authorizeURL;
+ CallbackURL = callbackURL;
+ tstbURL.Text = authorizeURL;
+ wbMain.Navigate(AuthorizeURL);
+ }
+
+ private void wbMain_Navigated(object sender, WebBrowserNavigatedEventArgs e)
+ {
+ if (!IsDisposed)
+ {
+ tstbURL.Text = e.Url.ToString();
+ CheckCallback(e.Url.ToString());
+ }
+ }
+
+ private void CheckCallback(string url)
+ {
+ if (url.StartsWith(CallbackURL, StringComparison.InvariantCultureIgnoreCase))
+ {
+ NameValueCollection args = HttpUtility.ParseQueryString(url);
+
+ if (args != null)
+ {
+ Code = args["code"];
+
+ if (!string.IsNullOrEmpty(Code))
+ {
+ DialogResult = DialogResult.OK;
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/UploadersLib/GUI/OAuthWebForm.resx b/UploadersLib/GUI/OAuthWebForm.resx
new file mode 100644
index 000000000..ff9a412b3
--- /dev/null
+++ b/UploadersLib/GUI/OAuthWebForm.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/UploadersLib/GUI/UploadersConfigFormHelper.cs b/UploadersLib/GUI/UploadersConfigFormHelper.cs
index d18732f6a..f9ede8197 100644
--- a/UploadersLib/GUI/UploadersConfigFormHelper.cs
+++ b/UploadersLib/GUI/UploadersConfigFormHelper.cs
@@ -37,6 +37,7 @@
using System.Windows.Forms;
using UploadersLib.FileUploaders;
using UploadersLib.Forms;
+using UploadersLib.GUI;
using UploadersLib.HelperClasses;
using UploadersLib.ImageUploaders;
using UploadersLib.SocialServices;
@@ -643,8 +644,17 @@ public void BoxAuthOpen()
if (!string.IsNullOrEmpty(url))
{
Config.BoxOAuth2Info = oauth;
- Helpers.LoadBrowserAsync(url);
+ //Helpers.LoadBrowserAsync(url);
DebugHelper.WriteLine("BoxAuthOpen - Authorization URL is opened: " + url);
+
+ // Workaround for authorization because we don't have callback url which starts with https://
+ using (OAuthWebForm oauthForm = new OAuthWebForm(url, "https://www.box.com/home/"))
+ {
+ if (oauthForm.ShowDialog() == DialogResult.OK)
+ {
+ BoxAuthComplete(oauthForm.Code);
+ }
+ }
}
else
{
diff --git a/UploadersLib/UploadersLib.csproj b/UploadersLib/UploadersLib.csproj
index 832825cca..1a33bb187 100644
--- a/UploadersLib/UploadersLib.csproj
+++ b/UploadersLib/UploadersLib.csproj
@@ -167,6 +167,12 @@
OAuth2Control.cs
+
+ Form
+
+
+ OAuthWebForm.cs
+
Form
@@ -323,6 +329,9 @@
OAuth2Control.cs
+
+ OAuthWebForm.cs
+
ResponseForm.cs