diff --git a/ShareX.UploadersLib/Enums.cs b/ShareX.UploadersLib/Enums.cs index fcdc8c8c0..2c87f736b 100644 --- a/ShareX.UploadersLib/Enums.cs +++ b/ShareX.UploadersLib/Enums.cs @@ -134,6 +134,8 @@ public enum FileDestination Sul, [Description("Streamable")] Streamable, + [Description("openload.co")] + Openload, SharedFolder, // Localized Email, // Localized CustomFileUploader // Localized diff --git a/ShareX.UploadersLib/Favicons/Openload.ico b/ShareX.UploadersLib/Favicons/Openload.ico new file mode 100644 index 000000000..563d37b16 Binary files /dev/null and b/ShareX.UploadersLib/Favicons/Openload.ico differ diff --git a/ShareX.UploadersLib/FileUploaders/OpenloadUploader.cs b/ShareX.UploadersLib/FileUploaders/OpenloadUploader.cs new file mode 100644 index 000000000..fb3c4a9f6 --- /dev/null +++ b/ShareX.UploadersLib/FileUploaders/OpenloadUploader.cs @@ -0,0 +1,170 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright (c) 2007-2016 ShareX Team + + 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 Newtonsoft.Json; +using System.Collections.Generic; +using System.IO; + +namespace ShareX.UploadersLib.FileUploaders +{ + public sealed class OpenloadUploader : FileUploader + { + + public string APILogin { get; set; } + public string APIKey { get; set; } + public bool UploadToFolder { get; set; } + public string FolderID { get; set; } + + public bool IsStatusOK(int statusCode) + { + return (statusCode / 100 == 2); + } + + public string GetUploadURL() + { + Dictionary args = new Dictionary(); + + if (!string.IsNullOrEmpty(APILogin) && !string.IsNullOrEmpty(APIKey)) + { + args.Add("login", APILogin); + args.Add("key", APIKey); + if (UploadToFolder && !string.IsNullOrEmpty(FolderID)) + args.Add("folder", FolderID); + } + + string response = SendRequest(HttpMethod.POST, "https://api.openload.co/1/file/ul", args); + if (!string.IsNullOrEmpty(response)) + { + var uploadResponse = JsonConvert.DeserializeObject>(response); + if (IsStatusOK(uploadResponse.status)) + return uploadResponse.result.url; + Errors.Add(string.Format("Can't retrieve the upload URL: {0}", uploadResponse.message)); + return null; + } + Errors.Add("Can't retrieve the upload URL"); + return null; + } + + public OpenloadFolderNode GetFolderTree(string folderID) + { + Dictionary args = new Dictionary(); + + if (string.IsNullOrEmpty(APILogin) || string.IsNullOrEmpty(APIKey)) + return null; + + args.Add("login", APILogin); + args.Add("key", APIKey); + if (!string.IsNullOrEmpty(folderID)) + args.Add("folder", folderID); + + string response = SendRequest(HttpMethod.POST, "https://api.openload.co/1/file/listfolder", args); + if (string.IsNullOrEmpty(response)) + return null; + var folderResponse = JsonConvert.DeserializeObject>(response); + if (!IsStatusOK(folderResponse.status)) + return null; + + OpenloadFolderNode folderTree = new OpenloadFolderNode(); + foreach (OpenloadFolder folder in folderResponse.result.folders) + { + OpenloadFolderNode folderNode = GetFolderTree(folder.id); + if (folderNode == null) + folderNode = new OpenloadFolderNode(); + folderNode.folder = folder; + folderTree.subNodes.Add(folderNode); + } + return folderTree; + } + + public UploadResult UploadToURL(Stream stream, string fileName, string uploadURL) + { + UploadResult result = UploadData(stream, uploadURL, fileName, "image"); + if (!string.IsNullOrEmpty(result.Response)) + { + var uploadResponse = JsonConvert.DeserializeObject>(result.Response); + if (IsStatusOK(uploadResponse.status)) + { + result.URL = uploadResponse.result.url; + return result; + } + } + Errors.Add("Upload to openload.co failed"); + return null; + } + + public override UploadResult Upload(Stream stream, string fileName) + { + string uploadURL = GetUploadURL(); + return (string.IsNullOrEmpty(uploadURL)) ? null : UploadToURL(stream, fileName, uploadURL); + } + + } + + public class OpenloadFolderNode + { + public OpenloadFolderNode() + { + subNodes = new List(); + } + + public OpenloadFolder folder { get; set; } + public List subNodes { get; set; } + } + + public class OpenloadResponse + { + public int status { get; set; } + public string message { get; set; } + public ResultType result { get; set; } + } + + public class OpenloadUploadResult + { + public string url { get; set; } + public string valid_until { get; set; } + } + + public class OpenloadImageUploadResult + { + public string name { get; set; } + public string size { get; set; } + public string sha1 { get; set; } + public string content_type { get; set; } + public string id { get; set; } + public string url { get; set; } + } + + public class OpenloadFolderResult + { + public OpenloadFolder[] folders { get; set; } + } + + public class OpenloadFolder + { + public string id { get; set; } + public string name { get; set; } + } + +} diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs index c9ea20c55..34d047f0c 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs @@ -367,6 +367,17 @@ private void InitializeComponent() this.tpSul = new System.Windows.Forms.TabPage(); this.txtSulAPIKey = new System.Windows.Forms.TextBox(); this.lblSulAPIKey = new System.Windows.Forms.Label(); + this.tpOpenload = new System.Windows.Forms.TabPage(); + this.gbOpenloadFolders = new System.Windows.Forms.GroupBox(); + this.trvOpenloadFolders = new System.Windows.Forms.TreeView(); + this.btnOpenloadRefreshFolders = new System.Windows.Forms.Button(); + this.cbOpenloadUploadToFolder = new System.Windows.Forms.CheckBox(); + this.gbOpenloadAuthentication = new System.Windows.Forms.GroupBox(); + this.lblOpenloadApiLink = new System.Windows.Forms.LinkLabel(); + this.txtOpenloadApiKey = new System.Windows.Forms.TextBox(); + this.lblOpenloadApiKey = new System.Windows.Forms.Label(); + this.txtOpenloadApiLogin = new System.Windows.Forms.TextBox(); + this.lblOpenloadApiLogin = new System.Windows.Forms.Label(); this.btnCopyShowFiles = new System.Windows.Forms.Button(); this.tpTextUploaders = new System.Windows.Forms.TabPage(); this.tcTextUploaders = new System.Windows.Forms.TabControl(); @@ -584,6 +595,9 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.nudEmailSmtpPort)).BeginInit(); this.tpSharedFolder.SuspendLayout(); this.tpSul.SuspendLayout(); + this.tpOpenload.SuspendLayout(); + this.gbOpenloadFolders.SuspendLayout(); + this.gbOpenloadAuthentication.SuspendLayout(); this.tpTextUploaders.SuspendLayout(); this.tcTextUploaders.SuspendLayout(); this.tpPastebin.SuspendLayout(); @@ -1503,6 +1517,7 @@ private void InitializeComponent() this.tcFileUploaders.Controls.Add(this.tpEmail); this.tcFileUploaders.Controls.Add(this.tpSharedFolder); this.tcFileUploaders.Controls.Add(this.tpSul); + this.tcFileUploaders.Controls.Add(this.tpOpenload); resources.ApplyResources(this.tcFileUploaders, "tcFileUploaders"); this.tcFileUploaders.Multiline = true; this.tcFileUploaders.Name = "tcFileUploaders"; @@ -3035,6 +3050,84 @@ private void InitializeComponent() resources.ApplyResources(this.lblSulAPIKey, "lblSulAPIKey"); this.lblSulAPIKey.Name = "lblSulAPIKey"; // + // tpOpenload + // + this.tpOpenload.Controls.Add(this.gbOpenloadFolders); + this.tpOpenload.Controls.Add(this.gbOpenloadAuthentication); + resources.ApplyResources(this.tpOpenload, "tpOpenload"); + this.tpOpenload.Name = "tpOpenload"; + this.tpOpenload.UseVisualStyleBackColor = true; + // + // gbOpenloadFolders + // + this.gbOpenloadFolders.Controls.Add(this.trvOpenloadFolders); + this.gbOpenloadFolders.Controls.Add(this.btnOpenloadRefreshFolders); + this.gbOpenloadFolders.Controls.Add(this.cbOpenloadUploadToFolder); + resources.ApplyResources(this.gbOpenloadFolders, "gbOpenloadFolders"); + this.gbOpenloadFolders.Name = "gbOpenloadFolders"; + this.gbOpenloadFolders.TabStop = false; + // + // trvOpenloadFolders + // + this.trvOpenloadFolders.HideSelection = false; + resources.ApplyResources(this.trvOpenloadFolders, "trvOpenloadFolders"); + this.trvOpenloadFolders.Name = "trvOpenloadFolders"; + this.trvOpenloadFolders.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.trvOpenloadFolders_AfterSelect); + // + // btnOpenloadRefreshFolders + // + resources.ApplyResources(this.btnOpenloadRefreshFolders, "btnOpenloadRefreshFolders"); + this.btnOpenloadRefreshFolders.Name = "btnOpenloadRefreshFolders"; + this.btnOpenloadRefreshFolders.UseVisualStyleBackColor = true; + this.btnOpenloadRefreshFolders.Click += new System.EventHandler(this.btnOpenloadRefreshFolders_Click); + // + // cbOpenloadUploadToFolder + // + resources.ApplyResources(this.cbOpenloadUploadToFolder, "cbOpenloadUploadToFolder"); + this.cbOpenloadUploadToFolder.Name = "cbOpenloadUploadToFolder"; + this.cbOpenloadUploadToFolder.UseVisualStyleBackColor = true; + this.cbOpenloadUploadToFolder.CheckedChanged += new System.EventHandler(this.cbOpenloadUploadToFolder_CheckedChanged); + // + // gbOpenloadAuthentication + // + this.gbOpenloadAuthentication.Controls.Add(this.lblOpenloadApiLink); + this.gbOpenloadAuthentication.Controls.Add(this.txtOpenloadApiKey); + this.gbOpenloadAuthentication.Controls.Add(this.lblOpenloadApiKey); + this.gbOpenloadAuthentication.Controls.Add(this.txtOpenloadApiLogin); + this.gbOpenloadAuthentication.Controls.Add(this.lblOpenloadApiLogin); + resources.ApplyResources(this.gbOpenloadAuthentication, "gbOpenloadAuthentication"); + this.gbOpenloadAuthentication.Name = "gbOpenloadAuthentication"; + this.gbOpenloadAuthentication.TabStop = false; + // + // lblOpenloadApiLink + // + resources.ApplyResources(this.lblOpenloadApiLink, "lblOpenloadApiLink"); + this.lblOpenloadApiLink.Name = "lblOpenloadApiLink"; + this.lblOpenloadApiLink.TabStop = true; + this.lblOpenloadApiLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblOpenloadApiLink_LinkClicked); + // + // txtOpenloadApiKey + // + resources.ApplyResources(this.txtOpenloadApiKey, "txtOpenloadApiKey"); + this.txtOpenloadApiKey.Name = "txtOpenloadApiKey"; + this.txtOpenloadApiKey.TextChanged += new System.EventHandler(this.txtOpenloadApiKey_TextChanged); + // + // lblOpenloadApiKey + // + resources.ApplyResources(this.lblOpenloadApiKey, "lblOpenloadApiKey"); + this.lblOpenloadApiKey.Name = "lblOpenloadApiKey"; + // + // txtOpenloadApiLogin + // + resources.ApplyResources(this.txtOpenloadApiLogin, "txtOpenloadApiLogin"); + this.txtOpenloadApiLogin.Name = "txtOpenloadApiLogin"; + this.txtOpenloadApiLogin.TextChanged += new System.EventHandler(this.txtOpenloadApiLogin_TextChanged); + // + // lblOpenloadApiLogin + // + resources.ApplyResources(this.lblOpenloadApiLogin, "lblOpenloadApiLogin"); + this.lblOpenloadApiLogin.Name = "lblOpenloadApiLogin"; + // // btnCopyShowFiles // resources.ApplyResources(this.btnCopyShowFiles, "btnCopyShowFiles"); @@ -4356,6 +4449,11 @@ private void InitializeComponent() this.tpSharedFolder.PerformLayout(); this.tpSul.ResumeLayout(false); this.tpSul.PerformLayout(); + this.tpOpenload.ResumeLayout(false); + this.gbOpenloadFolders.ResumeLayout(false); + this.gbOpenloadFolders.PerformLayout(); + this.gbOpenloadAuthentication.ResumeLayout(false); + this.gbOpenloadAuthentication.PerformLayout(); this.tpTextUploaders.ResumeLayout(false); this.tcTextUploaders.ResumeLayout(false); this.tpPastebin.ResumeLayout(false); @@ -4901,5 +4999,16 @@ private void InitializeComponent() private System.Windows.Forms.Button btnCheveretoTestAll; private System.Windows.Forms.CheckBox cbPastebinRaw; private System.Windows.Forms.CheckBox cbGistUseRawURL; + private System.Windows.Forms.TabPage tpOpenload; + private System.Windows.Forms.GroupBox gbOpenloadAuthentication; + private System.Windows.Forms.Label lblOpenloadApiLogin; + private System.Windows.Forms.LinkLabel lblOpenloadApiLink; + private System.Windows.Forms.TextBox txtOpenloadApiKey; + private System.Windows.Forms.Label lblOpenloadApiKey; + private System.Windows.Forms.TextBox txtOpenloadApiLogin; + private System.Windows.Forms.GroupBox gbOpenloadFolders; + private System.Windows.Forms.TreeView trvOpenloadFolders; + private System.Windows.Forms.Button btnOpenloadRefreshFolders; + private System.Windows.Forms.CheckBox cbOpenloadUploadToFolder; } } diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs index c6edb0f66..129fff468 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs @@ -100,6 +100,7 @@ private void FormSettings() AddIconToTab(tpMinus, Resources.Minus); AddIconToTab(tpOneDrive, Resources.OneDrive); AddIconToTab(tpOneTimeSecret, Resources.OneTimeSecret); + AddIconToTab(tpOpenload, Resources.OpenLoad); AddIconToTab(tpOwnCloud, Resources.OwnCloud); AddIconToTab(tpPaste_ee, Resources.page_white_text); AddIconToTab(tpPastebin, Resources.Pastebin); @@ -576,6 +577,13 @@ public void LoadSettings() txtStreamablePassword.Enabled = false; } + // openload.co + + txtOpenloadApiLogin.Text = Config.OpenloadAPILogin; + txtOpenloadApiKey.Text = Config.OpenloadAPIKey; + cbOpenloadUploadToFolder.Checked = Config.OpenloadUploadToSelectedFolder; + OpenloadUpdateFolderTree(); + #endregion File uploaders #region URL shorteners @@ -2450,6 +2458,98 @@ private void txtStreamablePassword_TextChanged(object sender, EventArgs e) #endregion Streamable + #region openload.co + + private void txtOpenloadApiLogin_TextChanged(object sender, EventArgs e) + { + Config.OpenloadAPILogin = txtOpenloadApiLogin.Text; + } + + private void txtOpenloadApiKey_TextChanged(object sender, EventArgs e) + { + Config.OpenloadAPIKey = txtOpenloadApiKey.Text; + } + + private void lblOpenloadApiLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + URLHelpers.OpenURL("https://openload.co/account"); + } + + private void btnOpenloadRefreshFolders_Click(object sender, EventArgs e) + { + btnOpenloadRefreshFolders.Enabled = false; + + OpenloadUploader openload = new OpenloadUploader() + { + APILogin = Config.OpenloadAPILogin, + APIKey = Config.OpenloadAPIKey + }; + + Config.OpenloadFolderTree = openload.GetFolderTree(string.Empty); + OpenloadUpdateFolderTree(); + + btnOpenloadRefreshFolders.Enabled = true; + } + + private void cbOpenloadUploadToFolder_CheckedChanged(object sender, EventArgs e) + { + Config.OpenloadUploadToSelectedFolder = cbOpenloadUploadToFolder.Checked; + } + + private void trvOpenloadFolders_AfterSelect(object sender, TreeViewEventArgs e) + { + Config.OpenloadSelectedFolderID = ((OpenloadFolder)e.Node.Tag).id; + } + + private void OpenloadUpdateFolderTree() + { + trvOpenloadFolders.Nodes.Clear(); + if (Config.OpenloadFolderTree != null) + { + foreach (OpenloadFolderNode node in Config.OpenloadFolderTree.subNodes) + { + TreeNode treeNode = OpenloadToTreeNode(node); + if (treeNode != null) + { + trvOpenloadFolders.Nodes.Add(treeNode); + if (string.Compare(node.folder.id, Config.OpenloadSelectedFolderID) == 0) + trvOpenloadFolders.SelectedNode = treeNode; + } + } + } + } + + private TreeNode OpenloadToTreeNode(OpenloadFolderNode node) + { + if (node != null && node.folder != null) + { + TreeNode treeNode = new TreeNode(node.folder.name); + treeNode.Tag = node.folder; + foreach (OpenloadFolderNode subNode in node.subNodes) + { + TreeNode subTreeNode = OpenloadToTreeNode(subNode); + if (subTreeNode != null) + { + treeNode.Nodes.Add(subTreeNode); + if (string.Compare(subNode.folder.id, Config.OpenloadSelectedFolderID) == 0) + { + trvOpenloadFolders.SelectedNode = subTreeNode; + TreeNode parentNode = treeNode; + while (parentNode != null) + { + parentNode.Expand(); + parentNode = parentNode.Parent; + } + } + } + } + return treeNode; + } + return null; + } + + #endregion openload.co + #endregion File Uploaders #region URL Shorteners diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx index a588cbad2..81e7bae9d 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx @@ -12409,6 +12409,291 @@ Using an encrypted library disables sharing. 4 + + 18, 58 + + + 330, 209 + + + 2 + + + trvOpenloadFolders + + + System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbOpenloadFolders + + + 0 + + + NoControl + + + 265, 23 + + + 83, 23 + + + 1 + + + Refresh + + + btnOpenloadRefreshFolders + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbOpenloadFolders + + + 1 + + + True + + + NoControl + + + 18, 27 + + + 180, 17 + + + 0 + + + Upload images to selected folder + + + cbOpenloadUploadToFolder + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbOpenloadFolders + + + 2 + + + 16, 190 + + + 369, 285 + + + 1 + + + Folders + + + gbOpenloadFolders + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpOpenload + + + 0 + + + True + + + NoControl + + + 16, 124 + + + 315, 13 + + + 4 + + + You can get your API keys from your openload.co account panel. + + + lblOpenloadApiLink + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbOpenloadAuthentication + + + 0 + + + 19, 92 + + + 329, 20 + + + 3 + + + txtOpenloadApiKey + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbOpenloadAuthentication + + + 1 + + + True + + + NoControl + + + 16, 76 + + + 48, 13 + + + 2 + + + API Key: + + + lblOpenloadApiKey + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbOpenloadAuthentication + + + 2 + + + 19, 40 + + + 329, 20 + + + 1 + + + txtOpenloadApiLogin + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbOpenloadAuthentication + + + 3 + + + True + + + NoControl + + + 16, 24 + + + 56, 13 + + + 0 + + + API Login: + + + lblOpenloadApiLogin + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbOpenloadAuthentication + + + 4 + + + 16, 16 + + + 369, 157 + + + 0 + + + Authentication + + + gbOpenloadAuthentication + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpOpenload + + + 1 + + + 4, 40 + + + 3, 3, 3, 3 + + + 972, 475 + + + 11 + + + openload.co + + + tpOpenload + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcFileUploaders + + + 24 + cbEmailConfirm diff --git a/ShareX.UploadersLib/Properties/Resources.Designer.cs b/ShareX.UploadersLib/Properties/Resources.Designer.cs index 79e7e6041..73bdd673f 100644 --- a/ShareX.UploadersLib/Properties/Resources.Designer.cs +++ b/ShareX.UploadersLib/Properties/Resources.Designer.cs @@ -516,6 +516,16 @@ internal static System.Drawing.Icon OneTimeSecret { } } + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon OpenLoad { + get { + object obj = ResourceManager.GetObject("OpenLoad", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShareX.UploadersLib/Properties/Resources.resx b/ShareX.UploadersLib/Properties/Resources.resx index 8c875d24d..04a54618d 100644 --- a/ShareX.UploadersLib/Properties/Resources.resx +++ b/ShareX.UploadersLib/Properties/Resources.resx @@ -494,4 +494,7 @@ Created folders: ..\favicons\someimage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\favicons\openload.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShareX.UploadersLib/ShareX.UploadersLib.csproj b/ShareX.UploadersLib/ShareX.UploadersLib.csproj index 26f64f734..195718e1f 100644 --- a/ShareX.UploadersLib/ShareX.UploadersLib.csproj +++ b/ShareX.UploadersLib/ShareX.UploadersLib.csproj @@ -123,6 +123,7 @@ + @@ -885,6 +886,7 @@ + @@ -909,4 +911,4 @@ if not exist APIKeysLocal.cs ( --> - \ No newline at end of file + diff --git a/ShareX.UploadersLib/UploadersConfig.cs b/ShareX.UploadersLib/UploadersConfig.cs index dbfdd6243..37435d3d5 100644 --- a/ShareX.UploadersLib/UploadersConfig.cs +++ b/ShareX.UploadersLib/UploadersConfig.cs @@ -288,6 +288,14 @@ public class UploadersConfig : SettingsBase public string StreamablePassword = ""; public bool StreamableAnonymous = true; + // openload.co + + public string OpenloadAPILogin = string.Empty; + public string OpenloadAPIKey = string.Empty; + public OpenloadFolderNode OpenloadFolderTree = null; + public bool OpenloadUploadToSelectedFolder = false; + public string OpenloadSelectedFolderID = string.Empty; + #endregion File uploaders #region URL shorteners diff --git a/ShareX/WorkerTask.cs b/ShareX/WorkerTask.cs index c4d937a2d..285ab22d3 100644 --- a/ShareX/WorkerTask.cs +++ b/ShareX/WorkerTask.cs @@ -1192,6 +1192,15 @@ public UploadResult UploadFile(Stream stream, string fileName) fileUploader = new Streamable(user, password); break; + case FileDestination.Openload: + fileUploader = new OpenloadUploader() + { + APILogin = Program.UploadersConfig.OpenloadAPILogin, + APIKey = Program.UploadersConfig.OpenloadAPIKey, + UploadToFolder = Program.UploadersConfig.OpenloadUploadToSelectedFolder, + FolderID = Program.UploadersConfig.OpenloadSelectedFolderID + }; + break; } if (fileUploader != null)