diff --git a/ShareX.UploadersLib/Enums.cs b/ShareX.UploadersLib/Enums.cs
index 724c69f26..dc44934d5 100644
--- a/ShareX.UploadersLib/Enums.cs
+++ b/ShareX.UploadersLib/Enums.cs
@@ -94,6 +94,8 @@ public enum FileDestination
OneDrive,
[Description("Google Drive")]
GoogleDrive,
+ [Description("puush")]
+ Puush,
[Description("Box")]
Box,
[Description("MEGA")]
diff --git a/ShareX.UploadersLib/Favicons/puush.ico b/ShareX.UploadersLib/Favicons/puush.ico
new file mode 100644
index 000000000..a778b4c5b
Binary files /dev/null and b/ShareX.UploadersLib/Favicons/puush.ico differ
diff --git a/ShareX.UploadersLib/FileUploaders/Puush.cs b/ShareX.UploadersLib/FileUploaders/Puush.cs
new file mode 100644
index 000000000..335d2f5b1
--- /dev/null
+++ b/ShareX.UploadersLib/FileUploaders/Puush.cs
@@ -0,0 +1,137 @@
+#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 System.Collections.Generic;
+using System.IO;
+
+namespace ShareX.UploadersLib.FileUploaders
+{
+ public class PuushFileUploaderService : FileUploaderService
+ {
+ public override FileDestination EnumValue { get; } = FileDestination.Puush;
+
+ public override bool CheckConfig(UploadersConfig config)
+ {
+ return !string.IsNullOrEmpty(config.PuushAPIKey);
+ }
+
+ public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)
+ {
+ return new Puush()
+ {
+ APIKey = config.PuushAPIKey
+ };
+ }
+ }
+
+ public class Puush : FileUploader
+ {
+ public const string PuushURL = "https://puush.me";
+ public const string PuushAPIURL = PuushURL + "/api";
+ public const string PuushAPILoginURL = PuushAPIURL + "/auth";
+ public const string PuushAPIUploadURL = PuushAPIURL + "/up";
+ public const string PuushRegisterURL = PuushURL + "/register";
+ public const string PuushResetPasswordURL = PuushURL + "/reset_password";
+
+ public string APIKey { get; set; }
+
+ public string Login(string email, string password)
+ {
+ Dictionary arguments = new Dictionary();
+ arguments.Add("e", email);
+ arguments.Add("p", password);
+ arguments.Add("z", "ShareX");
+
+ string response = SendRequest(HttpMethod.POST, PuushAPILoginURL, arguments);
+
+ if (!string.IsNullOrEmpty(response))
+ {
+ string[] values = response.Split(',');
+
+ if (values != null && values.Length > 1)
+ {
+ int status;
+
+ if (int.TryParse(values[0], out status) && status >= 0)
+ {
+ return values[1];
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public override UploadResult Upload(Stream stream, string fileName)
+ {
+ Dictionary arguments = new Dictionary();
+ arguments.Add("k", APIKey);
+ arguments.Add("z", "ShareX");
+
+ UploadResult result = UploadData(stream, PuushAPIUploadURL, fileName, "f", arguments);
+
+ if (result.IsSuccess)
+ {
+ string[] values = result.Response.Split(',');
+
+ if (values != null && values.Length > 1)
+ {
+ int status;
+
+ if (!int.TryParse(values[0], out status))
+ {
+ status = -2;
+ }
+
+ if (status < 0)
+ {
+ switch (status)
+ {
+ case -1:
+ Errors.Add("Authentication failure.");
+ break;
+ default:
+ case -2:
+ Errors.Add("Connection error.");
+ break;
+ case -3:
+ Errors.Add("Checksum error.");
+ break;
+ case -4:
+ Errors.Add("Insufficient account storage remaining.");
+ break;
+ }
+ }
+ else
+ {
+ result.URL = values[1];
+ }
+ }
+ }
+
+ return result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/ShareX.UploadersLib/Forms/PuushLoginForm.Designer.cs b/ShareX.UploadersLib/Forms/PuushLoginForm.Designer.cs
new file mode 100644
index 000000000..d5e8091ad
--- /dev/null
+++ b/ShareX.UploadersLib/Forms/PuushLoginForm.Designer.cs
@@ -0,0 +1,139 @@
+namespace ShareX.UploadersLib.Forms
+{
+ partial class PuushLoginForm
+ {
+ ///
+ /// 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.lblPassword = new System.Windows.Forms.Label();
+ this.lblEmail = new System.Windows.Forms.Label();
+ this.txtEmail = new System.Windows.Forms.TextBox();
+ this.txtPassword = new System.Windows.Forms.TextBox();
+ this.btnLogin = new System.Windows.Forms.Button();
+ this.llForgottenPassword = new System.Windows.Forms.LinkLabel();
+ this.llCreateAccount = new System.Windows.Forms.LinkLabel();
+ this.SuspendLayout();
+ //
+ // lblPassword
+ //
+ this.lblPassword.AutoSize = true;
+ this.lblPassword.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblPassword.Location = new System.Drawing.Point(13, 96);
+ this.lblPassword.Name = "lblPassword";
+ this.lblPassword.Size = new System.Drawing.Size(71, 16);
+ this.lblPassword.TabIndex = 1;
+ this.lblPassword.Text = "Password:";
+ //
+ // lblEmail
+ //
+ this.lblEmail.AutoSize = true;
+ this.lblEmail.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblEmail.Location = new System.Drawing.Point(13, 40);
+ this.lblEmail.Name = "lblEmail";
+ this.lblEmail.Size = new System.Drawing.Size(45, 16);
+ this.lblEmail.TabIndex = 3;
+ this.lblEmail.Text = "Email:";
+ //
+ // txtEmail
+ //
+ this.txtEmail.Location = new System.Drawing.Point(16, 64);
+ this.txtEmail.Name = "txtEmail";
+ this.txtEmail.Size = new System.Drawing.Size(224, 20);
+ this.txtEmail.TabIndex = 4;
+ //
+ // txtPassword
+ //
+ this.txtPassword.Location = new System.Drawing.Point(16, 120);
+ this.txtPassword.Name = "txtPassword";
+ this.txtPassword.Size = new System.Drawing.Size(224, 20);
+ this.txtPassword.TabIndex = 5;
+ this.txtPassword.UseSystemPasswordChar = true;
+ //
+ // btnLogin
+ //
+ this.btnLogin.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnLogin.Location = new System.Drawing.Point(16, 176);
+ this.btnLogin.Name = "btnLogin";
+ this.btnLogin.Size = new System.Drawing.Size(224, 32);
+ this.btnLogin.TabIndex = 6;
+ this.btnLogin.Text = "Login";
+ this.btnLogin.UseVisualStyleBackColor = true;
+ this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
+ //
+ // llForgottenPassword
+ //
+ this.llForgottenPassword.AutoSize = true;
+ this.llForgottenPassword.Location = new System.Drawing.Point(13, 152);
+ this.llForgottenPassword.Name = "llForgottenPassword";
+ this.llForgottenPassword.Size = new System.Drawing.Size(106, 13);
+ this.llForgottenPassword.TabIndex = 7;
+ this.llForgottenPassword.TabStop = true;
+ this.llForgottenPassword.Text = "Forgotten password?";
+ this.llForgottenPassword.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llForgottenPassword_LinkClicked);
+ //
+ // llCreateAccount
+ //
+ this.llCreateAccount.AutoSize = true;
+ this.llCreateAccount.Location = new System.Drawing.Point(13, 16);
+ this.llCreateAccount.Name = "llCreateAccount";
+ this.llCreateAccount.Size = new System.Drawing.Size(104, 13);
+ this.llCreateAccount.TabIndex = 8;
+ this.llCreateAccount.TabStop = true;
+ this.llCreateAccount.Text = "Create an account...";
+ this.llCreateAccount.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llCreateAccount_LinkClicked);
+ //
+ // PuushLoginForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.SystemColors.Window;
+ this.ClientSize = new System.Drawing.Size(256, 224);
+ this.Controls.Add(this.llCreateAccount);
+ this.Controls.Add(this.llForgottenPassword);
+ this.Controls.Add(this.btnLogin);
+ this.Controls.Add(this.txtPassword);
+ this.Controls.Add(this.txtEmail);
+ this.Controls.Add(this.lblEmail);
+ this.Controls.Add(this.lblPassword);
+ this.Name = "PuushLoginForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "puush login";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lblPassword;
+ private System.Windows.Forms.Label lblEmail;
+ private System.Windows.Forms.TextBox txtEmail;
+ private System.Windows.Forms.TextBox txtPassword;
+ private System.Windows.Forms.Button btnLogin;
+ private System.Windows.Forms.LinkLabel llForgottenPassword;
+ private System.Windows.Forms.LinkLabel llCreateAccount;
+ }
+}
\ No newline at end of file
diff --git a/ShareX.UploadersLib/Forms/PuushLoginForm.cs b/ShareX.UploadersLib/Forms/PuushLoginForm.cs
new file mode 100644
index 000000000..af65a7fb3
--- /dev/null
+++ b/ShareX.UploadersLib/Forms/PuushLoginForm.cs
@@ -0,0 +1,92 @@
+#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 ShareX.HelpersLib;
+using ShareX.UploadersLib.FileUploaders;
+using ShareX.UploadersLib.Properties;
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace ShareX.UploadersLib.Forms
+{
+ public partial class PuushLoginForm : Form
+ {
+ public string APIKey { get; set; }
+
+ public PuushLoginForm()
+ {
+ InitializeComponent();
+ Icon = Resources.puush;
+ }
+
+ private bool CheckValidation()
+ {
+ bool result = true;
+
+ if (string.IsNullOrEmpty(txtEmail.Text))
+ {
+ txtEmail.BackColor = Color.FromArgb(255, 200, 200);
+ result = false;
+ }
+
+ if (string.IsNullOrEmpty(txtPassword.Text))
+ {
+ txtPassword.BackColor = Color.FromArgb(255, 200, 200);
+ result = false;
+ }
+
+ return result;
+ }
+
+ private void llCreateAccount_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+ {
+ URLHelpers.OpenURL(Puush.PuushRegisterURL);
+ }
+
+ private void llForgottenPassword_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+ {
+ URLHelpers.OpenURL(Puush.PuushResetPasswordURL);
+ }
+
+ private void btnLogin_Click(object sender, EventArgs e)
+ {
+ if (CheckValidation())
+ {
+ APIKey = new Puush().Login(txtEmail.Text, txtPassword.Text);
+
+ if (!string.IsNullOrEmpty(APIKey))
+ {
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ else
+ {
+ MessageBox.Show("Login failed.", "Authentication failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ShareX.UploadersLib/Forms/PuushLoginForm.resx b/ShareX.UploadersLib/Forms/PuushLoginForm.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/ShareX.UploadersLib/Forms/PuushLoginForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ShareX.UploadersLib/Properties/Resources.Designer.cs b/ShareX.UploadersLib/Properties/Resources.Designer.cs
index eceacab97..1e1314373 100644
--- a/ShareX.UploadersLib/Properties/Resources.Designer.cs
+++ b/ShareX.UploadersLib/Properties/Resources.Designer.cs
@@ -865,6 +865,16 @@ internal class Resources {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon puush {
+ get {
+ object obj = ResourceManager.GetObject("puush", 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 c69f900ed..9572c26ea 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\puush.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 0fa7378b3..be2500045 100644
--- a/ShareX.UploadersLib/ShareX.UploadersLib.csproj
+++ b/ShareX.UploadersLib/ShareX.UploadersLib.csproj
@@ -129,6 +129,7 @@
+
@@ -158,6 +159,12 @@
OCRSpaceForm.cs
+
+ Form
+
+
+ PuushLoginForm.cs
+
Form
@@ -591,6 +598,9 @@
OCRSpaceForm.cs
+
+ PuushLoginForm.cs
+
ResponseForm.cs
@@ -934,6 +944,9 @@
+
+
+
diff --git a/ShareX.UploadersLib/UploadersConfig.cs b/ShareX.UploadersLib/UploadersConfig.cs
index 5cde381b1..4bbdd3be4 100644
--- a/ShareX.UploadersLib/UploadersConfig.cs
+++ b/ShareX.UploadersLib/UploadersConfig.cs
@@ -135,19 +135,19 @@ public class UploadersConfig : SettingsBase
public bool DropboxAutoCreateShareableLink = false;
public DropboxURLType DropboxURLType = DropboxURLType.Default;
+ // FTP Server
+
+ public List FTPAccountList = new List();
+ public int FTPSelectedImage = 0;
+ public int FTPSelectedText = 0;
+ public int FTPSelectedFile = 0;
+
// OneDrive
public OAuth2Info OneDriveOAuth2Info = null;
public OneDriveFileInfo OneDriveSelectedFolder = OneDrive.RootFolder;
public bool OneDriveAutoCreateShareableLink = true;
- // Copy
-
- public OAuthInfo CopyOAuthInfo = null;
- public CopyAccountInfo CopyAccountInfo = null;
- public string CopyUploadPath = "ShareX/%y/%mo";
- public CopyURLType CopyURLType = CopyURLType.Shortened;
-
// Google Drive
public OAuth2Info GoogleDriveOAuth2Info = null;
@@ -156,6 +156,10 @@ public class UploadersConfig : SettingsBase
public bool GoogleDriveUseFolder = false;
public string GoogleDriveFolderID = "";
+ // puush
+
+ public string PuushAPIKey = "";
+
// SendSpace
public AccountType SendSpaceAccountType = AccountType.Anonymous;
@@ -183,13 +187,6 @@ public class UploadersConfig : SettingsBase
public string LocalhostrPassword = "";
public bool LocalhostrDirectURL = true;
- // FTP Server
-
- public List FTPAccountList = new List();
- public int FTPSelectedImage = 0;
- public int FTPSelectedText = 0;
- public int FTPSelectedFile = 0;
-
// Shared Folder
public List LocalhostAccountList = new List();