Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c0039fa3
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,发现更多精彩内容 >>
提交
c0039fa3
编写于
8月 19, 2019
作者:
P
Pine Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Drop unneeded action registration
上级
af13ba22
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
37 deletion
+24
-37
src/vs/editor/browser/services/openerService.ts
src/vs/editor/browser/services/openerService.ts
+6
-3
src/vs/workbench/contrib/url/common/url.contribution.ts
src/vs/workbench/contrib/url/common/url.contribution.ts
+18
-34
未找到文件。
src/vs/editor/browser/services/openerService.ts
浏览文件 @
c0039fa3
...
...
@@ -67,9 +67,12 @@ export class OpenerService implements IOpenerService {
}
if
(
equalsIgnoreCase
(
scheme
,
Schemas
.
http
)
||
equalsIgnoreCase
(
scheme
,
Schemas
.
https
))
{
let
trustedDomains
:
string
[]
=
[];
let
trustedDomains
:
string
[]
=
[
'
https://code.visualstudio.com
'
];
try
{
trustedDomains
=
JSON
.
parse
(
this
.
_storageService
.
get
(
'
http.trustedDomains
'
,
StorageScope
.
GLOBAL
,
'
[]
'
));
const
trustedDomainsSrc
=
this
.
_storageService
.
get
(
'
http.trustedDomains
'
,
StorageScope
.
GLOBAL
);
if
(
trustedDomainsSrc
)
{
trustedDomains
=
JSON
.
parse
(
trustedDomainsSrc
);
}
}
catch
(
err
)
{
}
const
domainToOpen
=
`
${
scheme
}
://
${
authority
}
`
;
...
...
@@ -96,7 +99,7 @@ export class OpenerService implements IOpenerService {
if
(
choice
===
0
)
{
return
this
.
openExternal
(
resource
);
}
else
if
(
choice
===
2
)
{
return
this
.
_commandService
.
executeCommand
(
'
_
workbench.action.configureTrustedDomains
'
,
domainToOpen
).
then
((
pickedDomains
:
string
[])
=>
{
return
this
.
_commandService
.
executeCommand
(
'
workbench.action.configureTrustedDomains
'
,
domainToOpen
).
then
((
pickedDomains
:
string
[])
=>
{
if
(
pickedDomains
.
indexOf
(
domainToOpen
)
!==
-
1
)
{
return
this
.
openExternal
(
resource
);
}
...
...
src/vs/workbench/contrib/url/common/url.contribution.ts
浏览文件 @
c0039fa3
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
localize
}
from
'
vs/nls
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
SyncActionDescriptor
,
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Extensions
as
ActionExtensions
,
IWorkbenchActionRegistry
}
from
'
vs/workbench/common/actions
'
;
import
{
IURLService
}
from
'
vs/platform/url/common/url
'
;
...
...
@@ -13,6 +13,7 @@ import { URI } from 'vs/base/common/uri';
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
class
OpenUrlAction
extends
Action
{
...
...
@@ -42,12 +43,14 @@ Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions).registe
localize
(
'
developer
'
,
'
Developer
'
)
);
const
VSCODE_DOMAIN
=
'
https://code.visualstudio.com
'
;
const
configureTrustedDomainsHandler
=
(
quickInputService
:
IQuickInputService
,
storageService
:
IStorageService
,
domainToConfigure
?:
string
)
=>
{
let
trustedDomains
:
string
[]
=
[
'
https://code.visualstudio.com
'
];
let
trustedDomains
:
string
[]
=
[
VSCODE_DOMAIN
];
try
{
const
trustedDomainsSrc
=
storageService
.
get
(
'
http.trustedDomains
'
,
StorageScope
.
GLOBAL
);
...
...
@@ -75,7 +78,7 @@ const configureTrustedDomainsHandler = (
];
let
domainToConfigureItem
:
IQuickPickItem
|
undefined
=
undefined
;
if
(
domainToConfigure
)
{
if
(
domainToConfigure
&&
trustedDomains
.
indexOf
(
domainToConfigure
)
===
-
1
)
{
domainToConfigureItem
=
{
type
:
'
item
'
,
label
:
domainToConfigure
,
...
...
@@ -104,43 +107,24 @@ const configureTrustedDomainsHandler = (
});
};
export
class
ConfigureTrustedDomainsAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.configureTrustedDomains
'
;
static
readonly
LABEL
=
localize
(
'
configureTrustedDomains
'
,
"
Configure Trusted Domains
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IQuickInputService
private
readonly
quickInputService
:
IQuickInputService
,
@
IStorageService
private
readonly
storageService
:
IStorageService
)
{
super
(
id
,
label
);
}
run
():
Promise
<
any
>
{
return
configureTrustedDomainsHandler
(
this
.
quickInputService
,
this
.
storageService
);
}
}
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
).
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ConfigureTrustedDomainsAction
,
ConfigureTrustedDomainsAction
.
ID
,
ConfigureTrustedDomainsAction
.
LABEL
),
'
Configure Trusted Domains
'
);
CommandsRegistry
.
registerCommand
({
id
:
'
_workbench.action.configureTrustedDomains
'
,
const
configureTrustedDomainCommand
=
{
id
:
'
workbench.action.configureTrustedDomains
'
,
description
:
{
description
:
'
Configure Trusted Domains
'
,
description
:
localize
(
'
configureTrustedDomains
'
,
'
Configure Trusted Domains
'
)
,
args
:
[{
name
:
'
domainToConfigure
'
,
schema
:
{
type
:
'
string
'
}
}]
},
handler
:
(
accessor
,
domainToConfigure
?:
string
)
=>
{
handler
:
(
accessor
:
ServicesAccessor
,
domainToConfigure
?:
string
)
=>
{
const
quickInputService
=
accessor
.
get
(
IQuickInputService
);
const
storageService
=
accessor
.
get
(
IStorageService
);
return
configureTrustedDomainsHandler
(
quickInputService
,
storageService
,
domainToConfigure
);
}
};
CommandsRegistry
.
registerCommand
(
configureTrustedDomainCommand
);
MenuRegistry
.
appendMenuItem
(
MenuId
.
CommandPalette
,
{
command
:
{
id
:
configureTrustedDomainCommand
.
id
,
title
:
configureTrustedDomainCommand
.
description
.
description
}
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录