@@ -14,23 +14,23 @@ Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageS
14
14
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
15
15
+++ code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
16
16
@@ -17,6 +17,7 @@ import { AbstractStorageService, isProfi
17
- import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile';
17
+ import { isUserDataProfile, IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile';
18
18
import { IAnyWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
19
19
import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
20
20
+ import { hash } from 'vs/base/common/hash';
21
21
22
22
export class BrowserStorageService extends AbstractStorageService {
23
23
24
- @@ -67,7 +68,11 @@ export class BrowserStorageService exten
25
- return `global-${this.profileStorageProfile.id}`;
26
- }
27
- case StorageScope.WORKSPACE:
28
- - return this.payload.id;
29
- + // Add a unique ID based on the current path for per-workspace databases.
30
- + // This prevents workspaces on different machines that share the same domain
31
- + // and file path from colliding (since it does not appear IndexedDB can be
32
- + // scoped to a path) as long as they are hosted on different paths.
33
- + return this.payload.id + '-' + hash(location.pathname.toString().replace(/\/$/, "")).toString(16);
34
- }
24
+ @@ -297,7 +298,11 @@ export class IndexedDBStorageDatabase ex
35
25
}
36
26
27
+ static async createWorkspaceStorage(workspaceId: string, logService: ILogService): Promise<IIndexedDBStorageDatabase> {
28
+ - return IndexedDBStorageDatabase.create({ id: workspaceId }, logService);
29
+ + // Add a unique ID based on the current path for per-workspace databases.
30
+ + // This prevents workspaces on different machines that share the same domain
31
+ + // and file path from colliding (since it does not appear IndexedDB can be
32
+ + // scoped to a path) as long as they are hosted on different paths.
33
+ + return IndexedDBStorageDatabase.create({ id: workspaceId + '-' + hash(location.pathname.toString().replace(/\/$/, "")).toString(16) }, logService);
34
+ }
35
+
36
+ static async create(options: IndexedDBStorageDatabaseOptions, logService: ILogService): Promise<IIndexedDBStorageDatabase> {
0 commit comments