Skip to content

Commit 2869031

Browse files
committed
fixup! update unique-db patch
1 parent 2d8f136 commit 2869031

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

patches/unique-db.diff

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageS
1414
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
1515
+++ code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
1616
@@ -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';
1818
import { IAnyWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
1919
import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
2020
+import { hash } from 'vs/base/common/hash';
2121

2222
export class BrowserStorageService extends AbstractStorageService {
2323

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
3525
}
3626

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

Comments
 (0)