提交 7cfae389 编写于 作者: S Sandeep Somavarapu

use local hash instead of browser hash

上级 87e23c22
......@@ -30,6 +30,7 @@ import { WorkspaceService } from 'vs/workbench/services/configuration/browser/co
import { ConfigurationCache } from 'vs/workbench/services/configuration/browser/configurationCache';
import { ConfigurationFileService } from 'vs/workbench/services/configuration/common/configuration';
import { WebResources } from 'vs/workbench/browser/web.resources';
import { hash } from 'vs/base/common/hash';
interface IWindowConfiguration {
settingsUri: URI;
......@@ -159,25 +160,16 @@ class CodeRendererMain extends Disposable {
}
}
private async resolveWorkspaceInitializationPayload(): Promise<IWorkspaceInitializationPayload> {
const hash = (uri: URI) => {
return crypto.subtle.digest('SHA-1', new TextEncoder().encode(uri.toString())).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('');
});
};
private resolveWorkspaceInitializationPayload(): IWorkspaceInitializationPayload {
// Multi-root workspace
if (this.configuration.workspaceUri) {
const id = await hash(this.configuration.workspaceUri);
return { id, configPath: this.configuration.workspaceUri };
return { id: hash(this.configuration.workspaceUri.toString()).toString(16), configPath: this.configuration.workspaceUri };
}
// Single-folder workspace
if (this.configuration.folderUri) {
const id = await hash(this.configuration.folderUri);
return { id, folder: this.configuration.folderUri };
return { id: hash(this.configuration.folderUri.toString()).toString(16), folder: this.configuration.folderUri };
}
return { id: 'empty-window' };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册