🔥 remove unused auth code
This commit is contained in:
parent
044827bcce
commit
42aad40454
2 changed files with 0 additions and 73 deletions
|
|
@ -1,62 +0,0 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
export async function setupAuth() {
|
||||
const session = await vscode.authentication.getSession("github", [], {
|
||||
createIfNone: true,
|
||||
});
|
||||
return session;
|
||||
}
|
||||
|
||||
export class ManualTokenAuthProvider implements vscode.AuthenticationProvider {
|
||||
constructor(
|
||||
public onDidChangeSessions: vscode.Event<vscode.AuthenticationProviderAuthenticationSessionsChangeEvent>,
|
||||
private readonly context: vscode.ExtensionContext,
|
||||
) {}
|
||||
|
||||
getSessions(
|
||||
scopes?: readonly string[] | undefined,
|
||||
): Thenable<readonly vscode.AuthenticationSession[]> {
|
||||
const sessions = this.context.globalState.get<
|
||||
vscode.AuthenticationSession[]
|
||||
>("continue.manualTokenSessions");
|
||||
return Promise.resolve(
|
||||
sessions?.filter((session) => {
|
||||
if (!scopes) {
|
||||
return true;
|
||||
}
|
||||
return !scopes.some((scope) => session.scopes.indexOf(scope) === -1);
|
||||
}) ?? [],
|
||||
);
|
||||
}
|
||||
async createSession(
|
||||
scopes: readonly string[],
|
||||
): Promise<vscode.AuthenticationSession> {
|
||||
const token = await vscode.window.showInputBox({
|
||||
prompt: "Enter your Continue user token",
|
||||
ignoreFocusOut: true,
|
||||
});
|
||||
|
||||
if (!token) {
|
||||
throw new Error("User canceled");
|
||||
}
|
||||
|
||||
const session: vscode.AuthenticationSession = {
|
||||
id: uuidv4(),
|
||||
accessToken: token,
|
||||
account: {
|
||||
id: token,
|
||||
label: token,
|
||||
},
|
||||
scopes: [],
|
||||
};
|
||||
return session;
|
||||
}
|
||||
removeSession(sessionId: string): Thenable<void> {
|
||||
return this.context.globalState.update(
|
||||
"continue.manualTokenSessions",
|
||||
(sessions: vscode.AuthenticationSession[] | undefined) =>
|
||||
sessions?.filter((session) => session.id !== sessionId),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,6 @@ import { VerticalPerLineDiffManager } from "../diff/verticalPerLine/manager";
|
|||
import { VsCodeIde } from "../ideProtocol";
|
||||
import { registerAllCodeLensProviders } from "../lang-server/codeLens";
|
||||
import { setupRemoteConfigSync } from "../stubs/activation";
|
||||
import { getUserToken } from "../stubs/auth";
|
||||
import { TabAutocompleteModel } from "../util/loadAutocompleteModel";
|
||||
import type { VsCodeWebviewProtocol } from "../webviewProtocol";
|
||||
import { VsCodeMessenger } from "./VsCodeMessenger";
|
||||
|
|
@ -117,16 +116,6 @@ export class VsCodeExtension {
|
|||
// Indexing + pause token
|
||||
this.diffManager.webviewProtocol = this.webviewProtocol;
|
||||
|
||||
if (
|
||||
!(
|
||||
remoteConfigServerUrl === null ||
|
||||
remoteConfigServerUrl === undefined ||
|
||||
remoteConfigServerUrl.trim() === ""
|
||||
)
|
||||
) {
|
||||
getUserToken().then((token) => {});
|
||||
}
|
||||
|
||||
// CodeLens
|
||||
const verticalDiffCodeLens = registerAllCodeLensProviders(
|
||||
context,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue