mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 01:25:38 -05:00
Merge from vscode merge-base (#22780)
* Revert "Revert "Merge from vscode merge-base (#22769)" (#22779)"
This reverts commit 47a1745180.
* Fix notebook download task
* Remove done call from extensions-ci
This commit is contained in:
@@ -2,7 +2,40 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { env, UIKind, Uri } from 'vscode';
|
||||
|
||||
export function toBase64UrlEncoding(base64string: string) {
|
||||
return base64string.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_'); // Need to use base64url encoding
|
||||
}
|
||||
|
||||
const LOCALHOST_ADDRESSES = ['localhost', '127.0.0.1', '0:0:0:0:0:0:0:1', '::1'];
|
||||
function isLocalhost(uri: Uri): boolean {
|
||||
if (!/^https?$/i.test(uri.scheme)) {
|
||||
return false;
|
||||
}
|
||||
const host = uri.authority.split(':')[0];
|
||||
return LOCALHOST_ADDRESSES.indexOf(host) >= 0;
|
||||
}
|
||||
|
||||
export function isSupportedEnvironment(uri: Uri): boolean {
|
||||
if (env.uiKind === UIKind.Desktop) {
|
||||
return true;
|
||||
}
|
||||
// local development (localhost:* or 127.0.0.1:*)
|
||||
if (isLocalhost(uri)) {
|
||||
return true;
|
||||
}
|
||||
// At this point we should only ever see https
|
||||
if (uri.scheme !== 'https') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
// vscode.dev & insiders.vscode.dev
|
||||
/(?:^|\.)vscode\.dev$/.test(uri.authority) ||
|
||||
// github.dev & codespaces
|
||||
/(?:^|\.)github\.dev$/.test(uri.authority) ||
|
||||
// github.dev/codespaces local setup (github.localhost)
|
||||
/(?:^|\.)github\.localhost$/.test(uri.authority)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user