@codingame/monaco-vscode-workspace-trust-service-override 38.0.7 → 39.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/workspace/browser/workspace.contribution.js +63 -63
- package/vscode/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.js +211 -131
- package/vscode/src/vs/workbench/services/workspaces/browser/workspaceTrustEditorInput.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-workspace-trust-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "39.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - workspace-trust service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "39.0.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -64,13 +64,13 @@ function getSessionsWindowTrustNote(environmentService, productService, isWorksp
|
|
|
64
64
|
}
|
|
65
65
|
if (isWorkspace) {
|
|
66
66
|
return localize(
|
|
67
|
-
|
|
67
|
+
26921,
|
|
68
68
|
"Trusting this workspace will also mark it as trusted in {0}.",
|
|
69
69
|
productService.nameLong
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
return localize(
|
|
73
|
-
|
|
73
|
+
26922,
|
|
74
74
|
"Trusting this folder will also mark it as trusted in {0}.",
|
|
75
75
|
productService.nameLong
|
|
76
76
|
);
|
|
@@ -127,29 +127,29 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
|
|
|
127
127
|
await this.workspaceTrustManagementService.workspaceResolved;
|
|
128
128
|
const markdownDetails = [
|
|
129
129
|
this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY ? ( localize(
|
|
130
|
-
|
|
130
|
+
26923,
|
|
131
131
|
"You are trying to open untrusted files in a workspace which is trusted."
|
|
132
132
|
)) : ( localize(
|
|
133
|
-
|
|
133
|
+
26924,
|
|
134
134
|
"You are trying to open untrusted files in a window which is trusted."
|
|
135
135
|
)),
|
|
136
136
|
( localize(
|
|
137
|
-
|
|
137
|
+
26925,
|
|
138
138
|
"If you don't want to open untrusted files, we recommend to open them in Restricted Mode in a new window as the files may be malicious. See [our docs](https://aka.ms/vscode-workspace-trust) to learn more."
|
|
139
139
|
))
|
|
140
140
|
];
|
|
141
141
|
await this.dialogService.prompt({
|
|
142
142
|
type: Severity.Info,
|
|
143
|
-
message: this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY ? ( localize(
|
|
143
|
+
message: this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY ? ( localize(26926, "Do you want to allow untrusted files in this workspace?")) : ( localize(26927, "Do you want to allow untrusted files in this window?")),
|
|
144
144
|
buttons: [{
|
|
145
|
-
label: ( localize(
|
|
145
|
+
label: ( localize(26928, "&&Open")),
|
|
146
146
|
run: (
|
|
147
147
|
{
|
|
148
148
|
checkboxChecked
|
|
149
149
|
}
|
|
150
150
|
) => this.workspaceTrustRequestService.completeOpenFilesTrustRequest(WorkspaceTrustUriResponse.Open, !!checkboxChecked)
|
|
151
151
|
}, {
|
|
152
|
-
label: ( localize(
|
|
152
|
+
label: ( localize(26929, "Open in &&Restricted Mode")),
|
|
153
153
|
run: (
|
|
154
154
|
{
|
|
155
155
|
checkboxChecked
|
|
@@ -160,7 +160,7 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
|
|
|
160
160
|
run: () => this.workspaceTrustRequestService.completeOpenFilesTrustRequest(WorkspaceTrustUriResponse.Cancel)
|
|
161
161
|
},
|
|
162
162
|
checkbox: {
|
|
163
|
-
label: ( localize(
|
|
163
|
+
label: ( localize(26930, "Remember my decision for all workspaces")),
|
|
164
164
|
checked: false
|
|
165
165
|
},
|
|
166
166
|
custom: {
|
|
@@ -178,10 +178,10 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
|
|
|
178
178
|
this.workspaceTrustRequestService.onDidInitiateResourcesTrustRequest(async options => {
|
|
179
179
|
await this.workspaceTrustManagementService.workspaceResolved;
|
|
180
180
|
const markdownDetails = [options?.message ?? ( localize(
|
|
181
|
-
|
|
181
|
+
26931,
|
|
182
182
|
"You are trying to open an untrusted folder. Do you trust the authors of this content?"
|
|
183
183
|
)), ( localize(
|
|
184
|
-
|
|
184
|
+
26932,
|
|
185
185
|
"If you don't trust the authors of these files, we recommend not continuing as the files may be malicious. See [our docs](https://aka.ms/vscode-workspace-trust) to learn more."
|
|
186
186
|
)), `\`${this.labelService.getUriLabel(options.uri)}\``];
|
|
187
187
|
const sessionsTrustNote = getSessionsWindowTrustNote(this.environmentService, this.productService, false);
|
|
@@ -190,9 +190,9 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
|
|
|
190
190
|
}
|
|
191
191
|
await this.dialogService.prompt({
|
|
192
192
|
type: Severity.Info,
|
|
193
|
-
message: ( localize(
|
|
193
|
+
message: ( localize(26933, "Do you trust the authors of the files in this folder?")),
|
|
194
194
|
buttons: [{
|
|
195
|
-
label: ( localize(
|
|
195
|
+
label: ( localize(26934, "&&Trust Folder & Continue")),
|
|
196
196
|
run: () => this.workspaceTrustRequestService.completeResourcesTrustRequest(options.uri, WorkspaceTrustUriResponse.Open)
|
|
197
197
|
}],
|
|
198
198
|
cancelButton: {
|
|
@@ -212,22 +212,22 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
|
|
|
212
212
|
this._register(
|
|
213
213
|
this.workspaceTrustRequestService.onDidInitiateWorkspaceTrustRequest(async requestOptions => {
|
|
214
214
|
await this.workspaceTrustManagementService.workspaceResolved;
|
|
215
|
-
const message = this.useWorkspaceLanguage ? ( localize(
|
|
215
|
+
const message = this.useWorkspaceLanguage ? ( localize(26935, "Do you trust the authors of the files in this workspace?")) : ( localize(26936, "Do you trust the authors of the files in this folder?"));
|
|
216
216
|
const defaultDetails = ( localize(
|
|
217
|
-
|
|
217
|
+
26937,
|
|
218
218
|
"A feature you are trying to use may be a security risk if you do not trust the source of the files or folders you currently have open."
|
|
219
219
|
));
|
|
220
220
|
const details = requestOptions?.message ?? defaultDetails;
|
|
221
221
|
const buttons = requestOptions?.buttons ?? [{
|
|
222
|
-
label: this.useWorkspaceLanguage ? ( localize(
|
|
222
|
+
label: this.useWorkspaceLanguage ? ( localize(26938, "&&Trust Workspace & Continue")) : ( localize(26939, "&&Trust Folder & Continue")),
|
|
223
223
|
type: "ContinueWithTrust"
|
|
224
224
|
}, {
|
|
225
|
-
label: ( localize(
|
|
225
|
+
label: ( localize(26940, "&&Manage")),
|
|
226
226
|
type: "Manage"
|
|
227
227
|
}];
|
|
228
228
|
if (!( buttons.some(b => b.type === "Cancel"))) {
|
|
229
229
|
buttons.push({
|
|
230
|
-
label: ( localize(
|
|
230
|
+
label: ( localize(26941, "Cancel")),
|
|
231
231
|
type: "Cancel"
|
|
232
232
|
});
|
|
233
233
|
}
|
|
@@ -235,7 +235,7 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
|
|
|
235
235
|
markdown: ( new MarkdownString(details))
|
|
236
236
|
}, {
|
|
237
237
|
markdown: ( new MarkdownString(( localize(
|
|
238
|
-
|
|
238
|
+
26942,
|
|
239
239
|
"If you don't trust the authors of these files, we do not recommend continuing as the files may be malicious. See [our docs](https://aka.ms/vscode-workspace-trust) to learn more."
|
|
240
240
|
))))
|
|
241
241
|
}];
|
|
@@ -361,7 +361,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
361
361
|
);
|
|
362
362
|
if (!addedFoldersTrustInfo.map(info => info.trusted).every(trusted => trusted)) {
|
|
363
363
|
let detail = ( localize(
|
|
364
|
-
|
|
364
|
+
26943,
|
|
365
365
|
"You are adding files that are not currently trusted to a trusted workspace. Do you trust the authors of these new files?"
|
|
366
366
|
));
|
|
367
367
|
const sessionsTrustNote = getSessionsWindowTrustNote(this.environmentService, this.productService, false);
|
|
@@ -372,9 +372,9 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
372
372
|
confirmed
|
|
373
373
|
} = await this.dialogService.confirm({
|
|
374
374
|
type: Severity.Info,
|
|
375
|
-
message: ( localize(
|
|
375
|
+
message: ( localize(26944, "Do you trust the authors of the files in this folder?")),
|
|
376
376
|
detail,
|
|
377
|
-
cancelButton: ( localize(
|
|
377
|
+
cancelButton: ( localize(26945, "No")),
|
|
378
378
|
custom: {
|
|
379
379
|
icon: Codicon.shield
|
|
380
380
|
}
|
|
@@ -403,25 +403,25 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
403
403
|
} else {
|
|
404
404
|
console.warn("AI generated workspace trust dialog contents not available.");
|
|
405
405
|
}
|
|
406
|
-
const title = titleString ?? (this.useWorkspaceLanguage ? ( localize(
|
|
406
|
+
const title = titleString ?? (this.useWorkspaceLanguage ? ( localize(26935, "Do you trust the authors of the files in this workspace?")) : ( localize(26936, "Do you trust the authors of the files in this folder?")));
|
|
407
407
|
let checkboxText;
|
|
408
408
|
const workspaceIdentifier = toWorkspaceIdentifier(this.workspaceContextService.getWorkspace());
|
|
409
409
|
const isSingleFolderWorkspace = isSingleFolderWorkspaceIdentifier(workspaceIdentifier);
|
|
410
410
|
const isEmptyWindow = isEmptyWorkspaceIdentifier(workspaceIdentifier);
|
|
411
411
|
if (!isAiGeneratedWorkspace && this.workspaceTrustManagementService.canSetParentFolderTrust()) {
|
|
412
412
|
const name = basename(dirname(workspaceIdentifier.uri));
|
|
413
|
-
checkboxText = ( localize(
|
|
413
|
+
checkboxText = ( localize(26946, "Trust the authors of all files in the parent folder '{0}'", name));
|
|
414
414
|
}
|
|
415
415
|
const markdownStrings = [!isSingleFolderWorkspace ? ( localize(
|
|
416
|
-
|
|
416
|
+
26947,
|
|
417
417
|
"{0} provides features that may automatically execute files in this workspace.",
|
|
418
418
|
this.productService.nameShort
|
|
419
419
|
)) : ( localize(
|
|
420
|
-
|
|
420
|
+
26948,
|
|
421
421
|
"{0} provides features that may automatically execute files in this folder.",
|
|
422
422
|
this.productService.nameShort
|
|
423
423
|
)), learnMoreString ?? ( localize(
|
|
424
|
-
|
|
424
|
+
26949,
|
|
425
425
|
"If you don't trust the authors of these files, we recommend to continue in restricted mode as the files may be malicious. See [our docs](https://aka.ms/vscode-workspace-trust) to learn more."
|
|
426
426
|
)), !isEmptyWindow ? `\`${this.labelService.getWorkspaceLabel(workspaceIdentifier, {
|
|
427
427
|
verbose: Verbosity.LONG
|
|
@@ -431,11 +431,11 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
431
431
|
markdownStrings.push(sessionsTrustNote);
|
|
432
432
|
}
|
|
433
433
|
this.doShowModal(title, {
|
|
434
|
-
label: trustOption ?? ( localize(
|
|
435
|
-
sublabel: isSingleFolderWorkspace ? ( localize(
|
|
434
|
+
label: trustOption ?? ( localize(26950, "&&Yes, I trust the authors")),
|
|
435
|
+
sublabel: isSingleFolderWorkspace ? ( localize(26951, "Trust folder and enable all features")) : ( localize(26952, "Trust workspace and enable all features"))
|
|
436
436
|
}, {
|
|
437
|
-
label: dontTrustOption ?? ( localize(
|
|
438
|
-
sublabel: isSingleFolderWorkspace ? ( localize(
|
|
437
|
+
label: dontTrustOption ?? ( localize(26953, "&&No, I don't trust the authors")),
|
|
438
|
+
sublabel: isSingleFolderWorkspace ? ( localize(26954, "Open folder in restricted mode")) : ( localize(26955, "Open workspace in restricted mode"))
|
|
439
439
|
}, markdownStrings, checkboxText);
|
|
440
440
|
})
|
|
441
441
|
);
|
|
@@ -558,10 +558,10 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
558
558
|
return undefined;
|
|
559
559
|
}
|
|
560
560
|
const actions = [{
|
|
561
|
-
label: ( localize(
|
|
561
|
+
label: ( localize(26956, "Manage")),
|
|
562
562
|
href: "command:" + MANAGE_TRUST_COMMAND_ID
|
|
563
563
|
}, {
|
|
564
|
-
label: ( localize(
|
|
564
|
+
label: ( localize(26957, "Learn More")),
|
|
565
565
|
href: "https://aka.ms/vscode-workspace-trust"
|
|
566
566
|
}];
|
|
567
567
|
return {
|
|
@@ -586,17 +586,17 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
586
586
|
switch (this.workspaceContextService.getWorkbenchState()) {
|
|
587
587
|
case WorkbenchState.EMPTY:
|
|
588
588
|
return localize(
|
|
589
|
-
|
|
589
|
+
26958,
|
|
590
590
|
"Restricted Mode is intended for safe code browsing. Trust this window to enable all features. Use navigation keys to access banner actions."
|
|
591
591
|
);
|
|
592
592
|
case WorkbenchState.FOLDER:
|
|
593
593
|
return localize(
|
|
594
|
-
|
|
594
|
+
26959,
|
|
595
595
|
"Restricted Mode is intended for safe code browsing. Trust this folder to enable all features. Use navigation keys to access banner actions."
|
|
596
596
|
);
|
|
597
597
|
case WorkbenchState.WORKSPACE:
|
|
598
598
|
return localize(
|
|
599
|
-
|
|
599
|
+
26960,
|
|
600
600
|
"Restricted Mode is intended for safe code browsing. Trust this workspace to enable all features. Use navigation keys to access banner actions."
|
|
601
601
|
);
|
|
602
602
|
}
|
|
@@ -605,17 +605,17 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
605
605
|
switch (this.workspaceContextService.getWorkbenchState()) {
|
|
606
606
|
case WorkbenchState.EMPTY:
|
|
607
607
|
return localize(
|
|
608
|
-
|
|
608
|
+
26961,
|
|
609
609
|
"Restricted Mode is intended for safe code browsing. Trust this window to enable all features."
|
|
610
610
|
);
|
|
611
611
|
case WorkbenchState.FOLDER:
|
|
612
612
|
return localize(
|
|
613
|
-
|
|
613
|
+
26962,
|
|
614
614
|
"Restricted Mode is intended for safe code browsing. Trust this folder to enable all features."
|
|
615
615
|
);
|
|
616
616
|
case WorkbenchState.WORKSPACE:
|
|
617
617
|
return localize(
|
|
618
|
-
|
|
618
|
+
26963,
|
|
619
619
|
"Restricted Mode is intended for safe code browsing. Trust this workspace to enable all features."
|
|
620
620
|
);
|
|
621
621
|
}
|
|
@@ -634,12 +634,12 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
634
634
|
case WorkbenchState.EMPTY:
|
|
635
635
|
{
|
|
636
636
|
ariaLabel = ( localize(
|
|
637
|
-
|
|
637
|
+
26964,
|
|
638
638
|
"Restricted Mode: Some features are disabled because this window is not trusted."
|
|
639
639
|
));
|
|
640
640
|
toolTip = {
|
|
641
641
|
value: ( localize(
|
|
642
|
-
|
|
642
|
+
26965,
|
|
643
643
|
"Running in Restricted Mode\n\nSome [features are disabled]({0}) because this [window is not trusted]({1}).",
|
|
644
644
|
`command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`,
|
|
645
645
|
`command:${MANAGE_TRUST_COMMAND_ID}`
|
|
@@ -652,12 +652,12 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
652
652
|
case WorkbenchState.FOLDER:
|
|
653
653
|
{
|
|
654
654
|
ariaLabel = ( localize(
|
|
655
|
-
|
|
655
|
+
26966,
|
|
656
656
|
"Restricted Mode: Some features are disabled because this folder is not trusted."
|
|
657
657
|
));
|
|
658
658
|
toolTip = {
|
|
659
659
|
value: ( localize(
|
|
660
|
-
|
|
660
|
+
26967,
|
|
661
661
|
"Running in Restricted Mode\n\nSome [features are disabled]({0}) because this [folder is not trusted]({1}).",
|
|
662
662
|
`command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`,
|
|
663
663
|
`command:${MANAGE_TRUST_COMMAND_ID}`
|
|
@@ -670,12 +670,12 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
670
670
|
case WorkbenchState.WORKSPACE:
|
|
671
671
|
{
|
|
672
672
|
ariaLabel = ( localize(
|
|
673
|
-
|
|
673
|
+
26968,
|
|
674
674
|
"Restricted Mode: Some features are disabled because this workspace is not trusted."
|
|
675
675
|
));
|
|
676
676
|
toolTip = {
|
|
677
677
|
value: ( localize(
|
|
678
|
-
|
|
678
|
+
26969,
|
|
679
679
|
"Running in Restricted Mode\n\nSome [features are disabled]({0}) because this [workspace is not trusted]({1}).",
|
|
680
680
|
`command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`,
|
|
681
681
|
`command:${MANAGE_TRUST_COMMAND_ID}`
|
|
@@ -687,8 +687,8 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
689
|
return {
|
|
690
|
-
name: ( localize(
|
|
691
|
-
text: `$(shield) ${( localize(
|
|
690
|
+
name: ( localize(26970, "Workspace Trust")),
|
|
691
|
+
text: `$(shield) ${( localize(26971, "Restricted Mode"))}`,
|
|
692
692
|
ariaLabel: ariaLabel,
|
|
693
693
|
tooltip: toolTip,
|
|
694
694
|
command: MANAGE_TRUST_COMMAND_ID,
|
|
@@ -732,16 +732,16 @@ class WorkspaceTrustEditorInputSerializer {
|
|
|
732
732
|
}
|
|
733
733
|
( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(WorkspaceTrustEditorInput.ID, WorkspaceTrustEditorInputSerializer);
|
|
734
734
|
( Registry.as(EditorExtensions.EditorPane)).registerEditorPane(
|
|
735
|
-
EditorPaneDescriptor.create(WorkspaceTrustEditor, WorkspaceTrustEditor.ID, ( localize(
|
|
735
|
+
EditorPaneDescriptor.create(WorkspaceTrustEditor, WorkspaceTrustEditor.ID, ( localize(26972, "Workspace Trust Editor"))),
|
|
736
736
|
[( new SyncDescriptor(WorkspaceTrustEditorInput))]
|
|
737
737
|
);
|
|
738
738
|
const CONFIGURE_TRUST_COMMAND_ID = "workbench.trust.configure";
|
|
739
|
-
const WORKSPACES_CATEGORY = ( localize2(
|
|
739
|
+
const WORKSPACES_CATEGORY = ( localize2(26973, "Workspaces"));
|
|
740
740
|
registerAction2(class extends Action2 {
|
|
741
741
|
constructor() {
|
|
742
742
|
super({
|
|
743
743
|
id: CONFIGURE_TRUST_COMMAND_ID,
|
|
744
|
-
title: ( localize2(
|
|
744
|
+
title: ( localize2(26974, "Configure Workspace Trust Settings")),
|
|
745
745
|
precondition: ( ContextKeyExpr.and(WorkspaceTrustContext.IsEnabled, ( ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true)))),
|
|
746
746
|
category: WORKSPACES_CATEGORY,
|
|
747
747
|
f1: true
|
|
@@ -758,7 +758,7 @@ registerAction2(class extends Action2 {
|
|
|
758
758
|
constructor() {
|
|
759
759
|
super({
|
|
760
760
|
id: MANAGE_TRUST_COMMAND_ID,
|
|
761
|
-
title: ( localize2(
|
|
761
|
+
title: ( localize2(26975, "Manage Workspace Trust")),
|
|
762
762
|
precondition: ( ContextKeyExpr.and(WorkspaceTrustContext.IsEnabled, ( ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true)))),
|
|
763
763
|
category: WORKSPACES_CATEGORY,
|
|
764
764
|
f1: true
|
|
@@ -781,7 +781,7 @@ registerAction2(class extends Action2 {
|
|
|
781
781
|
type: "boolean",
|
|
782
782
|
default: true,
|
|
783
783
|
description: ( localize(
|
|
784
|
-
|
|
784
|
+
26976,
|
|
785
785
|
"Controls whether or not Workspace Trust is enabled within VS Code."
|
|
786
786
|
)),
|
|
787
787
|
tags: [WORKSPACE_TRUST_SETTING_TAG],
|
|
@@ -790,29 +790,29 @@ registerAction2(class extends Action2 {
|
|
|
790
790
|
[WORKSPACE_TRUST_STARTUP_PROMPT]: {
|
|
791
791
|
type: "string",
|
|
792
792
|
default: "never",
|
|
793
|
-
description: ( localize(
|
|
793
|
+
description: ( localize(26977, "Controls when the startup prompt to trust a workspace is shown.")),
|
|
794
794
|
tags: [WORKSPACE_TRUST_SETTING_TAG],
|
|
795
795
|
scope: ConfigurationScope.APPLICATION,
|
|
796
796
|
enum: ["always", "once", "never"],
|
|
797
|
-
enumDescriptions: [( localize(
|
|
797
|
+
enumDescriptions: [( localize(26978, "Ask for trust every time an untrusted workspace is opened.")), ( localize(26979, "Ask for trust the first time an untrusted workspace is opened.")), ( localize(26980, "Do not ask for trust when an untrusted workspace is opened."))]
|
|
798
798
|
},
|
|
799
799
|
[WORKSPACE_TRUST_BANNER]: {
|
|
800
800
|
type: "string",
|
|
801
801
|
default: "untilDismissed",
|
|
802
|
-
description: ( localize(
|
|
802
|
+
description: ( localize(26981, "Controls when the restricted mode banner is shown.")),
|
|
803
803
|
tags: [WORKSPACE_TRUST_SETTING_TAG],
|
|
804
804
|
scope: ConfigurationScope.APPLICATION,
|
|
805
805
|
enum: ["always", "untilDismissed", "never"],
|
|
806
|
-
enumDescriptions: [( localize(
|
|
807
|
-
|
|
806
|
+
enumDescriptions: [( localize(26982, "Show the banner every time an untrusted workspace is open.")), ( localize(
|
|
807
|
+
26983,
|
|
808
808
|
"Show the banner when an untrusted workspace is opened until dismissed."
|
|
809
|
-
)), ( localize(
|
|
809
|
+
)), ( localize(26984, "Do not show the banner when an untrusted workspace is open."))]
|
|
810
810
|
},
|
|
811
811
|
[WORKSPACE_TRUST_UNTRUSTED_FILES]: {
|
|
812
812
|
type: "string",
|
|
813
813
|
default: "prompt",
|
|
814
814
|
markdownDescription: ( localize(
|
|
815
|
-
|
|
815
|
+
26985,
|
|
816
816
|
"Controls how to handle opening untrusted files in a trusted workspace. This setting also applies to opening files in an empty window which is trusted via `#{0}#`.",
|
|
817
817
|
WORKSPACE_TRUST_EMPTY_WINDOW
|
|
818
818
|
)),
|
|
@@ -820,13 +820,13 @@ registerAction2(class extends Action2 {
|
|
|
820
820
|
scope: ConfigurationScope.APPLICATION,
|
|
821
821
|
enum: ["prompt", "open", "newWindow"],
|
|
822
822
|
enumDescriptions: [( localize(
|
|
823
|
-
|
|
823
|
+
26986,
|
|
824
824
|
"Ask how to handle untrusted files for each workspace. Once untrusted files are introduced to a trusted workspace, you will not be prompted again."
|
|
825
825
|
)), ( localize(
|
|
826
|
-
|
|
826
|
+
26987,
|
|
827
827
|
"Always allow untrusted files to be introduced to a trusted workspace without prompting."
|
|
828
828
|
)), ( localize(
|
|
829
|
-
|
|
829
|
+
26988,
|
|
830
830
|
"Always open untrusted files in a separate window in restricted mode without prompting."
|
|
831
831
|
))]
|
|
832
832
|
},
|
|
@@ -834,7 +834,7 @@ registerAction2(class extends Action2 {
|
|
|
834
834
|
type: "boolean",
|
|
835
835
|
default: true,
|
|
836
836
|
markdownDescription: ( localize(
|
|
837
|
-
|
|
837
|
+
26989,
|
|
838
838
|
"Controls whether or not the empty window is trusted by default within VS Code. When used with `#{0}#`, you can enable the full functionality of VS Code without prompting in an empty window.",
|
|
839
839
|
WORKSPACE_TRUST_UNTRUSTED_FILES
|
|
840
840
|
)),
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { Dimension } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/dom";
|
|
2
|
+
import { IMessage } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/inputbox/inputBox";
|
|
3
|
+
import { DomScrollableElement } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/scrollbar/scrollableElement";
|
|
2
4
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
5
|
+
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
6
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
7
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
8
|
+
import { IFileDialogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
3
9
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
10
|
+
import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
|
|
4
11
|
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
5
12
|
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
6
13
|
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
@@ -12,6 +19,7 @@ import { IEditorOpenContext } from "@codingame/monaco-vscode-api/vscode/vs/workb
|
|
|
12
19
|
import { IExtensionsWorkbenchService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/extensions/common/extensions.service";
|
|
13
20
|
import { IWorkbenchConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/configuration/common/configuration.service";
|
|
14
21
|
import { IExtensionManifestPropertiesService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService.service";
|
|
22
|
+
import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
15
23
|
import { WorkspaceTrustEditorInput } from "../../../services/workspaces/browser/workspaceTrustEditorInput.js";
|
|
16
24
|
import { IEditorOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/editor/common/editor";
|
|
17
25
|
import { IWorkbenchExtensionEnablementService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.service";
|
|
@@ -19,6 +27,48 @@ import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
19
27
|
import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
20
28
|
import { IEditorGroup } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService";
|
|
21
29
|
export declare const shieldIcon: ThemeIcon;
|
|
30
|
+
interface ITrustedUriItem {
|
|
31
|
+
parentOfWorkspaceItem: boolean;
|
|
32
|
+
uri: URI;
|
|
33
|
+
}
|
|
34
|
+
export declare class WorkspaceTrustedUrisTable extends Disposable {
|
|
35
|
+
private readonly container;
|
|
36
|
+
private readonly scrollableElement;
|
|
37
|
+
private readonly instantiationService;
|
|
38
|
+
private readonly workspaceService;
|
|
39
|
+
private readonly workspaceTrustManagementService;
|
|
40
|
+
private readonly uriService;
|
|
41
|
+
private readonly labelService;
|
|
42
|
+
private readonly fileDialogService;
|
|
43
|
+
private readonly _onDidAcceptEdit;
|
|
44
|
+
readonly onDidAcceptEdit: Event<ITrustedUriItem>;
|
|
45
|
+
private readonly _onDidRejectEdit;
|
|
46
|
+
readonly onDidRejectEdit: Event<ITrustedUriItem>;
|
|
47
|
+
private _onEdit;
|
|
48
|
+
readonly onEdit: Event<ITrustedUriItem>;
|
|
49
|
+
private _onDelete;
|
|
50
|
+
readonly onDelete: Event<ITrustedUriItem>;
|
|
51
|
+
private readonly table;
|
|
52
|
+
private readonly descriptionElement;
|
|
53
|
+
constructor(container: HTMLElement, scrollableElement: DomScrollableElement | undefined, instantiationService: IInstantiationService, workspaceService: IWorkspaceContextService, workspaceTrustManagementService: IWorkspaceTrustManagementService, uriService: IUriIdentityService, labelService: ILabelService, fileDialogService: IFileDialogService);
|
|
54
|
+
private addTrustedUri;
|
|
55
|
+
private getIndexOfTrustedUriEntry;
|
|
56
|
+
private selectTrustedUriEntry;
|
|
57
|
+
/**
|
|
58
|
+
* The table is laid out to fit all of its rows, so scrolling happens in the surrounding
|
|
59
|
+
* scrollable element rather than in the table itself.
|
|
60
|
+
*/
|
|
61
|
+
private revealInScrollableElement;
|
|
62
|
+
private get currentWorkspaceUri();
|
|
63
|
+
private get trustedUriEntries();
|
|
64
|
+
layout(): void;
|
|
65
|
+
updateTable(): void;
|
|
66
|
+
validateUri(path: string, item?: ITrustedUriItem): IMessage | null;
|
|
67
|
+
acceptEdit(item: ITrustedUriItem, uri: URI): Promise<void>;
|
|
68
|
+
rejectEdit(item: ITrustedUriItem): void;
|
|
69
|
+
delete(item: ITrustedUriItem): Promise<void>;
|
|
70
|
+
edit(item: ITrustedUriItem, usePickerIfPossible?: boolean): Promise<void>;
|
|
71
|
+
}
|
|
22
72
|
export declare class WorkspaceTrustEditor extends EditorPane {
|
|
23
73
|
private readonly workspaceService;
|
|
24
74
|
private readonly extensionWorkbenchService;
|
|
@@ -53,6 +103,7 @@ export declare class WorkspaceTrustEditor extends EditorPane {
|
|
|
53
103
|
private getFeaturesHeaderText;
|
|
54
104
|
private rendering;
|
|
55
105
|
private readonly rerenderDisposables;
|
|
106
|
+
private readonly actionButtons;
|
|
56
107
|
private render;
|
|
57
108
|
private getExtensionCount;
|
|
58
109
|
private createHeaderElement;
|
|
@@ -68,3 +119,4 @@ export declare class WorkspaceTrustEditor extends EditorPane {
|
|
|
68
119
|
private layoutParticipants;
|
|
69
120
|
layout(dimension: Dimension): void;
|
|
70
121
|
}
|
|
122
|
+
export {};
|
|
@@ -8,6 +8,7 @@ import { DomScrollableElement } from '@codingame/monaco-vscode-api/vscode/vs/bas
|
|
|
8
8
|
import { Action } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
|
|
9
9
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
10
10
|
import { debounce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/decorators';
|
|
11
|
+
import { onUnexpectedError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
11
12
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
12
13
|
import { KeyCode, KeyMod } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
13
14
|
import { normalizeDriveLetter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/labels';
|
|
@@ -31,6 +32,7 @@ import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platfo
|
|
|
31
32
|
import { asCssVariable } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
|
|
32
33
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
|
|
33
34
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
35
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/confettiColors';
|
|
34
36
|
import { editorErrorForeground } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
|
|
35
37
|
import { buttonBackground, buttonSecondaryBackground } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
|
|
36
38
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
|
|
@@ -65,15 +67,16 @@ import { isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/
|
|
|
65
67
|
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
66
68
|
|
|
67
69
|
var TrustedUriActionsColumnRenderer_1, TrustedUriPathColumnRenderer_1, TrustedUriHostColumnRenderer_1, WorkspaceTrustEditor_1;
|
|
68
|
-
const shieldIcon = registerIcon("workspace-trust-banner", Codicon.shield, ( localize(
|
|
69
|
-
const checkListIcon = registerIcon("workspace-trust-editor-check", Codicon.check, ( localize(
|
|
70
|
-
const xListIcon = registerIcon("workspace-trust-editor-cross", Codicon.x, ( localize(
|
|
71
|
-
const folderPickerIcon = registerIcon("workspace-trust-editor-folder-picker", Codicon.folder, ( localize(
|
|
72
|
-
const editIcon = registerIcon("workspace-trust-editor-edit-folder", Codicon.edit, ( localize(
|
|
73
|
-
const removeIcon = registerIcon("workspace-trust-editor-remove-folder", Codicon.close, ( localize(
|
|
70
|
+
const shieldIcon = registerIcon("workspace-trust-banner", Codicon.shield, ( localize(26990, "Icon for workspace trust ion the banner.")));
|
|
71
|
+
const checkListIcon = registerIcon("workspace-trust-editor-check", Codicon.check, ( localize(26991, "Icon for the checkmark in the workspace trust editor.")));
|
|
72
|
+
const xListIcon = registerIcon("workspace-trust-editor-cross", Codicon.x, ( localize(26992, "Icon for the cross in the workspace trust editor.")));
|
|
73
|
+
const folderPickerIcon = registerIcon("workspace-trust-editor-folder-picker", Codicon.folder, ( localize(26993, "Icon for the pick folder icon in the workspace trust editor.")));
|
|
74
|
+
const editIcon = registerIcon("workspace-trust-editor-edit-folder", Codicon.edit, ( localize(26994, "Icon for the edit folder icon in the workspace trust editor.")));
|
|
75
|
+
const removeIcon = registerIcon("workspace-trust-editor-remove-folder", Codicon.close, ( localize(26995, "Icon for the remove folder icon in the workspace trust editor.")));
|
|
74
76
|
let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposable {
|
|
75
77
|
constructor(
|
|
76
78
|
container,
|
|
79
|
+
scrollableElement,
|
|
77
80
|
instantiationService,
|
|
78
81
|
workspaceService,
|
|
79
82
|
workspaceTrustManagementService,
|
|
@@ -83,6 +86,7 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
83
86
|
) {
|
|
84
87
|
super();
|
|
85
88
|
this.container = container;
|
|
89
|
+
this.scrollableElement = scrollableElement;
|
|
86
90
|
this.instantiationService = instantiationService;
|
|
87
91
|
this.workspaceService = workspaceService;
|
|
88
92
|
this.workspaceTrustManagementService = workspaceTrustManagementService;
|
|
@@ -100,62 +104,64 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
100
104
|
this.descriptionElement = container.appendChild($(".workspace-trusted-folders-description"));
|
|
101
105
|
const tableElement = container.appendChild($(".trusted-uris-table"));
|
|
102
106
|
const addButtonBarElement = container.appendChild($(".trusted-uris-button-bar"));
|
|
103
|
-
this.table = this.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
107
|
+
this.table = this._register(
|
|
108
|
+
this.instantiationService.createInstance(WorkbenchTable, "WorkspaceTrust", tableElement, ( new TrustedUriTableVirtualDelegate()), [{
|
|
109
|
+
label: ( localize(26996, "Host")),
|
|
110
|
+
tooltip: "",
|
|
111
|
+
weight: 1,
|
|
112
|
+
templateId: TrustedUriHostColumnRenderer.TEMPLATE_ID,
|
|
113
|
+
project(row) {
|
|
114
|
+
return row;
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
label: ( localize(26997, "Path")),
|
|
118
|
+
tooltip: "",
|
|
119
|
+
weight: 8,
|
|
120
|
+
templateId: TrustedUriPathColumnRenderer.TEMPLATE_ID,
|
|
121
|
+
project(row) {
|
|
122
|
+
return row;
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
label: "",
|
|
126
|
+
tooltip: "",
|
|
127
|
+
weight: 1,
|
|
128
|
+
minimumWidth: 75,
|
|
129
|
+
maximumWidth: 75,
|
|
130
|
+
templateId: TrustedUriActionsColumnRenderer.TEMPLATE_ID,
|
|
131
|
+
project(row) {
|
|
132
|
+
return row;
|
|
133
|
+
}
|
|
134
|
+
}], [
|
|
135
|
+
this.instantiationService.createInstance(TrustedUriHostColumnRenderer),
|
|
136
|
+
this.instantiationService.createInstance(TrustedUriPathColumnRenderer, this),
|
|
137
|
+
this.instantiationService.createInstance(TrustedUriActionsColumnRenderer, this, this.currentWorkspaceUri)
|
|
138
|
+
], {
|
|
139
|
+
horizontalScrolling: false,
|
|
140
|
+
alwaysConsumeMouseWheel: false,
|
|
141
|
+
openOnSingleClick: false,
|
|
142
|
+
multipleSelectionSupport: false,
|
|
143
|
+
accessibilityProvider: {
|
|
144
|
+
getAriaLabel: item => {
|
|
145
|
+
const hostLabel = getHostLabel(this.labelService, item);
|
|
146
|
+
if (hostLabel === undefined || hostLabel.length === 0) {
|
|
147
|
+
return localize(26998, "{0}, trusted", this.labelService.getUriLabel(item.uri));
|
|
148
|
+
}
|
|
149
|
+
return localize(
|
|
150
|
+
26999,
|
|
151
|
+
"{0} on {1}, trusted",
|
|
152
|
+
this.labelService.getUriLabel(item.uri),
|
|
153
|
+
hostLabel
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
getWidgetAriaLabel: () => ( localize(27000, "Trusted Folders & Workspaces"))
|
|
150
157
|
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return ( element.uri.toString());
|
|
158
|
+
identityProvider: {
|
|
159
|
+
getId(element) {
|
|
160
|
+
return ( element.uri.toString());
|
|
161
|
+
}
|
|
156
162
|
}
|
|
157
|
-
}
|
|
158
|
-
|
|
163
|
+
})
|
|
164
|
+
);
|
|
159
165
|
this._register(this.table.onDidOpen(item => {
|
|
160
166
|
if (item && item.element && !item.browserEvent?.defaultPrevented) {
|
|
161
167
|
this.edit(item.element, true);
|
|
@@ -163,41 +169,58 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
163
169
|
}));
|
|
164
170
|
const buttonBar = this._register(( new ButtonBar(addButtonBarElement)));
|
|
165
171
|
const addButton = this._register(buttonBar.addButton({
|
|
166
|
-
title: ( localize(
|
|
172
|
+
title: ( localize(27001, "Add Folder")),
|
|
167
173
|
...defaultButtonStyles
|
|
168
174
|
}));
|
|
169
|
-
addButton.label = ( localize(
|
|
175
|
+
addButton.label = ( localize(27001, "Add Folder"));
|
|
170
176
|
this._register(addButton.onDidClick(async () => {
|
|
171
177
|
const uri = await this.fileDialogService.showOpenDialog({
|
|
172
178
|
canSelectFiles: false,
|
|
173
179
|
canSelectFolders: true,
|
|
174
180
|
canSelectMany: false,
|
|
175
181
|
defaultUri: this.currentWorkspaceUri,
|
|
176
|
-
openLabel: ( localize(
|
|
177
|
-
title: ( localize(
|
|
182
|
+
openLabel: ( localize(27002, "Trust Folder")),
|
|
183
|
+
title: ( localize(27003, "Select Folder To Trust"))
|
|
178
184
|
});
|
|
179
|
-
if (uri) {
|
|
180
|
-
|
|
185
|
+
if (uri?.length) {
|
|
186
|
+
try {
|
|
187
|
+
await this.addTrustedUri(uri[0]);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
onUnexpectedError(error);
|
|
190
|
+
}
|
|
181
191
|
}
|
|
182
192
|
}));
|
|
183
193
|
this._register(this.workspaceTrustManagementService.onDidChangeTrustedFolders(() => {
|
|
184
194
|
this.updateTable();
|
|
185
195
|
}));
|
|
186
196
|
}
|
|
197
|
+
async addTrustedUri(uri) {
|
|
198
|
+
await this.workspaceTrustManagementService.setUrisTrust([uri], true);
|
|
199
|
+
if (this._store.isDisposed) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const trustInfo = await this.workspaceTrustManagementService.getUriTrustInfo(uri);
|
|
203
|
+
if (this._store.isDisposed || !trustInfo.trusted) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
this.selectTrustedUriEntry({
|
|
207
|
+
uri: trustInfo.uri,
|
|
208
|
+
parentOfWorkspaceItem: false
|
|
209
|
+
});
|
|
210
|
+
}
|
|
187
211
|
getIndexOfTrustedUriEntry(item) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (this.trustedUriEntries[i].uri === item.uri) {
|
|
192
|
-
return i;
|
|
193
|
-
}
|
|
212
|
+
for (let i = 0; i < this.table.length; i++) {
|
|
213
|
+
if (this.uriService.extUri.isEqual(this.table.row(i).uri, item.uri)) {
|
|
214
|
+
return i;
|
|
194
215
|
}
|
|
195
216
|
}
|
|
196
|
-
return
|
|
217
|
+
return -1;
|
|
197
218
|
}
|
|
198
219
|
selectTrustedUriEntry(item, focus = true) {
|
|
199
220
|
const index = this.getIndexOfTrustedUriEntry(item);
|
|
200
221
|
if (index !== -1) {
|
|
222
|
+
this.table.reveal(index);
|
|
223
|
+
this.revealInScrollableElement(index);
|
|
201
224
|
if (focus) {
|
|
202
225
|
this.table.domFocus();
|
|
203
226
|
this.table.setFocus([index]);
|
|
@@ -205,6 +228,28 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
205
228
|
this.table.setSelection([index]);
|
|
206
229
|
}
|
|
207
230
|
}
|
|
231
|
+
revealInScrollableElement(index) {
|
|
232
|
+
if (!this.scrollableElement) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
this.scrollableElement.scanDomNode();
|
|
236
|
+
const viewportTop = this.scrollableElement.getDomNode().getBoundingClientRect().top;
|
|
237
|
+
const viewportHeight = this.scrollableElement.getScrollDimensions().height;
|
|
238
|
+
const rowTop = this.table.getHTMLElement().getBoundingClientRect().top - viewportTop + TrustedUriTableVirtualDelegate.HEADER_ROW_HEIGHT + index * TrustedUriTableVirtualDelegate.ROW_HEIGHT;
|
|
239
|
+
const rowBottom = rowTop + TrustedUriTableVirtualDelegate.ROW_HEIGHT;
|
|
240
|
+
const {
|
|
241
|
+
scrollTop
|
|
242
|
+
} = this.scrollableElement.getScrollPosition();
|
|
243
|
+
if (rowTop < 0) {
|
|
244
|
+
this.scrollableElement.setScrollPosition({
|
|
245
|
+
scrollTop: scrollTop + rowTop
|
|
246
|
+
});
|
|
247
|
+
} else if (rowBottom > viewportHeight) {
|
|
248
|
+
this.scrollableElement.setScrollPosition({
|
|
249
|
+
scrollTop: scrollTop + rowBottom - viewportHeight
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
208
253
|
get currentWorkspaceUri() {
|
|
209
254
|
return this.workspaceService.getWorkspace().folders[0]?.uri || URI.file("/");
|
|
210
255
|
}
|
|
@@ -257,9 +302,9 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
257
302
|
const entries = this.trustedUriEntries;
|
|
258
303
|
this.container.classList.toggle("empty", entries.length === 0);
|
|
259
304
|
this.descriptionElement.innerText = entries.length ? ( localize(
|
|
260
|
-
|
|
305
|
+
27004,
|
|
261
306
|
"You trust the following folders, their subfolders, and workspace files."
|
|
262
|
-
)) : ( localize(
|
|
307
|
+
)) : ( localize(27005, "You haven't trusted any folders or workspace files yet."));
|
|
263
308
|
this.table.splice(0, Number.POSITIVE_INFINITY, this.trustedUriEntries);
|
|
264
309
|
this.layout();
|
|
265
310
|
}
|
|
@@ -273,7 +318,7 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
273
318
|
return {
|
|
274
319
|
type: MessageType.WARNING,
|
|
275
320
|
content: ( localize(
|
|
276
|
-
|
|
321
|
+
27006,
|
|
277
322
|
"You will trust all repositories on {0}.",
|
|
278
323
|
getHostLabel(this.labelService, item)
|
|
279
324
|
))
|
|
@@ -283,7 +328,7 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
283
328
|
return {
|
|
284
329
|
type: MessageType.WARNING,
|
|
285
330
|
content: ( localize(
|
|
286
|
-
|
|
331
|
+
27007,
|
|
287
332
|
"You will trust all repositories and forks under '{0}' on {1}.",
|
|
288
333
|
segments[0],
|
|
289
334
|
getHostLabel(this.labelService, item)
|
|
@@ -293,13 +338,13 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
293
338
|
if (segments.length > 2) {
|
|
294
339
|
return {
|
|
295
340
|
type: MessageType.ERROR,
|
|
296
|
-
content: ( localize(
|
|
341
|
+
content: ( localize(27008, "You cannot trust individual folders within a repository.", path))
|
|
297
342
|
};
|
|
298
343
|
}
|
|
299
344
|
}
|
|
300
345
|
return null;
|
|
301
346
|
}
|
|
302
|
-
acceptEdit(item, uri) {
|
|
347
|
+
async acceptEdit(item, uri) {
|
|
303
348
|
const trustedFolders = this.workspaceTrustManagementService.getTrustedUris();
|
|
304
349
|
const index = trustedFolders.findIndex(u => this.uriService.extUri.isEqual(u, item.uri));
|
|
305
350
|
if (index >= trustedFolders.length || index === -1) {
|
|
@@ -307,8 +352,14 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
307
352
|
} else {
|
|
308
353
|
trustedFolders[index] = uri;
|
|
309
354
|
}
|
|
310
|
-
|
|
311
|
-
|
|
355
|
+
try {
|
|
356
|
+
await this.workspaceTrustManagementService.setTrustedUris(trustedFolders);
|
|
357
|
+
if (!this._store.isDisposed) {
|
|
358
|
+
this._onDidAcceptEdit.fire(item);
|
|
359
|
+
}
|
|
360
|
+
} catch (error) {
|
|
361
|
+
onUnexpectedError(error);
|
|
362
|
+
}
|
|
312
363
|
}
|
|
313
364
|
rejectEdit(item) {
|
|
314
365
|
this._onDidRejectEdit.fire(item);
|
|
@@ -334,8 +385,8 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
334
385
|
canSelectFolders: true,
|
|
335
386
|
canSelectMany: false,
|
|
336
387
|
defaultUri: item.uri,
|
|
337
|
-
openLabel: ( localize(
|
|
338
|
-
title: ( localize(
|
|
388
|
+
openLabel: ( localize(27002, "Trust Folder")),
|
|
389
|
+
title: ( localize(27003, "Select Folder To Trust"))
|
|
339
390
|
});
|
|
340
391
|
if (uri) {
|
|
341
392
|
this.acceptEdit(item, uri[0]);
|
|
@@ -348,7 +399,7 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
348
399
|
}
|
|
349
400
|
}
|
|
350
401
|
};
|
|
351
|
-
WorkspaceTrustedUrisTable = ( __decorate([( __param(
|
|
402
|
+
WorkspaceTrustedUrisTable = ( __decorate([( __param(2, IInstantiationService)), ( __param(3, IWorkspaceContextService)), ( __param(4, IWorkspaceTrustManagementService)), ( __param(5, IUriIdentityService)), ( __param(6, ILabelService)), ( __param(7, IFileDialogService))], WorkspaceTrustedUrisTable));
|
|
352
403
|
class TrustedUriTableVirtualDelegate {
|
|
353
404
|
constructor() {
|
|
354
405
|
this.headerRowHeight = TrustedUriTableVirtualDelegate.HEADER_ROW_HEIGHT;
|
|
@@ -402,7 +453,7 @@ let TrustedUriActionsColumnRenderer = class TrustedUriActionsColumnRenderer {
|
|
|
402
453
|
class: ThemeIcon.asClassName(editIcon),
|
|
403
454
|
enabled: true,
|
|
404
455
|
id: "editTrustedUri",
|
|
405
|
-
tooltip: ( localize(
|
|
456
|
+
tooltip: ( localize(27009, "Edit Path")),
|
|
406
457
|
run: () => {
|
|
407
458
|
this.table.edit(item, false);
|
|
408
459
|
}
|
|
@@ -414,7 +465,7 @@ let TrustedUriActionsColumnRenderer = class TrustedUriActionsColumnRenderer {
|
|
|
414
465
|
class: ThemeIcon.asClassName(folderPickerIcon),
|
|
415
466
|
enabled: true,
|
|
416
467
|
id: "pickerTrustedUri",
|
|
417
|
-
tooltip: ( localize(
|
|
468
|
+
tooltip: ( localize(27010, "Open File Picker")),
|
|
418
469
|
run: () => {
|
|
419
470
|
this.table.edit(item, true);
|
|
420
471
|
}
|
|
@@ -426,7 +477,7 @@ let TrustedUriActionsColumnRenderer = class TrustedUriActionsColumnRenderer {
|
|
|
426
477
|
class: ThemeIcon.asClassName(removeIcon),
|
|
427
478
|
enabled: true,
|
|
428
479
|
id: "deleteTrustedUri",
|
|
429
|
-
tooltip: ( localize(
|
|
480
|
+
tooltip: ( localize(27011, "Delete Path")),
|
|
430
481
|
run: async () => {
|
|
431
482
|
await this.table.delete(item);
|
|
432
483
|
}
|
|
@@ -452,13 +503,13 @@ let TrustedUriPathColumnRenderer = class TrustedUriPathColumnRenderer {
|
|
|
452
503
|
renderTemplate(container) {
|
|
453
504
|
const element = container.appendChild($(".path"));
|
|
454
505
|
const pathLabel = element.appendChild($("div.path-label"));
|
|
455
|
-
const
|
|
506
|
+
const disposables = ( new DisposableStore());
|
|
507
|
+
const pathInput = disposables.add(( new InputBox(element, this.contextViewService, {
|
|
456
508
|
validationOptions: {
|
|
457
509
|
validation: value => this.table.validateUri(value, this.currentItem)
|
|
458
510
|
},
|
|
459
511
|
inputBoxStyles: defaultInputBoxStyles
|
|
460
|
-
}));
|
|
461
|
-
const disposables = ( new DisposableStore());
|
|
512
|
+
})));
|
|
462
513
|
const renderDisposables = disposables.add(( new DisposableStore()));
|
|
463
514
|
return {
|
|
464
515
|
element,
|
|
@@ -496,7 +547,6 @@ let TrustedUriPathColumnRenderer = class TrustedUriPathColumnRenderer {
|
|
|
496
547
|
}) : item.uri.with({
|
|
497
548
|
path: pathToUse
|
|
498
549
|
});
|
|
499
|
-
templateData.pathLabel.innerText = this.formatPath(uri);
|
|
500
550
|
if (uri) {
|
|
501
551
|
this.table.acceptEdit(item, uri);
|
|
502
552
|
}
|
|
@@ -552,7 +602,7 @@ let TrustedUriPathColumnRenderer = class TrustedUriPathColumnRenderer {
|
|
|
552
602
|
};
|
|
553
603
|
TrustedUriPathColumnRenderer = TrustedUriPathColumnRenderer_1 = ( __decorate([( __param(1, IContextViewService))], TrustedUriPathColumnRenderer));
|
|
554
604
|
function getHostLabel(labelService, item) {
|
|
555
|
-
return item.uri.authority ? labelService.getHostLabel(item.uri.scheme, item.uri.authority) : ( localize(
|
|
605
|
+
return item.uri.authority ? labelService.getHostLabel(item.uri.scheme, item.uri.authority) : ( localize(27012, "Local"));
|
|
556
606
|
}
|
|
557
607
|
let TrustedUriHostColumnRenderer = class TrustedUriHostColumnRenderer {
|
|
558
608
|
static {
|
|
@@ -636,6 +686,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
636
686
|
this.keybindingService = keybindingService;
|
|
637
687
|
this.rendering = false;
|
|
638
688
|
this.rerenderDisposables = this._register(( new DisposableStore()));
|
|
689
|
+
this.actionButtons = ( new Map());
|
|
639
690
|
this.layoutParticipants = [];
|
|
640
691
|
}
|
|
641
692
|
createEditor(parent) {
|
|
@@ -649,6 +700,11 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
649
700
|
vertical: ScrollbarVisibility.Auto
|
|
650
701
|
})));
|
|
651
702
|
append(this.rootElement, this.bodyScrollBar.getDomNode());
|
|
703
|
+
this._register(addDisposableListener(
|
|
704
|
+
scrollableContent,
|
|
705
|
+
EventType.SCROLL,
|
|
706
|
+
() => this.bodyScrollBar.scanDomNode()
|
|
707
|
+
));
|
|
652
708
|
this.createAffectedFeaturesElement(scrollableContent);
|
|
653
709
|
this.createConfigurationElement(scrollableContent);
|
|
654
710
|
this.rootElement.style.setProperty("--workspace-trust-selected-color", asCssVariable(buttonBackground));
|
|
@@ -684,7 +740,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
684
740
|
this.rootElement.focus();
|
|
685
741
|
} else if (event.equals(KeyMod.CtrlCmd | KeyCode.Enter)) {
|
|
686
742
|
if (this.workspaceTrustManagementService.canSetWorkspaceTrust()) {
|
|
687
|
-
this.workspaceTrustManagementService.setWorkspaceTrust(!this.workspaceTrustManagementService.isWorkspaceTrusted());
|
|
743
|
+
this.workspaceTrustManagementService.setWorkspaceTrust(!this.workspaceTrustManagementService.isWorkspaceTrusted()).catch(onUnexpectedError);
|
|
688
744
|
}
|
|
689
745
|
}
|
|
690
746
|
}));
|
|
@@ -721,18 +777,18 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
721
777
|
getHeaderTitleText(trusted) {
|
|
722
778
|
if (trusted) {
|
|
723
779
|
if (this.workspaceTrustManagementService.isWorkspaceTrustForced()) {
|
|
724
|
-
return localize(
|
|
780
|
+
return localize(27013, "This window is trusted");
|
|
725
781
|
}
|
|
726
782
|
switch (this.workspaceService.getWorkbenchState()) {
|
|
727
783
|
case WorkbenchState.EMPTY:
|
|
728
|
-
return localize(
|
|
784
|
+
return localize(27014, "You trust this window");
|
|
729
785
|
case WorkbenchState.FOLDER:
|
|
730
|
-
return localize(
|
|
786
|
+
return localize(27015, "You trust this folder");
|
|
731
787
|
case WorkbenchState.WORKSPACE:
|
|
732
|
-
return localize(
|
|
788
|
+
return localize(27016, "You trust this workspace");
|
|
733
789
|
}
|
|
734
790
|
}
|
|
735
|
-
return localize(
|
|
791
|
+
return localize(27017, "You are in Restricted Mode");
|
|
736
792
|
}
|
|
737
793
|
getHeaderTitleIconClassNames(trusted) {
|
|
738
794
|
return ThemeIcon.asClassNameArray(shieldIcon);
|
|
@@ -743,36 +799,36 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
743
799
|
switch (this.workspaceService.getWorkbenchState()) {
|
|
744
800
|
case WorkbenchState.EMPTY:
|
|
745
801
|
{
|
|
746
|
-
title = trusted ? ( localize(
|
|
802
|
+
title = trusted ? ( localize(27018, "In a Trusted Window")) : ( localize(27019, "In Restricted Mode"));
|
|
747
803
|
subTitle = trusted ? ( localize(
|
|
748
|
-
|
|
804
|
+
27020,
|
|
749
805
|
"You trust the authors of the files in the current window. All features are enabled:"
|
|
750
806
|
)) : ( localize(
|
|
751
|
-
|
|
807
|
+
27021,
|
|
752
808
|
"You do not trust the authors of the files in the current window. The following features are disabled:"
|
|
753
809
|
));
|
|
754
810
|
break;
|
|
755
811
|
}
|
|
756
812
|
case WorkbenchState.FOLDER:
|
|
757
813
|
{
|
|
758
|
-
title = trusted ? ( localize(
|
|
814
|
+
title = trusted ? ( localize(27022, "In a Trusted Folder")) : ( localize(27019, "In Restricted Mode"));
|
|
759
815
|
subTitle = trusted ? ( localize(
|
|
760
|
-
|
|
816
|
+
27023,
|
|
761
817
|
"You trust the authors of the files in the current folder. All features are enabled:"
|
|
762
818
|
)) : ( localize(
|
|
763
|
-
|
|
819
|
+
27024,
|
|
764
820
|
"You do not trust the authors of the files in the current folder. The following features are disabled:"
|
|
765
821
|
));
|
|
766
822
|
break;
|
|
767
823
|
}
|
|
768
824
|
case WorkbenchState.WORKSPACE:
|
|
769
825
|
{
|
|
770
|
-
title = trusted ? ( localize(
|
|
826
|
+
title = trusted ? ( localize(27025, "In a Trusted Workspace")) : ( localize(27019, "In Restricted Mode"));
|
|
771
827
|
subTitle = trusted ? ( localize(
|
|
772
|
-
|
|
828
|
+
27026,
|
|
773
829
|
"You trust the authors of the files in the current workspace. All features are enabled:"
|
|
774
830
|
)) : ( localize(
|
|
775
|
-
|
|
831
|
+
27027,
|
|
776
832
|
"You do not trust the authors of the files in the current workspace. The following features are disabled:"
|
|
777
833
|
));
|
|
778
834
|
break;
|
|
@@ -788,7 +844,9 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
788
844
|
return;
|
|
789
845
|
}
|
|
790
846
|
this.rendering = true;
|
|
847
|
+
const focusedAction = Array.from(this.actionButtons).find(([, button]) => button.hasFocus())?.[0];
|
|
791
848
|
this.rerenderDisposables.clear();
|
|
849
|
+
this.actionButtons.clear();
|
|
792
850
|
const isWorkspaceTrusted = this.workspaceTrustManagementService.isWorkspaceTrusted();
|
|
793
851
|
this.rootElement.classList.toggle("trusted", isWorkspaceTrusted);
|
|
794
852
|
this.rootElement.classList.toggle("untrusted", !isWorkspaceTrusted);
|
|
@@ -798,16 +856,16 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
798
856
|
this.headerDescription.innerText = "";
|
|
799
857
|
const headerDescriptionText = append(this.headerDescription, $("div"));
|
|
800
858
|
headerDescriptionText.innerText = isWorkspaceTrusted ? ( localize(
|
|
801
|
-
|
|
859
|
+
27028,
|
|
802
860
|
"All features are enabled because trust has been granted to the workspace."
|
|
803
861
|
)) : ( localize(
|
|
804
|
-
|
|
862
|
+
27029,
|
|
805
863
|
"{0} is in a restricted mode intended for safe code browsing.",
|
|
806
864
|
this.productService.nameShort
|
|
807
865
|
));
|
|
808
866
|
const headerDescriptionActions = append(this.headerDescription, $("div"));
|
|
809
867
|
const headerDescriptionActionsText = ( localize(
|
|
810
|
-
|
|
868
|
+
27030,
|
|
811
869
|
"[Configure your settings]({0}) or [learn more](https://aka.ms/vscode-workspace-trust).",
|
|
812
870
|
`command:workbench.trust.configure`
|
|
813
871
|
));
|
|
@@ -822,7 +880,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
822
880
|
}
|
|
823
881
|
}
|
|
824
882
|
this.headerContainer.className = this.getHeaderContainerClass(isWorkspaceTrusted);
|
|
825
|
-
this.rootElement.setAttribute("aria-label", `${( localize(
|
|
883
|
+
this.rootElement.setAttribute("aria-label", `${( localize(27031, "Manage Workspace Trust"))}: ${this.headerContainer.innerText}`);
|
|
826
884
|
const restrictedSettings = this.configurationService.restrictedSettings;
|
|
827
885
|
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
828
886
|
const settingsRequiringTrustedWorkspaceCount = restrictedSettings.default.filter(key => {
|
|
@@ -849,6 +907,9 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
849
907
|
this.workspaceTrustedUrisTable.updateTable();
|
|
850
908
|
this.bodyScrollBar.getDomNode().style.height = `calc(100% - ${this.headerContainer.clientHeight}px)`;
|
|
851
909
|
this.bodyScrollBar.scanDomNode();
|
|
910
|
+
if (focusedAction) {
|
|
911
|
+
(this.actionButtons.get(focusedAction) ?? this.headerContainer).focus();
|
|
912
|
+
}
|
|
852
913
|
this.rendering = false;
|
|
853
914
|
}
|
|
854
915
|
getExtensionCount() {
|
|
@@ -890,9 +951,9 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
890
951
|
tabIndex: "0"
|
|
891
952
|
}));
|
|
892
953
|
const configurationTitle = append(this.configurationContainer, $(".workspace-trusted-folders-title"));
|
|
893
|
-
configurationTitle.innerText = ( localize(
|
|
954
|
+
configurationTitle.innerText = ( localize(27000, "Trusted Folders & Workspaces"));
|
|
894
955
|
this.workspaceTrustedUrisTable = this._register(
|
|
895
|
-
this.instantiationService.createInstance(WorkspaceTrustedUrisTable, this.configurationContainer)
|
|
956
|
+
this.instantiationService.createInstance(WorkspaceTrustedUrisTable, this.configurationContainer, this.bodyScrollBar)
|
|
896
957
|
);
|
|
897
958
|
}
|
|
898
959
|
createAffectedFeaturesElement(parent) {
|
|
@@ -915,7 +976,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
915
976
|
clearNode(this.untrustedContainer);
|
|
916
977
|
const [trustedTitle, trustedSubTitle] = this.getFeaturesHeaderText(true);
|
|
917
978
|
this.renderLimitationsHeaderElement(this.trustedContainer, trustedTitle, trustedSubTitle);
|
|
918
|
-
const trustedContainerItems = this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY ? [( localize(
|
|
979
|
+
const trustedContainerItems = this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY ? [( localize(27032, "Tasks are allowed to run")), ( localize(27033, "Debugging is enabled")), ( localize(27034, "All enabled extensions are activated"))] : [( localize(27032, "Tasks are allowed to run")), ( localize(27033, "Debugging is enabled")), ( localize(27035, "All workspace settings are applied")), ( localize(27034, "All enabled extensions are activated"))];
|
|
919
980
|
this.renderLimitationsListElement(
|
|
920
981
|
this.trustedContainer,
|
|
921
982
|
trustedContainerItems,
|
|
@@ -923,18 +984,18 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
923
984
|
);
|
|
924
985
|
const [untrustedTitle, untrustedSubTitle] = this.getFeaturesHeaderText(false);
|
|
925
986
|
this.renderLimitationsHeaderElement(this.untrustedContainer, untrustedTitle, untrustedSubTitle);
|
|
926
|
-
const untrustedContainerItems = this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY ? [( localize(
|
|
927
|
-
|
|
987
|
+
const untrustedContainerItems = this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY ? [( localize(27036, "Tasks are not allowed to run")), ( localize(27037, "Debugging is disabled")), fixBadLocalizedLinks(( localize(
|
|
988
|
+
27038,
|
|
928
989
|
"[{0} extensions]({1}) are disabled or have limited functionality",
|
|
929
990
|
numExtensions,
|
|
930
991
|
`command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`
|
|
931
|
-
)))] : [( localize(
|
|
932
|
-
|
|
992
|
+
)))] : [( localize(27036, "Tasks are not allowed to run")), ( localize(27037, "Debugging is disabled")), fixBadLocalizedLinks(numSettings ? ( localize(
|
|
993
|
+
27039,
|
|
933
994
|
"[{0} workspace settings]({1}) are not applied",
|
|
934
995
|
numSettings,
|
|
935
996
|
"command:settings.filterUntrusted"
|
|
936
|
-
)) : ( localize(
|
|
937
|
-
|
|
997
|
+
)) : ( localize(27040, "Workspace settings requiring trust are not applied"))), fixBadLocalizedLinks(( localize(
|
|
998
|
+
27038,
|
|
938
999
|
"[{0} extensions]({1}) are disabled or have limited functionality",
|
|
939
1000
|
numExtensions,
|
|
940
1001
|
`command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`
|
|
@@ -951,7 +1012,18 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
951
1012
|
this.addTrustedTextToElement(this.untrustedContainer);
|
|
952
1013
|
}
|
|
953
1014
|
} else {
|
|
954
|
-
if (this.workspaceTrustManagementService.
|
|
1015
|
+
if (!this.workspaceTrustManagementService.isWorkspaceTrustSourceResolved()) {
|
|
1016
|
+
const description = append(this.trustedContainer, $(".workspace-trust-untrusted-description"));
|
|
1017
|
+
description.innerText = ( localize(
|
|
1018
|
+
27041,
|
|
1019
|
+
"The source repository for this workspace could not be verified. You can keep reviewing files in Restricted Mode. Make sure the repository extension is enabled and you are signed in, then retry."
|
|
1020
|
+
));
|
|
1021
|
+
this.createButtonRow(this.trustedContainer, [{
|
|
1022
|
+
action: this.rerenderDisposables.add(( new Action("workspace.trust.button.action.retry", ( localize(27042, "Retry Source Check")), undefined, true, async () => {
|
|
1023
|
+
await this.workspaceTrustManagementService.resolveWorkspaceTrust();
|
|
1024
|
+
})))
|
|
1025
|
+
}]);
|
|
1026
|
+
} else if (this.workspaceTrustManagementService.canSetWorkspaceTrust()) {
|
|
955
1027
|
this.addTrustButtonToElement(this.trustedContainer);
|
|
956
1028
|
}
|
|
957
1029
|
}
|
|
@@ -965,20 +1037,28 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
965
1037
|
keybinding
|
|
966
1038
|
} of buttonInfo) {
|
|
967
1039
|
const button = buttonBar.addButtonWithDescription(defaultButtonStyles);
|
|
1040
|
+
this.actionButtons.set(action.id, button);
|
|
968
1041
|
button.label = action.label;
|
|
969
1042
|
button.enabled = enabled !== undefined ? enabled : action.enabled;
|
|
970
|
-
button.description = keybinding
|
|
971
|
-
button.element.ariaLabel = action.label + ", " + ( localize(
|
|
972
|
-
this.rerenderDisposables.add(button.onDidClick(e => {
|
|
1043
|
+
button.description = keybinding?.getLabel() ?? "";
|
|
1044
|
+
button.element.ariaLabel = keybinding ? action.label + ", " + ( localize(27043, "Keyboard Shortcut: {0}", keybinding.getAriaLabel())) : action.label;
|
|
1045
|
+
this.rerenderDisposables.add(button.onDidClick(async e => {
|
|
973
1046
|
if (e) {
|
|
974
1047
|
EventHelper.stop(e, true);
|
|
975
1048
|
}
|
|
976
|
-
|
|
1049
|
+
button.enabled = false;
|
|
1050
|
+
try {
|
|
1051
|
+
await action.run();
|
|
1052
|
+
} catch (error) {
|
|
1053
|
+
onUnexpectedError(error);
|
|
1054
|
+
} finally {
|
|
1055
|
+
button.enabled = enabled !== undefined ? enabled : action.enabled;
|
|
1056
|
+
}
|
|
977
1057
|
}));
|
|
978
1058
|
}
|
|
979
1059
|
}
|
|
980
1060
|
addTrustButtonToElement(parent) {
|
|
981
|
-
const trustAction = this.rerenderDisposables.add(( new Action("workspace.trust.button.action.grant", ( localize(
|
|
1061
|
+
const trustAction = this.rerenderDisposables.add(( new Action("workspace.trust.button.action.grant", ( localize(27044, "Trust")), undefined, true, async () => {
|
|
982
1062
|
await this.workspaceTrustManagementService.setWorkspaceTrust(true);
|
|
983
1063
|
})));
|
|
984
1064
|
const trustActions = [{
|
|
@@ -989,7 +1069,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
989
1069
|
}
|
|
990
1070
|
addDontTrustButtonToElement(parent) {
|
|
991
1071
|
this.createButtonRow(parent, [{
|
|
992
|
-
action: this.rerenderDisposables.add(( new Action("workspace.trust.button.action.deny", ( localize(
|
|
1072
|
+
action: this.rerenderDisposables.add(( new Action("workspace.trust.button.action.deny", ( localize(27045, "Don't Trust")), undefined, true, async () => {
|
|
993
1073
|
await this.workspaceTrustManagementService.setWorkspaceTrust(false);
|
|
994
1074
|
}))),
|
|
995
1075
|
keybinding: this.keybindingService.resolveUserBinding(isMacintosh ? "Cmd+Enter" : "Ctrl+Enter")[0]
|
|
@@ -1002,14 +1082,14 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
1002
1082
|
const textElement = append(parent, $(".workspace-trust-untrusted-description"));
|
|
1003
1083
|
if (!this.workspaceTrustManagementService.isWorkspaceTrustForced()) {
|
|
1004
1084
|
textElement.innerText = this.workspaceService.getWorkbenchState() === WorkbenchState.WORKSPACE ? ( localize(
|
|
1005
|
-
|
|
1085
|
+
27046,
|
|
1006
1086
|
"This workspace is trusted via the bolded entries in the trusted folders below."
|
|
1007
1087
|
)) : ( localize(
|
|
1008
|
-
|
|
1088
|
+
27047,
|
|
1009
1089
|
"This folder is trusted via the bolded entries in the trusted folders below."
|
|
1010
1090
|
));
|
|
1011
1091
|
} else {
|
|
1012
|
-
textElement.innerText = ( localize(
|
|
1092
|
+
textElement.innerText = ( localize(27048, "This window is trusted by nature of the workspace that is opened."));
|
|
1013
1093
|
}
|
|
1014
1094
|
}
|
|
1015
1095
|
renderLimitationsHeaderElement(parent, headerText, subtitleText) {
|
|
@@ -1059,4 +1139,4 @@ function fixBadLocalizedLinks(badString) {
|
|
|
1059
1139
|
return badString.replace(regex, "$1[$2]($3)$4");
|
|
1060
1140
|
}
|
|
1061
1141
|
|
|
1062
|
-
export { WorkspaceTrustEditor, shieldIcon };
|
|
1142
|
+
export { WorkspaceTrustEditor, WorkspaceTrustedUrisTable, shieldIcon };
|
|
@@ -7,7 +7,7 @@ import { registerIcon } from '@codingame/monaco-vscode-api/vscode/vs/platform/th
|
|
|
7
7
|
import { EditorInputCapabilities } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
8
8
|
import { EditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor/editorInput';
|
|
9
9
|
|
|
10
|
-
const WorkspaceTrustEditorIcon = registerIcon("workspace-trust-editor-label-icon", Codicon.shield, ( localize(
|
|
10
|
+
const WorkspaceTrustEditorIcon = registerIcon("workspace-trust-editor-label-icon", Codicon.shield, ( localize(28259, "Icon of the workspace trust editor label.")));
|
|
11
11
|
class WorkspaceTrustEditorInput extends EditorInput {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
@@ -29,7 +29,7 @@ class WorkspaceTrustEditorInput extends EditorInput {
|
|
|
29
29
|
return super.matches(otherInput) || otherInput instanceof WorkspaceTrustEditorInput;
|
|
30
30
|
}
|
|
31
31
|
getName() {
|
|
32
|
-
return localize(
|
|
32
|
+
return localize(28260, "Workspace Trust");
|
|
33
33
|
}
|
|
34
34
|
getIcon() {
|
|
35
35
|
return WorkspaceTrustEditorIcon;
|