mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-04 22:21:23 +12:00
Creat OAuth
This commit is contained in:
parent
19fd8418d7
commit
098e5aff64
|
@ -638,6 +638,7 @@ private void InitializeComponent()
|
|||
this.lblWidthHint = new System.Windows.Forms.Label();
|
||||
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
|
||||
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
|
||||
this.oauth2GoogleCloudStorage = new ShareX.UploadersLib.OAuthControl();
|
||||
this.tpOtherUploaders.SuspendLayout();
|
||||
this.tcOtherUploaders.SuspendLayout();
|
||||
this.tpTwitter.SuspendLayout();
|
||||
|
@ -677,6 +678,7 @@ private void InitializeComponent()
|
|||
this.tpBox.SuspendLayout();
|
||||
this.tpAmazonS3.SuspendLayout();
|
||||
this.gbAmazonS3Advanced.SuspendLayout();
|
||||
this.tpGoogleCloudStorage.SuspendLayout();
|
||||
this.tpAzureStorage.SuspendLayout();
|
||||
this.tpGfycat.SuspendLayout();
|
||||
this.tpMega.SuspendLayout();
|
||||
|
@ -2778,6 +2780,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// tpGoogleCloudStorage
|
||||
//
|
||||
this.tpGoogleCloudStorage.Controls.Add(this.oauth2GoogleCloudStorage);
|
||||
resources.ApplyResources(this.tpGoogleCloudStorage, "tpGoogleCloudStorage");
|
||||
this.tpGoogleCloudStorage.Name = "tpGoogleCloudStorage";
|
||||
this.tpGoogleCloudStorage.UseVisualStyleBackColor = true;
|
||||
|
@ -5200,6 +5203,15 @@ private void InitializeComponent()
|
|||
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
|
||||
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
|
||||
//
|
||||
// oauth2GoogleCloudStorage
|
||||
//
|
||||
resources.ApplyResources(this.oauth2GoogleCloudStorage, "oauth2GoogleCloudStorage");
|
||||
this.oauth2GoogleCloudStorage.Name = "oauth2GoogleCloudStorage";
|
||||
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);
|
||||
//
|
||||
// UploadersConfigForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
@ -5278,6 +5290,7 @@ private void InitializeComponent()
|
|||
this.tpAmazonS3.PerformLayout();
|
||||
this.gbAmazonS3Advanced.ResumeLayout(false);
|
||||
this.gbAmazonS3Advanced.PerformLayout();
|
||||
this.tpGoogleCloudStorage.ResumeLayout(false);
|
||||
this.tpAzureStorage.ResumeLayout(false);
|
||||
this.tpAzureStorage.PerformLayout();
|
||||
this.tpGfycat.ResumeLayout(false);
|
||||
|
@ -5986,5 +5999,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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -732,6 +732,15 @@ public void LoadSettings()
|
|||
|
||||
#endregion YouTube
|
||||
|
||||
#region Google Cloud Storage
|
||||
|
||||
if (OAuth2Info.CheckOAuth(Config.GoogleCloudStorageOAuth2Info))
|
||||
{
|
||||
oauth2GoogleCloudStorage.Status = OAuthLoginStatus.LoginSuccessful;
|
||||
}
|
||||
|
||||
#endregion Google Cloud Storage
|
||||
|
||||
#endregion File uploaders
|
||||
|
||||
#region URL shorteners
|
||||
|
@ -3031,6 +3040,31 @@ private void cbYouTubeUseShortenedLink_CheckedChanged(object sender, EventArgs e
|
|||
|
||||
#endregion YouTube
|
||||
|
||||
#region Google Cloud Storage
|
||||
|
||||
private void oauth2GoogleCloudStorage_ClearButtonClicked()
|
||||
{
|
||||
Config.GoogleCloudStorageOAuth2Info = null;
|
||||
}
|
||||
|
||||
private void oauth2GoogleCloudStorage_CompleteButtonClicked(string code)
|
||||
{
|
||||
OAuth2Complete(new GoogleCloudStorage(Config.GoogleCloudStorageOAuth2Info), oauth2GoogleCloudStorage, code);
|
||||
}
|
||||
|
||||
private void oauth2GoogleCloudStorage_OpenButtonClicked()
|
||||
{
|
||||
OAuth2Info oauth = new OAuth2Info(APIKeys.GoogleClientID, APIKeys.GoogleClientSecret);
|
||||
Config.GoogleCloudStorageOAuth2Info = OAuth2Open(new GoogleCloudStorage(oauth));
|
||||
}
|
||||
|
||||
private void oauth2GoogleCloudStorage_RefreshButtonClicked()
|
||||
{
|
||||
OAuth2Refresh(new GoogleCloudStorage(Config.GoogleCloudStorageOAuth2Info), oauth2GoogleCloudStorage);
|
||||
}
|
||||
|
||||
#endregion Google Cloud Storage
|
||||
|
||||
#endregion File uploaders
|
||||
|
||||
#region URL shorteners
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -392,7 +392,7 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
|
|||
#region Google Cloud Storage
|
||||
|
||||
public OAuth2Info GoogleCloudStorageOAuth2Info = null;
|
||||
public string GoogleCloudStorageBucket = "";
|
||||
public string GoogleCloudStorageBucket = "cdn.riolu.com";
|
||||
|
||||
#endregion Google Cloud Storage
|
||||
|
||||
|
|
Loading…
Reference in a new issue