2021-03-19 08:27:33 -04:00
|
|
|
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
|
2021-05-06 10:30:55 -04:00
|
|
|
index d79c8a3..7a25774 100644
|
2021-03-19 08:27:33 -04:00
|
|
|
--- a/src/vs/platform/product/common/product.ts
|
|
|
|
+++ b/src/vs/platform/product/common/product.ts
|
2021-05-06 10:30:55 -04:00
|
|
|
@@ -9,6 +9,7 @@ import { env } from 'vs/base/common/process';
|
2021-03-19 08:27:33 -04:00
|
|
|
import { dirname, joinPath } from 'vs/base/common/resources';
|
2021-05-06 10:30:55 -04:00
|
|
|
import { IProductConfiguration } from 'vs/base/common/product';
|
|
|
|
import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes';
|
2021-04-01 10:43:49 -04:00
|
|
|
+import { getUserDataPath } from 'vs/platform/environment/node/userDataPath';
|
2021-03-19 08:27:33 -04:00
|
|
|
|
|
|
|
let product: IProductConfiguration;
|
|
|
|
|
2021-05-06 10:30:55 -04:00
|
|
|
@@ -31,6 +32,29 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
2021-03-19 08:27:33 -04:00
|
|
|
product = require.__$__nodeRequire(joinPath(rootPath, 'product.json').fsPath);
|
|
|
|
const pkg = require.__$__nodeRequire(joinPath(rootPath, 'package.json').fsPath) as { version: string; };
|
|
|
|
|
|
|
|
+ // 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-04-01 10:43:49 -04:00
|
|
|
+ const userProduct = require.__$__nodeRequire(joinPath(FileAccess.asFileUri(getUserDataPath({} as any), require), 'product.json').fsPath);
|
2021-03-19 08:27:33 -04:00
|
|
|
+
|
|
|
|
+ product = merge(product, userProduct)
|
|
|
|
+ } catch (ex) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Running out of sources
|
|
|
|
if (env['VSCODE_DEV']) {
|
|
|
|
Object.assign(product, {
|
2021-05-06 10:30:55 -04:00
|
|
|
@@ -40,6 +64,19 @@ else if (typeof require?.__$__nodeRequire === 'function') {
|
2021-03-19 08:27:33 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Set user-defined extension gallery
|
|
|
|
+ const { serviceUrl, cacheUrl, itemUrl, controlUrl, recommendationsUrl } = product.extensionsGallery || {}
|
|
|
|
+
|
|
|
|
+ Object.assign(product, {
|
|
|
|
+ extensionsGallery: {
|
2021-03-19 12:02:21 -04: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 08:27:33 -04:00
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
Object.assign(product, {
|
|
|
|
version: pkg.version
|
|
|
|
});
|
2021-05-06 10:30:55 -04:00
|
|
|
|
|
|
|
diff --git a/src/vs/base/common/product.ts b/src/vs/base/common/product.ts
|
|
|
|
index 129b8de..fadb99a 100644
|
|
|
|
--- a/src/vs/base/common/product.ts
|
|
|
|
+++ b/src/vs/base/common/product.ts
|
|
|
|
@@ -62,6 +62,7 @@ export interface IProductConfiguration {
|
2021-03-19 08:27:33 -04:00
|
|
|
|
|
|
|
readonly extensionsGallery?: {
|
|
|
|
readonly serviceUrl: string;
|
|
|
|
+ readonly cacheUrl?: string;
|
|
|
|
readonly itemUrl: string;
|
|
|
|
readonly controlUrl: string;
|
|
|
|
readonly recommendationsUrl: string;
|