@codingame/monaco-vscode-authentication-service-override 5.2.0 → 6.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/services/authentication/browser/authenticationAccessService.js +5 -3
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js +19 -8
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-authentication-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@6.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationAccessService.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
3
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
4
5
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
6
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
5
7
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
6
8
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
9
|
|
|
@@ -35,7 +37,7 @@ let AuthenticationAccessService = class AuthenticationAccessService extends Disp
|
|
|
35
37
|
readAllowedExtensions(providerId, accountName) {
|
|
36
38
|
let trustedExtensions = [];
|
|
37
39
|
try {
|
|
38
|
-
const trustedExtensionSrc = this._storageService.get(`${providerId}-${accountName}`,
|
|
40
|
+
const trustedExtensionSrc = this._storageService.get(`${providerId}-${accountName}`, StorageScope.APPLICATION);
|
|
39
41
|
if (trustedExtensionSrc) {
|
|
40
42
|
trustedExtensions = JSON.parse(trustedExtensionSrc);
|
|
41
43
|
}
|
|
@@ -54,11 +56,11 @@ let AuthenticationAccessService = class AuthenticationAccessService extends Disp
|
|
|
54
56
|
allowList[index].allowed = extension.allowed;
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
|
-
this._storageService.store(`${providerId}-${accountName}`, JSON.stringify(allowList),
|
|
59
|
+
this._storageService.store(`${providerId}-${accountName}`, JSON.stringify(allowList), StorageScope.APPLICATION, StorageTarget.USER);
|
|
58
60
|
this._onDidChangeExtensionSessionAccess.fire({ providerId, accountName });
|
|
59
61
|
}
|
|
60
62
|
removeAllowedExtensions(providerId, accountName) {
|
|
61
|
-
this._storageService.remove(`${providerId}-${accountName}`,
|
|
63
|
+
this._storageService.remove(`${providerId}-${accountName}`, StorageScope.APPLICATION);
|
|
62
64
|
this._onDidChangeExtensionSessionAccess.fire({ providerId, accountName });
|
|
63
65
|
}
|
|
64
66
|
};
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js
CHANGED
|
@@ -4,8 +4,10 @@ import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
|
4
4
|
import { MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
5
|
import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
6
6
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
7
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
7
8
|
import 'vscode/vscode/vs/platform/notification/common/notification';
|
|
8
9
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
10
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
9
11
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
10
12
|
import { NumberBadge } from 'vscode/vscode/vs/workbench/services/activity/common/activity';
|
|
11
13
|
import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity.service';
|
|
@@ -111,17 +113,17 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
111
113
|
}
|
|
112
114
|
updateSessionPreference(providerId, extensionId, session) {
|
|
113
115
|
const key = `${extensionId}-${providerId}-${session.scopes.join(' ')}`;
|
|
114
|
-
this.storageService.store(key, session.id,
|
|
115
|
-
this.storageService.store(key, session.id,
|
|
116
|
+
this.storageService.store(key, session.id, StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
|
117
|
+
this.storageService.store(key, session.id, StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
116
118
|
}
|
|
117
119
|
getSessionPreference(providerId, extensionId, scopes) {
|
|
118
120
|
const key = `${extensionId}-${providerId}-${scopes.join(' ')}`;
|
|
119
|
-
return this.storageService.get(key,
|
|
121
|
+
return this.storageService.get(key, StorageScope.WORKSPACE) ?? this.storageService.get(key, StorageScope.APPLICATION);
|
|
120
122
|
}
|
|
121
123
|
removeSessionPreference(providerId, extensionId, scopes) {
|
|
122
124
|
const key = `${extensionId}-${providerId}-${scopes.join(' ')}`;
|
|
123
|
-
this.storageService.remove(key,
|
|
124
|
-
this.storageService.remove(key,
|
|
125
|
+
this.storageService.remove(key, StorageScope.WORKSPACE);
|
|
126
|
+
this.storageService.remove(key, StorageScope.APPLICATION);
|
|
125
127
|
}
|
|
126
128
|
async showGetSessionPrompt(provider, accountName, extensionId, extensionName) {
|
|
127
129
|
let SessionPromptChoice;
|
|
@@ -193,19 +195,28 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
193
195
|
extensionName
|
|
194
196
|
));
|
|
195
197
|
quickPick.onDidAccept(async (_) => {
|
|
196
|
-
|
|
198
|
+
quickPick.dispose();
|
|
199
|
+
let session = quickPick.selectedItems[0].session;
|
|
200
|
+
if (!session) {
|
|
201
|
+
try {
|
|
202
|
+
session = await this._authenticationService.createSession(providerId, scopes);
|
|
203
|
+
}
|
|
204
|
+
catch (e) {
|
|
205
|
+
reject(e);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
197
209
|
const accountName = session.account.label;
|
|
198
210
|
this._authenticationAccessService.updateAllowedExtensions(providerId, accountName, [{ id: extensionId, name: extensionName, allowed: true }]);
|
|
199
211
|
this.updateSessionPreference(providerId, extensionId, session);
|
|
200
212
|
this.removeAccessRequest(providerId, extensionId);
|
|
201
|
-
quickPick.dispose();
|
|
202
213
|
resolve(session);
|
|
203
214
|
});
|
|
204
215
|
quickPick.onDidHide(_ => {
|
|
216
|
+
quickPick.dispose();
|
|
205
217
|
if (!quickPick.selectedItems[0]) {
|
|
206
218
|
reject('User did not consent to account access');
|
|
207
219
|
}
|
|
208
|
-
quickPick.dispose();
|
|
209
220
|
});
|
|
210
221
|
quickPick.show();
|
|
211
222
|
}))
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
3
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
2
4
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
3
5
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
4
6
|
|
|
@@ -8,7 +10,7 @@ let AuthenticationUsageService = class AuthenticationUsageService {
|
|
|
8
10
|
}
|
|
9
11
|
readAccountUsages(providerId, accountName) {
|
|
10
12
|
const accountKey = `${providerId}-${accountName}-usages`;
|
|
11
|
-
const storedUsages = this._storageService.get(accountKey,
|
|
13
|
+
const storedUsages = this._storageService.get(accountKey, StorageScope.APPLICATION);
|
|
12
14
|
let usages = [];
|
|
13
15
|
if (storedUsages) {
|
|
14
16
|
try {
|
|
@@ -21,7 +23,7 @@ let AuthenticationUsageService = class AuthenticationUsageService {
|
|
|
21
23
|
}
|
|
22
24
|
removeAccountUsage(providerId, accountName) {
|
|
23
25
|
const accountKey = `${providerId}-${accountName}-usages`;
|
|
24
|
-
this._storageService.remove(accountKey,
|
|
26
|
+
this._storageService.remove(accountKey, StorageScope.APPLICATION);
|
|
25
27
|
}
|
|
26
28
|
addAccountUsage(providerId, accountName, extensionId, extensionName) {
|
|
27
29
|
const accountKey = `${providerId}-${accountName}-usages`;
|
|
@@ -41,7 +43,7 @@ let AuthenticationUsageService = class AuthenticationUsageService {
|
|
|
41
43
|
lastUsed: Date.now()
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
|
-
this._storageService.store(accountKey, JSON.stringify(usages),
|
|
46
|
+
this._storageService.store(accountKey, JSON.stringify(usages), StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
45
47
|
}
|
|
46
48
|
};
|
|
47
49
|
AuthenticationUsageService = ( __decorate([
|