diff --git a/ShareX.UploadersLib/FileUploaders/GoogleCloudStorage.cs b/ShareX.UploadersLib/FileUploaders/GoogleCloudStorage.cs index f443b132b..4773e31fe 100644 --- a/ShareX.UploadersLib/FileUploaders/GoogleCloudStorage.cs +++ b/ShareX.UploadersLib/FileUploaders/GoogleCloudStorage.cs @@ -62,6 +62,8 @@ public override GenericUploader CreateUploader(UploadersConfig config, TaskRefer public sealed class GoogleCloudStorage : FileUploader, IOAuth2 { + public GoogleOAuth2 OAuth2 { get; private set; } + public OAuth2Info AuthInfo => OAuth2.AuthInfo; public string Bucket { get; set; } public string Domain { get; set; } public string Prefix { get; set; } @@ -70,36 +72,32 @@ public sealed class GoogleCloudStorage : FileUploader, IOAuth2 public bool RemoveExtensionVideo { get; set; } public bool SetPublicACL { get; set; } - public OAuth2Info AuthInfo => googleAuth.AuthInfo; - - private GoogleOAuth2 googleAuth; - public GoogleCloudStorage(OAuth2Info oauth) { - googleAuth = new GoogleOAuth2(oauth, this) + OAuth2 = new GoogleOAuth2(oauth, this) { - Scope = "https://www.googleapis.com/auth/devstorage.read_write" + Scope = "https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/userinfo.profile" }; } public bool RefreshAccessToken() { - return googleAuth.RefreshAccessToken(); + return OAuth2.RefreshAccessToken(); } public bool CheckAuthorization() { - return googleAuth.CheckAuthorization(); + return OAuth2.CheckAuthorization(); } public string GetAuthorizationURL() { - return googleAuth.GetAuthorizationURL(); + return OAuth2.GetAuthorizationURL(); } public bool GetAccessToken(string code) { - return googleAuth.GetAccessToken(code); + return OAuth2.GetAccessToken(code); } public override UploadResult Upload(Stream stream, string fileName) @@ -129,7 +127,7 @@ public override UploadResult Upload(Stream stream, string fileName) string serializedGoogleCloudStorageMetadata = JsonConvert.SerializeObject(googleCloudStorageMetadata); - UploadResult result = SendRequestFile($"https://www.googleapis.com/upload/storage/v1/b/{Bucket}/o?uploadType=multipart&fields=name", stream, fileName, null, headers: googleAuth.GetAuthHeaders(), contentType: "multipart/related", relatedData: serializedGoogleCloudStorageMetadata); + UploadResult result = SendRequestFile($"https://www.googleapis.com/upload/storage/v1/b/{Bucket}/o?uploadType=multipart&fields=name", stream, fileName, null, headers: OAuth2.GetAuthHeaders(), contentType: "multipart/related", relatedData: serializedGoogleCloudStorageMetadata); GoogleCloudStorageResponse googleCloudStorageResponse = JsonConvert.DeserializeObject(result.Response); diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs index 314b24b5b..a00f43a47 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs @@ -196,6 +196,7 @@ private void InitializeComponent() this.cbOneDriveCreateShareableLink = new System.Windows.Forms.CheckBox(); this.oAuth2OneDrive = new ShareX.UploadersLib.OAuthControl(); this.tpGoogleDrive = new System.Windows.Forms.TabPage(); + this.oauth2GoogleDrive = new ShareX.UploadersLib.OAuthLoopbackControl(); this.cbGoogleDriveSharedDrive = new System.Windows.Forms.ComboBox(); this.cbGoogleDriveDirectLink = new System.Windows.Forms.CheckBox(); this.cbGoogleDriveUseFolder = new System.Windows.Forms.CheckBox(); @@ -271,7 +272,6 @@ private void InitializeComponent() this.txtGoogleCloudStorageDomain = new System.Windows.Forms.TextBox(); this.lblGoogleCloudStorageBucket = new System.Windows.Forms.Label(); this.txtGoogleCloudStorageBucket = new System.Windows.Forms.TextBox(); - this.oauth2GoogleCloudStorage = new ShareX.UploadersLib.OAuthControl(); this.tpAzureStorage = new System.Windows.Forms.TabPage(); this.lblAzureStorageURLPreview = new System.Windows.Forms.Label(); this.lblAzureStorageURLPreviewLabel = new System.Windows.Forms.Label(); @@ -630,7 +630,7 @@ private void InitializeComponent() this.tcUploaders = new System.Windows.Forms.TabControl(); this.tttvMain = new ShareX.HelpersLib.TabToTreeView(); this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl(); - this.oauth2GoogleDrive = new ShareX.UploadersLib.OAuthLoopbackControl(); + this.oauth2GoogleCloudStorage = new ShareX.UploadersLib.OAuthLoopbackControl(); this.tpOtherUploaders.SuspendLayout(); this.tcOtherUploaders.SuspendLayout(); this.tpTwitter.SuspendLayout(); @@ -1784,6 +1784,14 @@ private void InitializeComponent() resources.ApplyResources(this.tpGoogleDrive, "tpGoogleDrive"); this.tpGoogleDrive.Name = "tpGoogleDrive"; // + // oauth2GoogleDrive + // + resources.ApplyResources(this.oauth2GoogleDrive, "oauth2GoogleDrive"); + this.oauth2GoogleDrive.Name = "oauth2GoogleDrive"; + this.oauth2GoogleDrive.UserInfo = null; + this.oauth2GoogleDrive.ConnectButtonClicked += new System.Action(this.oauth2GoogleDrive_ConnectButtonClicked); + this.oauth2GoogleDrive.DisconnectButtonClicked += new System.Action(this.oauth2GoogleDrive_DisconnectButtonClicked); + // // cbGoogleDriveSharedDrive // this.cbGoogleDriveSharedDrive.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -2216,6 +2224,7 @@ private void InitializeComponent() // // tpGoogleCloudStorage // + this.tpGoogleCloudStorage.Controls.Add(this.oauth2GoogleCloudStorage); this.tpGoogleCloudStorage.Controls.Add(this.gbGoogleCloudStorageAdvanced); this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStoragePathPreview); this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStoragePathPreviewLabel); @@ -2225,7 +2234,6 @@ private void InitializeComponent() this.tpGoogleCloudStorage.Controls.Add(this.txtGoogleCloudStorageDomain); this.tpGoogleCloudStorage.Controls.Add(this.lblGoogleCloudStorageBucket); this.tpGoogleCloudStorage.Controls.Add(this.txtGoogleCloudStorageBucket); - this.tpGoogleCloudStorage.Controls.Add(this.oauth2GoogleCloudStorage); resources.ApplyResources(this.tpGoogleCloudStorage, "tpGoogleCloudStorage"); this.tpGoogleCloudStorage.Name = "tpGoogleCloudStorage"; this.tpGoogleCloudStorage.UseVisualStyleBackColor = true; @@ -2317,16 +2325,6 @@ private void InitializeComponent() this.txtGoogleCloudStorageBucket.Name = "txtGoogleCloudStorageBucket"; this.txtGoogleCloudStorageBucket.TextChanged += new System.EventHandler(this.txtGoogleCloudStorageBucket_TextChanged); // - // oauth2GoogleCloudStorage - // - resources.ApplyResources(this.oauth2GoogleCloudStorage, "oauth2GoogleCloudStorage"); - this.oauth2GoogleCloudStorage.Name = "oauth2GoogleCloudStorage"; - this.oauth2GoogleCloudStorage.UserInfo = null; - this.oauth2GoogleCloudStorage.OpenButtonClicked += new ShareX.UploadersLib.OAuthControl.OpenButtonClickedEventHandler(this.oauth2GoogleCloudStorage_OpenButtonClicked); - this.oauth2GoogleCloudStorage.CompleteButtonClicked += new ShareX.UploadersLib.OAuthControl.CompleteButtonClickedEventHandler(this.oauth2GoogleCloudStorage_CompleteButtonClicked); - this.oauth2GoogleCloudStorage.ClearButtonClicked += new ShareX.UploadersLib.OAuthControl.ClearButtonclickedEventHandler(this.oauth2GoogleCloudStorage_ClearButtonClicked); - this.oauth2GoogleCloudStorage.RefreshButtonClicked += new ShareX.UploadersLib.OAuthControl.RefreshButtonClickedEventHandler(this.oauth2GoogleCloudStorage_RefreshButtonClicked); - // // tpAzureStorage // this.tpAzureStorage.BackColor = System.Drawing.SystemColors.Window; @@ -4945,13 +4943,13 @@ private void InitializeComponent() this.actRapidShareAccountType.Name = "actRapidShareAccountType"; this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous; // - // oauth2GoogleDrive + // oauth2GoogleCloudStorage // - resources.ApplyResources(this.oauth2GoogleDrive, "oauth2GoogleDrive"); - this.oauth2GoogleDrive.Name = "oauth2GoogleDrive"; - this.oauth2GoogleDrive.UserInfo = null; - this.oauth2GoogleDrive.ConnectButtonClicked += new System.Action(this.oauth2GoogleDrive_ConnectButtonClicked); - this.oauth2GoogleDrive.DisconnectButtonClicked += new System.Action(this.oauth2GoogleDrive_DisconnectButtonClicked); + resources.ApplyResources(this.oauth2GoogleCloudStorage, "oauth2GoogleCloudStorage"); + this.oauth2GoogleCloudStorage.Name = "oauth2GoogleCloudStorage"; + this.oauth2GoogleCloudStorage.UserInfo = null; + this.oauth2GoogleCloudStorage.ConnectButtonClicked += new System.Action(this.oauth2GoogleCloudStorage_ConnectButtonClicked); + this.oauth2GoogleCloudStorage.DisconnectButtonClicked += new System.Action(this.oauth2GoogleCloudStorage_DisconnectButtonClicked); // // UploadersConfigForm // @@ -5604,7 +5602,6 @@ private void InitializeComponent() internal System.Windows.Forms.TabPage tpYouTube; private System.Windows.Forms.CheckBox cbYouTubeUseShortenedLink; internal System.Windows.Forms.TabPage tpGoogleCloudStorage; - private OAuthControl oauth2GoogleCloudStorage; private System.Windows.Forms.TextBox txtGoogleCloudStorageBucket; private System.Windows.Forms.Label lblGoogleCloudStorageBucket; private System.Windows.Forms.TextBox txtGoogleCloudStorageDomain; @@ -5694,5 +5691,6 @@ private void InitializeComponent() private OAuthLoopbackControl oauth2YouTube; private OAuthLoopbackControl oauth2GooglePhotos; private OAuthLoopbackControl oauth2GoogleDrive; + private OAuthLoopbackControl oauth2GoogleCloudStorage; } } \ No newline at end of file diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs index 0885457df..9312e8b11 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs @@ -752,7 +752,8 @@ private void LoadFileUploaderSettings() if (OAuth2Info.CheckOAuth(Config.GoogleCloudStorageOAuth2Info)) { - oauth2GoogleCloudStorage.Status = OAuthLoginStatus.LoginSuccessful; + oauth2GoogleCloudStorage.Connected = true; + oauth2GoogleCloudStorage.UserInfo = Config.GoogleCloudStorageUserInfo; } txtGoogleCloudStorageBucket.Text = Config.GoogleCloudStorageBucket; @@ -3081,25 +3082,27 @@ private void cbYouTubeShowDialog_CheckedChanged(object sender, EventArgs e) #region Google Cloud Storage - private void oauth2GoogleCloudStorage_ClearButtonClicked() - { - Config.GoogleCloudStorageOAuth2Info = null; - } - - private void oauth2GoogleCloudStorage_CompleteButtonClicked(string code) - { - OAuth2Complete(new GoogleCloudStorage(Config.GoogleCloudStorageOAuth2Info), code, oauth2GoogleCloudStorage); - } - - private void oauth2GoogleCloudStorage_OpenButtonClicked() + private void oauth2GoogleCloudStorage_ConnectButtonClicked() { OAuth2Info oauth = new OAuth2Info(APIKeys.GoogleClientID, APIKeys.GoogleClientSecret); - Config.GoogleCloudStorageOAuth2Info = OAuth2Open(new GoogleCloudStorage(oauth)); + IOAuth2Loopback oauthLoopback = new GoogleCloudStorage(oauth).OAuth2; + + using (OAuthListenerForm form = new OAuthListenerForm(oauthLoopback)) + { + form.ShowDialog(); + Config.GoogleCloudStorageOAuth2Info = form.OAuth2Info; + Config.GoogleCloudStorageUserInfo = form.UserInfo; + } + + oauth2GoogleCloudStorage.Connected = OAuth2Info.CheckOAuth(Config.GoogleCloudStorageOAuth2Info); + oauth2GoogleCloudStorage.UserInfo = Config.GoogleCloudStorageUserInfo; + this.ForceActivate(); } - private void oauth2GoogleCloudStorage_RefreshButtonClicked() + private void oauth2GoogleCloudStorage_DisconnectButtonClicked() { - OAuth2Refresh(new GoogleCloudStorage(Config.GoogleCloudStorageOAuth2Info), oauth2GoogleCloudStorage); + Config.GoogleCloudStorageOAuth2Info = null; + Config.GoogleCloudStorageUserInfo = null; } private void txtGoogleCloudStorageBucket_TextChanged(object sender, EventArgs e) diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx index 4e4b87d53..fec6f338c 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx @@ -3062,15 +3062,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 2 - - 8, 8 - - - 299, 75 - - - 0 - oauth2GoogleDrive @@ -3083,15 +3074,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 0 - - 16, 136 - - - 256, 21 - - - 3 - cbGoogleDriveSharedDrive @@ -3104,24 +3086,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 1 - - True - - - NoControl - - - 16, 111 - - - 93, 17 - - - 2 - - - Use direct link - cbGoogleDriveDirectLink @@ -3134,24 +3098,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 2 - - True - - - NoControl - - - 16, 167 - - - 165, 17 - - - 5 - - - Upload files to selected folder - cbGoogleDriveUseFolder @@ -3164,15 +3110,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 3 - - 16, 208 - - - 432, 20 - - - 7 - txtGoogleDriveFolderID @@ -3185,24 +3122,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 4 - - True - - - NoControl - - - 13, 191 - - - 53, 13 - - - 6 - - - Folder ID: - lblGoogleDriveFolderID @@ -3215,15 +3134,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 5 - - 16, 232 - - - 432, 296 - - - 8 - lvGoogleDriveFoldersList @@ -3236,24 +3146,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 6 - - False - - - NoControl - - - 280, 135 - - - 168, 23 - - - 4 - - - Refresh folders list - btnGoogleDriveRefreshFolders @@ -3266,24 +3158,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 7 - - True - - - NoControl - - - 16, 88 - - - 106, 17 - - - 1 - - - Is public upload? - cbGoogleDriveIsPublic @@ -3297,13 +3171,13 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 8 - 4, 58 + 4, 220 3, 3, 3, 3 - 803, 507 + 178, 0 1 @@ -3836,6 +3710,99 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 6 + + 8, 8 + + + 299, 75 + + + 0 + + + oauth2GoogleCloudStorage + + + ShareX.UploadersLib.OAuthLoopbackControl, ShareX.UploadersLib, Version=14.1.4.0, Culture=neutral, PublicKeyToken=null + + + tpGoogleCloudStorage + + + 0 + + + lblGoogleCloudStorageStripExtension + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbGoogleCloudStorageAdvanced + + + 0 + + + cbGoogleCloudStorageStripExtensionText + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbGoogleCloudStorageAdvanced + + + 1 + + + cbGoogleCloudStorageStripExtensionVideo + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbGoogleCloudStorageAdvanced + + + 2 + + + cbGoogleCloudStorageSetPublicACL + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbGoogleCloudStorageAdvanced + + + 3 + + + cbGoogleCloudStorageStripExtensionImage + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + gbGoogleCloudStorageAdvanced + + + 4 + + + 16, 283 + + + 416, 98 + + + 9 + + + Advanced + gbGoogleCloudStorageAdvanced @@ -3846,7 +3813,25 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage - 0 + 1 + + + True + + + NoControl + + + 13, 252 + + + 45, 13 + + + 8 + + + Preview lblGoogleCloudStoragePathPreview @@ -3858,7 +3843,25 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage - 1 + 2 + + + True + + + NoControl + + + 13, 233 + + + 72, 13 + + + 7 + + + URL preview: lblGoogleCloudStoragePathPreviewLabel @@ -3870,7 +3873,16 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage - 2 + 3 + + + 16, 153 + + + 320, 20 + + + 4 txtGoogleCloudStorageObjectPrefix @@ -3882,8 +3894,26 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage + 4 + + + True + + + NoControl + + + 13, 137 + + + 68, 13 + + 3 + + Upload path: + lblGoogleCloudStorageObjectPrefix @@ -3894,7 +3924,25 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage - 4 + 5 + + + True + + + NoControl + + + 13, 185 + + + 82, 13 + + + 5 + + + Custom domain: lblGoogleCloudStorageDomain @@ -3906,7 +3954,16 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage - 5 + 6 + + + 16, 201 + + + 320, 20 + + + 6 txtGoogleCloudStorageDomain @@ -3918,7 +3975,25 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage - 6 + 7 + + + True + + + NoControl + + + 13, 88 + + + 73, 13 + + + 1 + + + Bucket name: lblGoogleCloudStorageBucket @@ -3930,7 +4005,16 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage - 7 + 8 + + + 16, 104 + + + 320, 20 + + + 2 txtGoogleCloudStorageBucket @@ -3942,28 +4026,16 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt tpGoogleCloudStorage - 8 - - - oauth2GoogleCloudStorage - - - ShareX.UploadersLib.OAuthControl, ShareX.UploadersLib, Version=14.1.4.0, Culture=neutral, PublicKeyToken=null - - - tpGoogleCloudStorage - - 9 - 4, 220 + 4, 58 3, 3, 3, 3 - 178, 0 + 803, 507 32 @@ -6297,10 +6369,10 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 6 - 4, 220 + 4, 58 - 178, 0 + 803, 507 31 @@ -8897,6 +8969,180 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 3 + + 8, 8 + + + 299, 75 + + + 0 + + + oauth2GoogleDrive + + + ShareX.UploadersLib.OAuthLoopbackControl, ShareX.UploadersLib, Version=14.1.4.0, Culture=neutral, PublicKeyToken=null + + + tpGoogleDrive + + + 0 + + + 16, 136 + + + 256, 21 + + + 3 + + + cbGoogleDriveSharedDrive + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGoogleDrive + + + 1 + + + True + + + NoControl + + + 16, 111 + + + 93, 17 + + + 2 + + + Use direct link + + + cbGoogleDriveDirectLink + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGoogleDrive + + + 2 + + + True + + + NoControl + + + 16, 167 + + + 165, 17 + + + 5 + + + Upload files to selected folder + + + cbGoogleDriveUseFolder + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGoogleDrive + + + 3 + + + 16, 208 + + + 432, 20 + + + 7 + + + txtGoogleDriveFolderID + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGoogleDrive + + + 4 + + + True + + + NoControl + + + 13, 191 + + + 53, 13 + + + 6 + + + Folder ID: + + + lblGoogleDriveFolderID + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGoogleDrive + + + 5 + + + 16, 232 + + + 432, 296 + + + 8 + + + lvGoogleDriveFoldersList + + + ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=14.1.4.0, Culture=neutral, PublicKeyToken=null + + + tpGoogleDrive + + + 6 + Title @@ -8909,6 +9155,66 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 228 + + False + + + NoControl + + + 280, 135 + + + 168, 23 + + + 4 + + + Refresh folders list + + + btnGoogleDriveRefreshFolders + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGoogleDrive + + + 7 + + + True + + + NoControl + + + 16, 88 + + + 106, 17 + + + 1 + + + Is public upload? + + + cbGoogleDriveIsPublic + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpGoogleDrive + + + 8 + True @@ -10265,90 +10571,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 20 - - lblGoogleCloudStorageStripExtension - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbGoogleCloudStorageAdvanced - - - 0 - - - cbGoogleCloudStorageStripExtensionText - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbGoogleCloudStorageAdvanced - - - 1 - - - cbGoogleCloudStorageStripExtensionVideo - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbGoogleCloudStorageAdvanced - - - 2 - - - cbGoogleCloudStorageSetPublicACL - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbGoogleCloudStorageAdvanced - - - 3 - - - cbGoogleCloudStorageStripExtensionImage - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - gbGoogleCloudStorageAdvanced - - - 4 - - - 16, 450 - - - 416, 98 - - - 35 - - - Advanced - - - gbGoogleCloudStorageAdvanced - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 0 - True @@ -10362,7 +10584,7 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 129, 13 - 30 + 1 Remove file extension on: @@ -10392,7 +10614,7 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 47, 17 - 29 + 4 Text @@ -10422,7 +10644,7 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 53, 17 - 28 + 3 Video @@ -10452,7 +10674,7 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 151, 17 - 25 + 0 Set public-read ACL on file @@ -10482,7 +10704,7 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 55, 17 - 27 + 2 Image @@ -10499,240 +10721,6 @@ For example, if your bucket is called "bucket.example.com" then URL will be "htt 4 - - True - - - NoControl - - - 13, 419 - - - 45, 13 - - - 8 - - - Preview - - - lblGoogleCloudStoragePathPreview - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 1 - - - True - - - NoControl - - - 13, 400 - - - 72, 13 - - - 7 - - - URL preview: - - - lblGoogleCloudStoragePathPreviewLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 2 - - - 16, 320 - - - 320, 20 - - - 6 - - - txtGoogleCloudStorageObjectPrefix - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 3 - - - True - - - NoControl - - - 13, 304 - - - 68, 13 - - - 5 - - - Upload path: - - - lblGoogleCloudStorageObjectPrefix - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 4 - - - True - - - NoControl - - - 13, 352 - - - 82, 13 - - - 4 - - - Custom domain: - - - lblGoogleCloudStorageDomain - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 5 - - - 16, 368 - - - 320, 20 - - - 3 - - - txtGoogleCloudStorageDomain - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 6 - - - True - - - NoControl - - - 13, 255 - - - 73, 13 - - - 2 - - - Bucket name: - - - lblGoogleCloudStorageBucket - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 7 - - - 16, 271 - - - 320, 20 - - - 1 - - - txtGoogleCloudStorageBucket - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tpGoogleCloudStorage - - - 8 - - - 16, 16 - - - 326, 238 - - - 0 - - - oauth2GoogleCloudStorage - - - ShareX.UploadersLib.OAuthControl, ShareX.UploadersLib, Version=14.1.4.0, Culture=neutral, PublicKeyToken=null - - - tpGoogleCloudStorage - - - 9 - True diff --git a/ShareX.UploadersLib/UploadersConfig.cs b/ShareX.UploadersLib/UploadersConfig.cs index d0a2ac31c..89b2fdf90 100644 --- a/ShareX.UploadersLib/UploadersConfig.cs +++ b/ShareX.UploadersLib/UploadersConfig.cs @@ -432,6 +432,7 @@ public class UploadersConfig : SettingsBase #region Google Cloud Storage public OAuth2Info GoogleCloudStorageOAuth2Info { get; set; } = null; + public OAuthUserInfo GoogleCloudStorageUserInfo { get; set; } = null; public string GoogleCloudStorageBucket { get; set; } = ""; public string GoogleCloudStorageDomain { get; set; } = ""; public string GoogleCloudStorageObjectPrefix { get; set; } = "ShareX/%y/%mo";