Remove uuid from webview resource uris

This is no longer be needed. We still serve the webview code itself from a unique subdomain

This also removes the need for `serviceWorkerFetchIgnoreSubdomain`
This commit is contained in:
Matt Bierner
2021-05-21 09:28:28 -07:00
parent 79dea51e79
commit 9847783f62
11 changed files with 26 additions and 56 deletions

View File

@@ -22,7 +22,7 @@ export interface WebviewInitData {
*/
export const webviewResourceBaseHost = 'vscode-webview.net';
export const webviewRootResourceAuthority = (id: string) => `vscode-resource.${id}.${webviewResourceBaseHost}`;
export const webviewRootResourceAuthority = `vscode-resource.${webviewResourceBaseHost}`;
export const webviewGenericCspSource = `https://*.${webviewResourceBaseHost}`;
@@ -33,15 +33,13 @@ export const webviewGenericCspSource = `https://*.${webviewResourceBaseHost}`;
* we know where to load the resource from (remote or truly local):
*
* ```txt
* ${scheme}+${resource-authority}.vscode-resource.${id}.vscode-webview.net/${path}
* ${scheme}+${resource-authority}.vscode-resource.vscode-webview.net/${path}
* ```
*
* @param uuid Unique id of the webview.
* @param resource Uri of the resource to load.
* @param remoteInfo Optional information about the remote that specifies where `resource` should be resolved from.
*/
export function asWebviewUri(
uuid: string,
resource: vscode.Uri,
remoteInfo?: { authority: string | undefined, isRemote: boolean }
): vscode.Uri {
@@ -59,7 +57,7 @@ export function asWebviewUri(
return URI.from({
scheme: Schemas.https,
authority: `${resource.scheme}+${encodeURIComponent(resource.authority)}.${webviewRootResourceAuthority(uuid)}`,
authority: `${resource.scheme}+${encodeURIComponent(resource.authority)}.${webviewRootResourceAuthority}`,
path: resource.path,
fragment: resource.fragment,
query: resource.query,