public static void Init() { if (isInitialized) { return; } // make sure the api url is set correctly before attempting to log in RefreshApiUrlSetting(); if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load()) { APIUser.FetchCurrentUser((c) => AnalyticsSDK.LoggedInUserChanged(c.Model as APIUser), null); } clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath(); if (string.IsNullOrEmpty(clientInstallPath)) { clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath(); } signingIn = false; isInitialized = true; VRCContentManagerWindow.ClearContent(); }
protected override IEnumerator UpdateBlueprint() { bool doneUploading = false; apiAvatar.name = blueprintName.text; apiAvatar.description = blueprintDescription.text; apiAvatar.assetUrl = cloudFrontAssetUrl; apiAvatar.releaseStatus = sharePublic.isOn ? "public" : "private"; apiAvatar.tags = BuildTags(); apiAvatar.unityPackageUrl = cloudFrontUnityPackageUrl; if (shouldUpdateImageToggle.isOn) { yield return(StartCoroutine(UpdateImage(isUpdate ? apiAvatar.imageUrl : "", GetFriendlyAvatarFileName("Image")))); apiAvatar.imageUrl = cloudFrontImageUrl; } SetUploadProgress("Saving Avatar", "Almost finished!!", 0.8f); apiAvatar.Save( (c) => { AnalyticsSDK.AvatarUploaded(apiAvatar, true); doneUploading = true; }, (c) => { Debug.LogError(c.Error); SetUploadProgress("Saving Avatar", "Error saving blueprint.", 0.0f); doneUploading = true; }); while (!doneUploading) { yield return(null); } }
public static void Init() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (isInitialized) { return; } if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load()) { APIUser.Login((user) => AnalyticsSDK.LoggedInUserChanged(user), null); } clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath(); if (string.IsNullOrEmpty(clientInstallPath)) { clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath(); } signingIn = false; isInitialized = true; }
private static void SignIn(bool explicitAttempt) { lock (syncObject) { if (signingIn || APIUser.IsLoggedInWithCredentials || (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) || (!explicitAttempt && string.IsNullOrEmpty(storedPassword))) { return; } signingIn = true; } Init(); APIUser.Login(username, password, delegate(ApiModelContainer <APIUser> c) { APIUser user = c.Model as APIUser; if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"]); } signingIn = false; error = null; storedUsername = username; storedPassword = password; AnalyticsSDK.LoggedInUserChanged(user); if (!APIUser.CurrentUser.canPublishAllContent) { if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id) { UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id); VRC_SdkControlPanel.ShowContentPublishPermissionsDialog(); } } refreshWindow = true; }, delegate(ApiModelContainer <APIUser> c) { signingIn = false; storedUsername = null; storedPassword = null; error = c.Error; VRC.Tools.ClearCookies(); APIUser.Logout(); refreshWindow = true; VRC.Core.Logger.Log("Error logging in: " + error); } ); }
protected override IEnumerator CreateBlueprint() { yield return(StartCoroutine(UpdateImage(isUpdate ? worldRecord.imageUrl : "", GetFriendlyWorldFileName("Image")))); SetUploadProgress("Saving Blueprint to user", "Almost finished!!", 0.0f); ApiWorld world = new ApiWorld(); world.Init( pipelineManager.user, blueprintName.text, cloudFrontImageUrl, cloudFrontAssetUrl, blueprintDescription.text, (releasePublic.isOn) ? ("public") : ("private"), System.Convert.ToInt16(worldCapacity.text), BuildTags(), 0, cloudFrontPluginUrl, cloudFrontUnityPackageUrl ); world.id = pipelineManager.blueprintId; if (APIUser.CurrentUser.developerType > APIUser.DeveloperType.None) { world.isCurated = contentFeatured.isOn || contentSDKExample.isOn; } else { world.isCurated = false; } bool doneUploading = false; world.SaveAndAddToUser(false, delegate(ApiModel model) { ApiWorld savedBP = (ApiWorld)model; // pipelineManager.blueprintId = savedBP.id; UnityEditor.EditorPrefs.SetString("blueprintID-" + pipelineManager.GetInstanceID().ToString(), savedBP.id); Debug.Log("Setting blueprintID on pipeline manager and editor prefs"); AnalyticsSDK.WorldUploaded(model, false); doneUploading = true; }, delegate(string error) { Debug.LogError(error); doneUploading = true; }); while (!doneUploading) { yield return(null); } }
private static void AttemptLogin() { APIUser.Login(username, password, delegate(ApiModelContainer <APIUser> c) { APIUser user = c.Model as APIUser; if (c.Cookies.ContainsKey("twoFactorAuth")) { ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"], c.Cookies["twoFactorAuth"]); } else if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"]); } else { ApiCredentials.SetHumanName(user.username); } signingIn = false; error = null; storedUsername = null; storedPassword = null; AnalyticsSDK.LoggedInUserChanged(user); if (!APIUser.CurrentUser.canPublishAllContent) { if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id) { UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id); VRCSdkControlPanel.ShowContentPublishPermissionsDialog(); } } }, delegate(ApiModelContainer <APIUser> c) { Logout(); error = c.Error; VRC.Core.Logger.Log("Error logging in: " + error); }, delegate(ApiModelContainer <API2FA> c) { if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(username, username, "vrchat", c.Cookies["auth"]); } showTwoFactorAuthenticationEntry = true; onAuthenticationVerifiedAction = OnAuthenticationCompleted; } ); }
private static void Login() { APIUser.Login(username, password, delegate(ApiModelContainer <APIUser> c) { APIUser user = c.Model as APIUser; if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"]); } else { ApiCredentials.SetHumanName(user.username); } signingIn = false; error = null; storedUsername = username; storedPassword = password; AnalyticsSDK.LoggedInUserChanged(user); if (!APIUser.CurrentUser.canPublishAllContent) { if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id) { UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id); VRC_SdkControlPanel.ShowContentPublishPermissionsDialog(); } } refreshWindow = true; }, delegate(ApiModelContainer <APIUser> c) { Logout(); error = c.Error; VRC.Core.Logger.Log("Error logging in: " + error); }, delegate(ApiModelContainer <API2FA> c) { API2FA model2FA = c.Model as API2FA; if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(username, username, "vrchat", c.Cookies["auth"]); } enter2faWindow = EditorWindow.GetWindow <Enter2faCodeEditorWindow>("VRChat 2FA"); enter2faWindow.SetCredentialsAndVerificationHandling(username, password, OnAuthenticationCompleted); enter2faWindow.Show(); } ); }
protected override IEnumerator CreateBlueprint() { yield return(StartCoroutine(UpdateImage(isUpdate ? apiAvatar.imageUrl : "", GetFriendlyAvatarFileName("Image")))); ApiAvatar avatar = new ApiAvatar { id = pipelineManager.blueprintId, authorName = pipelineManager.user.displayName, authorId = pipelineManager.user.id, name = blueprintName.text, imageUrl = cloudFrontImageUrl, assetUrl = cloudFrontAssetUrl, description = blueprintDescription.text, tags = BuildTags(), unityPackageUrl = cloudFrontUnityPackageUrl, releaseStatus = sharePublic.isOn ? "public" : "private" }; bool doneUploading = false; bool wasError = false; avatar.Post( (c) => { ApiAvatar savedBP = (ApiAvatar)c.Model; pipelineManager.blueprintId = savedBP.id; UnityEditor.EditorPrefs.SetString("blueprintID-" + pipelineManager.GetInstanceID().ToString(), savedBP.id); AnalyticsSDK.AvatarUploaded(savedBP, false); doneUploading = true; }, (c) => { Debug.LogError(c.Error); SetUploadProgress("Saving Avatar", "Error saving blueprint.", 0.0f); doneUploading = true; wasError = true; }); while (!doneUploading) { yield return(null); } if (wasError) { yield return(new WaitUntil(() => UnityEditor.EditorUtility.DisplayDialog("VRChat SDK", "Error saving blueprint.", "Okay"))); } }
private static void SignIn(bool explicitAttempt) { lock (syncObject) { if (signingIn || APIUser.IsLoggedInWithCredentials || (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) || (!explicitAttempt && string.IsNullOrEmpty(storedPassword))) { return; } signingIn = true; } Init(); ApiCredentials.Clear(); ApiCredentials.SetUser(username, password); APIUser.Login( delegate(APIUser user) { signingIn = false; error = null; storedUsername = username; storedPassword = password; AnalyticsSDK.LoggedInUserChanged(user); if (!APIUser.CurrentUser.canPublishAllContent) { if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id) { UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id); VRC_SdkControlPanel.ShowContentPublishPermissionsDialog(); } } }, delegate(string message) { signingIn = false; storedUsername = null; storedPassword = null; error = message; APIUser.Logout(); VRC.Core.Logger.Log("Error logging in: " + message); } ); }
protected override IEnumerator UpdateBlueprint() { bool doneUploading = false; worldRecord.name = blueprintName.text; worldRecord.description = blueprintDescription.text; worldRecord.capacity = System.Convert.ToInt16(worldCapacity.text); worldRecord.assetUrl = cloudFrontAssetUrl; worldRecord.pluginUrl = cloudFrontPluginUrl; worldRecord.tags = BuildTags(); worldRecord.releaseStatus = (releasePublic.isOn) ? ("public") : ("private"); worldRecord.unityPackageUrl = cloudFrontUnityPackageUrl; worldRecord.UpdateVersionAndPlatform(); worldRecord.isCurated = contentFeatured.isOn || contentSDKExample.isOn; if (shouldUpdateImageToggle.isOn) { yield return(StartCoroutine(UpdateImage(isUpdate ? worldRecord.imageUrl : "", GetFriendlyWorldFileName("Image")))); worldRecord.imageUrl = cloudFrontImageUrl; SetUploadProgress("Saving Blueprint", "Almost finished!!", 0.0f); worldRecord.Save(true, delegate(ApiModel model) { AnalyticsSDK.WorldUploaded(model, true); doneUploading = true; }); } else { SetUploadProgress("Saving Blueprint", "Almost finished!!", 0.0f); worldRecord.Save(true, delegate(ApiModel model) { AnalyticsSDK.WorldUploaded(model, true); doneUploading = true; }); } while (!doneUploading) { yield return(null); } }
private static bool VerifyCredentials() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init((Action)null, (Action)null); } if (!APIUser.get_IsLoggedInWithCredentials() && ApiCredentials.Load()) { APIUser.FetchCurrentUser((Action <ApiModelContainer <APIUser> >) delegate(ApiModelContainer <APIUser> c) { AnalyticsSDK.LoggedInUserChanged(c.get_Model() as APIUser); }, (Action <ApiModelContainer <APIUser> >)null); } if (!APIUser.get_IsLoggedInWithCredentials()) { GUILayout.Label("Please use the \"VRChat SDK/Settings\" window to log in.", EditorStyles.get_boldLabel(), (GUILayoutOption[])new GUILayoutOption[0]); return(false); } return(true); }
protected override IEnumerator CreateBlueprint() { yield return(StartCoroutine(UpdateImage(isUpdate ? apiAvatar.imageUrl : "", GetFriendlyAvatarFileName("Image")))); ApiAvatar avatar = new ApiAvatar(); avatar.Init( pipelineManager.user, blueprintName.text, cloudFrontImageUrl, cloudFrontAssetUrl, blueprintDescription.text, sharePublic.isOn ? "public" : "private", BuildTags(), cloudFrontUnityPackageUrl ); avatar.id = pipelineManager.blueprintId; bool doneUploading = false; avatar.Save(false, delegate(ApiModel model) { ApiAvatar savedBP = (ApiAvatar)model; pipelineManager.blueprintId = savedBP.id; UnityEditor.EditorPrefs.SetString("blueprintID-" + pipelineManager.GetInstanceID().ToString(), savedBP.id); AnalyticsSDK.AvatarUploaded(model, false); doneUploading = true; }, delegate(string error) { Debug.LogError(error); doneUploading = true; }); while (!doneUploading) { yield return(null); } }
protected override IEnumerator UpdateBlueprint() { bool doneUploading = false; apiAvatar.name = blueprintName.text; apiAvatar.description = blueprintDescription.text; apiAvatar.assetUrl = cloudFrontAssetUrl; apiAvatar.releaseStatus = sharePublic.isOn ? "public" : "private"; apiAvatar.tags = BuildTags(); apiAvatar.unityPackageUrl = cloudFrontUnityPackageUrl; apiAvatar.UpdateVersionAndPlatform(); if (shouldUpdateImageToggle.isOn) { yield return(StartCoroutine(UpdateImage(isUpdate ? apiAvatar.imageUrl : "", GetFriendlyAvatarFileName("Image")))); apiAvatar.imageUrl = cloudFrontImageUrl; SetUploadProgress("Saving Avatar", "Almost finished!!", 0.8f); apiAvatar.Save(true, delegate(ApiModel model) { AnalyticsSDK.AvatarUploaded(model, true); doneUploading = true; }); } else { SetUploadProgress("Saving Avatar", "Almost finished!!", 0.8f); apiAvatar.Save(true, delegate(ApiModel model) { AnalyticsSDK.AvatarUploaded(model, true); doneUploading = true; }); } while (!doneUploading) { yield return(null); } }
private static void SignIn(bool explicitAttempt) { lock (syncObject) { if (signingIn || APIUser.IsLoggedInWithCredentials || (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) || (!explicitAttempt && string.IsNullOrEmpty(storedPassword))) { return; } signingIn = true; } Init(); ApiCredentials.Clear(); ApiCredentials.SetUser(username, password); APIUser.Login( delegate(APIUser user) { signingIn = false; error = null; storedUsername = username; storedPassword = password; AnalyticsSDK.LoggedInUserChanged(user); }, delegate(string message) { signingIn = false; storedUsername = null; storedPassword = null; error = message; APIUser.Logout(); VRC.Core.Logger.Log("Error logging in: " + message); } ); }
public static void InitAccount() { if (isInitialized) { return; } if (!APIUser.IsLoggedIn && ApiCredentials.Load()) { APIUser.FetchCurrentUser((c) => AnalyticsSDK.LoggedInUserChanged(c.Model as APIUser), null); } clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath(); if (string.IsNullOrEmpty(clientInstallPath)) { clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath(); } signingIn = false; isInitialized = true; ClearContent(); }
private static void AttemptLogin(string username = null, string password = null, Action successcallback = null) { if (selected_user_index >= add_index && (username == null || password == null)) { return; } if (username == null) { username = usernames[selected_user_index]; } if (password == null) { password = p_passwords[selected_user_index]; } signingIn = true; APIUser.Login(username, password, delegate(ApiModelContainer <APIUser> c) { APIUser user = c.Model as APIUser; if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"]); } else { ApiCredentials.SetHumanName(user.username); } signingIn = false; error = null; EditorPrefs.SetString("sdk#username", username); EditorPrefs.SetString("sdk#password", password); AnalyticsSDK.LoggedInUserChanged(user); if (!APIUser.CurrentUser.canPublishAllContent) { if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id) { UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id); VRCSdkControlPanel.ShowContentPublishPermissionsDialog(); } } ; if (successcallback != null) { successcallback.Invoke(); } AS_Window.RepaintActiveWindow(); }, delegate(ApiModelContainer <APIUser> c) { Logout(false); error = c.Error; VRC.Core.Logger.Log("Error logging in: " + error); AS_Window.RepaintActiveWindow(); }, delegate(ApiModelContainer <API2FA> c) { if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(username, username, "vrchat", c.Cookies["auth"]); } AS_Window.showTwoFactorAuthenticationEntry = true; onAuthenticationVerifiedAction = OnAuthenticationCompleted; AS_Window.RepaintActiveWindow(); } ); }