Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
14f40b4c
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
14f40b4c
编写于
11月 03, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ipc: remove vscode:setHeaders
#10587
上级
caef03e4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
33 deletion
+38
-33
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+16
-0
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+0
-14
src/vs/platform/environment/common/http.ts
src/vs/platform/environment/common/http.ts
+16
-0
src/vs/platform/extensionManagement/node/extensionGalleryService.ts
...tform/extensionManagement/node/extensionGalleryService.ts
+6
-10
src/vs/workbench/electron-browser/integration.ts
src/vs/workbench/electron-browser/integration.ts
+0
-9
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
14f40b4c
...
@@ -16,6 +16,7 @@ import { ILogService } from 'vs/code/electron-main/log';
...
@@ -16,6 +16,7 @@ import { ILogService } from 'vs/code/electron-main/log';
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
parseArgs
,
ParsedArgs
}
from
'
vs/platform/environment/node/argv
'
;
import
{
parseArgs
,
ParsedArgs
}
from
'
vs/platform/environment/node/argv
'
;
import
product
from
'
vs/platform/product
'
;
import
product
from
'
vs/platform/product
'
;
import
{
getCommonHTTPHeaders
}
from
'
vs/platform/environment/common/http
'
;
export
interface
IWindowState
{
export
interface
IWindowState
{
width
?:
number
;
width
?:
number
;
...
@@ -180,6 +181,21 @@ export class VSCodeWindow {
...
@@ -180,6 +181,21 @@ export class VSCodeWindow {
this
.
_win
=
new
BrowserWindow
(
options
);
this
.
_win
=
new
BrowserWindow
(
options
);
this
.
_id
=
this
.
_win
.
id
;
this
.
_id
=
this
.
_win
.
id
;
// TODO@joao: hook this up to some initialization routine
// this causes a race between setting the headers and doing
// a request that needs them. chances are low
getCommonHTTPHeaders
().
done
(
headers
=>
{
if
(
!
this
.
_win
)
{
return
;
}
const
urls
=
[
'
https://marketplace.visualstudio.com/*
'
,
'
https://*.vsassets.io/*
'
];
this
.
_win
.
webContents
.
session
.
webRequest
.
onBeforeSendHeaders
({
urls
},
(
details
,
cb
)
=>
{
cb
({
cancel
:
false
,
requestHeaders
:
objects
.
assign
(
details
.
requestHeaders
,
headers
)
});
});
});
if
(
isFullscreenOrMaximized
)
{
if
(
isFullscreenOrMaximized
)
{
this
.
win
.
maximize
();
this
.
win
.
maximize
();
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
14f40b4c
...
@@ -232,20 +232,6 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
...
@@ -232,20 +232,6 @@ export class WindowsManager implements IWindowsMainService, IWindowEventService
}
}
});
});
ipc
.
on
(
'
vscode:setHeaders
'
,
(
event
,
windowId
:
number
,
urls
:
string
[],
headers
:
any
)
=>
{
this
.
logService
.
log
(
'
IPC#vscode:setHeaders
'
);
const
vscodeWindow
=
this
.
getWindowById
(
windowId
);
if
(
!
vscodeWindow
||
!
urls
||
!
urls
.
length
||
!
headers
)
{
return
;
}
vscodeWindow
.
win
.
webContents
.
session
.
webRequest
.
onBeforeSendHeaders
({
urls
},
(
details
,
cb
)
=>
{
cb
({
cancel
:
false
,
requestHeaders
:
assign
(
details
.
requestHeaders
,
headers
)
});
});
});
ipc
.
on
(
'
vscode:broadcast
'
,
(
event
,
windowId
:
number
,
target
:
string
,
broadcast
:
{
channel
:
string
;
payload
:
any
;
})
=>
{
ipc
.
on
(
'
vscode:broadcast
'
,
(
event
,
windowId
:
number
,
target
:
string
,
broadcast
:
{
channel
:
string
;
payload
:
any
;
})
=>
{
if
(
broadcast
.
channel
&&
!
types
.
isUndefinedOrNull
(
broadcast
.
payload
))
{
if
(
broadcast
.
channel
&&
!
types
.
isUndefinedOrNull
(
broadcast
.
payload
))
{
this
.
logService
.
log
(
'
IPC#vscode:broadcast
'
,
target
,
broadcast
.
channel
,
broadcast
.
payload
);
this
.
logService
.
log
(
'
IPC#vscode:broadcast
'
,
target
,
broadcast
.
channel
,
broadcast
.
payload
);
...
...
src/vs/platform/environment/common/http.ts
0 → 100644
浏览文件 @
14f40b4c
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
getMachineId
}
from
'
vs/base/node/id
'
;
import
pkg
from
'
vs/platform/package
'
;
export
function
getCommonHTTPHeaders
():
TPromise
<
{
[
key
:
string
]:
string
;
}
>
{
return
getMachineId
().
then
(
machineId
=>
({
'
X-Market-Client-Id
'
:
`VSCode
${
pkg
.
version
}
`
,
'
User-Agent
'
:
`VSCode
${
pkg
.
version
}
`
,
'
X-Market-User-Id
'
:
machineId
}));
}
\ No newline at end of file
src/vs/platform/extensionManagement/node/extensionGalleryService.ts
浏览文件 @
14f40b4c
...
@@ -23,7 +23,7 @@ import pkg from 'vs/platform/package';
...
@@ -23,7 +23,7 @@ import pkg from 'vs/platform/package';
import
product
from
'
vs/platform/product
'
;
import
product
from
'
vs/platform/product
'
;
import
{
isVersionValid
}
from
'
vs/platform/extensions/node/extensionValidator
'
;
import
{
isVersionValid
}
from
'
vs/platform/extensions/node/extensionValidator
'
;
import
*
as
url
from
'
url
'
;
import
*
as
url
from
'
url
'
;
import
{
get
MachineId
}
from
'
vs/base/node/id
'
;
import
{
get
CommonHTTPHeaders
}
from
'
vs/platform/environment/common/http
'
;
interface
IRawGalleryExtensionFile
{
interface
IRawGalleryExtensionFile
{
assetType
:
string
;
assetType
:
string
;
...
@@ -262,12 +262,8 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
...
@@ -262,12 +262,8 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
private
extensionsGalleryUrl
:
string
;
private
extensionsGalleryUrl
:
string
;
@
memoize
@
memoize
private
get
commonHeaders
():
TPromise
<
{
[
key
:
string
]:
string
;
}
>
{
private
get
commonHTTPHeaders
():
TPromise
<
{
[
key
:
string
]:
string
;
}
>
{
return
getMachineId
().
then
(
machineId
=>
({
return
getCommonHTTPHeaders
();
'
X-Market-Client-Id
'
:
`VSCode
${
pkg
.
version
}
`
,
'
User-Agent
'
:
`VSCode
${
pkg
.
version
}
`
,
'
X-Market-User-Id
'
:
machineId
}));
}
}
constructor
(
constructor
(
...
@@ -288,7 +284,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
...
@@ -288,7 +284,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
}
}
getRequestHeaders
():
TPromise
<
{
[
key
:
string
]:
string
;
}
>
{
getRequestHeaders
():
TPromise
<
{
[
key
:
string
]:
string
;
}
>
{
return
this
.
commonHeaders
;
return
this
.
commonH
TTPH
eaders
;
}
}
query
(
options
:
IQueryOptions
=
{}):
TPromise
<
IPager
<
IGalleryExtension
>>
{
query
(
options
:
IQueryOptions
=
{}):
TPromise
<
IPager
<
IGalleryExtension
>>
{
...
@@ -338,7 +334,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
...
@@ -338,7 +334,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
}
}
private
queryGallery
(
query
:
Query
):
TPromise
<
{
galleryExtensions
:
IRawGalleryExtension
[],
total
:
number
;
}
>
{
private
queryGallery
(
query
:
Query
):
TPromise
<
{
galleryExtensions
:
IRawGalleryExtension
[],
total
:
number
;
}
>
{
return
this
.
commonHeaders
return
this
.
commonH
TTPH
eaders
.
then
(
headers
=>
{
.
then
(
headers
=>
{
const
data
=
JSON
.
stringify
(
query
.
raw
);
const
data
=
JSON
.
stringify
(
query
.
raw
);
...
@@ -478,7 +474,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
...
@@ -478,7 +474,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
parsedUrl
.
search
=
undefined
;
parsedUrl
.
search
=
undefined
;
parsedUrl
.
query
[
'
redirect
'
]
=
'
true
'
;
parsedUrl
.
query
[
'
redirect
'
]
=
'
true
'
;
return
this
.
commonHeaders
.
then
(
headers
=>
{
return
this
.
commonH
TTPH
eaders
.
then
(
headers
=>
{
headers
=
assign
({},
headers
,
options
.
headers
||
{});
headers
=
assign
({},
headers
,
options
.
headers
||
{});
options
=
assign
({},
options
,
{
headers
});
options
=
assign
({},
options
,
{
headers
});
...
...
src/vs/workbench/electron-browser/integration.ts
浏览文件 @
14f40b4c
...
@@ -34,7 +34,6 @@ import { IPath, IOpenFileRequest, IWindowConfiguration } from 'vs/workbench/elec
...
@@ -34,7 +34,6 @@ import { IPath, IOpenFileRequest, IWindowConfiguration } from 'vs/workbench/elec
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IExtensionGalleryService
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
ipcRenderer
as
ipc
,
webFrame
,
remote
}
from
'
electron
'
;
import
{
ipcRenderer
as
ipc
,
webFrame
,
remote
}
from
'
electron
'
;
...
@@ -69,7 +68,6 @@ export class ElectronIntegration {
...
@@ -69,7 +68,6 @@ export class ElectronIntegration {
@
IMessageService
private
messageService
:
IMessageService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
,
@
IExtensionGalleryService
private
extensionGalleryService
:
IExtensionGalleryService
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
)
{
)
{
}
}
...
@@ -194,13 +192,6 @@ export class ElectronIntegration {
...
@@ -194,13 +192,6 @@ export class ElectronIntegration {
}
}
}
}
});
});
// Extra request headers
this
.
extensionGalleryService
.
getRequestHeaders
().
done
(
headers
=>
{
const
urls
=
[
'
https://marketplace.visualstudio.com/*
'
,
'
https://*.vsassets.io/*
'
];
ipc
.
send
(
'
vscode:setHeaders
'
,
this
.
windowService
.
getWindowId
(),
urls
,
headers
);
});
}
}
private
resolveKeybindings
(
actionIds
:
string
[]):
TPromise
<
{
id
:
string
;
binding
:
number
;
}[]
>
{
private
resolveKeybindings
(
actionIds
:
string
[]):
TPromise
<
{
id
:
string
;
binding
:
number
;
}[]
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录