mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
- send auth session
- prepare credentials from auth session
This commit is contained in:
@@ -369,32 +369,17 @@ async function handleRoot(req, res) {
|
||||
webConfigJSON._wrapWebWorkerExtHostInIframe = true;
|
||||
}
|
||||
|
||||
const credentials = [];
|
||||
if (args['github-auth']) {
|
||||
const sessionId = uuid.v4();
|
||||
credentials.push({
|
||||
service: 'code-oss.login',
|
||||
account: 'account',
|
||||
password: JSON.stringify({
|
||||
id: sessionId,
|
||||
providerId: 'github',
|
||||
accessToken: args['github-auth']
|
||||
})
|
||||
}, {
|
||||
service: 'code-oss-github.login',
|
||||
account: 'account',
|
||||
password: JSON.stringify([{
|
||||
id: sessionId,
|
||||
scopes: ['user:email'],
|
||||
accessToken: args['github-auth']
|
||||
}])
|
||||
});
|
||||
}
|
||||
const authSessionInfo = args['github-auth'] ? {
|
||||
id: uuid.v4(),
|
||||
providerId: 'github',
|
||||
accessToken: args['github-auth'],
|
||||
scopes: [['user:email'], ['repo']]
|
||||
} : undefined;
|
||||
|
||||
const data = (await readFile(WEB_MAIN)).toString()
|
||||
.replace('{{WORKBENCH_WEB_CONFIGURATION}}', () => escapeAttribute(JSON.stringify(webConfigJSON))) // use a replace function to avoid that regexp replace patterns ($&, $0, ...) are applied
|
||||
.replace('{{WORKBENCH_BUILTIN_EXTENSIONS}}', () => escapeAttribute(JSON.stringify(dedupedBuiltInExtensions)))
|
||||
.replace('{{WORKBENCH_CREDENTIALS}}', () => escapeAttribute(JSON.stringify(credentials)))
|
||||
.replace('{{WORKBENCH_AUTH_SESSION}}', () => authSessionInfo ? escapeAttribute(JSON.stringify(authSessionInfo)) : '')
|
||||
.replace('{{WEBVIEW_ENDPOINT}}', '');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user