Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
649b7f6b
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
649b7f6b
编写于
1月 10, 2021
作者:
M
meganrogge
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete unused files
上级
637395ce
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
1 addition
and
343 deletion
+1
-343
src/vs/workbench/contrib/preferences/browser/notificationsEditor.ts
...kbench/contrib/preferences/browser/notificationsEditor.ts
+1
-1
src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts
...h/contrib/preferences/browser/preferences.contribution.ts
+0
-22
src/vs/workbench/contrib/url/browser/manageNotifications.ts
src/vs/workbench/contrib/url/browser/manageNotifications.ts
+0
-234
src/vs/workbench/contrib/url/browser/notificationFileSystemProvider.ts
...nch/contrib/url/browser/notificationFileSystemProvider.ts
+0
-82
src/vs/workbench/contrib/url/browser/url.contribution.ts
src/vs/workbench/contrib/url/browser/url.contribution.ts
+0
-4
未找到文件。
src/vs/workbench/contrib/preferences/browser/notificationsEditor.ts
浏览文件 @
649b7f6b
...
...
@@ -90,7 +90,7 @@ export class NotificationsEditor extends EditorPane implements INotificationsEdi
throw
new
Error
(
'
Method not implemented.
'
);
}
private
async
render
(
preserveFocus
:
boolean
):
Promise
<
void
>
{
this
.
notificationsEditorModel
=
new
NotificationsEditorModel
(
this
.
notificationService
);
this
.
notificationsEditorModel
=
this
.
instantiationService
.
createInstance
(
NotificationsEditorModel
);
await
this
.
notificationsEditorModel
.
resolve
();
this
.
renderNotificationEntries
();
}
...
...
src/vs/workbench/contrib/preferences/browser/preferences.contribution.ts
浏览文件 @
649b7f6b
...
...
@@ -425,28 +425,6 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
}
});
// registerAction2(class extends Action2 {
// constructor() {
// super({
// id: 'workbench.action.manageNotifications',
// title: { value: nls.localize('manageNotifications2', "Manage Notifications"), original: 'Manage Notifications' },
// category,
// menu: {
// id: MenuId.CommandPalette,
// when: WorkbenchStateContext.isEqualTo('workspace')
// }
// });
// }
// async run(accessor: ServicesAccessor) {
// const commandService = accessor.get(ICommandService);
// const preferencesService = accessor.get(IPreferencesService);
// const workspaceFolder = await commandService.executeCommand<IWorkspaceFolder>(PICK_WORKSPACE_FOLDER_COMMAND_ID);
// if (workspaceFolder) {
// await preferencesService.openNotifications();
// }
// }
// });
registerAction2
(
class
extends
Action2
{
constructor
()
{
super
({
...
...
src/vs/workbench/contrib/url/browser/manageNotifications.ts
已删除
100644 → 0
浏览文件 @
637395ce
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/productService
'
;
import
{
IQuickInputService
,
IQuickPickItem
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
IStorageService
,
StorageScope
,
StorageTarget
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IAuthenticationService
}
from
'
vs/workbench/services/authentication/browser/authenticationService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
const
MANAGE_NOTIFICATIONS_URI
=
URI
.
parse
(
'
trustedDomains:/Trusted Domains
'
);
export
const
MANAGE_NOTIFICATIONS_STORAGE_KEY
=
'
http.linkProtectionTrustedDomains
'
;
export
const
MANAGE_NOTIFICATIONS_CONTENT_STORAGE_KEY
=
'
http.linkProtectionTrustedDomainsContent
'
;
export
const
manageTrustedDomainSettingsCommand
=
{
id
:
'
workbench.action.manageTrustedDomain
'
,
description
:
{
description
:
localize
(
'
trustedDomain.manageTrustedDomain
'
,
'
Manage Trusted Domains
'
),
args
:
[]
},
handler
:
async
(
accessor
:
ServicesAccessor
)
=>
{
const
editorService
=
accessor
.
get
(
IEditorService
);
editorService
.
openEditor
({
resource
:
MANAGE_NOTIFICATIONS_URI
,
mode
:
'
jsonc
'
,
options
:
{
pinned
:
true
}
});
return
;
}
};
type
ConfigureTrustedDomainsQuickPickItem
=
IQuickPickItem
&
({
id
:
'
manage
'
;
}
|
{
id
:
'
trust
'
;
toTrust
:
string
});
type
ConfigureTrustedDomainsChoiceClassification
=
{
choice
:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
};
};
export
async
function
configureOpenerTrustedDomainsHandler
(
trustedDomains
:
string
[],
domainToConfigure
:
string
,
resource
:
URI
,
quickInputService
:
IQuickInputService
,
storageService
:
IStorageService
,
editorService
:
IEditorService
,
telemetryService
:
ITelemetryService
,
notificationService
:
INotificationService
,
clipboardService
:
IClipboardService
,
)
{
const
parsedDomainToConfigure
=
URI
.
parse
(
domainToConfigure
);
const
toplevelDomainSegements
=
parsedDomainToConfigure
.
authority
.
split
(
'
.
'
);
const
domainEnd
=
toplevelDomainSegements
.
slice
(
toplevelDomainSegements
.
length
-
2
).
join
(
'
.
'
);
const
topLevelDomain
=
'
*.
'
+
domainEnd
;
const
options
:
ConfigureTrustedDomainsQuickPickItem
[]
=
[];
options
.
push
({
type
:
'
item
'
,
label
:
localize
(
'
trustedDomain.trustDomain
'
,
'
Trust {0}
'
,
domainToConfigure
),
id
:
'
trust
'
,
toTrust
:
domainToConfigure
,
picked
:
true
});
const
isIP
=
toplevelDomainSegements
.
length
===
4
&&
toplevelDomainSegements
.
every
(
segment
=>
Number
.
isInteger
(
+
segment
)
||
Number
.
isInteger
(
+
segment
.
split
(
'
:
'
)[
0
]));
if
(
isIP
)
{
if
(
parsedDomainToConfigure
.
authority
.
includes
(
'
:
'
))
{
const
base
=
parsedDomainToConfigure
.
authority
.
split
(
'
:
'
)[
0
];
options
.
push
({
type
:
'
item
'
,
label
:
localize
(
'
trustedDomain.trustAllPorts
'
,
'
Trust {0} on all ports
'
,
base
),
toTrust
:
base
+
'
:*
'
,
id
:
'
trust
'
});
}
}
else
{
options
.
push
({
type
:
'
item
'
,
label
:
localize
(
'
trustedDomain.trustSubDomain
'
,
'
Trust {0} and all its subdomains
'
,
domainEnd
),
toTrust
:
topLevelDomain
,
id
:
'
trust
'
});
}
options
.
push
({
type
:
'
item
'
,
label
:
localize
(
'
trustedDomain.trustAllDomains
'
,
'
Trust all domains (disables link protection)
'
),
toTrust
:
'
*
'
,
id
:
'
trust
'
});
options
.
push
({
type
:
'
item
'
,
label
:
localize
(
'
trustedDomain.manageTrustedDomains
'
,
'
Manage Trusted Domains
'
),
id
:
'
manage
'
});
const
pickedResult
=
await
quickInputService
.
pick
<
ConfigureTrustedDomainsQuickPickItem
>
(
options
,
{
activeItem
:
options
[
0
]
}
);
if
(
pickedResult
&&
pickedResult
.
id
)
{
telemetryService
.
publicLog2
<
{
choice
:
string
},
ConfigureTrustedDomainsChoiceClassification
>
(
'
trustedDomains.configureTrustedDomainsQuickPickChoice
'
,
{
choice
:
pickedResult
.
id
}
);
switch
(
pickedResult
.
id
)
{
case
'
manage
'
:
await
editorService
.
openEditor
({
resource
:
MANAGE_NOTIFICATIONS_URI
,
mode
:
'
jsonc
'
,
options
:
{
pinned
:
true
}
});
notificationService
.
prompt
(
Severity
.
Info
,
localize
(
'
configuringURL
'
,
"
Configuring trust for: {0}
"
,
resource
.
toString
()),
[{
label
:
'
Copy
'
,
run
:
()
=>
clipboardService
.
writeText
(
resource
.
toString
())
}]);
return
trustedDomains
;
case
'
trust
'
:
const
itemToTrust
=
pickedResult
.
toTrust
;
if
(
trustedDomains
.
indexOf
(
itemToTrust
)
===
-
1
)
{
storageService
.
remove
(
MANAGE_NOTIFICATIONS_CONTENT_STORAGE_KEY
,
StorageScope
.
GLOBAL
);
storageService
.
store
(
MANAGE_NOTIFICATIONS_STORAGE_KEY
,
JSON
.
stringify
([...
trustedDomains
,
itemToTrust
]),
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
);
return
[...
trustedDomains
,
itemToTrust
];
}
}
}
return
[];
}
// Exported for testing.
export
function
extractGitHubRemotesFromGitConfig
(
gitConfig
:
string
):
string
[]
{
const
domains
=
new
Set
<
string
>
();
let
match
:
RegExpExecArray
|
null
;
const
RemoteMatcher
=
/^
\s
*url
\s
*=
\s
*
(?:
git@|https:
\/\/)
github
\.
com
(?:
:|
\/)(\S
*
)\s
*$/mg
;
while
(
match
=
RemoteMatcher
.
exec
(
gitConfig
))
{
const
repo
=
match
[
1
].
replace
(
/
\.
git$/
,
''
);
if
(
repo
)
{
domains
.
add
(
`https://github.com/
${
repo
}
/`
);
}
}
return
[...
domains
];
}
async
function
getRemotes
(
fileService
:
IFileService
,
textFileService
:
ITextFileService
,
contextService
:
IWorkspaceContextService
):
Promise
<
string
[]
>
{
const
workspaceUris
=
contextService
.
getWorkspace
().
folders
.
map
(
folder
=>
folder
.
uri
);
const
domains
=
await
Promise
.
race
([
new
Promise
<
string
[][]
>
(
resolve
=>
setTimeout
(()
=>
resolve
([]),
2000
)),
Promise
.
all
<
string
[]
>
(
workspaceUris
.
map
(
async
workspaceUri
=>
{
const
path
=
workspaceUri
.
path
;
const
uri
=
workspaceUri
.
with
({
path
:
`
${
path
!==
'
/
'
?
path
:
''
}
/.git/config`
});
const
exists
=
await
fileService
.
exists
(
uri
);
if
(
!
exists
)
{
return
[];
}
const
gitConfig
=
(
await
(
textFileService
.
read
(
uri
,
{
acceptTextOnly
:
true
}).
catch
(()
=>
({
value
:
''
})))).
value
;
return
extractGitHubRemotesFromGitConfig
(
gitConfig
);
}))]);
const
set
=
domains
.
reduce
((
set
,
list
)
=>
list
.
reduce
((
set
,
item
)
=>
set
.
add
(
item
),
set
),
new
Set
<
string
>
());
return
[...
set
];
}
export
interface
IStaticTrustedDomains
{
readonly
defaultTrustedDomains
:
string
[];
readonly
trustedDomains
:
string
[];
}
export
interface
ITrustedDomains
extends
IStaticTrustedDomains
{
readonly
userDomains
:
string
[];
readonly
workspaceDomains
:
string
[];
}
export
async
function
readTrustedDomains
(
accessor
:
ServicesAccessor
):
Promise
<
ITrustedDomains
>
{
const
{
defaultTrustedDomains
,
trustedDomains
}
=
readStaticTrustedDomains
(
accessor
);
const
[
workspaceDomains
,
userDomains
]
=
await
Promise
.
all
([
readWorkspaceTrustedDomains
(
accessor
),
readAuthenticationTrustedDomains
(
accessor
)]);
return
{
workspaceDomains
,
userDomains
,
defaultTrustedDomains
,
trustedDomains
,
};
}
export
async
function
readWorkspaceTrustedDomains
(
accessor
:
ServicesAccessor
):
Promise
<
string
[]
>
{
const
fileService
=
accessor
.
get
(
IFileService
);
const
textFileService
=
accessor
.
get
(
ITextFileService
);
const
workspaceContextService
=
accessor
.
get
(
IWorkspaceContextService
);
return
getRemotes
(
fileService
,
textFileService
,
workspaceContextService
);
}
export
async
function
readAuthenticationTrustedDomains
(
accessor
:
ServicesAccessor
):
Promise
<
string
[]
>
{
const
authenticationService
=
accessor
.
get
(
IAuthenticationService
);
return
authenticationService
.
isAuthenticationProviderRegistered
(
'
github
'
)
&&
((
await
authenticationService
.
getSessions
(
'
github
'
))
??
[]).
length
>
0
?
[
`https://github.com`
]
:
[];
}
export
function
readStaticTrustedDomains
(
accessor
:
ServicesAccessor
):
IStaticTrustedDomains
{
const
storageService
=
accessor
.
get
(
IStorageService
);
const
productService
=
accessor
.
get
(
IProductService
);
const
defaultTrustedDomains
:
string
[]
=
productService
.
linkProtectionTrustedDomains
?
[...
productService
.
linkProtectionTrustedDomains
]
:
[];
let
trustedDomains
:
string
[]
=
[];
try
{
const
trustedDomainsSrc
=
storageService
.
get
(
MANAGE_NOTIFICATIONS_STORAGE_KEY
,
StorageScope
.
GLOBAL
);
if
(
trustedDomainsSrc
)
{
trustedDomains
=
JSON
.
parse
(
trustedDomainsSrc
);
}
}
catch
(
err
)
{
}
return
{
defaultTrustedDomains
,
trustedDomains
,
};
}
src/vs/workbench/contrib/url/browser/notificationFileSystemProvider.ts
已删除
100644 → 0
浏览文件 @
637395ce
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
parse
}
from
'
vs/base/common/json
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
FileDeleteOptions
,
FileOverwriteOptions
,
FileSystemProviderCapabilities
,
FileType
,
FileWriteOptions
,
IFileService
,
IStat
,
IWatchOptions
,
IFileSystemProviderWithFileReadWriteCapability
}
from
'
vs/platform/files/common/files
'
;
import
{
IStorageService
,
StorageScope
,
StorageTarget
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
MANAGE_NOTIFICATIONS_CONTENT_STORAGE_KEY
,
MANAGE_NOTIFICATIONS_STORAGE_KEY
}
from
'
vs/workbench/contrib/url/browser/manageNotifications
'
;
const
MANAGE_NOTIFICATIONS_STAT
:
IStat
=
{
type
:
FileType
.
File
,
ctime
:
Date
.
now
(),
mtime
:
Date
.
now
(),
size
:
0
};
export
class
NotificationFileSystemProvider
implements
IFileSystemProviderWithFileReadWriteCapability
,
IWorkbenchContribution
{
readonly
capabilities
=
FileSystemProviderCapabilities
.
FileReadWrite
;
readonly
onDidChangeCapabilities
=
Event
.
None
;
readonly
onDidChangeFile
=
Event
.
None
;
constructor
(
@
IFileService
private
readonly
fileService
:
IFileService
,
@
IStorageService
private
readonly
storageService
:
IStorageService
,
//@IInstantiationService private readonly instantiationService: IInstantiationService,
)
{
this
.
fileService
.
registerProvider
(
'
notifications
'
,
this
);
}
onDidErrorOccur
?:
Event
<
string
>
|
undefined
;
stat
(
resource
:
URI
):
Promise
<
IStat
>
{
return
Promise
.
resolve
(
MANAGE_NOTIFICATIONS_STAT
);
}
async
readFile
(
resource
:
URI
):
Promise
<
Uint8Array
>
{
const
buffer
=
VSBuffer
.
fromString
(
'
hi
'
).
buffer
;
return
buffer
;
}
writeFile
(
resource
:
URI
,
content
:
Uint8Array
,
opts
:
FileWriteOptions
):
Promise
<
void
>
{
try
{
const
trustedDomainsContent
=
VSBuffer
.
wrap
(
content
).
toString
();
const
trustedDomains
=
parse
(
trustedDomainsContent
);
this
.
storageService
.
store
(
MANAGE_NOTIFICATIONS_CONTENT_STORAGE_KEY
,
trustedDomainsContent
,
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
);
this
.
storageService
.
store
(
MANAGE_NOTIFICATIONS_STORAGE_KEY
,
JSON
.
stringify
(
trustedDomains
)
||
''
,
StorageScope
.
GLOBAL
,
StorageTarget
.
USER
);
}
catch
(
err
)
{
}
return
Promise
.
resolve
();
}
watch
(
resource
:
URI
,
opts
:
IWatchOptions
):
IDisposable
{
return
{
dispose
()
{
return
;
}
};
}
mkdir
(
resource
:
URI
):
Promise
<
void
>
{
return
Promise
.
resolve
(
undefined
!
);
}
readdir
(
resource
:
URI
):
Promise
<
[
string
,
FileType
][]
>
{
return
Promise
.
resolve
(
undefined
!
);
}
delete
(
resource
:
URI
,
opts
:
FileDeleteOptions
):
Promise
<
void
>
{
return
Promise
.
resolve
(
undefined
!
);
}
rename
(
from
:
URI
,
to
:
URI
,
opts
:
FileOverwriteOptions
):
Promise
<
void
>
{
return
Promise
.
resolve
(
undefined
!
);
}
}
src/vs/workbench/contrib/url/browser/url.contribution.ts
浏览文件 @
649b7f6b
...
...
@@ -69,10 +69,6 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).regi
TrustedDomainsFileSystemProvider
,
LifecyclePhase
.
Ready
);
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
).
registerWorkbenchContribution
(
NotificationFileSystemProvider
,
LifecyclePhase
.
Ready
);
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
).
registerWorkbenchContribution
(
ExternalUriResolverContribution
,
LifecyclePhase
.
Ready
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录