Skip to content

Commit

Permalink
[electron] fix resolution of hostname placeholder
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <[email protected]>
  • Loading branch information
akosyakov committed May 14, 2020
1 parent 8ca3e64 commit f6449af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"--no-cluster",
"--app-project-path=${workspaceRoot}/examples/electron",
"--remote-debugging-port=9222",
"--no-app-auto-install"
"--no-app-auto-install",
"--plugins=local-dir:../../plugins"
],
"env": {
"NODE_ENV": "development",
Expand Down Expand Up @@ -189,4 +190,4 @@
]
}
]
}
}
2 changes: 1 addition & 1 deletion packages/core/src/browser/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class Endpoint {
return this.location.pathname;
}

protected get host(): string {
get host(): string {
if (this.options.host) {
return this.options.host;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class WebviewEnvironment {
try {
const variable = await this.environments.getValue(WebviewExternalEndpoint.pattern);
const value = variable && variable.value || WebviewExternalEndpoint.defaultPattern;
this.externalEndpointHost.resolve(value.replace('{{hostname}}', window.location.host || 'localhost'));
const { host } = new Endpoint();
this.externalEndpointHost.resolve(value.replace('{{hostname}}', host));
} catch (e) {
this.externalEndpointHost.reject(e);
}
Expand Down

0 comments on commit f6449af

Please sign in to comment.