mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Amazon S3 renamings
This commit is contained in:
parent
47a14a6ff9
commit
f7236c27f5
7 changed files with 646 additions and 807 deletions
|
@ -45,7 +45,7 @@ public class AmazonS3NewFileUploaderService : FileUploaderService
|
||||||
public override bool CheckConfig(UploadersConfig config)
|
public override bool CheckConfig(UploadersConfig config)
|
||||||
{
|
{
|
||||||
return config.AmazonS3Settings != null && !string.IsNullOrEmpty(config.AmazonS3Settings.AccessKeyID) &&
|
return config.AmazonS3Settings != null && !string.IsNullOrEmpty(config.AmazonS3Settings.AccessKeyID) &&
|
||||||
!string.IsNullOrEmpty(config.AmazonS3Settings.SecretAccessKey) && !string.IsNullOrEmpty(config.AmazonS3Settings.RegionHostname) &&
|
!string.IsNullOrEmpty(config.AmazonS3Settings.SecretAccessKey) && !string.IsNullOrEmpty(config.AmazonS3Settings.Endpoint) &&
|
||||||
!string.IsNullOrEmpty(config.AmazonS3Settings.Bucket);
|
!string.IsNullOrEmpty(config.AmazonS3Settings.Bucket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public sealed class AmazonS3 : FileUploader
|
||||||
{
|
{
|
||||||
private const string DefaultRegion = "us-east-1";
|
private const string DefaultRegion = "us-east-1";
|
||||||
|
|
||||||
public static List<AmazonS3Region> Regions { get; } = new List<AmazonS3Region>()
|
public static List<AmazonS3Region> Endpoints { get; } = new List<AmazonS3Region>()
|
||||||
{
|
{
|
||||||
new AmazonS3Region("Asia Pacific (Tokyo)", "s3-ap-northeast-1.amazonaws.com", "ap-northeast-1"),
|
new AmazonS3Region("Asia Pacific (Tokyo)", "s3-ap-northeast-1.amazonaws.com", "ap-northeast-1"),
|
||||||
new AmazonS3Region("Asia Pacific (Seoul)", "s3.ap-northeast-2.amazonaws.com", "ap-northeast-2"),
|
new AmazonS3Region("Asia Pacific (Seoul)", "s3.ap-northeast-2.amazonaws.com", "ap-northeast-2"),
|
||||||
|
@ -91,13 +91,13 @@ public AmazonS3(AmazonS3Settings settings)
|
||||||
|
|
||||||
public override UploadResult Upload(Stream stream, string fileName)
|
public override UploadResult Upload(Stream stream, string fileName)
|
||||||
{
|
{
|
||||||
string hostname = URLHelpers.RemovePrefixes(Settings.RegionHostname);
|
string endpoint = URLHelpers.RemovePrefixes(Settings.Endpoint);
|
||||||
string host = $"{Settings.Bucket}.{hostname}";
|
string host = $"{Settings.Bucket}.{endpoint}";
|
||||||
string algorithm = "AWS4-HMAC-SHA256";
|
string algorithm = "AWS4-HMAC-SHA256";
|
||||||
string credentialDate = DateTime.UtcNow.ToString("yyyyMMdd", CultureInfo.InvariantCulture);
|
string credentialDate = DateTime.UtcNow.ToString("yyyyMMdd", CultureInfo.InvariantCulture);
|
||||||
string identifier = GetIdentifier();
|
string region = GetRegion();
|
||||||
string scope = $"{credentialDate}/{identifier}/s3/aws4_request";
|
string scope = URLHelpers.CombineURL(credentialDate, region, "s3", "aws4_request");
|
||||||
string credential = $"{Settings.AccessKeyID}/{scope}";
|
string credential = URLHelpers.CombineURL(Settings.AccessKeyID, scope);
|
||||||
string longDate = DateTime.UtcNow.ToString("yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture);
|
string longDate = DateTime.UtcNow.ToString("yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture);
|
||||||
string expiresTotalSeconds = ((long)TimeSpan.FromHours(1).TotalSeconds).ToString();
|
string expiresTotalSeconds = ((long)TimeSpan.FromHours(1).TotalSeconds).ToString();
|
||||||
string contentType = Helpers.GetMimeType(fileName);
|
string contentType = Helpers.GetMimeType(fileName);
|
||||||
|
@ -137,7 +137,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
||||||
Helpers.BytesToHex(Helpers.ComputeSHA256(canonicalRequest));
|
Helpers.BytesToHex(Helpers.ComputeSHA256(canonicalRequest));
|
||||||
|
|
||||||
byte[] dateKey = Helpers.ComputeHMACSHA256(credentialDate, "AWS4" + Settings.SecretAccessKey);
|
byte[] dateKey = Helpers.ComputeHMACSHA256(credentialDate, "AWS4" + Settings.SecretAccessKey);
|
||||||
byte[] dateRegionKey = Helpers.ComputeHMACSHA256(identifier, dateKey);
|
byte[] dateRegionKey = Helpers.ComputeHMACSHA256(region, dateKey);
|
||||||
byte[] dateRegionServiceKey = Helpers.ComputeHMACSHA256("s3", dateRegionKey);
|
byte[] dateRegionServiceKey = Helpers.ComputeHMACSHA256("s3", dateRegionKey);
|
||||||
byte[] signingKey = Helpers.ComputeHMACSHA256("aws4_request", dateRegionServiceKey);
|
byte[] signingKey = Helpers.ComputeHMACSHA256("aws4_request", dateRegionServiceKey);
|
||||||
string signature = Helpers.BytesToHex(Helpers.ComputeHMACSHA256(stringToSign, signingKey));
|
string signature = Helpers.BytesToHex(Helpers.ComputeHMACSHA256(stringToSign, signingKey));
|
||||||
|
@ -172,14 +172,14 @@ public override UploadResult Upload(Stream stream, string fileName)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetIdentifier()
|
private string GetRegion()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Settings.RegionIdentifier))
|
if (!string.IsNullOrEmpty(Settings.Region))
|
||||||
{
|
{
|
||||||
return Settings.RegionIdentifier;
|
return Settings.Region;
|
||||||
}
|
}
|
||||||
|
|
||||||
string url = Settings.RegionHostname;
|
string url = Settings.Endpoint;
|
||||||
|
|
||||||
int delimIndex = url.IndexOf("//", StringComparison.Ordinal);
|
int delimIndex = url.IndexOf("//", StringComparison.Ordinal);
|
||||||
if (delimIndex >= 0)
|
if (delimIndex >= 0)
|
||||||
|
@ -199,7 +199,6 @@ private string GetIdentifier()
|
||||||
}
|
}
|
||||||
|
|
||||||
string serviceAndRegion = url.Substring(0, awsIndex);
|
string serviceAndRegion = url.Substring(0, awsIndex);
|
||||||
|
|
||||||
if (serviceAndRegion.StartsWith("s3-", StringComparison.Ordinal))
|
if (serviceAndRegion.StartsWith("s3-", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
serviceAndRegion = "s3." + serviceAndRegion.Substring(3);
|
serviceAndRegion = "s3." + serviceAndRegion.Substring(3);
|
||||||
|
@ -222,7 +221,7 @@ private string GetUploadPath(string fileName)
|
||||||
|
|
||||||
public string GenerateURL(string fileName)
|
public string GenerateURL(string fileName)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Settings.RegionHostname) && !string.IsNullOrEmpty(Settings.Bucket))
|
if (!string.IsNullOrEmpty(Settings.Endpoint) && !string.IsNullOrEmpty(Settings.Bucket))
|
||||||
{
|
{
|
||||||
string uploadPath = GetUploadPath(fileName);
|
string uploadPath = GetUploadPath(fileName);
|
||||||
|
|
||||||
|
@ -234,7 +233,7 @@ public string GenerateURL(string fileName)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
url = URLHelpers.CombineURL(Settings.RegionHostname, Settings.Bucket, uploadPath);
|
url = URLHelpers.CombineURL(Settings.Endpoint, Settings.Bucket, uploadPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return URLHelpers.FixPrefix(url, "https://");
|
return URLHelpers.FixPrefix(url, "https://");
|
||||||
|
|
|
@ -28,25 +28,25 @@ namespace ShareX.UploadersLib.FileUploaders
|
||||||
public class AmazonS3Region
|
public class AmazonS3Region
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Hostname { get; set; }
|
public string Endpoint { get; set; }
|
||||||
public string Identifier { get; set; }
|
public string Region { get; set; }
|
||||||
|
|
||||||
public AmazonS3Region(string name, string hostname)
|
public AmazonS3Region(string name, string endpoint)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Hostname = hostname;
|
Endpoint = endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmazonS3Region(string name, string hostname, string identifier)
|
public AmazonS3Region(string name, string endpoint, string region)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Hostname = hostname;
|
Endpoint = endpoint;
|
||||||
Identifier = identifier;
|
Region = region;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"{Name} [{Hostname}]";
|
return $"{Name} [{Endpoint}]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,15 +29,12 @@ public class AmazonS3Settings
|
||||||
{
|
{
|
||||||
public string AccessKeyID { get; set; }
|
public string AccessKeyID { get; set; }
|
||||||
public string SecretAccessKey { get; set; }
|
public string SecretAccessKey { get; set; }
|
||||||
public string RegionHostname { get; set; }
|
public string Endpoint { get; set; }
|
||||||
public string RegionIdentifier { get; set; }
|
public string Region { get; set; }
|
||||||
public string Bucket { get; set; }
|
public string Bucket { get; set; }
|
||||||
public string ObjectPrefix { get; set; }
|
public string ObjectPrefix { get; set; }
|
||||||
public bool UseCustomCNAME { get; set; }
|
public bool UseCustomCNAME { get; set; }
|
||||||
public string CustomDomain { get; set; }
|
public string CustomDomain { get; set; }
|
||||||
public bool UseReducedRedundancyStorage { get; set; }
|
public bool UseReducedRedundancyStorage { get; set; }
|
||||||
|
|
||||||
// TEMP: For backward compatibility
|
|
||||||
public string Endpoint { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -180,6 +180,7 @@ private void InitializeComponent()
|
||||||
this.cboFtpText = new System.Windows.Forms.ComboBox();
|
this.cboFtpText = new System.Windows.Forms.ComboBox();
|
||||||
this.ucFTPAccounts = new ShareX.UploadersLib.AccountsControl();
|
this.ucFTPAccounts = new ShareX.UploadersLib.AccountsControl();
|
||||||
this.tpDropbox = new System.Windows.Forms.TabPage();
|
this.tpDropbox = new System.Windows.Forms.TabPage();
|
||||||
|
this.cbDropboxUseDirectLink = new System.Windows.Forms.CheckBox();
|
||||||
this.oauth2Dropbox = new ShareX.UploadersLib.OAuthControl();
|
this.oauth2Dropbox = new ShareX.UploadersLib.OAuthControl();
|
||||||
this.cbDropboxAutoCreateShareableLink = new System.Windows.Forms.CheckBox();
|
this.cbDropboxAutoCreateShareableLink = new System.Windows.Forms.CheckBox();
|
||||||
this.pbDropboxLogo = new System.Windows.Forms.PictureBox();
|
this.pbDropboxLogo = new System.Windows.Forms.PictureBox();
|
||||||
|
@ -221,19 +222,19 @@ private void InitializeComponent()
|
||||||
this.btnBoxRefreshFolders = new System.Windows.Forms.Button();
|
this.btnBoxRefreshFolders = new System.Windows.Forms.Button();
|
||||||
this.oauth2Box = new ShareX.UploadersLib.OAuthControl();
|
this.oauth2Box = new ShareX.UploadersLib.OAuthControl();
|
||||||
this.tpAmazonS3 = new System.Windows.Forms.TabPage();
|
this.tpAmazonS3 = new System.Windows.Forms.TabPage();
|
||||||
this.lblAmazonS3Hostname = new System.Windows.Forms.Label();
|
this.lblAmazonS3Endpoint = new System.Windows.Forms.Label();
|
||||||
this.txtAmazonS3Hostname = new System.Windows.Forms.TextBox();
|
this.txtAmazonS3Endpoint = new System.Windows.Forms.TextBox();
|
||||||
this.lblAmazonS3Identifier = new System.Windows.Forms.Label();
|
this.lblAmazonS3Region = new System.Windows.Forms.Label();
|
||||||
this.txtAmazonS3Identifier = new System.Windows.Forms.TextBox();
|
this.txtAmazonS3Region = new System.Windows.Forms.TextBox();
|
||||||
this.txtAmazonS3CustomDomain = new System.Windows.Forms.TextBox();
|
this.txtAmazonS3CustomDomain = new System.Windows.Forms.TextBox();
|
||||||
this.lblAmazonS3PathPreviewLabel = new System.Windows.Forms.Label();
|
this.lblAmazonS3PathPreviewLabel = new System.Windows.Forms.Label();
|
||||||
this.lblAmazonS3PathPreview = new System.Windows.Forms.Label();
|
this.lblAmazonS3PathPreview = new System.Windows.Forms.Label();
|
||||||
this.btnAmazonS3BucketNameOpen = new System.Windows.Forms.Button();
|
this.btnAmazonS3BucketNameOpen = new System.Windows.Forms.Button();
|
||||||
this.btnAmazonS3AccessKeyOpen = new System.Windows.Forms.Button();
|
this.btnAmazonS3AccessKeyOpen = new System.Windows.Forms.Button();
|
||||||
this.cbAmazonS3Endpoint = new System.Windows.Forms.ComboBox();
|
this.cbAmazonS3Endpoints = new System.Windows.Forms.ComboBox();
|
||||||
this.lblAmazonS3BucketName = new System.Windows.Forms.Label();
|
this.lblAmazonS3BucketName = new System.Windows.Forms.Label();
|
||||||
this.txtAmazonS3BucketName = new System.Windows.Forms.TextBox();
|
this.txtAmazonS3BucketName = new System.Windows.Forms.TextBox();
|
||||||
this.lblAmazonS3Regions = new System.Windows.Forms.Label();
|
this.lblAmazonS3Endpoints = new System.Windows.Forms.Label();
|
||||||
this.txtAmazonS3ObjectPrefix = new System.Windows.Forms.TextBox();
|
this.txtAmazonS3ObjectPrefix = new System.Windows.Forms.TextBox();
|
||||||
this.lblAmazonS3ObjectPrefix = new System.Windows.Forms.Label();
|
this.lblAmazonS3ObjectPrefix = new System.Windows.Forms.Label();
|
||||||
this.txtAmazonS3SecretKey = new System.Windows.Forms.TextBox();
|
this.txtAmazonS3SecretKey = new System.Windows.Forms.TextBox();
|
||||||
|
@ -597,7 +598,6 @@ private void InitializeComponent()
|
||||||
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
|
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
|
||||||
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
|
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
|
||||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.cbDropboxUseDirectLink = new System.Windows.Forms.CheckBox();
|
|
||||||
this.tpOtherUploaders.SuspendLayout();
|
this.tpOtherUploaders.SuspendLayout();
|
||||||
this.tcOtherUploaders.SuspendLayout();
|
this.tcOtherUploaders.SuspendLayout();
|
||||||
this.tpTwitter.SuspendLayout();
|
this.tpTwitter.SuspendLayout();
|
||||||
|
@ -1828,6 +1828,13 @@ private void InitializeComponent()
|
||||||
this.tpDropbox.Name = "tpDropbox";
|
this.tpDropbox.Name = "tpDropbox";
|
||||||
this.tpDropbox.UseVisualStyleBackColor = true;
|
this.tpDropbox.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// cbDropboxUseDirectLink
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.cbDropboxUseDirectLink, "cbDropboxUseDirectLink");
|
||||||
|
this.cbDropboxUseDirectLink.Name = "cbDropboxUseDirectLink";
|
||||||
|
this.cbDropboxUseDirectLink.UseVisualStyleBackColor = true;
|
||||||
|
this.cbDropboxUseDirectLink.CheckedChanged += new System.EventHandler(this.cbDropboxUseDirectLink_CheckedChanged);
|
||||||
|
//
|
||||||
// oauth2Dropbox
|
// oauth2Dropbox
|
||||||
//
|
//
|
||||||
this.oauth2Dropbox.IsRefreshable = false;
|
this.oauth2Dropbox.IsRefreshable = false;
|
||||||
|
@ -2128,20 +2135,20 @@ private void InitializeComponent()
|
||||||
//
|
//
|
||||||
// tpAmazonS3
|
// tpAmazonS3
|
||||||
//
|
//
|
||||||
this.tpAmazonS3.Controls.Add(this.lblAmazonS3Hostname);
|
this.tpAmazonS3.Controls.Add(this.lblAmazonS3Endpoint);
|
||||||
this.tpAmazonS3.Controls.Add(this.txtAmazonS3Hostname);
|
this.tpAmazonS3.Controls.Add(this.txtAmazonS3Endpoint);
|
||||||
this.tpAmazonS3.Controls.Add(this.lblAmazonS3Identifier);
|
this.tpAmazonS3.Controls.Add(this.lblAmazonS3Region);
|
||||||
this.tpAmazonS3.Controls.Add(this.txtAmazonS3Identifier);
|
this.tpAmazonS3.Controls.Add(this.txtAmazonS3Region);
|
||||||
this.tpAmazonS3.Controls.Add(this.txtAmazonS3CustomDomain);
|
this.tpAmazonS3.Controls.Add(this.txtAmazonS3CustomDomain);
|
||||||
this.tpAmazonS3.Controls.Add(this.lblAmazonS3PathPreviewLabel);
|
this.tpAmazonS3.Controls.Add(this.lblAmazonS3PathPreviewLabel);
|
||||||
this.tpAmazonS3.Controls.Add(this.lblAmazonS3PathPreview);
|
this.tpAmazonS3.Controls.Add(this.lblAmazonS3PathPreview);
|
||||||
this.tpAmazonS3.Controls.Add(this.btnAmazonS3BucketNameOpen);
|
this.tpAmazonS3.Controls.Add(this.btnAmazonS3BucketNameOpen);
|
||||||
this.tpAmazonS3.Controls.Add(this.btnAmazonS3AccessKeyOpen);
|
this.tpAmazonS3.Controls.Add(this.btnAmazonS3AccessKeyOpen);
|
||||||
this.tpAmazonS3.Controls.Add(this.cbAmazonS3CustomCNAME);
|
this.tpAmazonS3.Controls.Add(this.cbAmazonS3CustomCNAME);
|
||||||
this.tpAmazonS3.Controls.Add(this.cbAmazonS3Endpoint);
|
this.tpAmazonS3.Controls.Add(this.cbAmazonS3Endpoints);
|
||||||
this.tpAmazonS3.Controls.Add(this.lblAmazonS3BucketName);
|
this.tpAmazonS3.Controls.Add(this.lblAmazonS3BucketName);
|
||||||
this.tpAmazonS3.Controls.Add(this.txtAmazonS3BucketName);
|
this.tpAmazonS3.Controls.Add(this.txtAmazonS3BucketName);
|
||||||
this.tpAmazonS3.Controls.Add(this.lblAmazonS3Regions);
|
this.tpAmazonS3.Controls.Add(this.lblAmazonS3Endpoints);
|
||||||
this.tpAmazonS3.Controls.Add(this.txtAmazonS3ObjectPrefix);
|
this.tpAmazonS3.Controls.Add(this.txtAmazonS3ObjectPrefix);
|
||||||
this.tpAmazonS3.Controls.Add(this.lblAmazonS3ObjectPrefix);
|
this.tpAmazonS3.Controls.Add(this.lblAmazonS3ObjectPrefix);
|
||||||
this.tpAmazonS3.Controls.Add(this.cbAmazonS3UseRRS);
|
this.tpAmazonS3.Controls.Add(this.cbAmazonS3UseRRS);
|
||||||
|
@ -2153,27 +2160,27 @@ private void InitializeComponent()
|
||||||
this.tpAmazonS3.Name = "tpAmazonS3";
|
this.tpAmazonS3.Name = "tpAmazonS3";
|
||||||
this.tpAmazonS3.UseVisualStyleBackColor = true;
|
this.tpAmazonS3.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// lblAmazonS3Hostname
|
// lblAmazonS3Endpoint
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.lblAmazonS3Hostname, "lblAmazonS3Hostname");
|
resources.ApplyResources(this.lblAmazonS3Endpoint, "lblAmazonS3Endpoint");
|
||||||
this.lblAmazonS3Hostname.Name = "lblAmazonS3Hostname";
|
this.lblAmazonS3Endpoint.Name = "lblAmazonS3Endpoint";
|
||||||
//
|
//
|
||||||
// txtAmazonS3Hostname
|
// txtAmazonS3Endpoint
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.txtAmazonS3Hostname, "txtAmazonS3Hostname");
|
resources.ApplyResources(this.txtAmazonS3Endpoint, "txtAmazonS3Endpoint");
|
||||||
this.txtAmazonS3Hostname.Name = "txtAmazonS3Hostname";
|
this.txtAmazonS3Endpoint.Name = "txtAmazonS3Endpoint";
|
||||||
this.txtAmazonS3Hostname.TextChanged += new System.EventHandler(this.txtAmazonS3Hostname_TextChanged);
|
this.txtAmazonS3Endpoint.TextChanged += new System.EventHandler(this.txtAmazonS3Endpoint_TextChanged);
|
||||||
//
|
//
|
||||||
// lblAmazonS3Identifier
|
// lblAmazonS3Region
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.lblAmazonS3Identifier, "lblAmazonS3Identifier");
|
resources.ApplyResources(this.lblAmazonS3Region, "lblAmazonS3Region");
|
||||||
this.lblAmazonS3Identifier.Name = "lblAmazonS3Identifier";
|
this.lblAmazonS3Region.Name = "lblAmazonS3Region";
|
||||||
//
|
//
|
||||||
// txtAmazonS3Identifier
|
// txtAmazonS3Region
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.txtAmazonS3Identifier, "txtAmazonS3Identifier");
|
resources.ApplyResources(this.txtAmazonS3Region, "txtAmazonS3Region");
|
||||||
this.txtAmazonS3Identifier.Name = "txtAmazonS3Identifier";
|
this.txtAmazonS3Region.Name = "txtAmazonS3Region";
|
||||||
this.txtAmazonS3Identifier.TextChanged += new System.EventHandler(this.txtAmazonS3Identifier_TextChanged);
|
this.txtAmazonS3Region.TextChanged += new System.EventHandler(this.txtAmazonS3Region_TextChanged);
|
||||||
//
|
//
|
||||||
// txtAmazonS3CustomDomain
|
// txtAmazonS3CustomDomain
|
||||||
//
|
//
|
||||||
|
@ -2205,13 +2212,13 @@ private void InitializeComponent()
|
||||||
this.btnAmazonS3AccessKeyOpen.UseVisualStyleBackColor = true;
|
this.btnAmazonS3AccessKeyOpen.UseVisualStyleBackColor = true;
|
||||||
this.btnAmazonS3AccessKeyOpen.Click += new System.EventHandler(this.btnAmazonS3AccessKeyOpen_Click);
|
this.btnAmazonS3AccessKeyOpen.Click += new System.EventHandler(this.btnAmazonS3AccessKeyOpen_Click);
|
||||||
//
|
//
|
||||||
// cbAmazonS3Endpoint
|
// cbAmazonS3Endpoints
|
||||||
//
|
//
|
||||||
this.cbAmazonS3Endpoint.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.cbAmazonS3Endpoints.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.cbAmazonS3Endpoint.FormattingEnabled = true;
|
this.cbAmazonS3Endpoints.FormattingEnabled = true;
|
||||||
resources.ApplyResources(this.cbAmazonS3Endpoint, "cbAmazonS3Endpoint");
|
resources.ApplyResources(this.cbAmazonS3Endpoints, "cbAmazonS3Endpoints");
|
||||||
this.cbAmazonS3Endpoint.Name = "cbAmazonS3Endpoint";
|
this.cbAmazonS3Endpoints.Name = "cbAmazonS3Endpoints";
|
||||||
this.cbAmazonS3Endpoint.SelectedIndexChanged += new System.EventHandler(this.cbAmazonS3Endpoint_SelectedIndexChanged);
|
this.cbAmazonS3Endpoints.SelectedIndexChanged += new System.EventHandler(this.cbAmazonS3Endpoints_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// lblAmazonS3BucketName
|
// lblAmazonS3BucketName
|
||||||
//
|
//
|
||||||
|
@ -2224,10 +2231,10 @@ private void InitializeComponent()
|
||||||
this.txtAmazonS3BucketName.Name = "txtAmazonS3BucketName";
|
this.txtAmazonS3BucketName.Name = "txtAmazonS3BucketName";
|
||||||
this.txtAmazonS3BucketName.TextChanged += new System.EventHandler(this.txtAmazonS3BucketName_TextChanged);
|
this.txtAmazonS3BucketName.TextChanged += new System.EventHandler(this.txtAmazonS3BucketName_TextChanged);
|
||||||
//
|
//
|
||||||
// lblAmazonS3Regions
|
// lblAmazonS3Endpoints
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.lblAmazonS3Regions, "lblAmazonS3Regions");
|
resources.ApplyResources(this.lblAmazonS3Endpoints, "lblAmazonS3Endpoints");
|
||||||
this.lblAmazonS3Regions.Name = "lblAmazonS3Regions";
|
this.lblAmazonS3Endpoints.Name = "lblAmazonS3Endpoints";
|
||||||
//
|
//
|
||||||
// txtAmazonS3ObjectPrefix
|
// txtAmazonS3ObjectPrefix
|
||||||
//
|
//
|
||||||
|
@ -4812,13 +4819,6 @@ private void InitializeComponent()
|
||||||
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
|
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
|
||||||
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
|
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
|
||||||
//
|
//
|
||||||
// cbDropboxUseDirectLink
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.cbDropboxUseDirectLink, "cbDropboxUseDirectLink");
|
|
||||||
this.cbDropboxUseDirectLink.Name = "cbDropboxUseDirectLink";
|
|
||||||
this.cbDropboxUseDirectLink.UseVisualStyleBackColor = true;
|
|
||||||
this.cbDropboxUseDirectLink.CheckedChanged += new System.EventHandler(this.cbDropboxUseDirectLink_CheckedChanged);
|
|
||||||
//
|
|
||||||
// UploadersConfigForm
|
// UploadersConfigForm
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
|
@ -5094,10 +5094,10 @@ private void InitializeComponent()
|
||||||
private System.Windows.Forms.Button btnAmazonS3BucketNameOpen;
|
private System.Windows.Forms.Button btnAmazonS3BucketNameOpen;
|
||||||
private System.Windows.Forms.Button btnAmazonS3AccessKeyOpen;
|
private System.Windows.Forms.Button btnAmazonS3AccessKeyOpen;
|
||||||
private System.Windows.Forms.CheckBox cbAmazonS3CustomCNAME;
|
private System.Windows.Forms.CheckBox cbAmazonS3CustomCNAME;
|
||||||
private System.Windows.Forms.ComboBox cbAmazonS3Endpoint;
|
private System.Windows.Forms.ComboBox cbAmazonS3Endpoints;
|
||||||
private System.Windows.Forms.Label lblAmazonS3BucketName;
|
private System.Windows.Forms.Label lblAmazonS3BucketName;
|
||||||
private System.Windows.Forms.TextBox txtAmazonS3BucketName;
|
private System.Windows.Forms.TextBox txtAmazonS3BucketName;
|
||||||
private System.Windows.Forms.Label lblAmazonS3Regions;
|
private System.Windows.Forms.Label lblAmazonS3Endpoints;
|
||||||
private System.Windows.Forms.TextBox txtAmazonS3ObjectPrefix;
|
private System.Windows.Forms.TextBox txtAmazonS3ObjectPrefix;
|
||||||
private System.Windows.Forms.Label lblAmazonS3ObjectPrefix;
|
private System.Windows.Forms.Label lblAmazonS3ObjectPrefix;
|
||||||
private System.Windows.Forms.CheckBox cbAmazonS3UseRRS;
|
private System.Windows.Forms.CheckBox cbAmazonS3UseRRS;
|
||||||
|
@ -5552,11 +5552,11 @@ private void InitializeComponent()
|
||||||
private System.Windows.Forms.Label lblGistCustomURL;
|
private System.Windows.Forms.Label lblGistCustomURL;
|
||||||
private System.Windows.Forms.Label lblGistOAuthInfo;
|
private System.Windows.Forms.Label lblGistOAuthInfo;
|
||||||
private System.Windows.Forms.Label lblGistCustomURLExample;
|
private System.Windows.Forms.Label lblGistCustomURLExample;
|
||||||
private System.Windows.Forms.TextBox txtAmazonS3Identifier;
|
private System.Windows.Forms.TextBox txtAmazonS3Region;
|
||||||
private System.Windows.Forms.TextBox txtAmazonS3Hostname;
|
private System.Windows.Forms.TextBox txtAmazonS3Endpoint;
|
||||||
private System.Windows.Forms.Label lblAmazonS3Identifier;
|
private System.Windows.Forms.Label lblAmazonS3Region;
|
||||||
private System.Windows.Forms.ToolTip toolTip1;
|
private System.Windows.Forms.ToolTip toolTip1;
|
||||||
private System.Windows.Forms.Label lblAmazonS3Hostname;
|
private System.Windows.Forms.Label lblAmazonS3Endpoint;
|
||||||
private System.Windows.Forms.CheckBox cbDropboxUseDirectLink;
|
private System.Windows.Forms.CheckBox cbDropboxUseDirectLink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -514,9 +514,9 @@ public void LoadSettings()
|
||||||
|
|
||||||
txtAmazonS3AccessKey.Text = Config.AmazonS3Settings.AccessKeyID;
|
txtAmazonS3AccessKey.Text = Config.AmazonS3Settings.AccessKeyID;
|
||||||
txtAmazonS3SecretKey.Text = Config.AmazonS3Settings.SecretAccessKey;
|
txtAmazonS3SecretKey.Text = Config.AmazonS3Settings.SecretAccessKey;
|
||||||
cbAmazonS3Endpoint.Items.AddRange(AmazonS3.Regions.ToArray());
|
cbAmazonS3Endpoints.Items.AddRange(AmazonS3.Endpoints.ToArray());
|
||||||
txtAmazonS3Hostname.Text = Config.AmazonS3Settings.RegionHostname;
|
txtAmazonS3Endpoint.Text = Config.AmazonS3Settings.Endpoint;
|
||||||
txtAmazonS3Identifier.Text = Config.AmazonS3Settings.RegionIdentifier;
|
txtAmazonS3Region.Text = Config.AmazonS3Settings.Region;
|
||||||
txtAmazonS3BucketName.Text = Config.AmazonS3Settings.Bucket;
|
txtAmazonS3BucketName.Text = Config.AmazonS3Settings.Bucket;
|
||||||
txtAmazonS3ObjectPrefix.Text = Config.AmazonS3Settings.ObjectPrefix;
|
txtAmazonS3ObjectPrefix.Text = Config.AmazonS3Settings.ObjectPrefix;
|
||||||
cbAmazonS3CustomCNAME.Checked = Config.AmazonS3Settings.UseCustomCNAME;
|
cbAmazonS3CustomCNAME.Checked = Config.AmazonS3Settings.UseCustomCNAME;
|
||||||
|
@ -1974,26 +1974,26 @@ private void txtAmazonS3SecretKey_TextChanged(object sender, EventArgs e)
|
||||||
Config.AmazonS3Settings.SecretAccessKey = txtAmazonS3SecretKey.Text;
|
Config.AmazonS3Settings.SecretAccessKey = txtAmazonS3SecretKey.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbAmazonS3Endpoint_SelectedIndexChanged(object sender, EventArgs e)
|
private void cbAmazonS3Endpoints_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AmazonS3Region region = cbAmazonS3Endpoint.SelectedItem as AmazonS3Region;
|
AmazonS3Region region = cbAmazonS3Endpoints.SelectedItem as AmazonS3Region;
|
||||||
|
|
||||||
if (region != null)
|
if (region != null)
|
||||||
{
|
{
|
||||||
txtAmazonS3Identifier.Text = region.Identifier;
|
txtAmazonS3Region.Text = region.Region;
|
||||||
txtAmazonS3Hostname.Text = region.Hostname;
|
txtAmazonS3Endpoint.Text = region.Endpoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void txtAmazonS3Hostname_TextChanged(object sender, EventArgs e)
|
private void txtAmazonS3Endpoint_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Config.AmazonS3Settings.RegionHostname = txtAmazonS3Hostname.Text;
|
Config.AmazonS3Settings.Endpoint = txtAmazonS3Endpoint.Text;
|
||||||
UpdateAmazonS3Status();
|
UpdateAmazonS3Status();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void txtAmazonS3Identifier_TextChanged(object sender, EventArgs e)
|
private void txtAmazonS3Region_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Config.AmazonS3Settings.RegionIdentifier = txtAmazonS3Identifier.Text;
|
Config.AmazonS3Settings.Region = txtAmazonS3Region.Text;
|
||||||
UpdateAmazonS3Status();
|
UpdateAmazonS3Status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -464,15 +464,14 @@ private static void RunUploaderBackwardCompatibilityTasks()
|
||||||
UploadersConfig.DropboxUseDirectLink = true;
|
UploadersConfig.DropboxUseDirectLink = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(UploadersConfig.AmazonS3Settings.Endpoint) && string.IsNullOrEmpty(UploadersConfig.AmazonS3Settings.RegionHostname) &&
|
if (!string.IsNullOrEmpty(UploadersConfig.AmazonS3Settings.Endpoint))
|
||||||
string.IsNullOrEmpty(UploadersConfig.AmazonS3Settings.RegionIdentifier))
|
|
||||||
{
|
{
|
||||||
foreach (AmazonS3Region region in AmazonS3.Regions)
|
foreach (AmazonS3Region region in AmazonS3.Endpoints)
|
||||||
{
|
{
|
||||||
if (region.Identifier.Equals(UploadersConfig.AmazonS3Settings.Endpoint, StringComparison.InvariantCultureIgnoreCase))
|
if (region.Region.Equals(UploadersConfig.AmazonS3Settings.Endpoint, StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
UploadersConfig.AmazonS3Settings.RegionHostname = region.Hostname;
|
UploadersConfig.AmazonS3Settings.Endpoint = region.Endpoint;
|
||||||
UploadersConfig.AmazonS3Settings.RegionIdentifier = region.Identifier;
|
UploadersConfig.AmazonS3Settings.Region = region.Region;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue