Added ability to select Lambda link URL

This commit is contained in:
Marcus Stojcevich 2015-10-14 20:43:32 -07:00
parent 32ed439f35
commit f7cf93713e
4 changed files with 101 additions and 14 deletions

View file

@ -41,7 +41,8 @@ public Lambda(LambdaSettings config)
}
private const string uploadUrl = "https://lambda.sx/api/upload";
private const string responseUrl = "https://λ.pw/";
public static string[] UploadURLs = new string[] { "https://λ.pw/", "https://lambda.sx/" };
public override UploadResult Upload(Stream stream, string fileName)
{
@ -65,7 +66,7 @@ public override UploadResult Upload(Stream stream, string fileName)
if (result.IsSuccess)
{
result.URL = responseUrl + response.url;
result.URL = Config.UploadURL + response.url;
}
else
{
@ -93,5 +94,6 @@ internal class LambdaFile
public class LambdaSettings
{
public string UserAPIKey = string.Empty;
public string UploadURL = "https://λ.pw/";
}
}

View file

@ -295,6 +295,8 @@ private void InitializeComponent()
this.lblLambdaInfo = new System.Windows.Forms.Label();
this.lblLambdaApiKey = new System.Windows.Forms.Label();
this.txtLambdaApiKey = new System.Windows.Forms.TextBox();
this.lblLambdaUploadURL = new System.Windows.Forms.Label();
this.cbLambdaUploadURL = new System.Windows.Forms.ComboBox();
this.tpPomf = new System.Windows.Forms.TabPage();
this.txtPomfResultURL = new System.Windows.Forms.TextBox();
this.txtPomfUploadURL = new System.Windows.Forms.TextBox();
@ -308,6 +310,7 @@ private void InitializeComponent()
this.lblUp1Key = new System.Windows.Forms.Label();
this.lblUp1Host = new System.Windows.Forms.Label();
this.tpSeafile = new System.Windows.Forms.TabPage();
this.cbSeafileAPIURL = new System.Windows.Forms.ComboBox();
this.grpSeafileShareSettings = new System.Windows.Forms.GroupBox();
this.txtSeafileSharePassword = new System.Windows.Forms.TextBox();
this.lblSeafileSharePassword = new System.Windows.Forms.Label();
@ -486,7 +489,6 @@ private void InitializeComponent()
this.lblWidthHint = new System.Windows.Forms.Label();
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
this.cbSeafileAPIURL = new System.Windows.Forms.ComboBox();
this.tpOtherUploaders.SuspendLayout();
this.tcOtherUploaders.SuspendLayout();
this.tpTwitter.SuspendLayout();
@ -2471,6 +2473,8 @@ private void InitializeComponent()
this.tpLambda.Controls.Add(this.lblLambdaInfo);
this.tpLambda.Controls.Add(this.lblLambdaApiKey);
this.tpLambda.Controls.Add(this.txtLambdaApiKey);
this.tpLambda.Controls.Add(this.lblLambdaUploadURL);
this.tpLambda.Controls.Add(this.cbLambdaUploadURL);
resources.ApplyResources(this.tpLambda, "tpLambda");
this.tpLambda.Name = "tpLambda";
this.tpLambda.UseVisualStyleBackColor = true;
@ -2493,6 +2497,19 @@ private void InitializeComponent()
this.txtLambdaApiKey.UseSystemPasswordChar = true;
this.txtLambdaApiKey.TextChanged += new System.EventHandler(this.txtLambdaApiKey_TextChanged);
//
// lblLambdaUploadURL
//
resources.ApplyResources(this.lblLambdaUploadURL, "lblLambdaUploadURL");
this.lblLambdaUploadURL.Name = "lblLambdaUploadURL";
//
// cbLambdaUploadURL
//
this.cbLambdaUploadURL.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbLambdaUploadURL.FormattingEnabled = true;
resources.ApplyResources(this.cbLambdaUploadURL, "cbLambdaUploadURL");
this.cbLambdaUploadURL.Name = "cbLambdaUploadURL";
this.cbLambdaUploadURL.SelectedIndexChanged += new System.EventHandler(this.cbLambdaUploadURL_SelectedIndexChanged);
//
// tpPomf
//
this.tpPomf.Controls.Add(this.txtPomfResultURL);
@ -2599,6 +2616,16 @@ private void InitializeComponent()
this.tpSeafile.Name = "tpSeafile";
this.tpSeafile.UseVisualStyleBackColor = true;
//
// cbSeafileAPIURL
//
this.cbSeafileAPIURL.FormattingEnabled = true;
this.cbSeafileAPIURL.Items.AddRange(new object[] {
resources.GetString("cbSeafileAPIURL.Items"),
resources.GetString("cbSeafileAPIURL.Items1")});
resources.ApplyResources(this.cbSeafileAPIURL, "cbSeafileAPIURL");
this.cbSeafileAPIURL.Name = "cbSeafileAPIURL";
this.cbSeafileAPIURL.TextChanged += new System.EventHandler(this.cbSeafileAPIURL_TextChanged);
//
// grpSeafileShareSettings
//
this.grpSeafileShareSettings.Controls.Add(this.txtSeafileSharePassword);
@ -3875,16 +3902,6 @@ private void InitializeComponent()
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
//
// cbSeafileAPIURL
//
this.cbSeafileAPIURL.FormattingEnabled = true;
this.cbSeafileAPIURL.Items.AddRange(new object[] {
resources.GetString("cbSeafileAPIURL.Items"),
resources.GetString("cbSeafileAPIURL.Items1")});
resources.ApplyResources(this.cbSeafileAPIURL, "cbSeafileAPIURL");
this.cbSeafileAPIURL.Name = "cbSeafileAPIURL";
this.cbSeafileAPIURL.TextChanged += new System.EventHandler(this.cbSeafileAPIURL_TextChanged);
//
// UploadersConfigForm
//
resources.ApplyResources(this, "$this");
@ -4404,6 +4421,8 @@ private void InitializeComponent()
private System.Windows.Forms.Label lblLambdaApiKey;
private System.Windows.Forms.TextBox txtLambdaApiKey;
private System.Windows.Forms.Label lblLambdaInfo;
private System.Windows.Forms.Label lblLambdaUploadURL;
private System.Windows.Forms.ComboBox cbLambdaUploadURL;
private OAuthControl oauthTwitter;
private System.Windows.Forms.TextBox txtTwitterDescription;
private System.Windows.Forms.Label lblTwitterDescription;

View file

@ -551,6 +551,8 @@ public void LoadSettings()
// Lambda
txtLambdaApiKey.Text = Config.LambdaSettings.UserAPIKey;
cbLambdaUploadURL.Items.AddRange(Lambda.UploadURLs);
cbLambdaUploadURL.SelectedItem = Config.LambdaSettings.UploadURL;
// Pomf
@ -2030,6 +2032,19 @@ private void txtLambdaApiKey_TextChanged(object sender, EventArgs e)
Config.LambdaSettings.UserAPIKey = txtLambdaApiKey.Text;
}
private void cbLambdaUploadURL_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbLambdaUploadURL.SelectedIndex > -1)
{
string url = cbLambdaUploadURL.SelectedItem as string;
if (url != null)
{
Config.LambdaSettings.UploadURL = url;
}
}
}
#endregion Lambda
#region Pomf

View file

@ -6940,7 +6940,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/
<value>13, 16</value>
</data>
<data name="lblLambdaInfo.Size" type="System.Drawing.Size, System.Drawing">
<value>496, 13</value>
<value>554, 13</value>
</data>
<data name="lblLambdaInfo.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
@ -7011,6 +7011,57 @@ For example, if your bucket is called bucket.example.com then URL will be http:/
<data name="&gt;&gt;txtLambdaApiKey.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="lblLambdaUploadURL.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblLambdaUploadURL.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="lblLambdaUploadURL.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 86</value>
</data>
<data name="lblLambdaUploadURL.Size" type="System.Drawing.Size, System.Drawing">
<value>55, 13</value>
</data>
<data name="lblLambdaUploadURL.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="lblLambdaUploadURL.Text" xml:space="preserve">
<value>Link URL:</value>
</data>
<data name="&gt;&gt;lblLambdaUploadURL.Name" xml:space="preserve">
<value>lblLambdaUploadURL</value>
</data>
<data name="&gt;&gt;lblLambdaUploadURL.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblLambdaUploadURL.Parent" xml:space="preserve">
<value>tpLambda</value>
</data>
<data name="&gt;&gt;lblLambdaUploadURL.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="cbLambdaUploadURL.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 102</value>
</data>
<data name="cbLambdaUploadURL.Size" type="System.Drawing.Size, System.Drawing">
<value>216, 21</value>
</data>
<data name="cbLambdaUploadURL.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;cbLambdaUploadURL.Name" xml:space="preserve">
<value>cbLambdaUploadURL</value>
</data>
<data name="&gt;&gt;cbLambdaUploadURL.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cbLambdaUploadURL.Parent" xml:space="preserve">
<value>tpLambda</value>
</data>
<data name="&gt;&gt;cbLambdaUploadURL.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="tpLambda.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 40</value>
</data>