Add live url preview

This commit is contained in:
Matthew Burnett 2018-04-26 00:41:11 -04:00
parent 28efed0d22
commit fb3ce039f0
5 changed files with 2227 additions and 8696 deletions

View file

@ -173,5 +173,11 @@ public string GenerateURL(string uploadPath)
return URLHelpers.FixPrefix(url, "https://");
}
public string GetPreviewURL()
{
string uploadPath = GetUploadPath("example.png");
return GenerateURL(uploadPath);
}
}
}

View file

@ -303,6 +303,8 @@ private void InitializeComponent()
this.lblAmazonS3AccessKey = new System.Windows.Forms.Label();
this.txtAmazonS3AccessKey = new System.Windows.Forms.TextBox();
this.tpGoogleCloudStorage = new System.Windows.Forms.TabPage();
this.lblGoogleCloudStoragePathPreview = new System.Windows.Forms.Label();
this.lblGoogleCloudStoragePathPreviewLabel = new System.Windows.Forms.Label();
this.txtGoogleCloudStorageObjectPrefix = new System.Windows.Forms.TextBox();
this.lblGoogleCloudStorageObjectPrefix = new System.Windows.Forms.Label();
this.lblGoogleCloudStorageDomain = new System.Windows.Forms.Label();
@ -2790,6 +2792,8 @@ private void InitializeComponent()
//
// tpGoogleCloudStorage
//
this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStoragePathPreview);
this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStoragePathPreviewLabel);
this.tpGoogleCloudStorage.Controls.Add(this.txtGoogleCloudStorageObjectPrefix);
this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStorageObjectPrefix);
this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStorageDomain);
@ -2801,6 +2805,16 @@ private void InitializeComponent()
this.tpGoogleCloudStorage.Name = "tpGoogleCloudStorage";
this.tpGoogleCloudStorage.UseVisualStyleBackColor = true;
//
// lblGoogleCloudStoragePathPreview
//
resources.ApplyResources(this.lblGoogleCloudStoragePathPreview, "lblGoogleCloudStoragePathPreview");
this.lblGoogleCloudStoragePathPreview.Name = "lblGoogleCloudStoragePathPreview";
//
// lblGoogleCloudStoragePathPreviewLabel
//
resources.ApplyResources(this.lblGoogleCloudStoragePathPreviewLabel, "lblGoogleCloudStoragePathPreviewLabel");
this.lblGoogleCloudStoragePathPreviewLabel.Name = "lblGoogleCloudStoragePathPreviewLabel";
//
// txtGoogleCloudStorageObjectPrefix
//
resources.ApplyResources(this.txtGoogleCloudStorageObjectPrefix, "txtGoogleCloudStorageObjectPrefix");
@ -6097,5 +6111,7 @@ private void InitializeComponent()
private System.Windows.Forms.Button btnSharedFolderAdd;
private System.Windows.Forms.PropertyGrid pgSharedFolderAccount;
private System.Windows.Forms.ListBox lbSharedFolderAccounts;
private System.Windows.Forms.Label lblGoogleCloudStoragePathPreviewLabel;
private System.Windows.Forms.Label lblGoogleCloudStoragePathPreview;
}
}

View file

@ -3033,16 +3033,19 @@ private void oauth2GoogleCloudStorage_RefreshButtonClicked()
private void txtGoogleCloudStorageBucket_TextChanged(object sender, EventArgs e)
{
Config.GoogleCloudStorageBucket = txtGoogleCloudStorageBucket.Text;
UpdateGoogleCloudStorageStatus();
}
private void txtGoogleCloudStorageDomain_TextChanged(object sender, EventArgs e)
{
Config.GoogleCloudStorageDomain = txtGoogleCloudStorageDomain.Text;
UpdateGoogleCloudStorageStatus();
}
private void txtGoogleCloudStorageObjectPrefix_TextChanged(object sender, EventArgs e)
{
Config.GoogleCloudStorageObjectPrefix = txtGoogleCloudStorageObjectPrefix.Text;
UpdateGoogleCloudStorageStatus();
}
#endregion Google Cloud Storage

File diff suppressed because it is too large Load diff

View file

@ -471,6 +471,22 @@ private void UpdateAmazonS3Status()
#endregion Amazon S3
#region Google Cloud Storage
private void UpdateGoogleCloudStorageStatus()
{
GoogleCloudStorage GCS = new GoogleCloudStorage(Config.GoogleCloudStorageOAuth2Info)
{
Bucket = Config.GoogleCloudStorageBucket,
Domain = Config.GoogleCloudStorageDomain,
Prefix = Config.GoogleCloudStorageObjectPrefix
};
lblGoogleCloudStoragePathPreview.Text = GCS.GetPreviewURL();
}
#endregion Google Cloud Storage
#region Google Drive
public void GoogleDriveAuthOpen()