Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
1bd34868
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1bd34868
编写于
7月 15, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove references to pkg and product and use productService
上级
27aebd40
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
10 deletion
+12
-10
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+2
-1
src/vs/platform/extensionManagement/node/extensionGalleryService.ts
...tform/extensionManagement/node/extensionGalleryService.ts
+7
-7
src/vs/platform/extensionManagement/test/node/extensionGalleryService.test.ts
...nsionManagement/test/node/extensionGalleryService.test.ts
+3
-2
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
1bd34868
...
@@ -26,6 +26,7 @@ import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainServ
...
@@ -26,6 +26,7 @@ import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainServ
import
{
endsWith
}
from
'
vs/base/common/strings
'
;
import
{
endsWith
}
from
'
vs/base/common/strings
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
pkg
from
'
vs/platform/product/node/package
'
;
const
RUN_TEXTMATE_IN_WORKER
=
false
;
const
RUN_TEXTMATE_IN_WORKER
=
false
;
...
@@ -309,7 +310,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
...
@@ -309,7 +310,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
private
handleMarketplaceRequests
():
void
{
private
handleMarketplaceRequests
():
void
{
// Resolve marketplace headers
// Resolve marketplace headers
this
.
marketplaceHeadersPromise
=
resolveMarketplaceHeaders
(
this
.
environmentService
,
this
.
fileService
);
this
.
marketplaceHeadersPromise
=
resolveMarketplaceHeaders
(
pkg
.
version
,
this
.
environmentService
,
this
.
fileService
);
// Inject headers when requests are incoming
// Inject headers when requests are incoming
const
urls
=
[
'
https://marketplace.visualstudio.com/*
'
,
'
https://*.vsassets.io/*
'
];
const
urls
=
[
'
https://marketplace.visualstudio.com/*
'
,
'
https://*.vsassets.io/*
'
];
...
...
src/vs/platform/extensionManagement/node/extensionGalleryService.ts
浏览文件 @
1bd34868
...
@@ -11,8 +11,6 @@ import { assign, getOrDefault } from 'vs/base/common/objects';
...
@@ -11,8 +11,6 @@ import { assign, getOrDefault } from 'vs/base/common/objects';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IPager
}
from
'
vs/base/common/paging
'
;
import
{
IPager
}
from
'
vs/base/common/paging
'
;
import
{
IRequestService
,
IRequestOptions
,
IRequestContext
,
asJson
,
asText
}
from
'
vs/platform/request/common/request
'
;
import
{
IRequestService
,
IRequestOptions
,
IRequestContext
,
asJson
,
asText
}
from
'
vs/platform/request/common/request
'
;
import
pkg
from
'
vs/platform/product/node/package
'
;
import
product
from
'
vs/platform/product/node/product
'
;
import
{
isEngineValid
}
from
'
vs/platform/extensions/node/extensionValidator
'
;
import
{
isEngineValid
}
from
'
vs/platform/extensions/node/extensionValidator
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
generateUuid
,
isUUID
}
from
'
vs/base/common/uuid
'
;
import
{
generateUuid
,
isUUID
}
from
'
vs/base/common/uuid
'
;
...
@@ -24,6 +22,7 @@ import { IFileService } from 'vs/platform/files/common/files';
...
@@ -24,6 +22,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/product
'
;
interface
IRawGalleryExtensionFile
{
interface
IRawGalleryExtensionFile
{
assetType
:
string
;
assetType
:
string
;
...
@@ -339,11 +338,12 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
...
@@ -339,11 +338,12 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
@
IEnvironmentService
private
readonly
environmentService
:
IEnvironmentService
,
@
IEnvironmentService
private
readonly
environmentService
:
IEnvironmentService
,
@
ITelemetryService
private
readonly
telemetryService
:
ITelemetryService
,
@
ITelemetryService
private
readonly
telemetryService
:
ITelemetryService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
@
IProductService
productService
:
IProductService
,
)
{
)
{
const
config
=
product
.
extensionsGallery
;
const
config
=
product
Service
.
extensionsGallery
;
this
.
extensionsGalleryUrl
=
config
&&
config
.
serviceUrl
;
this
.
extensionsGalleryUrl
=
config
&&
config
.
serviceUrl
;
this
.
extensionsControlUrl
=
config
&&
config
.
controlUrl
;
this
.
extensionsControlUrl
=
config
&&
config
.
controlUrl
;
this
.
commonHeadersPromise
=
resolveMarketplaceHeaders
(
this
.
environmentService
,
this
.
fileService
);
this
.
commonHeadersPromise
=
resolveMarketplaceHeaders
(
productService
.
version
,
this
.
environmentService
,
this
.
fileService
);
}
}
private
api
(
path
=
''
):
string
{
private
api
(
path
=
''
):
string
{
...
@@ -774,7 +774,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
...
@@ -774,7 +774,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
}
}
}
}
export
async
function
resolveMarketplaceHeaders
(
environmentService
:
IEnvironmentService
,
fileService
:
IFileService
):
Promise
<
{
[
key
:
string
]:
string
;
}
>
{
export
async
function
resolveMarketplaceHeaders
(
version
:
string
,
environmentService
:
IEnvironmentService
,
fileService
:
IFileService
):
Promise
<
{
[
key
:
string
]:
string
;
}
>
{
const
marketplaceMachineIdFile
=
URI
.
file
(
path
.
join
(
environmentService
.
userDataPath
,
'
machineid
'
));
const
marketplaceMachineIdFile
=
URI
.
file
(
path
.
join
(
environmentService
.
userDataPath
,
'
machineid
'
));
let
uuid
:
string
|
null
=
null
;
let
uuid
:
string
|
null
=
null
;
...
@@ -796,8 +796,8 @@ export async function resolveMarketplaceHeaders(environmentService: IEnvironment
...
@@ -796,8 +796,8 @@ export async function resolveMarketplaceHeaders(environmentService: IEnvironment
}
}
}
}
return
{
return
{
'
X-Market-Client-Id
'
:
`VSCode
${
pkg
.
version
}
`
,
'
X-Market-Client-Id
'
:
`VSCode
${
version
}
`
,
'
User-Agent
'
:
`VSCode
${
pkg
.
version
}
`
,
'
User-Agent
'
:
`VSCode
${
version
}
`
,
'
X-Market-User-Id
'
:
uuid
'
X-Market-User-Id
'
:
uuid
};
};
}
}
\ No newline at end of file
src/vs/platform/extensionManagement/test/node/extensionGalleryService.test.ts
浏览文件 @
1bd34868
...
@@ -18,6 +18,7 @@ import { FileService } from 'vs/platform/files/common/fileService';
...
@@ -18,6 +18,7 @@ import { FileService } from 'vs/platform/files/common/fileService';
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
DiskFileSystemProvider
}
from
'
vs/platform/files/node/diskFileSystemProvider
'
;
import
{
DiskFileSystemProvider
}
from
'
vs/platform/files/node/diskFileSystemProvider
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
pkg
from
'
vs/platform/product/node/package
'
;
suite
(
'
Extension Gallery Service
'
,
()
=>
{
suite
(
'
Extension Gallery Service
'
,
()
=>
{
const
parentDir
=
getRandomTestPath
(
os
.
tmpdir
(),
'
vsctests
'
,
'
extensiongalleryservice
'
);
const
parentDir
=
getRandomTestPath
(
os
.
tmpdir
(),
'
vsctests
'
,
'
extensiongalleryservice
'
);
...
@@ -52,10 +53,10 @@ suite('Extension Gallery Service', () => {
...
@@ -52,10 +53,10 @@ suite('Extension Gallery Service', () => {
const
args
=
[
'
--user-data-dir
'
,
marketplaceHome
];
const
args
=
[
'
--user-data-dir
'
,
marketplaceHome
];
const
environmentService
=
new
EnvironmentService
(
parseArgs
(
args
),
process
.
execPath
);
const
environmentService
=
new
EnvironmentService
(
parseArgs
(
args
),
process
.
execPath
);
return
resolveMarketplaceHeaders
(
environmentService
,
fileService
).
then
(
headers
=>
{
return
resolveMarketplaceHeaders
(
pkg
.
version
,
environmentService
,
fileService
).
then
(
headers
=>
{
assert
.
ok
(
isUUID
(
headers
[
'
X-Market-User-Id
'
]));
assert
.
ok
(
isUUID
(
headers
[
'
X-Market-User-Id
'
]));
return
resolveMarketplaceHeaders
(
environmentService
,
fileService
).
then
(
headers2
=>
{
return
resolveMarketplaceHeaders
(
pkg
.
version
,
environmentService
,
fileService
).
then
(
headers2
=>
{
assert
.
equal
(
headers
[
'
X-Market-User-Id
'
],
headers2
[
'
X-Market-User-Id
'
]);
assert
.
equal
(
headers
[
'
X-Market-User-Id
'
],
headers2
[
'
X-Market-User-Id
'
]);
});
});
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录