mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Implement new paste.ee API
This commit is contained in:
parent
5d8a0a3f3d
commit
206a79d86e
6 changed files with 180 additions and 101 deletions
|
@ -69,6 +69,7 @@ public static partial class APIKeys
|
|||
public static string PastebinCaKey = "";
|
||||
public static string GitHubID = "";
|
||||
public static string GitHubSecret = "";
|
||||
public static string Paste_eeApplicationKey = "";
|
||||
|
||||
// URL Shorteners
|
||||
public static string BitlyClientID = "";
|
||||
|
|
|
@ -270,6 +270,9 @@ private void InitializeComponent()
|
|||
this.btnBoxRefreshFolders = new System.Windows.Forms.Button();
|
||||
this.oauth2Box = new ShareX.UploadersLib.OAuthControl();
|
||||
this.tpAmazonS3 = new System.Windows.Forms.TabPage();
|
||||
this.btnAmazonS3StorageClassHelp = new System.Windows.Forms.Button();
|
||||
this.lblAmazonS3StorageClass = new System.Windows.Forms.Label();
|
||||
this.cbAmazonS3StorageClass = new System.Windows.Forms.ComboBox();
|
||||
this.cbAmazonS3UsePathStyle = new System.Windows.Forms.CheckBox();
|
||||
this.lblAmazonS3Endpoint = new System.Windows.Forms.Label();
|
||||
this.txtAmazonS3Endpoint = new System.Windows.Forms.TextBox();
|
||||
|
@ -650,9 +653,7 @@ private void InitializeComponent()
|
|||
this.lblWidthHint = new System.Windows.Forms.Label();
|
||||
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
|
||||
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
|
||||
this.cbAmazonS3StorageClass = new System.Windows.Forms.ComboBox();
|
||||
this.lblAmazonS3StorageClass = new System.Windows.Forms.Label();
|
||||
this.btnAmazonS3StorageClassHelp = new System.Windows.Forms.Button();
|
||||
this.btnPaste_eeGetUserKey = new System.Windows.Forms.Button();
|
||||
this.tpOtherUploaders.SuspendLayout();
|
||||
this.tcOtherUploaders.SuspendLayout();
|
||||
this.tpTwitter.SuspendLayout();
|
||||
|
@ -2594,6 +2595,26 @@ private void InitializeComponent()
|
|||
this.tpAmazonS3.Name = "tpAmazonS3";
|
||||
this.tpAmazonS3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnAmazonS3StorageClassHelp
|
||||
//
|
||||
resources.ApplyResources(this.btnAmazonS3StorageClassHelp, "btnAmazonS3StorageClassHelp");
|
||||
this.btnAmazonS3StorageClassHelp.Name = "btnAmazonS3StorageClassHelp";
|
||||
this.btnAmazonS3StorageClassHelp.UseVisualStyleBackColor = true;
|
||||
this.btnAmazonS3StorageClassHelp.Click += new System.EventHandler(this.btnAmazonS3StorageClassHelp_Click);
|
||||
//
|
||||
// lblAmazonS3StorageClass
|
||||
//
|
||||
resources.ApplyResources(this.lblAmazonS3StorageClass, "lblAmazonS3StorageClass");
|
||||
this.lblAmazonS3StorageClass.Name = "lblAmazonS3StorageClass";
|
||||
//
|
||||
// cbAmazonS3StorageClass
|
||||
//
|
||||
this.cbAmazonS3StorageClass.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbAmazonS3StorageClass.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.cbAmazonS3StorageClass, "cbAmazonS3StorageClass");
|
||||
this.cbAmazonS3StorageClass.Name = "cbAmazonS3StorageClass";
|
||||
this.cbAmazonS3StorageClass.SelectedIndexChanged += new System.EventHandler(this.cbAmazonS3StorageClass_SelectedIndexChanged);
|
||||
//
|
||||
// cbAmazonS3UsePathStyle
|
||||
//
|
||||
resources.ApplyResources(this.cbAmazonS3UsePathStyle, "cbAmazonS3UsePathStyle");
|
||||
|
@ -4478,6 +4499,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// tpPaste_ee
|
||||
//
|
||||
this.tpPaste_ee.Controls.Add(this.btnPaste_eeGetUserKey);
|
||||
this.tpPaste_ee.Controls.Add(this.lblPaste_eeUserAPIKey);
|
||||
this.tpPaste_ee.Controls.Add(this.txtPaste_eeUserAPIKey);
|
||||
resources.ApplyResources(this.tpPaste_ee, "tpPaste_ee");
|
||||
|
@ -5310,25 +5332,12 @@ private void InitializeComponent()
|
|||
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
|
||||
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
|
||||
//
|
||||
// cbAmazonS3StorageClass
|
||||
// btnPaste_eeGetUserKey
|
||||
//
|
||||
this.cbAmazonS3StorageClass.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbAmazonS3StorageClass.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.cbAmazonS3StorageClass, "cbAmazonS3StorageClass");
|
||||
this.cbAmazonS3StorageClass.Name = "cbAmazonS3StorageClass";
|
||||
this.cbAmazonS3StorageClass.SelectedIndexChanged += new System.EventHandler(this.cbAmazonS3StorageClass_SelectedIndexChanged);
|
||||
//
|
||||
// lblAmazonS3StorageClass
|
||||
//
|
||||
resources.ApplyResources(this.lblAmazonS3StorageClass, "lblAmazonS3StorageClass");
|
||||
this.lblAmazonS3StorageClass.Name = "lblAmazonS3StorageClass";
|
||||
//
|
||||
// btnAmazonS3StorageClassHelp
|
||||
//
|
||||
resources.ApplyResources(this.btnAmazonS3StorageClassHelp, "btnAmazonS3StorageClassHelp");
|
||||
this.btnAmazonS3StorageClassHelp.Name = "btnAmazonS3StorageClassHelp";
|
||||
this.btnAmazonS3StorageClassHelp.UseVisualStyleBackColor = true;
|
||||
this.btnAmazonS3StorageClassHelp.Click += new System.EventHandler(this.btnAmazonS3StorageClassHelp_Click);
|
||||
resources.ApplyResources(this.btnPaste_eeGetUserKey, "btnPaste_eeGetUserKey");
|
||||
this.btnPaste_eeGetUserKey.Name = "btnPaste_eeGetUserKey";
|
||||
this.btnPaste_eeGetUserKey.UseVisualStyleBackColor = true;
|
||||
this.btnPaste_eeGetUserKey.Click += new System.EventHandler(this.btnPaste_eeGetUserKey_Click);
|
||||
//
|
||||
// UploadersConfigForm
|
||||
//
|
||||
|
@ -6136,5 +6145,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Label lblAmazonS3StorageClass;
|
||||
private System.Windows.Forms.ComboBox cbAmazonS3StorageClass;
|
||||
private System.Windows.Forms.Button btnAmazonS3StorageClassHelp;
|
||||
private System.Windows.Forms.Button btnPaste_eeGetUserKey;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ public void LoadSettings()
|
|||
|
||||
// Paste.ee
|
||||
|
||||
txtPaste_eeUserAPIKey.Text = Config.Paste_eeUserAPIKey;
|
||||
txtPaste_eeUserAPIKey.Text = Config.Paste_eeUserKey;
|
||||
|
||||
// Gist
|
||||
|
||||
|
@ -1156,9 +1156,14 @@ private void cbPastebinRaw_CheckedChanged(object sender, EventArgs e)
|
|||
|
||||
#region Paste.ee
|
||||
|
||||
private void btnPaste_eeGetUserKey_Click(object sender, EventArgs e)
|
||||
{
|
||||
URLHelpers.OpenURL($"https://paste.ee/account/api/authorize/{APIKeys.Paste_eeApplicationKey}");
|
||||
}
|
||||
|
||||
private void txtPaste_eeUserAPIKey_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Config.Paste_eeUserAPIKey = txtPaste_eeUserAPIKey.Text;
|
||||
Config.Paste_eeUserKey = txtPaste_eeUserAPIKey.Text;
|
||||
}
|
||||
|
||||
#endregion Paste.ee
|
||||
|
|
|
@ -496,7 +496,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/
|
|||
</data>
|
||||
<data name="tpTwitter.Text" xml:space="preserve">
|
||||
<value>Twitter</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpTwitter.Name" xml:space="preserve">
|
||||
<value>tpTwitter</value>
|
||||
</data>
|
||||
|
@ -2782,7 +2782,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpBitly.Text" xml:space="preserve">
|
||||
<value>bit.ly</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpBitly.Name" xml:space="preserve">
|
||||
<value>tpBitly</value>
|
||||
</data>
|
||||
|
@ -2851,7 +2851,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpGoogleURLShortener.Text" xml:space="preserve">
|
||||
<value>Google</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpGoogleURLShortener.Name" xml:space="preserve">
|
||||
<value>tpGoogleURLShortener</value>
|
||||
</data>
|
||||
|
@ -3112,7 +3112,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpYourls.Text" xml:space="preserve">
|
||||
<value>YOURLS</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpYourls.Name" xml:space="preserve">
|
||||
<value>tpYourls</value>
|
||||
</data>
|
||||
|
@ -3271,7 +3271,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpAdFly.Text" xml:space="preserve">
|
||||
<value>adf.ly</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpAdFly.Name" xml:space="preserve">
|
||||
<value>tpAdFly</value>
|
||||
</data>
|
||||
|
@ -3346,7 +3346,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpCoinURL.Text" xml:space="preserve">
|
||||
<value>CoinURL</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpCoinURL.Name" xml:space="preserve">
|
||||
<value>tpCoinURL</value>
|
||||
</data>
|
||||
|
@ -3532,7 +3532,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpPolr.Text" xml:space="preserve">
|
||||
<value>Polr</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPolr.Name" xml:space="preserve">
|
||||
<value>tpPolr</value>
|
||||
</data>
|
||||
|
@ -5056,7 +5056,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpFTP.Text" xml:space="preserve">
|
||||
<value>FTP / FTPS / SFTP</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpFTP.Name" xml:space="preserve">
|
||||
<value>tpFTP</value>
|
||||
</data>
|
||||
|
@ -5355,7 +5355,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpDropbox.Text" xml:space="preserve">
|
||||
<value>Dropbox</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpDropbox.Name" xml:space="preserve">
|
||||
<value>tpDropbox</value>
|
||||
</data>
|
||||
|
@ -5487,7 +5487,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpOneDrive.Text" xml:space="preserve">
|
||||
<value>OneDrive</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpOneDrive.Name" xml:space="preserve">
|
||||
<value>tpOneDrive</value>
|
||||
</data>
|
||||
|
@ -5739,7 +5739,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpGoogleDrive.Text" xml:space="preserve">
|
||||
<value>Google Drive</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpGoogleDrive.Name" xml:space="preserve">
|
||||
<value>tpGoogleDrive</value>
|
||||
</data>
|
||||
|
@ -6003,7 +6003,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpPuush.Text" xml:space="preserve">
|
||||
<value>puush</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPuush.Name" xml:space="preserve">
|
||||
<value>tpPuush</value>
|
||||
</data>
|
||||
|
@ -6198,7 +6198,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpBox.Text" xml:space="preserve">
|
||||
<value>Box</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpBox.Name" xml:space="preserve">
|
||||
<value>tpBox</value>
|
||||
</data>
|
||||
|
@ -6819,7 +6819,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpAmazonS3.Text" xml:space="preserve">
|
||||
<value>Amazon S3</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpAmazonS3.Name" xml:space="preserve">
|
||||
<value>tpAmazonS3</value>
|
||||
</data>
|
||||
|
@ -7143,7 +7143,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpAzureStorage.Text" xml:space="preserve">
|
||||
<value>Azure Storage</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpAzureStorage.Name" xml:space="preserve">
|
||||
<value>tpAzureStorage</value>
|
||||
</data>
|
||||
|
@ -7242,7 +7242,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpGfycat.Text" xml:space="preserve">
|
||||
<value>Gfycat</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpGfycat.Name" xml:space="preserve">
|
||||
<value>tpGfycat</value>
|
||||
</data>
|
||||
|
@ -7560,7 +7560,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpMega.Text" xml:space="preserve">
|
||||
<value>Mega</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpMega.Name" xml:space="preserve">
|
||||
<value>tpMega</value>
|
||||
</data>
|
||||
|
@ -7911,7 +7911,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpOwnCloud.Text" xml:space="preserve">
|
||||
<value>ownCloud</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpOwnCloud.Name" xml:space="preserve">
|
||||
<value>tpOwnCloud</value>
|
||||
</data>
|
||||
|
@ -8121,7 +8121,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpMediaFire.Text" xml:space="preserve">
|
||||
<value>MediaFire</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpMediaFire.Name" xml:space="preserve">
|
||||
<value>tpMediaFire</value>
|
||||
</data>
|
||||
|
@ -8283,7 +8283,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpPushbullet.Text" xml:space="preserve">
|
||||
<value>Pushbullet</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPushbullet.Name" xml:space="preserve">
|
||||
<value>tpPushbullet</value>
|
||||
</data>
|
||||
|
@ -8460,7 +8460,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpSendSpace.Text" xml:space="preserve">
|
||||
<value>SendSpace</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpSendSpace.Name" xml:space="preserve">
|
||||
<value>tpSendSpace</value>
|
||||
</data>
|
||||
|
@ -8646,7 +8646,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpGe_tt.Text" xml:space="preserve">
|
||||
<value>Ge.tt</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpGe_tt.Name" xml:space="preserve">
|
||||
<value>tpGe_tt</value>
|
||||
</data>
|
||||
|
@ -8805,7 +8805,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpHostr.Text" xml:space="preserve">
|
||||
<value>Hostr</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpHostr.Name" xml:space="preserve">
|
||||
<value>tpHostr</value>
|
||||
</data>
|
||||
|
@ -9255,7 +9255,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpMinus.Text" xml:space="preserve">
|
||||
<value>Minus</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpMinus.Name" xml:space="preserve">
|
||||
<value>tpMinus</value>
|
||||
</data>
|
||||
|
@ -9462,7 +9462,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpJira.Text" xml:space="preserve">
|
||||
<value>Atlassian Jira</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpJira.Name" xml:space="preserve">
|
||||
<value>tpJira</value>
|
||||
</data>
|
||||
|
@ -9621,7 +9621,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpLambda.Text" xml:space="preserve">
|
||||
<value>Lambda</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpLambda.Name" xml:space="preserve">
|
||||
<value>tpLambda</value>
|
||||
</data>
|
||||
|
@ -9831,7 +9831,7 @@ store.book[0].title</value>
|
|||
</data>
|
||||
<data name="tpPomf.Text" xml:space="preserve">
|
||||
<value>Pomf</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPomf.Name" xml:space="preserve">
|
||||
<value>tpPomf</value>
|
||||
</data>
|
||||
|
@ -10792,7 +10792,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpSeafile.Text" xml:space="preserve">
|
||||
<value>Seafile</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpSeafile.Name" xml:space="preserve">
|
||||
<value>tpSeafile</value>
|
||||
</data>
|
||||
|
@ -10993,7 +10993,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpStreamable.Text" xml:space="preserve">
|
||||
<value>Streamable</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpStreamable.Name" xml:space="preserve">
|
||||
<value>tpStreamable</value>
|
||||
</data>
|
||||
|
@ -11101,7 +11101,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpSul.Text" xml:space="preserve">
|
||||
<value>s-ul</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpSul.Name" xml:space="preserve">
|
||||
<value>tpSul</value>
|
||||
</data>
|
||||
|
@ -11206,7 +11206,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpLithiio.Text" xml:space="preserve">
|
||||
<value>Lithiio</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpLithiio.Name" xml:space="preserve">
|
||||
<value>tpLithiio</value>
|
||||
</data>
|
||||
|
@ -11581,7 +11581,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpUplea.Text" xml:space="preserve">
|
||||
<value>Uplea</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpUplea.Name" xml:space="preserve">
|
||||
<value>tpUplea</value>
|
||||
</data>
|
||||
|
@ -12088,7 +12088,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpPlik.Text" xml:space="preserve">
|
||||
<value>Plik</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPlik.Name" xml:space="preserve">
|
||||
<value>tpPlik</value>
|
||||
</data>
|
||||
|
@ -13231,7 +13231,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpPastebin.Text" xml:space="preserve">
|
||||
<value>Pastebin</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPastebin.Name" xml:space="preserve">
|
||||
<value>tpPastebin</value>
|
||||
</data>
|
||||
|
@ -13244,6 +13244,30 @@ Using an encrypted library disables sharing.</value>
|
|||
<data name=">>tpPastebin.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="btnPaste_eeGetUserKey.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 16</value>
|
||||
</data>
|
||||
<data name="btnPaste_eeGetUserKey.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>296, 24</value>
|
||||
</data>
|
||||
<data name="btnPaste_eeGetUserKey.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="btnPaste_eeGetUserKey.Text" xml:space="preserve">
|
||||
<value>Get user key...</value>
|
||||
</data>
|
||||
<data name=">>btnPaste_eeGetUserKey.Name" xml:space="preserve">
|
||||
<value>btnPaste_eeGetUserKey</value>
|
||||
</data>
|
||||
<data name=">>btnPaste_eeGetUserKey.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>btnPaste_eeGetUserKey.Parent" xml:space="preserve">
|
||||
<value>tpPaste_ee</value>
|
||||
</data>
|
||||
<data name=">>btnPaste_eeGetUserKey.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="lblPaste_eeUserAPIKey.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
|
@ -13251,16 +13275,16 @@ Using an encrypted library disables sharing.</value>
|
|||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="lblPaste_eeUserAPIKey.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>13, 16</value>
|
||||
<value>13, 48</value>
|
||||
</data>
|
||||
<data name="lblPaste_eeUserAPIKey.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>72, 13</value>
|
||||
<value>52, 13</value>
|
||||
</data>
|
||||
<data name="lblPaste_eeUserAPIKey.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="lblPaste_eeUserAPIKey.Text" xml:space="preserve">
|
||||
<value>User API key:</value>
|
||||
<value>User key:</value>
|
||||
</data>
|
||||
<data name=">>lblPaste_eeUserAPIKey.Name" xml:space="preserve">
|
||||
<value>lblPaste_eeUserAPIKey</value>
|
||||
|
@ -13272,10 +13296,10 @@ Using an encrypted library disables sharing.</value>
|
|||
<value>tpPaste_ee</value>
|
||||
</data>
|
||||
<data name=">>lblPaste_eeUserAPIKey.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="txtPaste_eeUserAPIKey.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 32</value>
|
||||
<value>16, 64</value>
|
||||
</data>
|
||||
<data name="txtPaste_eeUserAPIKey.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>296, 20</value>
|
||||
|
@ -13293,7 +13317,7 @@ Using an encrypted library disables sharing.</value>
|
|||
<value>tpPaste_ee</value>
|
||||
</data>
|
||||
<data name=">>txtPaste_eeUserAPIKey.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="tpPaste_ee.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>4, 22</value>
|
||||
|
@ -13309,7 +13333,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpPaste_ee.Text" xml:space="preserve">
|
||||
<value>Paste.ee</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPaste_ee.Name" xml:space="preserve">
|
||||
<value>tpPaste_ee</value>
|
||||
</data>
|
||||
|
@ -13549,7 +13573,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpGist.Text" xml:space="preserve">
|
||||
<value>GitHub Gist</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpGist.Name" xml:space="preserve">
|
||||
<value>tpGist</value>
|
||||
</data>
|
||||
|
@ -13657,7 +13681,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpUpaste.Text" xml:space="preserve">
|
||||
<value>uPaste</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpUpaste.Name" xml:space="preserve">
|
||||
<value>tpUpaste</value>
|
||||
</data>
|
||||
|
@ -13816,7 +13840,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpHastebin.Text" xml:space="preserve">
|
||||
<value>Hastebin</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpHastebin.Name" xml:space="preserve">
|
||||
<value>tpHastebin</value>
|
||||
</data>
|
||||
|
@ -13945,7 +13969,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpOneTimeSecret.Text" xml:space="preserve">
|
||||
<value>OneTimeSecret</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpOneTimeSecret.Name" xml:space="preserve">
|
||||
<value>tpOneTimeSecret</value>
|
||||
</data>
|
||||
|
@ -14002,7 +14026,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpPastie.Text" xml:space="preserve">
|
||||
<value>Pastie</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPastie.Name" xml:space="preserve">
|
||||
<value>tpPastie</value>
|
||||
</data>
|
||||
|
@ -14359,7 +14383,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpImgur.Text" xml:space="preserve">
|
||||
<value>Imgur</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpImgur.Name" xml:space="preserve">
|
||||
<value>tpImgur</value>
|
||||
</data>
|
||||
|
@ -14599,7 +14623,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpImageShack.Text" xml:space="preserve">
|
||||
<value>ImageShack</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpImageShack.Name" xml:space="preserve">
|
||||
<value>tpImageShack</value>
|
||||
</data>
|
||||
|
@ -14803,7 +14827,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpTinyPic.Text" xml:space="preserve">
|
||||
<value>TinyPic</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpTinyPic.Name" xml:space="preserve">
|
||||
<value>tpTinyPic</value>
|
||||
</data>
|
||||
|
@ -14983,7 +15007,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpFlickr.Text" xml:space="preserve">
|
||||
<value>Flickr</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpFlickr.Name" xml:space="preserve">
|
||||
<value>tpFlickr</value>
|
||||
</data>
|
||||
|
@ -15475,7 +15499,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpPhotobucket.Text" xml:space="preserve">
|
||||
<value>Photobucket</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpPhotobucket.Name" xml:space="preserve">
|
||||
<value>tpPhotobucket</value>
|
||||
</data>
|
||||
|
@ -15643,7 +15667,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpGooglePhotos.Text" xml:space="preserve">
|
||||
<value>Google Photos</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpGooglePhotos.Name" xml:space="preserve">
|
||||
<value>tpGooglePhotos</value>
|
||||
</data>
|
||||
|
@ -15913,7 +15937,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpChevereto.Text" xml:space="preserve">
|
||||
<value>Chevereto</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpChevereto.Name" xml:space="preserve">
|
||||
<value>tpChevereto</value>
|
||||
</data>
|
||||
|
@ -16021,7 +16045,7 @@ Using an encrypted library disables sharing.</value>
|
|||
</data>
|
||||
<data name="tpVgyme.Text" xml:space="preserve">
|
||||
<value>vgy.me</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</data>
|
||||
<data name=">>tpVgyme.Name" xml:space="preserve">
|
||||
<value>tpVgyme</value>
|
||||
</data>
|
||||
|
|
|
@ -23,8 +23,10 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using ShareX.UploadersLib.Properties;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
@ -40,7 +42,18 @@ public class Paste_eeTextUploaderService : TextUploaderService
|
|||
|
||||
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo)
|
||||
{
|
||||
return new Paste_ee(config.Paste_eeUserAPIKey);
|
||||
string apiKey;
|
||||
|
||||
if (!string.IsNullOrEmpty(config.Paste_eeUserKey))
|
||||
{
|
||||
apiKey = config.Paste_eeUserKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
apiKey = APIKeys.Paste_eeApplicationKey;
|
||||
}
|
||||
|
||||
return new Paste_ee(apiKey);
|
||||
}
|
||||
|
||||
public override TabPage GetUploadersConfigTabPage(UploadersConfigForm form) => form.tpPaste_ee;
|
||||
|
@ -50,11 +63,6 @@ public sealed class Paste_ee : TextUploader
|
|||
{
|
||||
public string APIKey { get; private set; }
|
||||
|
||||
public Paste_ee()
|
||||
{
|
||||
APIKey = "public";
|
||||
}
|
||||
|
||||
public Paste_ee(string apiKey)
|
||||
{
|
||||
APIKey = apiKey;
|
||||
|
@ -62,35 +70,66 @@ public Paste_ee(string apiKey)
|
|||
|
||||
public override UploadResult UploadText(string text, string fileName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(APIKey))
|
||||
{
|
||||
throw new Exception("API key is missing.");
|
||||
}
|
||||
|
||||
UploadResult ur = new UploadResult();
|
||||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
if (string.IsNullOrEmpty(APIKey))
|
||||
Paste_eeSubmitRequestBody requestBody = new Paste_eeSubmitRequestBody()
|
||||
{
|
||||
APIKey = "public";
|
||||
}
|
||||
encrypted = false,
|
||||
description = "",
|
||||
sections = new Paste_eeSubmitRequestBodySection[]
|
||||
{
|
||||
new Paste_eeSubmitRequestBodySection()
|
||||
{
|
||||
name = "",
|
||||
//syntax = "autodetect",
|
||||
contents = text
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Dictionary<string, string> arguments = new Dictionary<string, string>();
|
||||
arguments.Add("key", APIKey);
|
||||
arguments.Add("description", "");
|
||||
arguments.Add("paste", text);
|
||||
arguments.Add("format", "simple");
|
||||
arguments.Add("return", "link");
|
||||
string json = JsonConvert.SerializeObject(requestBody);
|
||||
|
||||
ur.Response = SendRequestMultiPart("http://paste.ee/api", arguments);
|
||||
NameValueCollection headers = new NameValueCollection();
|
||||
headers.Add("X-Auth-Token", APIKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(ur.Response) && ur.Response.StartsWith("error"))
|
||||
ur.Response = SendRequest(HttpMethod.POST, "https://api.paste.ee/v1/pastes", json, ContentTypeJSON, null, headers);
|
||||
|
||||
if (!string.IsNullOrEmpty(ur.Response))
|
||||
{
|
||||
Errors.Add(ur.Response);
|
||||
}
|
||||
else
|
||||
{
|
||||
ur.URL = ur.Response;
|
||||
Paste_eeSubmitResponse response = JsonConvert.DeserializeObject<Paste_eeSubmitResponse>(ur.Response);
|
||||
|
||||
ur.URL = response.link;
|
||||
}
|
||||
}
|
||||
|
||||
return ur;
|
||||
}
|
||||
}
|
||||
|
||||
public class Paste_eeSubmitRequestBody
|
||||
{
|
||||
public bool encrypted { get; set; }
|
||||
public string description { get; set; }
|
||||
public Paste_eeSubmitRequestBodySection[] sections { get; set; }
|
||||
}
|
||||
|
||||
public class Paste_eeSubmitRequestBodySection
|
||||
{
|
||||
public string name { get; set; }
|
||||
//public string syntax { get; set; }
|
||||
public string contents { get; set; }
|
||||
}
|
||||
|
||||
public class Paste_eeSubmitResponse
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string link { get; set; }
|
||||
}
|
||||
}
|
|
@ -94,7 +94,7 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
|
|||
|
||||
// Paste.ee
|
||||
|
||||
public string Paste_eeUserAPIKey = "public";
|
||||
public string Paste_eeUserKey = "";
|
||||
|
||||
// Gist
|
||||
|
||||
|
|
Loading…
Reference in a new issue