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
>
import { normalizeURL } from '../../../../../../platform/url/common/trustedDomains.js';
8
>
import { testUrlMatchesGlob } from '../../../../../../platform/url/common/urlGlob.js';
9
>
10
>
/**
11
>
* Approval settings for a URL pattern
12
>
*/
13
>
export interface IUrlApprovalSettings {
14
>
approveRequest?: boolean;
15
>
approveResponse?: boolean;
16
>
}
17
>
18
>
/**
19
>
* Extracts domain patterns from a URL for use in approval actions
20
>
* @param url The URL to extract patterns from
21
>
* @returns An array of patterns in order of specificity (most specific first)
22
>
*/
23
>
export function extractUrlPatterns(url: URI): string[] {
24
const normalizedStr = normalizeURL(url);
25
const normalized = URI.parse(normalizedStr);