@codingame/monaco-vscode-extension-gallery-service-override 4.4.1 → 4.5.0-improve-code-splitting.1
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/extensionGallery.js +21 -16
- package/package.json +10 -3
- package/vscode/src/vs/platform/extensionManagement/common/abstractExtensionManagementService.js +7 -6
- package/vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js +12 -11
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementIpc.js +1 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionTipsService.js +2 -3
- package/vscode/src/vs/platform/extensionManagement/common/extensionsProfileScannerService.js +334 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionsScannerService.js +904 -0
- package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.js +9 -0
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileIpc.js +67 -0
- package/vscode/src/vs/platform/userDataSync/common/ignoredExtensions.js +65 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.js +18 -14
- package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.js +8 -6
- package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +25 -21
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant.js +5 -5
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionFeaturesTab.js +7 -6
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js +18 -16
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.js +9 -9
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +31 -24
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.js +3 -3
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsDependencyChecker.js +7 -5
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsList.js +8 -6
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.js +4 -4
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewer.js +6 -5
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +29 -24
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.js +34 -30
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.js +14 -13
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +33 -28
- package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.js +6 -6
- package/vscode/src/vs/workbench/contrib/extensions/browser/keymapRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/languageRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/unsupportedExtensionsMigrationContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.js +6 -6
- package/vscode/src/vs/workbench/contrib/extensions/common/reportExtensionIssueAction.js +1 -1
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js +19 -16
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionsProfileScannerService.js +8 -7
- package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +17 -17
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionFeaturesManagemetService.js +4 -4
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.js +2 -3
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.js +21 -20
- package/vscode/src/vs/workbench/services/extensionManagement/common/remoteExtensionManagementService.js +4 -4
- package/vscode/src/vs/workbench/services/extensionManagement/common/webExtensionManagementService.js +9 -9
- package/vscode/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.js +2 -2
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +339 -0
- package/vscode/src/vs/workbench/services/extensions/browser/extensionsScannerService.js +9 -9
- package/vscode/src/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.js +151 -0
- package/override/vs/platform/dialogs/common/dialogs.js +0 -10
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
5
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
6
|
+
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
7
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
8
|
+
import { IURLService } from 'vscode/vscode/vs/platform/url/common/url.service';
|
|
9
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
10
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
11
|
+
import { ExtensionIdentifier } from 'vscode/vscode/vs/platform/extensions/common/extensions';
|
|
12
|
+
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
13
|
+
import { Action2, MenuId, registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
14
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
15
|
+
import { IsWebContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
|
|
16
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
17
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
18
|
+
import { disposableWindowInterval } from 'vscode/vscode/vs/base/browser/dom';
|
|
19
|
+
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
20
|
+
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
21
|
+
import { isCancellationError } from 'vscode/vscode/vs/base/common/errors';
|
|
22
|
+
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
23
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
24
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
25
|
+
|
|
26
|
+
var ExtensionUrlBootstrapHandler_1;
|
|
27
|
+
const FIVE_MINUTES = 5 * 60 * 1000;
|
|
28
|
+
const THIRTY_SECONDS = 30 * 1000;
|
|
29
|
+
const URL_TO_HANDLE = 'extensionUrlHandler.urlToHandle';
|
|
30
|
+
const USER_TRUSTED_EXTENSIONS_CONFIGURATION_KEY = 'extensions.confirmedUriHandlerExtensionIds';
|
|
31
|
+
const USER_TRUSTED_EXTENSIONS_STORAGE_KEY = 'extensionUrlHandler.confirmedExtensions';
|
|
32
|
+
function isExtensionId(value) {
|
|
33
|
+
return /^[a-z0-9][a-z0-9\-]*\.[a-z0-9][a-z0-9\-]*$/i.test(value);
|
|
34
|
+
}
|
|
35
|
+
class UserTrustedExtensionIdStorage {
|
|
36
|
+
get extensions() {
|
|
37
|
+
const userTrustedExtensionIdsJson = this.storageService.get(USER_TRUSTED_EXTENSIONS_STORAGE_KEY, 0 , '[]');
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(userTrustedExtensionIdsJson);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
constructor(storageService) {
|
|
46
|
+
this.storageService = storageService;
|
|
47
|
+
}
|
|
48
|
+
has(id) {
|
|
49
|
+
return this.extensions.indexOf(id) > -1;
|
|
50
|
+
}
|
|
51
|
+
add(id) {
|
|
52
|
+
this.set([...this.extensions, id]);
|
|
53
|
+
}
|
|
54
|
+
set(ids) {
|
|
55
|
+
this.storageService.store(USER_TRUSTED_EXTENSIONS_STORAGE_KEY, JSON.stringify(ids), 0 , 1 );
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
let ExtensionUrlHandler = class ExtensionUrlHandler {
|
|
59
|
+
constructor(urlService, extensionService, dialogService, commandService, hostService, storageService, configurationService, telemetryService, notificationService, productService, workbenchEnvironmentService) {
|
|
60
|
+
this.extensionService = extensionService;
|
|
61
|
+
this.dialogService = dialogService;
|
|
62
|
+
this.commandService = commandService;
|
|
63
|
+
this.hostService = hostService;
|
|
64
|
+
this.storageService = storageService;
|
|
65
|
+
this.configurationService = configurationService;
|
|
66
|
+
this.telemetryService = telemetryService;
|
|
67
|
+
this.notificationService = notificationService;
|
|
68
|
+
this.productService = productService;
|
|
69
|
+
this.workbenchEnvironmentService = workbenchEnvironmentService;
|
|
70
|
+
this.extensionHandlers = ( new Map());
|
|
71
|
+
this.uriBuffer = ( new Map());
|
|
72
|
+
this.userTrustedExtensionsStorage = ( new UserTrustedExtensionIdStorage(storageService));
|
|
73
|
+
const interval = disposableWindowInterval(mainWindow, () => this.garbageCollect(), THIRTY_SECONDS);
|
|
74
|
+
const urlToHandleValue = this.storageService.get(URL_TO_HANDLE, 1 );
|
|
75
|
+
if (urlToHandleValue) {
|
|
76
|
+
this.storageService.remove(URL_TO_HANDLE, 1 );
|
|
77
|
+
this.handleURL(URI.revive(JSON.parse(urlToHandleValue)), { trusted: true });
|
|
78
|
+
}
|
|
79
|
+
this.disposable = combinedDisposable(urlService.registerHandler(this), interval);
|
|
80
|
+
const cache = ExtensionUrlBootstrapHandler.cache;
|
|
81
|
+
setTimeout(() => cache.forEach(([uri, option]) => this.handleURL(uri, option)));
|
|
82
|
+
}
|
|
83
|
+
async handleURL(uri, options) {
|
|
84
|
+
if (!isExtensionId(uri.authority)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const extensionId = uri.authority;
|
|
88
|
+
this.telemetryService.publicLog2('uri_invoked/start', { extensionId });
|
|
89
|
+
const initialHandler = this.extensionHandlers.get(ExtensionIdentifier.toKey(extensionId));
|
|
90
|
+
let extensionDisplayName;
|
|
91
|
+
if (!initialHandler) {
|
|
92
|
+
const extension = await this.extensionService.getExtension(extensionId);
|
|
93
|
+
if (!extension) {
|
|
94
|
+
await this.handleUnhandledURL(uri, extensionId, options);
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
extensionDisplayName = extension.displayName ?? '';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
extensionDisplayName = initialHandler.extensionDisplayName;
|
|
103
|
+
}
|
|
104
|
+
const trusted = options?.trusted
|
|
105
|
+
|| this.productService.trustedExtensionProtocolHandlers?.includes(extensionId)
|
|
106
|
+
|| this.didUserTrustExtension(ExtensionIdentifier.toKey(extensionId));
|
|
107
|
+
if (!trusted) {
|
|
108
|
+
let uriString = ( uri.toString(false));
|
|
109
|
+
if (uriString.length > 40) {
|
|
110
|
+
uriString = `${uriString.substring(0, 30)}...${uriString.substring(uriString.length - 5)}`;
|
|
111
|
+
}
|
|
112
|
+
const result = await this.dialogService.confirm({
|
|
113
|
+
message: ( localizeWithPath(
|
|
114
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
115
|
+
'confirmUrl',
|
|
116
|
+
"Allow '{0}' extension to open this URI?",
|
|
117
|
+
extensionDisplayName
|
|
118
|
+
)),
|
|
119
|
+
checkbox: {
|
|
120
|
+
label: ( localizeWithPath(
|
|
121
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
122
|
+
'rememberConfirmUrl',
|
|
123
|
+
"Do not ask me again for this extension"
|
|
124
|
+
)),
|
|
125
|
+
},
|
|
126
|
+
detail: uriString,
|
|
127
|
+
primaryButton: ( localizeWithPath(
|
|
128
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
129
|
+
{ key: 'open', comment: ['&& denotes a mnemonic'] },
|
|
130
|
+
"&&Open"
|
|
131
|
+
))
|
|
132
|
+
});
|
|
133
|
+
if (!result.confirmed) {
|
|
134
|
+
this.telemetryService.publicLog2('uri_invoked/cancel', { extensionId });
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
if (result.checkboxChecked) {
|
|
138
|
+
this.userTrustedExtensionsStorage.add(ExtensionIdentifier.toKey(extensionId));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const handler = this.extensionHandlers.get(ExtensionIdentifier.toKey(extensionId));
|
|
142
|
+
if (handler) {
|
|
143
|
+
if (!initialHandler) {
|
|
144
|
+
return await this.handleURLByExtension(extensionId, handler, uri, options);
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const timestamp = ( new Date()).getTime();
|
|
149
|
+
let uris = this.uriBuffer.get(ExtensionIdentifier.toKey(extensionId));
|
|
150
|
+
if (!uris) {
|
|
151
|
+
uris = [];
|
|
152
|
+
this.uriBuffer.set(ExtensionIdentifier.toKey(extensionId), uris);
|
|
153
|
+
}
|
|
154
|
+
uris.push({ timestamp, uri });
|
|
155
|
+
await this.extensionService.activateByEvent(`onUri:${ExtensionIdentifier.toKey(extensionId)}`, 1 );
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
registerExtensionHandler(extensionId, handler) {
|
|
159
|
+
this.extensionHandlers.set(ExtensionIdentifier.toKey(extensionId), handler);
|
|
160
|
+
const uris = this.uriBuffer.get(ExtensionIdentifier.toKey(extensionId)) || [];
|
|
161
|
+
for (const { uri } of uris) {
|
|
162
|
+
this.handleURLByExtension(extensionId, handler, uri);
|
|
163
|
+
}
|
|
164
|
+
this.uriBuffer.delete(ExtensionIdentifier.toKey(extensionId));
|
|
165
|
+
}
|
|
166
|
+
unregisterExtensionHandler(extensionId) {
|
|
167
|
+
this.extensionHandlers.delete(ExtensionIdentifier.toKey(extensionId));
|
|
168
|
+
}
|
|
169
|
+
async handleURLByExtension(extensionId, handler, uri, options) {
|
|
170
|
+
this.telemetryService.publicLog2('uri_invoked/end', { extensionId: ExtensionIdentifier.toKey(extensionId) });
|
|
171
|
+
return await handler.handleURL(uri, options);
|
|
172
|
+
}
|
|
173
|
+
async handleUnhandledURL(uri, extensionId, options) {
|
|
174
|
+
this.telemetryService.publicLog2('uri_invoked/install_extension/start', { extensionId });
|
|
175
|
+
try {
|
|
176
|
+
await this.commandService.executeCommand('workbench.extensions.installExtension', extensionId, {
|
|
177
|
+
justification: {
|
|
178
|
+
reason: `${( localizeWithPath(
|
|
179
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
180
|
+
'installDetail',
|
|
181
|
+
"This extension wants to open a URI:"
|
|
182
|
+
))}\n${( uri.toString())}`,
|
|
183
|
+
action: ( localizeWithPath(
|
|
184
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
185
|
+
'openUri',
|
|
186
|
+
"Open URI"
|
|
187
|
+
))
|
|
188
|
+
},
|
|
189
|
+
enable: true
|
|
190
|
+
});
|
|
191
|
+
this.telemetryService.publicLog2('uri_invoked/install_extension/accept', { extensionId });
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
if (isCancellationError(error)) {
|
|
195
|
+
this.telemetryService.publicLog2('uri_invoked/install_extension/cancel', { extensionId });
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
this.telemetryService.publicLog2('uri_invoked/install_extension/error', { extensionId });
|
|
199
|
+
this.notificationService.error(error);
|
|
200
|
+
}
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const extension = await this.extensionService.getExtension(extensionId);
|
|
204
|
+
if (extension) {
|
|
205
|
+
await this.handleURL(uri, { ...options, trusted: true });
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this.telemetryService.publicLog2('uri_invoked/install_extension/reload', { extensionId, isRemote: !!this.workbenchEnvironmentService.remoteAuthority });
|
|
209
|
+
const result = await this.dialogService.confirm({
|
|
210
|
+
message: ( localizeWithPath(
|
|
211
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
212
|
+
'reloadAndHandle',
|
|
213
|
+
"Extension '{0}' is not loaded. Would you like to reload the window to load the extension and open the URL?",
|
|
214
|
+
extensionId
|
|
215
|
+
)),
|
|
216
|
+
primaryButton: ( localizeWithPath(
|
|
217
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
218
|
+
{ key: 'reloadAndOpen', comment: ['&& denotes a mnemonic'] },
|
|
219
|
+
"&&Reload Window and Open"
|
|
220
|
+
))
|
|
221
|
+
});
|
|
222
|
+
if (!result.confirmed) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this.storageService.store(URL_TO_HANDLE, JSON.stringify(uri.toJSON()), 1 , 1 );
|
|
226
|
+
await this.hostService.reload();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
garbageCollect() {
|
|
230
|
+
const now = ( new Date()).getTime();
|
|
231
|
+
const uriBuffer = ( new Map());
|
|
232
|
+
this.uriBuffer.forEach((uris, extensionId) => {
|
|
233
|
+
uris = uris.filter(({ timestamp }) => now - timestamp < FIVE_MINUTES);
|
|
234
|
+
if (uris.length > 0) {
|
|
235
|
+
uriBuffer.set(extensionId, uris);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
this.uriBuffer = uriBuffer;
|
|
239
|
+
}
|
|
240
|
+
didUserTrustExtension(id) {
|
|
241
|
+
if (( this.userTrustedExtensionsStorage.has(id))) {
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
return this.getConfirmedTrustedExtensionIdsFromConfiguration().indexOf(id) > -1;
|
|
245
|
+
}
|
|
246
|
+
getConfirmedTrustedExtensionIdsFromConfiguration() {
|
|
247
|
+
const trustedExtensionIds = this.configurationService.getValue(USER_TRUSTED_EXTENSIONS_CONFIGURATION_KEY);
|
|
248
|
+
if (!Array.isArray(trustedExtensionIds)) {
|
|
249
|
+
return [];
|
|
250
|
+
}
|
|
251
|
+
return trustedExtensionIds;
|
|
252
|
+
}
|
|
253
|
+
dispose() {
|
|
254
|
+
this.disposable.dispose();
|
|
255
|
+
this.extensionHandlers.clear();
|
|
256
|
+
this.uriBuffer.clear();
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
ExtensionUrlHandler = ( __decorate([
|
|
260
|
+
( __param(0, IURLService)),
|
|
261
|
+
( __param(1, IExtensionService)),
|
|
262
|
+
( __param(2, IDialogService)),
|
|
263
|
+
( __param(3, ICommandService)),
|
|
264
|
+
( __param(4, IHostService)),
|
|
265
|
+
( __param(5, IStorageService)),
|
|
266
|
+
( __param(6, IConfigurationService)),
|
|
267
|
+
( __param(7, ITelemetryService)),
|
|
268
|
+
( __param(8, INotificationService)),
|
|
269
|
+
( __param(9, IProductService)),
|
|
270
|
+
( __param(10, IWorkbenchEnvironmentService))
|
|
271
|
+
], ExtensionUrlHandler));
|
|
272
|
+
let ExtensionUrlBootstrapHandler = class ExtensionUrlBootstrapHandler {
|
|
273
|
+
static { ExtensionUrlBootstrapHandler_1 = this; }
|
|
274
|
+
static { this.ID = 'workbench.contrib.extensionUrlBootstrapHandler'; }
|
|
275
|
+
static { this._cache = []; }
|
|
276
|
+
static get cache() {
|
|
277
|
+
ExtensionUrlBootstrapHandler_1.disposable.dispose();
|
|
278
|
+
const result = ExtensionUrlBootstrapHandler_1._cache;
|
|
279
|
+
ExtensionUrlBootstrapHandler_1._cache = [];
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
constructor(urlService) {
|
|
283
|
+
ExtensionUrlBootstrapHandler_1.disposable = urlService.registerHandler(this);
|
|
284
|
+
}
|
|
285
|
+
async handleURL(uri, options) {
|
|
286
|
+
if (!isExtensionId(uri.authority)) {
|
|
287
|
+
return false;
|
|
288
|
+
}
|
|
289
|
+
ExtensionUrlBootstrapHandler_1._cache.push([uri, options]);
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
ExtensionUrlBootstrapHandler = ExtensionUrlBootstrapHandler_1 = ( __decorate([
|
|
294
|
+
( __param(0, IURLService))
|
|
295
|
+
], ExtensionUrlBootstrapHandler));
|
|
296
|
+
registerWorkbenchContribution2(ExtensionUrlBootstrapHandler.ID, ExtensionUrlBootstrapHandler, 2 );
|
|
297
|
+
class ManageAuthorizedExtensionURIsAction extends Action2 {
|
|
298
|
+
constructor() {
|
|
299
|
+
super({
|
|
300
|
+
id: 'workbench.extensions.action.manageAuthorizedExtensionURIs',
|
|
301
|
+
title: ( localize2WithPath(
|
|
302
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
303
|
+
'manage',
|
|
304
|
+
'Manage Authorized Extension URIs...'
|
|
305
|
+
)),
|
|
306
|
+
category: ( localize2WithPath(
|
|
307
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
308
|
+
'extensions',
|
|
309
|
+
'Extensions'
|
|
310
|
+
)),
|
|
311
|
+
menu: {
|
|
312
|
+
id: MenuId.CommandPalette,
|
|
313
|
+
when: ( IsWebContext.toNegated())
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
async run(accessor) {
|
|
318
|
+
const storageService = accessor.get(IStorageService);
|
|
319
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
320
|
+
const storage = ( new UserTrustedExtensionIdStorage(storageService));
|
|
321
|
+
const items = ( storage.extensions.map(label => ({ label, picked: true })));
|
|
322
|
+
if (items.length === 0) {
|
|
323
|
+
await quickInputService.pick([{ label: ( localizeWithPath(
|
|
324
|
+
'vs/workbench/services/extensions/browser/extensionUrlHandler',
|
|
325
|
+
'no',
|
|
326
|
+
'There are currently no authorized extension URIs.'
|
|
327
|
+
)) }]);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const result = await quickInputService.pick(items, { canPickMany: true });
|
|
331
|
+
if (!result) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
storage.set(( result.map(item => item.label)));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
registerAction2(ManageAuthorizedExtensionURIsAction);
|
|
338
|
+
|
|
339
|
+
export { ExtensionUrlHandler };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { IExtensionsProfileScannerService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionsProfileScannerService';
|
|
3
|
-
import { AbstractExtensionsScannerService } from '
|
|
4
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
2
|
+
import { IExtensionsProfileScannerService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionsProfileScannerService.service';
|
|
3
|
+
import { AbstractExtensionsScannerService } from '../../../../platform/extensionManagement/common/extensionsScannerService.js';
|
|
5
4
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
6
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
7
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
8
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
9
|
+
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
|
|
10
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
11
|
+
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
12
12
|
|
|
13
13
|
let ExtensionsScannerService = class ExtensionsScannerService extends AbstractExtensionsScannerService {
|
|
14
14
|
constructor(userDataProfileService, userDataProfilesService, extensionsProfileScannerService, fileService, logService, environmentService, productService, uriIdentityService, instantiationService) {
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
|
|
4
|
+
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
5
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
6
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
7
|
+
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
8
|
+
import { distinct } from 'vscode/vscode/vs/base/common/arrays';
|
|
9
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
10
|
+
import { UserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfileIpc.js';
|
|
11
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
|
+
|
|
13
|
+
const associatedRemoteProfilesKey = 'associatedRemoteProfiles';
|
|
14
|
+
let RemoteUserDataProfilesService = class RemoteUserDataProfilesService extends Disposable {
|
|
15
|
+
constructor(environmentService, remoteAgentService, userDataProfilesService, userDataProfileService, storageService, logService) {
|
|
16
|
+
super();
|
|
17
|
+
this.environmentService = environmentService;
|
|
18
|
+
this.remoteAgentService = remoteAgentService;
|
|
19
|
+
this.userDataProfilesService = userDataProfilesService;
|
|
20
|
+
this.userDataProfileService = userDataProfileService;
|
|
21
|
+
this.storageService = storageService;
|
|
22
|
+
this.logService = logService;
|
|
23
|
+
this.initPromise = this.init();
|
|
24
|
+
}
|
|
25
|
+
async init() {
|
|
26
|
+
const connection = this.remoteAgentService.getConnection();
|
|
27
|
+
if (!connection) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const environment = await this.remoteAgentService.getEnvironment();
|
|
31
|
+
if (!environment) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.remoteUserDataProfilesService = ( new UserDataProfilesService(
|
|
35
|
+
environment.profiles.all,
|
|
36
|
+
environment.profiles.home,
|
|
37
|
+
connection.getChannel('userDataProfiles')
|
|
38
|
+
));
|
|
39
|
+
this._register(this.userDataProfilesService.onDidChangeProfiles(e => this.onDidChangeLocalProfiles(e)));
|
|
40
|
+
const remoteProfile = await this.getAssociatedRemoteProfile(this.userDataProfileService.currentProfile, this.remoteUserDataProfilesService);
|
|
41
|
+
if (!remoteProfile.isDefault) {
|
|
42
|
+
this.setAssociatedRemoteProfiles([...this.getAssociatedRemoteProfiles(), remoteProfile.id]);
|
|
43
|
+
}
|
|
44
|
+
this.cleanUp();
|
|
45
|
+
}
|
|
46
|
+
async onDidChangeLocalProfiles(e) {
|
|
47
|
+
for (const profile of e.removed) {
|
|
48
|
+
const remoteProfile = this.remoteUserDataProfilesService?.profiles.find(p => p.id === profile.id);
|
|
49
|
+
if (remoteProfile) {
|
|
50
|
+
await this.remoteUserDataProfilesService?.removeProfile(remoteProfile);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async getRemoteProfiles() {
|
|
55
|
+
await this.initPromise;
|
|
56
|
+
if (!this.remoteUserDataProfilesService) {
|
|
57
|
+
throw new Error('Remote profiles service not available in the current window');
|
|
58
|
+
}
|
|
59
|
+
return this.remoteUserDataProfilesService.profiles;
|
|
60
|
+
}
|
|
61
|
+
async getRemoteProfile(localProfile) {
|
|
62
|
+
await this.initPromise;
|
|
63
|
+
if (!this.remoteUserDataProfilesService) {
|
|
64
|
+
throw new Error('Remote profiles service not available in the current window');
|
|
65
|
+
}
|
|
66
|
+
return this.getAssociatedRemoteProfile(localProfile, this.remoteUserDataProfilesService);
|
|
67
|
+
}
|
|
68
|
+
async getAssociatedRemoteProfile(localProfile, remoteUserDataProfilesService) {
|
|
69
|
+
if (localProfile.isDefault) {
|
|
70
|
+
return remoteUserDataProfilesService.defaultProfile;
|
|
71
|
+
}
|
|
72
|
+
let profile = remoteUserDataProfilesService.profiles.find(p => p.id === localProfile.id);
|
|
73
|
+
if (!profile) {
|
|
74
|
+
profile = await remoteUserDataProfilesService.createProfile(localProfile.id, localProfile.name, {
|
|
75
|
+
shortName: localProfile.shortName,
|
|
76
|
+
transient: localProfile.isTransient,
|
|
77
|
+
useDefaultFlags: localProfile.useDefaultFlags,
|
|
78
|
+
});
|
|
79
|
+
this.setAssociatedRemoteProfiles([...this.getAssociatedRemoteProfiles(), this.userDataProfileService.currentProfile.id]);
|
|
80
|
+
}
|
|
81
|
+
return profile;
|
|
82
|
+
}
|
|
83
|
+
getAssociatedRemoteProfiles() {
|
|
84
|
+
if (this.environmentService.remoteAuthority) {
|
|
85
|
+
const remotes = this.parseAssociatedRemoteProfiles();
|
|
86
|
+
return remotes[this.environmentService.remoteAuthority] ?? [];
|
|
87
|
+
}
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
setAssociatedRemoteProfiles(profiles) {
|
|
91
|
+
if (this.environmentService.remoteAuthority) {
|
|
92
|
+
const remotes = this.parseAssociatedRemoteProfiles();
|
|
93
|
+
profiles = distinct(profiles);
|
|
94
|
+
if (profiles.length) {
|
|
95
|
+
remotes[this.environmentService.remoteAuthority] = profiles;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
delete remotes[this.environmentService.remoteAuthority];
|
|
99
|
+
}
|
|
100
|
+
if (( Object.keys(remotes)).length) {
|
|
101
|
+
this.storageService.store(associatedRemoteProfilesKey, JSON.stringify(remotes), -1 , 1 );
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.storageService.remove(associatedRemoteProfilesKey, -1 );
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
parseAssociatedRemoteProfiles() {
|
|
109
|
+
if (this.environmentService.remoteAuthority) {
|
|
110
|
+
const value = this.storageService.get(associatedRemoteProfilesKey, -1 );
|
|
111
|
+
try {
|
|
112
|
+
return value ? JSON.parse(value) : {};
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
this.logService.error(error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return {};
|
|
119
|
+
}
|
|
120
|
+
async cleanUp() {
|
|
121
|
+
const associatedRemoteProfiles = [];
|
|
122
|
+
for (const profileId of this.getAssociatedRemoteProfiles()) {
|
|
123
|
+
const remoteProfile = this.remoteUserDataProfilesService?.profiles.find(p => p.id === profileId);
|
|
124
|
+
if (!remoteProfile) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const localProfile = this.userDataProfilesService.profiles.find(p => p.id === profileId);
|
|
128
|
+
if (localProfile) {
|
|
129
|
+
if (localProfile.name !== remoteProfile.name || localProfile.shortName !== remoteProfile.shortName) {
|
|
130
|
+
await this.remoteUserDataProfilesService?.updateProfile(remoteProfile, { name: localProfile.name, shortName: localProfile.shortName });
|
|
131
|
+
}
|
|
132
|
+
associatedRemoteProfiles.push(profileId);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (remoteProfile) {
|
|
136
|
+
await this.remoteUserDataProfilesService?.removeProfile(remoteProfile);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
this.setAssociatedRemoteProfiles(associatedRemoteProfiles);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
RemoteUserDataProfilesService = ( __decorate([
|
|
143
|
+
( __param(0, IWorkbenchEnvironmentService)),
|
|
144
|
+
( __param(1, IRemoteAgentService)),
|
|
145
|
+
( __param(2, IUserDataProfilesService)),
|
|
146
|
+
( __param(3, IUserDataProfileService)),
|
|
147
|
+
( __param(4, IStorageService)),
|
|
148
|
+
( __param(5, ILogService))
|
|
149
|
+
], RemoteUserDataProfilesService));
|
|
150
|
+
|
|
151
|
+
export { RemoteUserDataProfilesService };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { AbstractDialogHandler, IDialogService, IFileDialogService, getFileNamesMessage } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
2
|
-
|
|
3
|
-
var ConfirmResult;
|
|
4
|
-
( (function(ConfirmResult) {
|
|
5
|
-
ConfirmResult[ConfirmResult["SAVE"] = 0] = "SAVE";
|
|
6
|
-
ConfirmResult[ConfirmResult["DONT_SAVE"] = 1] = "DONT_SAVE";
|
|
7
|
-
ConfirmResult[ConfirmResult["CANCEL"] = 2] = "CANCEL";
|
|
8
|
-
})(ConfirmResult || (ConfirmResult = {})));
|
|
9
|
-
|
|
10
|
-
export { ConfirmResult };
|