From f8c5ea1c909038dcce643a38688417cd117c8548 Mon Sep 17 00:00:00 2001 From: Nikita Iarychenko Date: Thu, 20 Mar 2025 14:37:43 +0400 Subject: [PATCH] OPENIDE #126 Hide option "Log in via Github" (cherry picked from commit 9e519d146e3b9c5897276f0c51129f087d8350a4) --- .../src/ru/openide/io/WhiteListUrls.kt | 4 ++- .../github/authentication/GHAccountsUtil.kt | 30 ++++++++----------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/platform/ide-core/src/ru/openide/io/WhiteListUrls.kt b/platform/ide-core/src/ru/openide/io/WhiteListUrls.kt index 5aaabf194ea6..c10a42abc7bf 100644 --- a/platform/ide-core/src/ru/openide/io/WhiteListUrls.kt +++ b/platform/ide-core/src/ru/openide/io/WhiteListUrls.kt @@ -59,7 +59,9 @@ object WhiteListUrls { "https://api.hsforms.com/submissions/v3/integration/submit/", "https://store.amplicode.ru", "https://ls.store.amplicode.ru", - "https://resources.openide.ru" + "https://resources.openide.ru", + "https://api.github.com", + "https://avatars.githubusercontent.com" ) // Collect urls from KnownSchemaIdentifiers.json diff --git a/plugins/github/github-core/src/org/jetbrains/plugins/github/authentication/GHAccountsUtil.kt b/plugins/github/github-core/src/org/jetbrains/plugins/github/authentication/GHAccountsUtil.kt index fa917e560bcc..deb3f9a893a4 100644 --- a/plugins/github/github-core/src/org/jetbrains/plugins/github/authentication/GHAccountsUtil.kt +++ b/plugins/github/github-core/src/org/jetbrains/plugins/github/authentication/GHAccountsUtil.kt @@ -1,4 +1,7 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// +// Modified by Nikita Iarychenko at 2025 as part of the OpenIDE project(https://openide.ru). +// Any modifications are available on the same license terms as the original source code. package org.jetbrains.plugins.github.authentication import com.intellij.collaboration.async.cancelledWith @@ -82,14 +85,6 @@ object GHAccountsUtil { internal fun createAddAccountActionGroup(model: GHLoginModel, project: Project, parentComponent: JComponent): ActionGroup { val group = DefaultActionGroup() - group.add( - DumbAwareAction.create(GithubBundle.message("action.Github.Accounts.AddGHAccount.text")) { - scopedDialog(project) { - GHLoginDialog.OAuth(model, project, this, parentComponent).apply { - setServer(GithubServerPath.DEFAULT_HOST, false) - } - }.showAndGet() - }) group.add( DumbAwareAction.create(GithubBundle.message("action.Github.Accounts.AddGHAccountWithToken.text")) { @@ -177,14 +172,15 @@ object GHAccountsUtil { @JvmStatic @ApiStatus.Internal fun login(model: GHLoginModel, request: GHLoginRequest, project: Project?, parentComponent: Component?) { - if (request.server != GithubServerPath.DEFAULT_SERVER) { - request.loginWithToken(model, project, parentComponent) - } - else when (request.authType) { - AuthorizationType.OAUTH -> request.loginWithOAuth(model, project, parentComponent) - AuthorizationType.TOKEN -> request.loginWithToken(model, project, parentComponent) - AuthorizationType.UNDEFINED -> request.loginWithOAuthOrToken(model, project, parentComponent) - } + //if (request.server != GithubServerPath.DEFAULT_SERVER) { + // request.loginWithToken(model, project, parentComponent) + //} + //else when (request.authType) { + // AuthorizationType.OAUTH -> request.loginWithOAuth(model, project, parentComponent) + // AuthorizationType.TOKEN -> request.loginWithToken(model, project, parentComponent) + // AuthorizationType.UNDEFINED -> request.loginWithOAuthOrToken(model, project, parentComponent) + //} + return request.loginWithToken(model, project, parentComponent) } }