1
>
/*---------------------------------------------------------------------------------------------
configRemotes.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { URI } from '../../../base/common/uri.js';
7
>
8
>
const SshProtocolMatcher = /^([^@:]+@)?([^:]+):/;
9
>
const SshUrlMatcher = /^([^@:]+@)?([^:]+):(.+)$/;
10
>
const AuthorityMatcher = /^([^@]+@)?([^:]+)(:\d+)?$/;
11
>
const SecondLevelDomainMatcher = /([^@:.]+\.[^@:.]+)(:\d+)?$/;
12
>
const RemoteMatcher = /^\s*url\s*=\s*(.+\S)\s*$/mg;
13
>
const AnyButDot = /[^.]/g;
14
>
15
>
export const AllowedSecondLevelDomains = [
16
>
'github.com',
17
>
'bitbucket.org',
18
>
'visualstudio.com',
19
>
'gitlab.com',
20
>
'heroku.com',
21
>
'azurewebsites.net',
22
>
'ibm.com',
23
>
'amazon.com',
24
>
'amazonaws.com',
25
>
'cloudapp.net',
26
>
'rhcloud.com',
27
>
'google.com',
28
>
'azure.com'
29
>
];
30
>
31
function stripLowLevelDomains(domain: string): string | null {
32
const match = domain.match(SecondLevelDomainMatcher);
33
return match ? match[1] : null;
34
}
36
function extractDomain(url: string): string | null {
37
if (url.indexOf('://') === -1) {