diff --git a/deadlock-plugins/deadlock-extension/src/core/controller.ts b/deadlock-plugins/deadlock-extension/src/core/controller.ts index 2877d4c59bee0e91c57d8a20ff73123b3ec243fa..25fe14e32fdce903603a1b7a79bfefd8759ab31d 100644 --- a/deadlock-plugins/deadlock-extension/src/core/controller.ts +++ b/deadlock-plugins/deadlock-extension/src/core/controller.ts @@ -1,5 +1,6 @@ import * as vscode from 'vscode'; import { KEYCLOAK_DEVICE_AUTH_URL, KEYCLOAK_TOKEN_CREATE_URL, KEYCLOAK_USER_INFO_URL } from '../config'; +import { copyProjectSources, log } from '../recorder/utils'; import { OPEN_GETTING_STARTED_COMMAND } from '../theia/command'; import BriefingView from '../view/briefingView'; import GettingStartedView from '../view/gettingStartedView'; @@ -32,6 +33,7 @@ export default class Controller { handleUri(uri: vscode.Uri) { const queryParams: URLSearchParams = new URLSearchParams(uri.query); const action: string | null = queryParams.get('action'); + log('Opening link', uri); switch (action) { case 'open-challenge': @@ -96,12 +98,21 @@ export default class Controller { const hadBeenConnected = (await this.extensionStore.getAccessToken()) !== undefined; if (!hadBeenConnected) { - this.authenticate(); + await this.authenticate(); vscode.window.showInformationMessage('Nouvelle connexion validée'); } else { vscode.window.showInformationMessage('Déjà connecté: session récupérée'); } - + await copyProjectSources( + 'Documents/deadlock-challenges/resources/code_desktop_exemple', + this.extensionStore.getMissionWorkdir()!, + ).catch((e) => { + log(e); + }); + await vscode.commands.executeCommand( + 'remote-containers.openFolder', + vscode.Uri.file(this.extensionStore.getMissionWorkdir()!), + ); vscode.commands.executeCommand(OPEN_GETTING_STARTED_COMMAND.cmd); } }