-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firebase token file sync #801
Changes from 4 commits
16e7225
7ee1442
7e46b02
5c958a3
6dfc071
a79cfce
73f1264
102fe4e
09b7949
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
import { tabNineProcess } from "../binary/requests/requests"; | ||
import { openLogin, openLogout } from "../cloudEnvs/authentication.api"; | ||
import isCloudEnv from "../cloudEnvs/isCloudEnv"; | ||
|
||
export function callForLogin(): Promise<unknown> { | ||
if (isCloudEnv) { | ||
return openLogin(); | ||
} | ||
return tabNineProcess.request({ Login: {} }); | ||
} | ||
|
||
export async function callForLogout(): Promise<unknown> { | ||
if (isCloudEnv) { | ||
return openLogout(); | ||
} | ||
return tabNineProcess.request({ Logout: {} }); | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,24 @@ | ||||||
import { env, Uri } from "vscode"; | ||||||
import { configuration } from "../binary/requests/requests"; | ||||||
import { StateType } from "../globals/consts"; | ||||||
|
||||||
export async function openLogin(): Promise<void> { | ||||||
return openBinaryConfig("sign_in"); | ||||||
} | ||||||
|
||||||
export async function openLogout(): Promise<void> { | ||||||
return openBinaryConfig("sign_out"); | ||||||
} | ||||||
|
||||||
async function openBinaryConfig(url: string): Promise<void> { | ||||||
const config = await configuration({ quiet: true, source: StateType.AUTH }); | ||||||
if (config && config.message) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace with
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. amogus |
||||||
const localUri = await env.asExternalUri(Uri.parse(config.message)); | ||||||
|
||||||
await env.openExternal( | ||||||
localUri.with({ | ||||||
path: `${localUri.path}/${url}`, | ||||||
}) | ||||||
); | ||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,7 +3,7 @@ import * as os from "os"; | |||||
|
||||||
export const TABNINE_CONFIG_DIR = path.join(os.homedir(), ".config", "TabNine"); | ||||||
|
||||||
export const TABNINE_TOKEN_FILE_NAME = "tabnine.token"; | ||||||
export const TABNINE_TOKEN_FILE_NAME = ".refresh_token_v2"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace with
Suggested change
|
||||||
|
||||||
export const TABNINE_TOKEN_FILE_PATH = path.join( | ||||||
TABNINE_CONFIG_DIR, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with