Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
25ed721e
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,发现更多精彩内容 >>
提交
25ed721e
编写于
4月 03, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More support for keytar
上级
40dbf397
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
107 addition
and
2 deletion
+107
-2
src/vs/workbench/api/browser/mainThreadKeytar.ts
src/vs/workbench/api/browser/mainThreadKeytar.ts
+61
-0
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+8
-0
src/vs/workbench/api/electron-browser/extensionHost.contribution.ts
...kbench/api/electron-browser/extensionHost.contribution.ts
+1
-0
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+35
-1
src/vs/workbench/api/node/extHostExtensionService.ts
src/vs/workbench/api/node/extHostExtensionService.ts
+2
-1
未找到文件。
src/vs/workbench/api/browser/mainThreadKeytar.ts
0 → 100644
浏览文件 @
25ed721e
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
MainContext
,
MainThreadKeytarShape
,
IExtHostContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
interface
IKeytarModule
{
getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
;
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
;
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
;
findPassword
(
service
:
string
):
Promise
<
string
|
null
>
;
}
@
extHostNamedCustomer
(
MainContext
.
MainThreadKeytar
)
export
class
MainThreadKeytar
implements
MainThreadKeytarShape
{
private
_keytar
:
IKeytarModule
|
null
;
constructor
(
extHostContext
:
IExtHostContext
)
{
try
{
this
.
_keytar
=
<
IKeytarModule
>
require
.
__$__nodeRequire
(
'
keytar
'
);
}
catch
(
e
)
{
this
.
_keytar
=
null
;
}
}
dispose
():
void
{
//
}
async
$getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
{
if
(
this
.
_keytar
)
{
return
this
.
_keytar
.
getPassword
(
service
,
account
);
}
return
null
;
}
async
$setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
{
if
(
this
.
_keytar
)
{
return
this
.
_keytar
.
setPassword
(
service
,
account
,
password
);
}
}
async
$deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
{
if
(
this
.
_keytar
)
{
return
this
.
_keytar
.
deletePassword
(
service
,
account
);
}
return
false
;
}
async
$findPassword
(
service
:
string
):
Promise
<
string
|
null
>
{
if
(
this
.
_keytar
)
{
return
this
.
_keytar
.
findPassword
(
service
);
}
return
null
;
}
}
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
25ed721e
...
...
@@ -253,6 +253,13 @@ export interface MainThreadConsoleShape extends IDisposable {
$logExtensionHostMessage
(
msg
:
IRemoteConsoleLog
):
void
;
}
export
interface
MainThreadKeytarShape
extends
IDisposable
{
$getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
;
$setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
;
$deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
;
$findPassword
(
service
:
string
):
Promise
<
string
|
null
>
;
}
export
interface
ISerializedRegExp
{
pattern
:
string
;
flags
?:
string
;
...
...
@@ -1197,6 +1204,7 @@ export const MainContext = {
MainThreadTextEditors
:
createMainId
<
MainThreadTextEditorsShape
>
(
'
MainThreadTextEditors
'
),
MainThreadErrors
:
createMainId
<
MainThreadErrorsShape
>
(
'
MainThreadErrors
'
),
MainThreadTreeViews
:
createMainId
<
MainThreadTreeViewsShape
>
(
'
MainThreadTreeViews
'
),
MainThreadKeytar
:
createMainId
<
MainThreadKeytarShape
>
(
'
MainThreadKeytar
'
),
MainThreadLanguageFeatures
:
createMainId
<
MainThreadLanguageFeaturesShape
>
(
'
MainThreadLanguageFeatures
'
),
MainThreadLanguages
:
createMainId
<
MainThreadLanguagesShape
>
(
'
MainThreadLanguages
'
),
MainThreadMessageService
:
createMainId
<
MainThreadMessageServiceShape
>
(
'
MainThreadMessageService
'
),
...
...
src/vs/workbench/api/electron-browser/extensionHost.contribution.ts
浏览文件 @
25ed721e
...
...
@@ -32,6 +32,7 @@ import '../browser/mainThreadExtensionService';
import
'
../browser/mainThreadFileSystem
'
;
import
'
../browser/mainThreadFileSystemEventService
'
;
import
'
../browser/mainThreadHeapService
'
;
import
'
../browser/mainThreadKeytar
'
;
import
'
../browser/mainThreadLanguageFeatures
'
;
import
'
../browser/mainThreadLanguages
'
;
import
'
../browser/mainThreadLogService
'
;
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
25ed721e
...
...
@@ -19,7 +19,7 @@ import { score } from 'vs/editor/common/modes/languageSelector';
import
*
as
files
from
'
vs/platform/files/common/files
'
;
import
pkg
from
'
vs/platform/product/node/package
'
;
import
product
from
'
vs/platform/product/node/product
'
;
import
{
ExtHostContext
,
IInitData
,
IMainContext
,
MainContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostContext
,
IInitData
,
IMainContext
,
MainContext
,
MainThreadKeytarShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostApiCommands
}
from
'
vs/workbench/api/node/extHostApiCommands
'
;
import
{
ExtHostClipboard
}
from
'
vs/workbench/api/node/extHostClipboard
'
;
import
{
ExtHostCommands
}
from
'
vs/workbench/api/node/extHostCommands
'
;
...
...
@@ -945,3 +945,37 @@ export class VSCodeNodeModuleFactory implements INodeModuleFactory {
return
this
.
_defaultApiImpl
;
}
}
interface
IKeytarModule
{
getPassword
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
;
setPassword
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
;
deletePassword
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
;
findPassword
(
service
:
string
):
Promise
<
string
|
null
>
;
}
export
class
KeytarNodeModuleFactory
implements
INodeModuleFactory
{
public
readonly
nodeModuleName
=
'
keytar
'
;
private
_impl
:
IKeytarModule
;
constructor
(
mainThreadKeytar
:
MainThreadKeytarShape
)
{
this
.
_impl
=
{
getPassword
:
(
service
:
string
,
account
:
string
):
Promise
<
string
|
null
>
=>
{
return
mainThreadKeytar
.
$getPassword
(
service
,
account
);
},
setPassword
:
(
service
:
string
,
account
:
string
,
password
:
string
):
Promise
<
void
>
=>
{
return
mainThreadKeytar
.
$setPassword
(
service
,
account
,
password
);
},
deletePassword
:
(
service
:
string
,
account
:
string
):
Promise
<
boolean
>
=>
{
return
mainThreadKeytar
.
$deletePassword
(
service
,
account
);
},
findPassword
:
(
service
:
string
):
Promise
<
string
|
null
>
=>
{
return
mainThreadKeytar
.
$findPassword
(
service
);
}
};
}
public
load
(
request
:
string
,
parent
:
{
filename
:
string
;
}):
any
{
return
this
.
_impl
;
}
}
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
25ed721e
...
...
@@ -12,7 +12,7 @@ import { TernarySearchTree } from 'vs/base/common/map';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
createApiFactory
,
IExtensionApiFactory
,
NodeModuleRequireInterceptor
,
VSCodeNodeModuleFactory
}
from
'
vs/workbench/api/node/extHost.api.impl
'
;
import
{
createApiFactory
,
IExtensionApiFactory
,
NodeModuleRequireInterceptor
,
VSCodeNodeModuleFactory
,
KeytarNodeModuleFactory
}
from
'
vs/workbench/api/node/extHost.api.impl
'
;
import
{
ExtHostExtensionServiceShape
,
IEnvironment
,
IInitData
,
IMainContext
,
MainContext
,
MainThreadExtensionServiceShape
,
MainThreadTelemetryShape
,
MainThreadWorkspaceShape
,
IStaticWorkspaceData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostConfiguration
}
from
'
vs/workbench/api/node/extHostConfiguration
'
;
import
{
ActivatedExtension
,
EmptyExtension
,
ExtensionActivatedByAPI
,
ExtensionActivatedByEvent
,
ExtensionActivationReason
,
ExtensionActivationTimes
,
ExtensionActivationTimesBuilder
,
ExtensionsActivator
,
IExtensionAPI
,
IExtensionContext
,
IExtensionMemento
,
IExtensionModule
,
HostExtension
}
from
'
vs/workbench/api/node/extHostExtensionActivator
'
;
...
...
@@ -244,6 +244,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
const
configProvider
=
await
this
.
_extHostConfiguration
.
getConfigProvider
();
const
extensionPaths
=
await
this
.
getExtensionPathIndex
();
NodeModuleRequireInterceptor
.
INSTANCE
.
register
(
new
VSCodeNodeModuleFactory
(
this
.
_extensionApiFactory
,
extensionPaths
,
this
.
_registry
,
configProvider
));
NodeModuleRequireInterceptor
.
INSTANCE
.
register
(
new
KeytarNodeModuleFactory
(
this
.
_extHostContext
.
getProxy
(
MainContext
.
MainThreadKeytar
)));
// Do this when extension service exists, but extensions are not being activated yet.
await
connectProxyResolver
(
this
.
_extHostWorkspace
,
configProvider
,
this
,
this
.
_extHostLogService
,
this
.
_mainThreadTelemetryProxy
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录