Amazon S3 custom domain support

This commit is contained in:
Jaex 2017-03-18 03:43:38 +03:00
parent bcc09ca8d6
commit 1ec3506022
3 changed files with 2353 additions and 8186 deletions

View file

@ -181,8 +181,19 @@ public string GenerateURL(string fileName)
if (!string.IsNullOrEmpty(Settings.RegionHostname) && !string.IsNullOrEmpty(Settings.Bucket))
{
string uploadPath = GetUploadPath(fileName);
string url = URLHelpers.CombineURL(Settings.RegionHostname, Settings.Bucket, uploadPath);
return URLHelpers.ForcePrefix(url, "https://");
string url;
if (Settings.UseCustomCNAME && !string.IsNullOrEmpty(Settings.CustomDomain))
{
url = URLHelpers.CombineURL(Settings.CustomDomain, uploadPath);
}
else
{
url = URLHelpers.CombineURL(Settings.RegionHostname, Settings.Bucket, uploadPath);
}
return URLHelpers.FixPrefix(url, "https://");
}
return "";

View file

@ -222,6 +222,10 @@ private void InitializeComponent()
this.btnBoxRefreshFolders = new System.Windows.Forms.Button();
this.oauth2Box = new ShareX.UploadersLib.OAuthControl();
this.tpAmazonS3 = new System.Windows.Forms.TabPage();
this.lblAmazonS3Hostname = new System.Windows.Forms.Label();
this.txtAmazonS3Hostname = new System.Windows.Forms.TextBox();
this.lblAmazonS3Identifier = new System.Windows.Forms.Label();
this.txtAmazonS3Identifier = new System.Windows.Forms.TextBox();
this.txtAmazonS3CustomDomain = new System.Windows.Forms.TextBox();
this.lblAmazonS3PathPreviewLabel = new System.Windows.Forms.Label();
this.lblAmazonS3PathPreview = new System.Windows.Forms.Label();
@ -593,11 +597,7 @@ private void InitializeComponent()
this.lblWidthHint = new System.Windows.Forms.Label();
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
this.txtAmazonS3Identifier = new System.Windows.Forms.TextBox();
this.lblAmazonS3Identifier = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.txtAmazonS3Hostname = new System.Windows.Forms.TextBox();
this.lblAmazonS3Hostname = new System.Windows.Forms.Label();
this.tpOtherUploaders.SuspendLayout();
this.tcOtherUploaders.SuspendLayout();
this.tpTwitter.SuspendLayout();
@ -2161,6 +2161,28 @@ private void InitializeComponent()
this.tpAmazonS3.Name = "tpAmazonS3";
this.tpAmazonS3.UseVisualStyleBackColor = true;
//
// lblAmazonS3Hostname
//
resources.ApplyResources(this.lblAmazonS3Hostname, "lblAmazonS3Hostname");
this.lblAmazonS3Hostname.Name = "lblAmazonS3Hostname";
//
// txtAmazonS3Hostname
//
resources.ApplyResources(this.txtAmazonS3Hostname, "txtAmazonS3Hostname");
this.txtAmazonS3Hostname.Name = "txtAmazonS3Hostname";
this.txtAmazonS3Hostname.TextChanged += new System.EventHandler(this.txtAmazonS3Hostname_TextChanged);
//
// lblAmazonS3Identifier
//
resources.ApplyResources(this.lblAmazonS3Identifier, "lblAmazonS3Identifier");
this.lblAmazonS3Identifier.Name = "lblAmazonS3Identifier";
//
// txtAmazonS3Identifier
//
resources.ApplyResources(this.txtAmazonS3Identifier, "txtAmazonS3Identifier");
this.txtAmazonS3Identifier.Name = "txtAmazonS3Identifier";
this.txtAmazonS3Identifier.TextChanged += new System.EventHandler(this.txtAmazonS3Identifier_TextChanged);
//
// txtAmazonS3CustomDomain
//
resources.ApplyResources(this.txtAmazonS3CustomDomain, "txtAmazonS3CustomDomain");
@ -4798,28 +4820,6 @@ private void InitializeComponent()
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
//
// txtAmazonS3Identifier
//
resources.ApplyResources(this.txtAmazonS3Identifier, "txtAmazonS3Identifier");
this.txtAmazonS3Identifier.Name = "txtAmazonS3Identifier";
this.txtAmazonS3Identifier.TextChanged += new System.EventHandler(this.txtAmazonS3Identifier_TextChanged);
//
// lblAmazonS3Identifier
//
resources.ApplyResources(this.lblAmazonS3Identifier, "lblAmazonS3Identifier");
this.lblAmazonS3Identifier.Name = "lblAmazonS3Identifier";
//
// txtAmazonS3Hostname
//
resources.ApplyResources(this.txtAmazonS3Hostname, "txtAmazonS3Hostname");
this.txtAmazonS3Hostname.Name = "txtAmazonS3Hostname";
this.txtAmazonS3Hostname.TextChanged += new System.EventHandler(this.txtAmazonS3Hostname_TextChanged);
//
// lblAmazonS3Hostname
//
resources.ApplyResources(this.lblAmazonS3Hostname, "lblAmazonS3Hostname");
this.lblAmazonS3Hostname.Name = "lblAmazonS3Hostname";
//
// UploadersConfigForm
//
resources.ApplyResources(this, "$this");

File diff suppressed because it is too large Load diff