mirror of
https://github.com/VSCodium/vscodium.git
synced 2026-04-24 03:50:13 +10:00
72 lines
2.4 KiB
Diff
72 lines
2.4 KiB
Diff
diff --git a/src/main.ts b/src/main.ts
|
|
index 62ddd5f..90c6cfd 100644
|
|
--- a/src/main.ts
|
|
+++ b/src/main.ts
|
|
@@ -8,2 +8,3 @@ import * as fs from 'original-fs';
|
|
import * as os from 'os';
|
|
+import { createRequire } from 'node:module';
|
|
import { configurePortable } from './bootstrap-node.js';
|
|
@@ -23,2 +24,3 @@ import { NativeParsedArgs } from './vs/platform/environment/common/argv.js';
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
+const require = createRequire(import.meta.url);
|
|
|
|
@@ -103,2 +105,13 @@ registerListeners();
|
|
|
|
+function resolveUserProduct() {
|
|
+ const userProductPath = `file:///${userDataPath}/product.json`;
|
|
+
|
|
+ try {
|
|
+ // Assign the product configuration to the global scope
|
|
+ const productPath = require(fileURLToPath(userProductPath));
|
|
+ globalThis._VSCODE_PRODUCT_JSON = productPath;
|
|
+ } catch (ex) {
|
|
+ }
|
|
+}
|
|
+
|
|
/**
|
|
@@ -174,2 +188,3 @@ async function startup(codeCachePath: string | undefined, nlsConfig: INLSConfigu
|
|
process.env['VSCODE_CODE_CACHE_PATH'] = codeCachePath || '';
|
|
+ resolveUserProduct();
|
|
|
|
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
|
|
index 1a2a619..9bf5ac0 100644
|
|
--- a/src/vs/platform/product/common/product.ts
|
|
+++ b/src/vs/platform/product/common/product.ts
|
|
@@ -29,2 +29,36 @@ else if (globalThis._VSCODE_PRODUCT_JSON && globalThis._VSCODE_PACKAGE_JSON) {
|
|
|
|
+ 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
|