2023-05-28 17:57:35 -04:00
|
|
|
diff --git a/src/main.js b/src/main.js
|
2023-05-28 18:02:39 -04:00
|
|
|
index d986fee..1ad0ef0 100644
|
2023-05-28 17:57:35 -04:00
|
|
|
--- a/src/main.js
|
|
|
|
+++ b/src/main.js
|
2023-05-28 18:02:39 -04:00
|
|
|
@@ -18,2 +18,3 @@ perf.mark('code/didStartMain');
|
2023-05-28 17:57:35 -04:00
|
|
|
const path = require('path');
|
|
|
|
+const { fileURLToPath } = require('url');
|
|
|
|
const fs = require('fs');
|
2023-05-28 18:02:39 -04:00
|
|
|
@@ -149,2 +150,14 @@ app.once('ready', function () {
|
|
|
|
|
2023-05-28 17:57:35 -04:00
|
|
|
+function resolveUserProduct() {
|
|
|
|
+ const userDataPath = getUserDataPath({}, product.nameShort ?? 'code-oss-dev');
|
|
|
|
+ const userProductPath = `file:///${userDataPath}/product.json`;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ // Assign the product configuration to the global scope
|
|
|
|
+ const productPath = require(fileURLToPath(userProductPath));
|
|
|
|
+ global["_VSCODE_USER_PRODUCT_JSON"] = productPath;
|
|
|
|
+ } catch (ex) {
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/**
|
2023-05-28 18:02:39 -04:00
|
|
|
@@ -160,2 +173,3 @@ function startup(codeCachePath, nlsConfig) {
|
2023-05-28 17:57:35 -04:00
|
|
|
process.env['VSCODE_CODE_CACHE_PATH'] = codeCachePath || '';
|
|
|
|
+ resolveUserProduct();
|
2023-05-28 18:02:39 -04:00
|
|
|
|
2023-05-28 17:57:35 -04:00
|
|
|
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
|
2023-05-28 18:02:39 -04:00
|
|
|
index 51a55e1..e2af375 100644
|
2023-05-28 17:57:35 -04:00
|
|
|
--- a/src/vs/platform/product/common/product.ts
|
|
|
|
+++ b/src/vs/platform/product/common/product.ts
|
2023-05-28 18:02:39 -04:00
|
|
|
@@ -29,2 +29,36 @@ else if (globalThis._VSCODE_PRODUCT_JSON && globalThis._VSCODE_PACKAGE_JSON) {
|
|
|
|
|
2023-05-28 17:57:35 -04:00
|
|
|
+ const { serviceUrl, searchUrl, itemUrl, controlUrl } = product.extensionsGallery || {};
|
|
|
|
+
|
|
|
|
+ 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,
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 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;
|
|
|
|
+
|
|
|
|
+ const userProduct = (globalThis as Record<string, any>)._VSCODE_USER_PRODUCT_JSON || {};
|
|
|
|
+
|
|
|
|
+ product = merge(product, userProduct);
|
|
|
|
+ } catch (ex) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
// Running out of sources
|