@codingame/monaco-vscode-authentication-service-override 4.4.1 → 4.5.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/authentication.js +5 -3
- package/package.json +10 -2
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationAccessService.js +70 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js +11 -10
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js +51 -0
- package/override/vs/platform/dialogs/common/dialogs.js +0 -10
package/authentication.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
-
import { IAuthenticationService, IAuthenticationExtensionsService } from 'vscode/vscode/vs/workbench/services/authentication/common/authentication';
|
|
2
|
+
import { IAuthenticationService, IAuthenticationExtensionsService } from 'vscode/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
3
3
|
import { AuthenticationService } from 'vscode/vscode/vs/workbench/services/authentication/browser/authenticationService';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { AuthenticationAccessService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationAccessService.js';
|
|
5
|
+
import { AuthenticationUsageService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationUsageService.js';
|
|
6
6
|
import { AuthenticationExtensionsService } from './vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js';
|
|
7
|
+
import { IAuthenticationAccessService } from 'vscode/vscode/vs/workbench/services/authentication/browser/authenticationAccessService.service';
|
|
8
|
+
import { IAuthenticationUsageService } from 'vscode/vscode/vs/workbench/services/authentication/browser/authenticationUsageService.service';
|
|
7
9
|
|
|
8
10
|
function getServiceOverride() {
|
|
9
11
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-authentication-service-override",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -17,7 +17,15 @@
|
|
|
17
17
|
"main": "index.js",
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"default": "./index.js"
|
|
23
|
+
},
|
|
24
|
+
"./vscode/*": {
|
|
25
|
+
"default": "./vscode/src/*.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
20
28
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@4.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.5.0"
|
|
22
30
|
}
|
|
23
31
|
}
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationAccessService.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
5
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
6
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
|
+
|
|
8
|
+
let AuthenticationAccessService = class AuthenticationAccessService extends Disposable {
|
|
9
|
+
constructor(_storageService, _productService) {
|
|
10
|
+
super();
|
|
11
|
+
this._storageService = _storageService;
|
|
12
|
+
this._productService = _productService;
|
|
13
|
+
this._onDidChangeExtensionSessionAccess = this._register(( new Emitter()));
|
|
14
|
+
this.onDidChangeExtensionSessionAccess = this._onDidChangeExtensionSessionAccess.event;
|
|
15
|
+
}
|
|
16
|
+
isAccessAllowed(providerId, accountName, extensionId) {
|
|
17
|
+
const trustedExtensionAuthAccess = this._productService.trustedExtensionAuthAccess;
|
|
18
|
+
if (Array.isArray(trustedExtensionAuthAccess)) {
|
|
19
|
+
if (trustedExtensionAuthAccess.includes(extensionId)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (trustedExtensionAuthAccess?.[providerId]?.includes(extensionId)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
const allowList = this.readAllowedExtensions(providerId, accountName);
|
|
27
|
+
const extensionData = allowList.find(extension => extension.id === extensionId);
|
|
28
|
+
if (!extensionData) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return extensionData.allowed !== undefined
|
|
32
|
+
? extensionData.allowed
|
|
33
|
+
: true;
|
|
34
|
+
}
|
|
35
|
+
readAllowedExtensions(providerId, accountName) {
|
|
36
|
+
let trustedExtensions = [];
|
|
37
|
+
try {
|
|
38
|
+
const trustedExtensionSrc = this._storageService.get(`${providerId}-${accountName}`, -1 );
|
|
39
|
+
if (trustedExtensionSrc) {
|
|
40
|
+
trustedExtensions = JSON.parse(trustedExtensionSrc);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (err) { }
|
|
44
|
+
return trustedExtensions;
|
|
45
|
+
}
|
|
46
|
+
updateAllowedExtensions(providerId, accountName, extensions) {
|
|
47
|
+
const allowList = this.readAllowedExtensions(providerId, accountName);
|
|
48
|
+
for (const extension of extensions) {
|
|
49
|
+
const index = allowList.findIndex(e => e.id === extension.id);
|
|
50
|
+
if (index === -1) {
|
|
51
|
+
allowList.push(extension);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
allowList[index].allowed = extension.allowed;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
this._storageService.store(`${providerId}-${accountName}`, JSON.stringify(allowList), -1 , 0 );
|
|
58
|
+
this._onDidChangeExtensionSessionAccess.fire({ providerId, accountName });
|
|
59
|
+
}
|
|
60
|
+
removeAllowedExtensions(providerId, accountName) {
|
|
61
|
+
this._storageService.remove(`${providerId}-${accountName}`, -1 );
|
|
62
|
+
this._onDidChangeExtensionSessionAccess.fire({ providerId, accountName });
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
AuthenticationAccessService = ( __decorate([
|
|
66
|
+
( __param(0, IStorageService)),
|
|
67
|
+
( __param(1, IProductService))
|
|
68
|
+
], AuthenticationAccessService));
|
|
69
|
+
|
|
70
|
+
export { AuthenticationAccessService };
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationExtensionsService.js
CHANGED
|
@@ -3,15 +3,16 @@ import { Disposable, MutableDisposable, dispose } from 'vscode/vscode/vs/base/co
|
|
|
3
3
|
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
|
-
import '
|
|
7
|
-
import
|
|
8
|
-
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
9
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
6
|
+
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
7
|
+
import 'vscode/vscode/vs/platform/notification/common/notification';
|
|
8
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
9
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
10
|
+
import { NumberBadge } from 'vscode/vscode/vs/workbench/services/activity/common/activity';
|
|
11
|
+
import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity.service';
|
|
12
|
+
import { IAuthenticationAccessService } from 'vscode/vscode/vs/workbench/services/authentication/browser/authenticationAccessService.service';
|
|
13
|
+
import { IAuthenticationUsageService } from 'vscode/vscode/vs/workbench/services/authentication/browser/authenticationUsageService.service';
|
|
14
|
+
import { IAuthenticationService } from 'vscode/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
15
|
+
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
15
16
|
|
|
16
17
|
const SCOPESLIST_SEPARATOR = ' ';
|
|
17
18
|
let AuthenticationExtensionsService = class AuthenticationExtensionsService extends Disposable {
|
|
@@ -133,7 +134,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
|
|
|
133
134
|
SessionPromptChoice[SessionPromptChoice["Cancel"] = 2] = "Cancel";
|
|
134
135
|
})(SessionPromptChoice || (SessionPromptChoice = {})));
|
|
135
136
|
const { result } = await this.dialogService.prompt({
|
|
136
|
-
type: Severity.Info,
|
|
137
|
+
type: Severity$1.Info,
|
|
137
138
|
message: ( localizeWithPath(
|
|
138
139
|
'vs/workbench/services/authentication/browser/authenticationExtensionsService',
|
|
139
140
|
'confirmAuthenticationAccess',
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
3
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
4
|
+
|
|
5
|
+
let AuthenticationUsageService = class AuthenticationUsageService {
|
|
6
|
+
constructor(_storageService) {
|
|
7
|
+
this._storageService = _storageService;
|
|
8
|
+
}
|
|
9
|
+
readAccountUsages(providerId, accountName) {
|
|
10
|
+
const accountKey = `${providerId}-${accountName}-usages`;
|
|
11
|
+
const storedUsages = this._storageService.get(accountKey, -1 );
|
|
12
|
+
let usages = [];
|
|
13
|
+
if (storedUsages) {
|
|
14
|
+
try {
|
|
15
|
+
usages = JSON.parse(storedUsages);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return usages;
|
|
21
|
+
}
|
|
22
|
+
removeAccountUsage(providerId, accountName) {
|
|
23
|
+
const accountKey = `${providerId}-${accountName}-usages`;
|
|
24
|
+
this._storageService.remove(accountKey, -1 );
|
|
25
|
+
}
|
|
26
|
+
addAccountUsage(providerId, accountName, extensionId, extensionName) {
|
|
27
|
+
const accountKey = `${providerId}-${accountName}-usages`;
|
|
28
|
+
const usages = this.readAccountUsages(providerId, accountName);
|
|
29
|
+
const existingUsageIndex = usages.findIndex(usage => usage.extensionId === extensionId);
|
|
30
|
+
if (existingUsageIndex > -1) {
|
|
31
|
+
usages.splice(existingUsageIndex, 1, {
|
|
32
|
+
extensionId,
|
|
33
|
+
extensionName,
|
|
34
|
+
lastUsed: Date.now()
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
usages.push({
|
|
39
|
+
extensionId,
|
|
40
|
+
extensionName,
|
|
41
|
+
lastUsed: Date.now()
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
this._storageService.store(accountKey, JSON.stringify(usages), -1 , 1 );
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
AuthenticationUsageService = ( __decorate([
|
|
48
|
+
( __param(0, IStorageService))
|
|
49
|
+
], AuthenticationUsageService));
|
|
50
|
+
|
|
51
|
+
export { AuthenticationUsageService };
|
|
@@ -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 };
|