mirror of
https://github.com/VSCodium/vscodium.git
synced 2026-04-23 11:30:14 +10:00
- add cacheUrl
- locate & load user-customized product.json
This commit is contained in:
@@ -1,28 +0,0 @@
|
|||||||
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
|
|
||||||
index 2bea85740c..d0e9da036c 100644
|
|
||||||
--- a/src/vs/platform/product/common/product.ts
|
|
||||||
+++ b/src/vs/platform/product/common/product.ts
|
|
||||||
@@ -57,6 +57,23 @@ else {
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Set user-defined extension gallery
|
|
||||||
+ if (
|
|
||||||
+ env['VSCODIUM_EXTENSIONS_GALLERY_SERVICE_URL']
|
|
||||||
+ || env['VSCODIUM_EXTENSIONS_GALLERY_ITEM_URL']
|
|
||||||
+ || env['VSCODIUM_EXTENSIONS_GALLERY_CONTROL_URL']
|
|
||||||
+ || env['VSCODIUM_EXTENSIONS_GALLERY_RECOMMENDATIONS_URL']
|
|
||||||
+ ) {
|
|
||||||
+ Object.assign(product, {
|
|
||||||
+ extensionsGallery: {
|
|
||||||
+ serviceUrl: env['VSCODIUM_EXTENSIONS_GALLERY_SERVICE_URL'],
|
|
||||||
+ itemUrl: env['VSCODIUM_EXTENSIONS_GALLERY_ITEM_URL'],
|
|
||||||
+ controlUrl: env['VSCODIUM_EXTENSIONS_GALLERY_CONTROL_URL'],
|
|
||||||
+ recommendationsUrl: env['VSCODIUM_EXTENSIONS_GALLERY_RECOMMENDATIONS_URL']
|
|
||||||
+ }
|
|
||||||
+ })
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
Object.assign(product, {
|
|
||||||
version: pkg.version
|
|
||||||
});
|
|
||||||
74
patches/custom-gallery.patch
Normal file
74
patches/custom-gallery.patch
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
|
||||||
|
index 2730ee7..4d46c23 100644
|
||||||
|
--- a/src/vs/platform/product/common/product.ts
|
||||||
|
+++ b/src/vs/platform/product/common/product.ts
|
||||||
|
@@ -8,6 +8,7 @@ import { isWeb } from 'vs/base/common/platform';
|
||||||
|
import { env } from 'vs/base/common/process';
|
||||||
|
import { FileAccess } from 'vs/base/common/network';
|
||||||
|
import { dirname, joinPath } from 'vs/base/common/resources';
|
||||||
|
+import { getDefaultUserDataPath } from 'vs/base/node/userDataPath';
|
||||||
|
|
||||||
|
let product: IProductConfiguration;
|
||||||
|
|
||||||
|
@@ -47,6 +48,29 @@ else {
|
||||||
|
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;
|
||||||
|
+
|
||||||
|
+ const userProduct = require.__$__nodeRequire(joinPath(FileAccess.asFileUri(getDefaultUserDataPath(), require), 'product.json').fsPath);
|
||||||
|
+
|
||||||
|
+ product = merge(product, userProduct)
|
||||||
|
+ } catch (ex) {
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// Running out of sources
|
||||||
|
if (env['VSCODE_DEV']) {
|
||||||
|
Object.assign(product, {
|
||||||
|
@@ -56,6 +80,19 @@ else {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Set user-defined extension gallery
|
||||||
|
+ const { serviceUrl, cacheUrl, itemUrl, controlUrl, recommendationsUrl } = product.extensionsGallery || {}
|
||||||
|
+
|
||||||
|
+ Object.assign(product, {
|
||||||
|
+ extensionsGallery: {
|
||||||
|
+ serviceUrl: env['VSCODIUM_GALLERY_SERVICE_URL'] || serviceUrl,
|
||||||
|
+ cacheUrl: env['VSCODIUM_GALLERY_CACHE_URL'] || cacheUrl,
|
||||||
|
+ itemUrl: env['VSCODIUM_GALLERY_ITEM_URL'] || itemUrl,
|
||||||
|
+ controlUrl: env['VSCODIUM_GALLERY_CONTROL_URL'] || controlUrl,
|
||||||
|
+ recommendationsUrl: env['VSCODIUM_GALLERY_RECOMMENDATIONS_URL'] || recommendationsUrl
|
||||||
|
+ }
|
||||||
|
+ })
|
||||||
|
+
|
||||||
|
Object.assign(product, {
|
||||||
|
version: pkg.version
|
||||||
|
});
|
||||||
|
diff --git a/src/vs/platform/product/common/productService.ts b/src/vs/platform/product/common/productService.ts
|
||||||
|
index 07263ca..0328f58 100644
|
||||||
|
--- a/src/vs/platform/product/common/productService.ts
|
||||||
|
+++ b/src/vs/platform/product/common/productService.ts
|
||||||
|
@@ -67,6 +67,7 @@ export interface IProductConfiguration {
|
||||||
|
|
||||||
|
readonly extensionsGallery?: {
|
||||||
|
readonly serviceUrl: string;
|
||||||
|
+ readonly cacheUrl?: string;
|
||||||
|
readonly itemUrl: string;
|
||||||
|
readonly controlUrl: string;
|
||||||
|
readonly recommendationsUrl: string;
|
||||||
@@ -8,9 +8,9 @@ cd vscode || exit
|
|||||||
../update_settings.sh
|
../update_settings.sh
|
||||||
|
|
||||||
# apply patches
|
# apply patches
|
||||||
patch -u src/vs/platform/product/common/product.ts -i ../patches/custom-extensions-gallery.patch
|
|
||||||
patch -u src/vs/platform/update/electron-main/updateService.win32.ts -i ../patches/update-cache-path.patch
|
patch -u src/vs/platform/update/electron-main/updateService.win32.ts -i ../patches/update-cache-path.patch
|
||||||
patch -u resources/linux/rpm/code.spec.template -i ../patches/fix-rpm-spec.patch
|
patch -u resources/linux/rpm/code.spec.template -i ../patches/fix-rpm-spec.patch
|
||||||
|
git apply --ignore-whitespace ../patches/custom-gallery.patch
|
||||||
|
|
||||||
if [[ "$OS_NAME" == "osx" ]]; then
|
if [[ "$OS_NAME" == "osx" ]]; then
|
||||||
CHILD_CONCURRENCY=1 yarn --frozen-lockfile --ignore-optional
|
CHILD_CONCURRENCY=1 yarn --frozen-lockfile --ignore-optional
|
||||||
|
|||||||
Reference in New Issue
Block a user