@@ -13,7 +13,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
13
13
import { parse } from 'vs/base/common/marshalling' ;
14
14
import { Emitter , Event } from 'vs/base/common/event' ;
15
15
import { Disposable , DisposableStore , IDisposable } from 'vs/base/common/lifecycle' ;
16
- import { Schemas } from 'vs/base/common/network' ;
16
+ import { FileAccess , Schemas } from 'vs/base/common/network' ;
17
17
import { isEqual } from 'vs/base/common/resources' ;
18
18
import { URI , UriComponents } from 'vs/base/common/uri' ;
19
19
import { request } from 'vs/base/parts/request/browser/request' ;
@@ -209,6 +209,10 @@ class LocalStorageURLCallbackProvider extends Disposable implements IURLCallback
209
209
private checkCallbacksTimeout : unknown | undefined = undefined ;
210
210
private onDidChangeLocalStorageDisposable : IDisposable | undefined ;
211
211
212
+ constructor ( private readonly _callbackRoute : string ) {
213
+ super ( ) ;
214
+ }
215
+
212
216
create ( options : Partial < UriComponents > = { } ) : URI {
213
217
const id = ++ LocalStorageURLCallbackProvider . REQUEST_ID ;
214
218
const queryParams : string [ ] = [ `vscode-reqid=${ id } ` ] ;
@@ -232,7 +236,7 @@ class LocalStorageURLCallbackProvider extends Disposable implements IURLCallback
232
236
this . startListening ( ) ;
233
237
}
234
238
235
- return URI . parse ( window . location . href ) . with ( { path : '/callback' , query : queryParams . join ( '&' ) } ) ;
239
+ return URI . parse ( window . location . href ) . with ( { path : this . _callbackRoute , query : queryParams . join ( '&' ) } ) ;
236
240
}
237
241
238
242
private startListening ( ) : void {
@@ -568,9 +572,12 @@ async function doStart(): Promise<IDisposable> {
568
572
569
573
const remoteAuthority = window . location . host ;
570
574
571
- const wsHostPrefix = ! devMode ? info . workspaceId : remoteAuthority . substr ( 0 , remoteAuthority . indexOf ( '.' ) ) ;
572
- const webEndpointUrlTemplate = `https://{{uuid}}.${ info . workspaceClusterHost } /${ wsHostPrefix } /static` ;
573
- const webviewEndpoint = `https://{{uuid}}.${ info . workspaceClusterHost } /${ wsHostPrefix } /static/out/vs/workbench/contrib/webview/browser/pre/` ;
575
+ // To make webviews work in development, go to file src/vs/workbench/contrib/webview/browser/pre/main.js
576
+ // and update `signalReady` method to bypass hostname check
577
+ const baseUri = FileAccess . asBrowserUri ( '' , require ) ;
578
+ const uuidUri = `${ baseUri . scheme } ://${ baseUri . authority . replace ( / ^ b l o b s e r v e / , '{{uuid}}' ) } ${ baseUri . path . replace ( / \/ o u t \/ $ / , '' ) } ` ;
579
+ const webEndpointUrlTemplate = uuidUri ;
580
+ const webviewEndpoint = `${ uuidUri } /out/vs/workbench/contrib/webview/browser/pre/` ;
574
581
575
582
const folderUri = info . workspaceLocationFolder
576
583
? URI . from ( {
@@ -961,13 +968,9 @@ async function doStart(): Promise<IDisposable> {
961
968
'workbench.preferredLightColorTheme' : 'Gitpod Light' ,
962
969
'workbench.preferredDarkColorTheme' : 'Gitpod Dark' ,
963
970
} ,
964
- urlCallbackProvider : new LocalStorageURLCallbackProvider ( ) ,
971
+ urlCallbackProvider : new LocalStorageURLCallbackProvider ( '/callback' ) ,
965
972
credentialsProvider,
966
973
productConfiguration : {
967
- nameShort : product . nameShort + ( info . ideAlias === 'code-latest' ? ' - Insiders' : '' ) ,
968
- nameLong : product . nameLong + ( info . ideAlias === 'code-latest' ? ' - Insiders' : '' ) ,
969
- version : product . version + ( info . ideAlias === 'code-latest' ? '-insider' : '' ) ,
970
- quality : ( info . ideAlias === 'code-latest' ? 'insider' : 'stable' ) ,
971
974
linkProtectionTrustedDomains : [
972
975
...( product . linkProtectionTrustedDomains || [ ] ) ,
973
976
gitpodDomain
0 commit comments