Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
baab2e68
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,发现更多精彩内容 >>
提交
baab2e68
编写于
6月 05, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #74887
上级
97ce6386
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
39 deletion
+6
-39
src/vs/base/browser/hash.ts
src/vs/base/browser/hash.ts
+0
-15
src/vs/base/test/browser/hash.test.ts
src/vs/base/test/browser/hash.test.ts
+0
-16
src/vs/workbench/services/configuration/browser/configuration.ts
...workbench/services/configuration/browser/configuration.ts
+6
-8
未找到文件。
src/vs/base/browser/hash.ts
已删除
100644 → 0
浏览文件 @
97ce6386
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export
function
createSHA1
(
content
:
string
):
Thenable
<
string
>
{
if
(
typeof
require
!==
'
undefined
'
)
{
const
_crypto
:
typeof
crypto
=
require
.
__$__nodeRequire
(
'
crypto
'
);
return
Promise
.
resolve
(
_crypto
[
'
createHash
'
](
'
sha1
'
).
update
(
content
).
digest
(
'
hex
'
));
}
return
crypto
.
subtle
.
digest
(
'
SHA-1
'
,
new
TextEncoder
().
encode
(
content
)).
then
(
buffer
=>
{
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#Converting_a_digest_to_a_hex_string
return
Array
.
prototype
.
map
.
call
(
new
Uint8Array
(
buffer
),
(
value
:
number
)
=>
`00
${
value
.
toString
(
16
)}
`
.
slice
(
-
2
)).
join
(
''
);
});
}
\ No newline at end of file
src/vs/base/test/browser/hash.test.ts
已删除
100644 → 0
浏览文件 @
97ce6386
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
createSHA1
}
from
'
vs/base/browser/hash
'
;
suite
(
'
Hash
'
,
()
=>
{
test
(
'
computeSHA1Hash
'
,
async
()
=>
{
assert
.
equal
(
await
createSHA1
(
''
),
'
da39a3ee5e6b4b0d3255bfef95601890afd80709
'
);
assert
.
equal
(
await
createSHA1
(
'
hello world
'
),
'
2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
'
);
assert
.
equal
(
await
createSHA1
(
'
da39a3ee5e6b4b0d3255bfef95601890afd80709
'
),
'
10a34637ad661d98ba3344717656fcc76209c2f8
'
);
assert
.
equal
(
await
createSHA1
(
'
2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
'
),
'
d6b0d82cea4269b51572b8fab43adcee9fc3cf9a
'
);
assert
.
equal
(
await
createSHA1
(
'
öäü_?ß()<>ÖÄÜ
'
),
'
b64beaeff9e317b0193c8e40a2431b210388eba9
'
);
});
});
\ No newline at end of file
src/vs/workbench/services/configuration/browser/configuration.ts
浏览文件 @
baab2e68
...
...
@@ -21,8 +21,8 @@ import { extname, join } from 'vs/base/common/path';
import
{
equals
}
from
'
vs/base/common/objects
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IConfigurationModel
,
compare
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
createSHA1
}
from
'
vs/base/browser/hash
'
;
import
{
IRemoteAgentService
}
from
'
vs/workbench/services/remote/common/remoteAgentService
'
;
import
{
hash
}
from
'
vs/base/common/hash
'
;
export
class
RemoteUserConfiguration
extends
Disposable
{
...
...
@@ -672,7 +672,7 @@ class CachedFolderConfiguration extends Disposable implements IFolderConfigurati
readonly
onDidChange
:
Event
<
void
>
=
this
.
_onDidChange
.
event
;
private
configurationModel
:
ConfigurationModel
;
private
readonly
key
:
Thenable
<
ConfigurationKey
>
;
private
readonly
key
:
ConfigurationKey
;
constructor
(
folder
:
URI
,
...
...
@@ -680,14 +680,13 @@ class CachedFolderConfiguration extends Disposable implements IFolderConfigurati
private
readonly
configurationCache
:
IConfigurationCache
)
{
super
();
this
.
key
=
createSHA1
(
join
(
folder
.
path
,
configFolderRelativePath
)).
then
(
key
=>
({
type
:
'
folder
'
,
key
}))
;
this
.
key
=
{
type
:
'
folder
'
,
key
:
hash
(
join
(
folder
.
path
,
configFolderRelativePath
)).
toString
(
16
)
}
;
this
.
configurationModel
=
new
ConfigurationModel
();
}
async
loadConfiguration
():
Promise
<
ConfigurationModel
>
{
try
{
const
key
=
await
this
.
key
;
const
contents
=
await
this
.
configurationCache
.
read
(
key
);
const
contents
=
await
this
.
configurationCache
.
read
(
this
.
key
);
const
parsed
:
IConfigurationModel
=
JSON
.
parse
(
contents
.
toString
());
this
.
configurationModel
=
new
ConfigurationModel
(
parsed
.
contents
,
parsed
.
keys
,
parsed
.
overrides
);
}
catch
(
e
)
{
...
...
@@ -696,11 +695,10 @@ class CachedFolderConfiguration extends Disposable implements IFolderConfigurati
}
async
updateConfiguration
(
configurationModel
:
ConfigurationModel
):
Promise
<
void
>
{
const
key
=
await
this
.
key
;
if
(
configurationModel
.
keys
.
length
)
{
await
this
.
configurationCache
.
write
(
key
,
JSON
.
stringify
(
configurationModel
.
toJSON
()));
await
this
.
configurationCache
.
write
(
this
.
key
,
JSON
.
stringify
(
configurationModel
.
toJSON
()));
}
else
{
await
this
.
configurationCache
.
remove
(
key
);
await
this
.
configurationCache
.
remove
(
this
.
key
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录