From 1bc97780c104f02a472f6de512d4a2aebbf26e17 Mon Sep 17 00:00:00 2001 From: chriswang521 Date: Thu, 17 Aug 2023 17:26:02 +0800 Subject: [PATCH] =?UTF-8?q?=20=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E6=8F=92=E4=BB=B6=E5=95=86=E5=BA=97=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=8F=AF=E4=BF=A1=E4=BB=BB=E5=9F=9F?= =?UTF-8?q?TrustDomains.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../translations/main.i18n.json | 3 ++- .../common/extensionsGallery.config.contribution.ts | 10 ++++++++++ src/vs/workbench/contrib/url/browser/trustedDomains.ts | 7 +++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/extensions/vscode-language-pack-zh-hans/translations/main.i18n.json b/extensions/vscode-language-pack-zh-hans/translations/main.i18n.json index bb0506e8..c4cffd24 100644 --- a/extensions/vscode-language-pack-zh-hans/translations/main.i18n.json +++ b/extensions/vscode-language-pack-zh-hans/translations/main.i18n.json @@ -1547,7 +1547,8 @@ "vs/platform/extensionsGallery/common/extensionsGallery.config.contribution":{ "extensionsGalleryConfigurationTitle":"插件商店地址", "extensionsGalleryServiceUrl":"配置插件商店的服务器地址serviceUrl。例如:https://open-vsx.org/vscode/gallery", - "extensionsGalleryItemUrl":"配置插件商店的单个插件地址itemUrl。例如:https://open-vsx.org/vscode/item" + "extensionsGalleryItemUrl":"配置插件商店的单个插件地址itemUrl。例如:https://open-vsx.org/vscode/item", + "extensionsGalleryTrustDomains":"配置可信任域。当配置新的插件商店地址时,请务必配置可信任域。例如:https://open-vsx.org" }, "vs/platform/extensionsGallery/common/extensionsGalleryConfig":{ "galleryConfigChanged":"插件商店配置地址已更改。" diff --git a/src/vs/platform/extensionsGallery/common/extensionsGallery.config.contribution.ts b/src/vs/platform/extensionsGallery/common/extensionsGallery.config.contribution.ts index a13d92c9..5e01a6f1 100644 --- a/src/vs/platform/extensionsGallery/common/extensionsGallery.config.contribution.ts +++ b/src/vs/platform/extensionsGallery/common/extensionsGallery.config.contribution.ts @@ -30,6 +30,15 @@ configurationRegistry.registerConfiguration({ description: localize('extensionsGalleryItemUrl', "Configure Extensions Gallery ItemUrl.Sample:https://open-vsx.org/vscode/item"), restricted: true, + }, + 'extensionsGallery.trustDomains': { + type: 'array', + items: { + type: 'string' + }, + default: [], + description: localize('extensionsGalleryTrustDomains', "Configure Trusted Domains,Sample:https://open-vsx.org"), + scope: ConfigurationScope.RESOURCE } }, }); @@ -38,6 +47,7 @@ export interface IExtensionsGalleryConfiguration { // extensionsGallery?: { serviceUrl: string; itemUrl: string; + trustDomains: string[]; // } } diff --git a/src/vs/workbench/contrib/url/browser/trustedDomains.ts b/src/vs/workbench/contrib/url/browser/trustedDomains.ts index 613047e7..bcae5bc1 100644 --- a/src/vs/workbench/contrib/url/browser/trustedDomains.ts +++ b/src/vs/workbench/contrib/url/browser/trustedDomains.ts @@ -16,6 +16,7 @@ import { IFileService } from 'vs/platform/files/common/files'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; const TRUSTED_DOMAINS_URI = URI.parse('trustedDomains:/Trusted Domains'); @@ -206,10 +207,12 @@ export function readStaticTrustedDomains(accessor: ServicesAccessor): IStaticTru const storageService = accessor.get(IStorageService); const productService = accessor.get(IProductService); const environmentService = accessor.get(IBrowserWorkbenchEnvironmentService); - + const configurationService = accessor.get(IConfigurationService); + const configuraionDomains = configurationService.getValue('extensionsGallery.trustDomains'); const defaultTrustedDomains = [ ...productService.linkProtectionTrustedDomains ?? [], - ...environmentService.options?.additionalTrustedDomains ?? [] + ...environmentService.options?.additionalTrustedDomains ?? [], + ...configuraionDomains ?? [] ]; let trustedDomains: string[] = [];