Skip to content

Commit

Permalink
proxy support for extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Nov 19, 2015
1 parent c703e36 commit 612efb5
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { download } from 'vs/base/node/request';
import { IWorkspaceContextService } from 'vs/workbench/services/workspace/common/contextService';
import { Limiter } from 'vs/base/common/async';
import Event, { Emitter } from 'vs/base/common/event';
import { manager as Settings } from 'vs/workbench/electron-main/settings';

function parseManifest(raw: string): TPromise<IExtensionManifest> {
return new Promise((c, e) => {
Expand Down Expand Up @@ -115,12 +116,15 @@ export class ExtensionsService implements IExtensionsService {
return TPromise.wrapError(new Error(nls.localize('missingGalleryInformation', "Gallery information is missing")));
}

const httpProxySettings = Settings.getValue('http.proxy');
const getAgent = url => httpProxySettings ? getProxyAgent(url, httpProxySettings) : getSystemProxyAgent(url);

const url = `${ galleryInformation.galleryApiUrl }/publisher/${ extension.publisher }/extension/${ extension.name }/latest/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage?install=true`;
const zipPath = path.join(tmpdir(), galleryInformation.id);
const extensionPath = path.join(this.extensionsPath, `${ extension.publisher }.${ extension.name }`);
const manifestPath = path.join(extensionPath, 'package.json');

return download(zipPath, { url })
return download(zipPath, { url: url, agent: getAgent(url) })
.then(() => validate(zipPath, extension))
.then(manifest => { this._onInstallExtension.fire(manifest); return manifest; })
.then(manifest => extract(zipPath, extensionPath, { sourcePath: 'extension', overwrite: true }).then(() => manifest))
Expand Down

0 comments on commit 612efb5

Please sign in to comment.