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-12-02 22:31:45 +03:00
|
|
|
index ef798fa..5a0550b 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-11-23 23:51:36 +03:00
|
|
|
@@ -5,3 +5,4 @@
|
2022-11-12 12:09:54 +03:00
|
|
|
|
2021-09-02 23:34:19 +03:00
|
|
|
-import { globals } from 'vs/base/common/platform';
|
2022-11-12 12:09:54 +03:00
|
|
|
+import { AppResourcePath, FileAccess } from 'vs/base/common/network';
|
2021-09-02 23:34:19 +03:00
|
|
|
+import { globals, isWindows } from 'vs/base/common/platform';
|
2021-05-28 20:45:05 +03:00
|
|
|
import { env } from 'vs/base/common/process';
|
2022-11-23 23:51:36 +03:00
|
|
|
@@ -9,2 +10,3 @@ import { IProductConfiguration } from 'vs/base/common/product';
|
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-12-02 22:31:45 +03:00
|
|
|
@@ -29,2 +31,40 @@ else if (globalThis._VSCODE_PRODUCT_JSON && globalThis._VSCODE_PACKAGE_JSON) {
|
2021-03-19 15:27:33 +03:00
|
|
|
|
2022-09-25 15:54:41 +03:00
|
|
|
+ // Set user-defined extension gallery
|
2022-12-02 22:31:45 +03:00
|
|
|
+ const { serviceUrl, searchUrl, itemUrl, controlUrl } = product.extensionsGallery || {}
|
2022-09-25 15:54:41 +03:00
|
|
|
+
|
|
|
|
+ Object.assign(product, {
|
|
|
|
+ extensionsGallery: {
|
|
|
|
+ serviceUrl: env['VSCODE_GALLERY_SERVICE_URL'] || serviceUrl,
|
|
|
|
+ searchUrl: env['VSCODE_GALLERY_SEARCH_URL'] || searchUrl,
|
|
|
|
+ itemUrl: env['VSCODE_GALLERY_ITEM_URL'] || itemUrl,
|
|
|
|
+ controlUrl: env['VSCODE_GALLERY_CONTROL_URL'] || controlUrl,
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
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;
|
|
|
|
+
|
2022-09-25 15:54:41 +03:00
|
|
|
+ const userDataPath = getUserDataPath({} as any, product.nameShort);
|
2021-05-28 20:45:05 +03:00
|
|
|
+ const userProductPath = isWindows ? `file:///${userDataPath}/product.json` : `file://${userDataPath}/product.json`;
|
2021-03-19 15:27:33 +03:00
|
|
|
+
|
2022-11-12 12:09:54 +03:00
|
|
|
+ const userProduct = require.__$__nodeRequire(FileAccess.asFileUri(userProductPath as AppResourcePath).fsPath);
|
2021-05-28 20:45:05 +03:00
|
|
|
+
|
|
|
|
+ product = merge(product, userProduct);
|
2021-03-19 15:27:33 +03:00
|
|
|
+ } catch (ex) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Running out of sources
|