Upaste privacy setting

This commit is contained in:
Jaex 2014-02-01 00:11:25 +02:00
parent 5df8113443
commit 98f5fc94a6
6 changed files with 33 additions and 7 deletions

View file

@ -673,7 +673,10 @@ public UploadResult UploadText(Stream stream, string fileName)
: new Gist(Program.UploadersConfig.GistPublishPublic, Program.UploadersConfig.GistOAuth2Info); : new Gist(Program.UploadersConfig.GistPublishPublic, Program.UploadersConfig.GistOAuth2Info);
break; break;
case TextDestination.Upaste: case TextDestination.Upaste:
textUploader = new Upaste(Program.UploadersConfig.UpasteUserKey); textUploader = new Upaste(Program.UploadersConfig.UpasteUserKey)
{
IsPublic = Program.UploadersConfig.UpasteIsPublic
};
break; break;
case TextDestination.CustomTextUploader: case TextDestination.CustomTextUploader:
if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomTextUploaderSelected)) if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomTextUploaderSelected))

View file

@ -336,6 +336,7 @@ private void InitializeComponent()
this.txtRapidSharePremiumUserName = new System.Windows.Forms.TextBox(); this.txtRapidSharePremiumUserName = new System.Windows.Forms.TextBox();
this.ttHelpTip = new System.Windows.Forms.ToolTip(this.components); this.ttHelpTip = new System.Windows.Forms.ToolTip(this.components);
this.actRapidShareAccountType = new UploadersLib.GUI.AccountTypeControl(); this.actRapidShareAccountType = new UploadersLib.GUI.AccountTypeControl();
this.cbUpasteIsPublic = new System.Windows.Forms.CheckBox();
this.tcUploaders.SuspendLayout(); this.tcUploaders.SuspendLayout();
this.tpImageUploaders.SuspendLayout(); this.tpImageUploaders.SuspendLayout();
this.tcImageUploaders.SuspendLayout(); this.tcImageUploaders.SuspendLayout();
@ -1363,6 +1364,7 @@ private void InitializeComponent()
// //
// tpUpaste // tpUpaste
// //
this.tpUpaste.Controls.Add(this.cbUpasteIsPublic);
this.tpUpaste.Controls.Add(this.lblUpasteUserKey); this.tpUpaste.Controls.Add(this.lblUpasteUserKey);
this.tpUpaste.Controls.Add(this.txtUpasteUserKey); this.tpUpaste.Controls.Add(this.txtUpasteUserKey);
this.tpUpaste.Location = new System.Drawing.Point(4, 22); this.tpUpaste.Location = new System.Drawing.Point(4, 22);
@ -3598,6 +3600,17 @@ private void InitializeComponent()
this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29); this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29);
this.actRapidShareAccountType.TabIndex = 16; this.actRapidShareAccountType.TabIndex = 16;
// //
// cbUpasteIsPublic
//
this.cbUpasteIsPublic.AutoSize = true;
this.cbUpasteIsPublic.Location = new System.Drawing.Point(16, 56);
this.cbUpasteIsPublic.Name = "cbUpasteIsPublic";
this.cbUpasteIsPublic.Size = new System.Drawing.Size(106, 17);
this.cbUpasteIsPublic.TabIndex = 2;
this.cbUpasteIsPublic.Text = "Is public upload?";
this.cbUpasteIsPublic.UseVisualStyleBackColor = true;
this.cbUpasteIsPublic.CheckedChanged += new System.EventHandler(this.cbUpasteIsPublic_CheckedChanged);
//
// UploadersConfigForm // UploadersConfigForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -4018,5 +4031,6 @@ private void InitializeComponent()
private System.Windows.Forms.TabPage tpUpaste; private System.Windows.Forms.TabPage tpUpaste;
private System.Windows.Forms.Label lblUpasteUserKey; private System.Windows.Forms.Label lblUpasteUserKey;
private System.Windows.Forms.TextBox txtUpasteUserKey; private System.Windows.Forms.TextBox txtUpasteUserKey;
private System.Windows.Forms.CheckBox cbUpasteIsPublic;
} }
} }

View file

@ -950,6 +950,11 @@ private void txtUpasteUserKey_TextChanged(object sender, EventArgs e)
Config.UpasteUserKey = txtUpasteUserKey.Text; Config.UpasteUserKey = txtUpasteUserKey.Text;
} }
private void cbUpasteIsPublic_CheckedChanged(object sender, EventArgs e)
{
Config.UpasteIsPublic = cbUpasteIsPublic.Checked;
}
#endregion uPaste #endregion uPaste
#endregion Text Uploaders #endregion Text Uploaders

View file

@ -234,6 +234,7 @@ public void LoadSettings(UploadersConfig uploadersConfig)
// Upaste // Upaste
txtUpasteUserKey.Text = Config.UpasteUserKey; txtUpasteUserKey.Text = Config.UpasteUserKey;
cbUpasteIsPublic.Checked = Config.UpasteIsPublic;
#endregion Text uploaders #endregion Text uploaders

View file

@ -33,11 +33,12 @@ public sealed class Upaste : TextUploader
{ {
private const string APIURL = "http://upaste.me/api"; private const string APIURL = "http://upaste.me/api";
public string APIKey { get; private set; } public string UserKey { get; private set; }
public bool IsPublic { get; set; }
public Upaste(string apiKey) public Upaste(string userKey)
{ {
APIKey = apiKey; UserKey = userKey;
} }
public override UploadResult UploadText(string text, string fileName) public override UploadResult UploadText(string text, string fileName)
@ -47,14 +48,14 @@ public override UploadResult UploadText(string text, string fileName)
if (!string.IsNullOrEmpty(text)) if (!string.IsNullOrEmpty(text))
{ {
Dictionary<string, string> arguments = new Dictionary<string, string>(); Dictionary<string, string> arguments = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(APIKey)) if (!string.IsNullOrEmpty(UserKey))
{ {
arguments.Add("api_key", APIKey); arguments.Add("api_key", UserKey);
} }
arguments.Add("paste", text); arguments.Add("paste", text);
//arguments.Add("syntax", ""); //arguments.Add("syntax", "");
//arguments.Add("name", ""); //arguments.Add("name", "");
arguments.Add("privacy", "1"); // 0 public 1 private arguments.Add("privacy", IsPublic ? "0" : "1"); // 0 public 1 private
arguments.Add("expire", "0"); arguments.Add("expire", "0");
arguments.Add("json", "true"); arguments.Add("json", "true");

View file

@ -40,6 +40,7 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
#region Image uploaders #region Image uploaders
// ImageShack // ImageShack
public ImageShackOptions ImageShackSettings = new ImageShackOptions(); public ImageShackOptions ImageShackSettings = new ImageShackOptions();
// TinyPic // TinyPic
@ -103,6 +104,7 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
// uPaste // uPaste
public string UpasteUserKey = string.Empty; public string UpasteUserKey = string.Empty;
public bool UpasteIsPublic = false;
#endregion Text uploaders #endregion Text uploaders