blob: 58f5777969e4242198a00b7453dc4a9d3271c71d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only
import { Uri, Webview } from 'vscode';
export function getNonce() {
let text = '';
const possible =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < 32; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
return text;
}
export function getUri(
webview: Webview,
extensionUri: Uri,
pathList: string[]
) {
return webview.asWebviewUri(Uri.joinPath(extensionUri, ...pathList));
}
|