2021-05-28 20:45:05 +03:00
|
|
|
diff --git a/src/vs/base/common/product.ts b/src/vs/base/common/product.ts
|
2022-08-16 14:51:45 +03:00
|
|
|
index 1ae8079..eb56045 100644
|
2021-05-28 20:45:05 +03:00
|
|
|
--- a/src/vs/base/common/product.ts
|
|
|
|
+++ b/src/vs/base/common/product.ts
|
2022-08-16 14:51:45 +03:00
|
|
|
@@ -72,2 +72,3 @@ export interface IProductConfiguration {
|
2021-09-02 23:34:19 +03:00
|
|
|
readonly serviceUrl: string;
|
|
|
|
+ readonly cacheUrl?: string;
|
|
|
|
readonly itemUrl: string;
|
2021-03-19 15:27:33 +03:00
|
|
|
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
|
2022-06-09 23:19:30 +03:00
|
|
|
index 7e63a16..3bfeab8 100644
|
2021-03-19 15:27:33 +03:00
|
|
|
--- a/src/vs/platform/product/common/product.ts
|
|
|
|
+++ b/src/vs/platform/product/common/product.ts
|
2022-08-16 14:51:45 +03:00
|
|
|
@@ -6,3 +6,3 @@
|
2021-05-28 20:45:05 +03:00
|
|
|
import { FileAccess } from 'vs/base/common/network';
|
2021-09-02 23:34:19 +03:00
|
|
|
-import { globals } from 'vs/base/common/platform';
|
|
|
|
+import { globals, isWindows } from 'vs/base/common/platform';
|
2021-05-28 20:45:05 +03:00
|
|
|
import { env } from 'vs/base/common/process';
|
2022-08-16 14:51:45 +03:00
|
|
|
@@ -11,2 +11,3 @@ import { dirname, joinPath } from 'vs/base/common/resources';
|
2021-05-06 17:30:55 +03:00
|
|
|
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
|
2021-04-01 17:43:49 +03:00
|
|
|
+import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
|
2021-03-19 15:27:33 +03:00
|
|
|
|
2022-08-16 14:51:45 +03:00
|
|
|
@@ -36,2 +37,28 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
2021-03-19 15:27:33 +03:00
|
|
|
|
|
|
|
+ // Merge user-customized product.json
|
|
|
|
+ try {
|
|
|
|
+ const merge = (...objects: any[]) =>
|
|
|
|
+ objects.reduce((result, current) => {
|
|
|
|
+ Object.keys(current).forEach((key) => {
|
|
|
|
+ if (Array.isArray(result[key]) && Array.isArray(current[key])) {
|
|
|
|
+ result[key] = current[key];
|
|
|
|
+ } else if (typeof result[key] === 'object' && typeof current[key] === 'object') {
|
|
|
|
+ result[key] = merge(result[key], current[key]);
|
|
|
|
+ } else {
|
|
|
|
+ result[key] = current[key];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ }, {}) as any;
|
|
|
|
+
|
2021-05-28 20:45:05 +03:00
|
|
|
+ const userDataPath = getUserDataPath({} as any);
|
|
|
|
+ const userProductPath = isWindows ? `file:///${userDataPath}/product.json` : `file://${userDataPath}/product.json`;
|
2021-03-19 15:27:33 +03:00
|
|
|
+
|
2021-05-28 20:45:05 +03:00
|
|
|
+ const userProduct = require.__$__nodeRequire(FileAccess.asFileUri(userProductPath, require).fsPath);
|
|
|
|
+
|
|
|
|
+ product = merge(product, userProduct);
|
2021-03-19 15:27:33 +03:00
|
|
|
+ } catch (ex) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Running out of sources
|
2022-08-16 14:51:45 +03:00
|
|
|
@@ -46,2 +73,15 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
2021-03-19 15:27:33 +03:00
|
|
|
|
|
|
|
+ // Set user-defined extension gallery
|
|
|
|
+ const { serviceUrl, cacheUrl, itemUrl, controlUrl, recommendationsUrl } = product.extensionsGallery || {}
|
|
|
|
+
|
|
|
|
+ Object.assign(product, {
|
|
|
|
+ extensionsGallery: {
|
2021-03-19 19:02:21 +03:00
|
|
|
+ serviceUrl: env['VSCODE_GALLERY_SERVICE_URL'] || serviceUrl,
|
|
|
|
+ cacheUrl: env['VSCODE_GALLERY_CACHE_URL'] || cacheUrl,
|
|
|
|
+ itemUrl: env['VSCODE_GALLERY_ITEM_URL'] || itemUrl,
|
|
|
|
+ controlUrl: env['VSCODE_GALLERY_CONTROL_URL'] || controlUrl,
|
|
|
|
+ recommendationsUrl: env['VSCODE_GALLERY_RECOMMENDATIONS_URL'] || recommendationsUrl
|
2021-03-19 15:27:33 +03:00
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
Object.assign(product, {
|