diff --git a/libs/remix-git/src/isogit.ts b/libs/remix-git/src/isogit.ts index d7b0e0eb60..be3230973c 100644 --- a/libs/remix-git/src/isogit.ts +++ b/libs/remix-git/src/isogit.ts @@ -161,7 +161,7 @@ const getAuthor = async (input, plugin: any) => { } -const getGitHubUser = async (input: { token: string }): Promise<{ +const getGitHubUser = async(input: { token: string }): Promise<{ user: GitHubUser, emails: userEmails, scopes: string[] @@ -171,17 +171,22 @@ const getGitHubUser = async (input: { token: string }): Promise<{ auth: input.token }) - const user = await octokit.request('GET /user') + const user = await octokit.request('GET /user', { + headers: { + 'X-GitHub-Api-Version': '2022-11-28' + } + }) const emails = await octokit.request('GET /user/emails') const scopes = user.headers['x-oauth-scopes'] || '' - console.log('USER', user.data) - return { - user: user.data, + user: { + ...user.data, isConnected: + user.data.login !== undefined && user.data.login !== null && user.data.login !== '' + }, emails: emails.data, - scopes: scopes && scopes.split(',') + scopes: scopes && scopes.split(',').map(scope => scope.trim()) } } catch (e) { return null diff --git a/libs/remix-ui/app/src/lib/remix-app/actions/app.ts b/libs/remix-ui/app/src/lib/remix-app/actions/app.ts index 20932eef6c..9822635e1e 100644 --- a/libs/remix-ui/app/src/lib/remix-app/actions/app.ts +++ b/libs/remix-ui/app/src/lib/remix-app/actions/app.ts @@ -1,4 +1,4 @@ -import { GitHubUser } from '@remix-ui/git'; +import { GitHubUser } from '@remix-api'; import { AppModal } from '../interface' type ActionMap = { diff --git a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts index dc6e453edc..b1cee75257 100644 --- a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts +++ b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts @@ -1,4 +1,4 @@ -import { GitHubUser } from '@remix-ui/git' +import { GitHubUser } from '@remix-api' import { ModalTypes } from '../types' export type ValidationResult = { diff --git a/libs/remix-ui/app/src/lib/remix-app/state/app.ts b/libs/remix-ui/app/src/lib/remix-app/state/app.ts index 417911ae0c..1e76098bdc 100644 --- a/libs/remix-ui/app/src/lib/remix-app/state/app.ts +++ b/libs/remix-ui/app/src/lib/remix-app/state/app.ts @@ -1,4 +1,4 @@ -import { GitHubUser } from "@remix-ui/git"; +import { GitHubUser } from "@remix-api"; import { AppState } from "../interface"; export const appInitialState: AppState = { diff --git a/libs/remix-ui/git/src/lib/gitactions.ts b/libs/remix-ui/git/src/lib/gitactions.ts index ce410e653b..7505501118 100644 --- a/libs/remix-ui/git/src/lib/gitactions.ts +++ b/libs/remix-ui/git/src/lib/gitactions.ts @@ -8,7 +8,6 @@ import { ModalTypes, appActionTypes, AppAction } from "@remix-ui/app"; import { sendToMatomo, setFileDecorators } from "./pluginActions"; import { Plugin } from "@remixproject/engine"; import { addInputType, branch, branchDifference, checkoutInputType, cloneInputType, commitChange, CustomRemixApi, fetchInputType, GitHubUser, pullInputType, pushInputType, remote, rmInputType, userEmails } from "@remix-api"; -import { app } from "electron"; export const fileStatuses = [ ["new,untracked", 0, 2, 0], // new, untracked diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index f6bf6d4184..215bc019f3 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -17,7 +17,8 @@ import { customAction } from '@remixproject/plugin-api' import { AppContext, appPlatformTypes, platformContext } from '@remix-ui/app' import { ElectronMenu } from './components/electron-menu' import { ElectronWorkspaceName } from './components/electron-workspace-name' -import { branch, GitHubUser, gitUIPanels, userEmails } from '@remix-ui/git' +import { branch } from '@remix-api' +import { gitUIPanels } from '@remix-ui/git' const _paq = (window._paq = window._paq || []) diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index 32e4d05d98..214c1196b2 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -6,7 +6,7 @@ import { RemixAppManager } from 'libs/remix-ui/plugin-manager/src/types' import { ViewPlugin } from '@remixproject/engine-web' import { appPlatformTypes } from '@remix-ui/app' import { Placement } from 'react-bootstrap/esm/Overlay' -import { branch, GitHubUser } from '@remix-ui/git' +import { branch } from '@remix-api' export type action = { name: string, type?: Array, path?: string[], extension?: string[], pattern?: string[], id: string, multiselect: boolean, label: string, sticky?: boolean, group: number, platform?: appPlatformTypes } export interface JSONStandardInput {