2022-03-23 04:07:14 +08:00
|
|
|
Make storage local to the remote server
|
|
|
|
|
|
|
|
This solves two problems:
|
|
|
|
1. Extensions running in the browser (like Vim) might use these paths
|
|
|
|
directly instead of using the file service and most likely can't write
|
|
|
|
to `/User` on disk.
|
|
|
|
2. Settings will be stored in the file system instead of in browser
|
|
|
|
storage. Using browser storage makes sharing or seeding settings
|
|
|
|
between browsers difficult. We may want to revisit this once/if we get
|
|
|
|
settings sync.
|
|
|
|
|
|
|
|
Unfortunately this does not affect state which uses a separate method with
|
|
|
|
IndexedDB and does not appear nearly as easy to redirect to disk.
|
|
|
|
|
|
|
|
To test install the Vim extension and make sure something that uses file storage
|
|
|
|
works (history recall for example) and change settings from the UI and on disk
|
|
|
|
while making sure they appear on the other side.
|
|
|
|
|
|
|
|
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
2023-07-20 06:00:31 +08:00
|
|
|
@@ -326,6 +326,7 @@ export class WebClientServer {
|
2022-06-22 05:51:46 +08:00
|
|
|
const workbenchWebConfiguration = {
|
|
|
|
remoteAuthority,
|
|
|
|
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
|
|
|
|
+ userDataPath: this._environmentService.userDataPath,
|
|
|
|
_wrapWebWorkerExtHostInIframe,
|
2022-10-18 07:30:39 +08:00
|
|
|
developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() },
|
|
|
|
settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined,
|
2022-03-23 04:07:14 +08:00
|
|
|
Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
|
2023-07-20 06:00:31 +08:00
|
|
|
@@ -283,6 +283,11 @@ export interface IWorkbenchConstructionO
|
2022-03-23 04:07:14 +08:00
|
|
|
*/
|
|
|
|
readonly configurationDefaults?: Record<string, any>;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Path to the user data directory.
|
|
|
|
+ */
|
|
|
|
+ readonly userDataPath?: string
|
|
|
|
+
|
|
|
|
//#endregion
|
|
|
|
|
2023-02-08 06:22:06 +08:00
|
|
|
//#region Profile options
|
2022-03-23 04:07:14 +08:00
|
|
|
Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts
|
2023-06-16 00:00:03 +08:00
|
|
|
@@ -102,7 +102,14 @@ export class BrowserWorkbenchEnvironment
|
2022-11-10 06:10:03 +08:00
|
|
|
get logFile(): URI { return joinPath(this.windowLogsPath, 'window.log'); }
|
2022-03-23 04:07:14 +08:00
|
|
|
|
|
|
|
@memoize
|
2022-05-05 05:58:49 +08:00
|
|
|
- get userRoamingDataHome(): URI { return URI.file('/User').with({ scheme: Schemas.vscodeUserData }); }
|
2022-03-23 04:07:14 +08:00
|
|
|
+ get userRoamingDataHome(): URI { return joinPath(URI.file(this.userDataPath).with({ scheme: Schemas.vscodeRemote }), 'User'); }
|
|
|
|
+
|
|
|
|
+ get userDataPath(): string {
|
|
|
|
+ if (!this.options.userDataPath) {
|
|
|
|
+ throw new Error('userDataPath was not provided to the browser');
|
|
|
|
+ }
|
|
|
|
+ return this.options.userDataPath;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@memoize
|
2022-08-17 09:26:19 +08:00
|
|
|
get argvResource(): URI { return joinPath(this.userRoamingDataHome, 'argv.json'); }
|