设置页面的插件商店配置中添加可信任域TrustDomains.

This commit is contained in:
chriswang521 2023-08-17 17:26:02 +08:00
parent 5a979b5480
commit 1bc97780c1
3 changed files with 17 additions and 3 deletions

View File

@ -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":"插件商店配置地址已更改。"

View File

@ -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[];
// }
}

View File

@ -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<string[]>('extensionsGallery.trustDomains');
const defaultTrustedDomains = [
...productService.linkProtectionTrustedDomains ?? [],
...environmentService.options?.additionalTrustedDomains ?? []
...environmentService.options?.additionalTrustedDomains ?? [],
...configuraionDomains ?? []
];
let trustedDomains: string[] = [];