Workspace trust not enabled in web
This commit is contained in:
parent
2b6df1bba9
commit
4209e2cc12
|
@ -24,6 +24,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
|||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IWorkspacesService, hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { WORKSPACE_TRUST_ENABLED } from 'vs/workbench/services/workspaces/common/workspaceTrust';
|
||||
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
|
||||
|
||||
export class OpenFileAction extends Action {
|
||||
|
||||
|
@ -256,7 +257,7 @@ class WorkspaceTrustManageAction extends Action2 {
|
|||
super({
|
||||
id: 'workbench.action.manageTrust',
|
||||
title: { value: localize('manageTrustAction', "Manage Workspace Trust"), original: 'Manage Workspace Trust' },
|
||||
precondition: ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true),
|
||||
precondition: ContextKeyExpr.and(IsWebContext.negate(), ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true)),
|
||||
category: localize('workspacesCategory', "Workspaces"),
|
||||
f1: true
|
||||
});
|
||||
|
|
|
@ -34,6 +34,8 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
|||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { isWeb } from 'vs/base/common/platform';
|
||||
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
|
||||
|
||||
const workspaceTrustIcon = registerIcon('workspace-trust-icon', Codicon.shield, localize('workspaceTrustIcon', "Icon for workspace trust badge."));
|
||||
|
||||
|
@ -384,7 +386,7 @@ registerAction2(class extends Action2 {
|
|||
id: MenuId.GlobalActivity,
|
||||
group: '6_workspace_trust',
|
||||
order: 40,
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true), WorkspaceTrustContext.PendingRequest.negate())
|
||||
when: ContextKeyExpr.and(IsWebContext.negate(), ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true), WorkspaceTrustContext.PendingRequest.negate())
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -407,7 +409,7 @@ MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|||
},
|
||||
group: '6_workspace_trust',
|
||||
order: 40,
|
||||
when: ContextKeyExpr.and(ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true), WorkspaceTrustContext.PendingRequest)
|
||||
when: ContextKeyExpr.and(IsWebContext.negate(), ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true), WorkspaceTrustContext.PendingRequest)
|
||||
});
|
||||
|
||||
// Configuration
|
||||
|
@ -421,6 +423,7 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
|||
[WORKSPACE_TRUST_ENABLED]: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
included: !isWeb,
|
||||
description: localize('workspace.trust.description', "Controls whether or not workspace trust is enabled within VS Code."),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import { EditorModel } from 'vs/workbench/common/editor';
|
|||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { dirname, resolve } from 'vs/base/common/path';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { isWeb } from 'vs/base/common/platform';
|
||||
|
||||
export const WORKSPACE_TRUST_ENABLED = 'security.workspace.trust.enabled';
|
||||
export const WORKSPACE_TRUST_STORAGE_KEY = 'content.trust.model.key';
|
||||
|
@ -429,7 +430,7 @@ export class WorkspaceTrustService extends Disposable implements IWorkspaceTrust
|
|||
}
|
||||
|
||||
isWorkspaceTrustEnabled(): boolean {
|
||||
return this.configurationService.inspect<boolean>(WORKSPACE_TRUST_ENABLED).userValue ?? false;
|
||||
return isWeb ? false : this.configurationService.inspect<boolean>(WORKSPACE_TRUST_ENABLED).userValue ?? false;
|
||||
}
|
||||
|
||||
async requestWorkspaceTrust(options: WorkspaceTrustRequestOptions = { modal: true }): Promise<WorkspaceTrustState | undefined> {
|
||||
|
|
Loading…
Reference in a new issue